:root {
  color-scheme: light;
  --paper: #f7f6ef;
  --white: #fffefb;
  --ink: #27372e;
  --muted: #56645b;
  --green: #365b47;
  --light-green: #e2eadb;
  --line: #dbe1d5;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3e7458; outline-offset: 4px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner, main { width: min(1180px, calc(100% - 72px)); margin: 0 auto; }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 14px; }
.site-name { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; text-decoration: none; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); gap: 3px; transform: rotate(-9deg); }
.brand-mark i { height: 9px; border-radius: 3px; background: #5c806a; }
.brand-mark i:nth-child(2) { background: #edbf90; }
.brand-mark i:nth-child(3) { background: #b9cbaa; }
.brand-mark i:nth-child(4) { background: #c78779; }

.share-button, .viewer-nav button, .close-button, .carousel-controls button, .bulk-download, .album-link {
  color: var(--green);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 44px;
  padding: 0 14px;
}
.share-button { white-space: nowrap; font-weight: 650; font-size: .9rem; }
.share-button:hover, .viewer-nav button:hover, .close-button:hover, .carousel-controls button:hover, .bulk-download:hover, .album-link:hover { background: #ebf1e7; }

main { padding: 28px 0 64px; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr);
  gap: clamp(18px, 4vw, 48px);
  align-items: center;
  min-height: 304px;
  padding: 36px clamp(30px, 5vw, 68px);
  overflow: hidden;
  background: linear-gradient(112deg, #e6eddf, #edf1e2 56%, #f0ead8);
  border: 1px solid #e0e7d7;
  border-radius: 30px;
}
.intro-copy { z-index: 1; }
.intro h1 {
  margin: 0;
  font-size: clamp(2.45rem, 5vw, 4rem);
  line-height: 1.12;
  font-weight: 850;
  letter-spacing: -.065em;
}
.intro p { margin: 18px 0 24px; color: var(--muted); line-height: 1.65; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 17px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-size: .94rem;
  font-weight: 700;
  white-space: nowrap;
}
.primary-button:hover { background: #2b4a38; }

.carousel {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dce3d6;
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 9px 24px #394a3610;
}
.carousel-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 1px 3px 10px; }
.carousel-header h2 { margin: 0; font-size: 1rem; }
.carousel-header span { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.carousel-image {
  display: block;
  width: 100%;
  height: clamp(200px, 27vw, 318px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #edf0e7;
}
.carousel-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.carousel-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-height: 55px; padding: 7px 0 5px 3px; }
.carousel-caption p { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 700; line-height: 1.35; }
.carousel-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.carousel-controls button { min-width: 0; padding: 0 4px; font-size: .9rem; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.album-link, .bulk-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 700;
}
.album-link, .album-hint { display: none; }

.photos { margin-top: 30px; scroll-margin-top: 14px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-title { display: flex; align-items: baseline; gap: 12px; }
.section-title h2 { margin: 0; font-size: clamp(1.35rem, 2.8vw, 1.85rem); letter-spacing: -.04em; }
.count { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.section-tools { display: flex; align-items: center; gap: 8px; }
.search { position: relative; width: min(100%, 290px); min-width: 0; }
.search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 12px 0 37px;
  color: var(--ink);
  background: var(--white);
}
.search input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute;
  left: 15px;
  top: 14px;
  width: 13px;
  height: 13px;
  border: 1.7px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  bottom: -3px;
  right: -4px;
  background: var(--muted);
  transform: rotate(48deg);
}

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}
.photo-open {
  width: 100%;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: #e8ebe0;
}
.photo-open:focus-visible { outline-offset: -4px; }
.photo-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
@media (hover: hover) { .photo-open:hover img { transform: scale(1.035); } }
.photo-info { display: flex; align-items: center; gap: 6px; min-height: 60px; padding: 6px 9px 6px 12px; }
.photo-info h3 { margin: 0; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.photo-download {
  flex-shrink: 0;
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  min-height: 44px;
  border-radius: 9px;
  color: var(--green);
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
.photo-download:hover { background: var(--light-green); }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }

body:has(dialog[open]) { overflow: hidden; }
dialog {
  color: var(--ink);
  width: min(880px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
}
dialog::backdrop { background: #202c25b8; }
.viewer-content { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; max-height: calc(100dvh - 30px); }
.viewer-header, .viewer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.viewer-caption { min-width: 0; }
.viewer-caption h2 { margin: 0 0 4px; font-size: 1.12rem; overflow-wrap: anywhere; }
.viewer-caption span { font-size: .85rem; color: var(--muted); }
.close-button { flex: 0 0 44px; padding: 0; font-size: 1.45rem; }
.viewer-image-wrap { display: grid; place-items: center; min-height: 0; padding: 10px; background: #eef0e8; }
.viewer-image-wrap img { display: block; width: 100%; height: 100%; max-height: min(600px, 64dvh); object-fit: contain; }
.viewer-nav { display: flex; gap: 6px; }
.viewer-nav button { padding: 0 11px; }
.viewer-nav button:disabled { cursor: default; opacity: .45; }
.album-hint { margin: 0; padding: 0 16px 12px; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.feedback {
  position: fixed;
  z-index: 2;
  max-width: calc(100% - 24px);
  inset: auto 12px 18px;
  width: max-content;
  margin: auto;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--green);
  color: #fff;
}

@media (max-width: 900px) {
  .site-header-inner, main { width: calc(100% - 42px); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intro { min-height: 270px; }
}
@media (max-width: 630px) {
  .site-header-inner, main { width: calc(100% - 30px); }
  .site-header-inner { min-height: 62px; }
  main { padding-top: 14px; }
  .intro { grid-template-columns: 1fr; gap: 16px; min-height: auto; padding: 22px 13px 13px; border-radius: 22px; }
  .intro-copy { padding: 0 7px; }
  .intro h1 { font-size: clamp(2.2rem, 9vw, 3.1rem); }
  .intro p { margin: 11px 0 15px; }
  .carousel { padding: 9px; border-radius: 16px; }
  .carousel-image { height: clamp(190px, 64vw, 300px); }
  .photos { margin-top: 23px; }
  .section-bar { align-items: stretch; flex-direction: column; gap: 9px; margin-bottom: 11px; }
  .search { width: auto; flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .photo-card { border-radius: 12px; }
  .photo-info { min-height: 56px; padding-left: 8px; padding-right: 3px; }
  .photo-info h3 { font-size: .875rem; }
  .photo-download { padding: 0 5px; }
}
@media (pointer: coarse) {
  .album-link { display: inline-flex; }
  .album-hint { display: block; }
  .viewer-image-wrap img { max-height: min(600px, 54dvh); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
