:root {
  color-scheme: light;
  --paper: #f5f5ef;
  --surface: #fffefb;
  --ink: #182820;
  --muted: #4c6157;
  --line: #ccd5c8;
  --green: #274a3a;
  --pale: #e9eee2;
  --soft: #eff2e8;
  --accent: #b6cd8c;
  --danger: #9c3127;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Microsoft YaHei", serif;
  font: 100%/1.55 var(--sans);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #62864c; outline-offset: 4px; }
.shell { width: min(72rem, calc(100% - 5rem)); margin-inline: auto; }
.skip-link { position: absolute; top: .75rem; left: .75rem; z-index: 5; transform: translateY(-160%); padding: .6rem .8rem; background: var(--surface); border-radius: .4rem; }
.skip-link:focus { transform: none; }

.site-header { min-height: 5.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .68rem; text-decoration: none; font-size: 1.08rem; font-weight: 750; line-height: 1.2; letter-spacing: .035em; }
.brand img { flex: 0 0 40px; }
.brand small { display: block; margin-top: .2rem; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .17em; }
.nav-link { display: inline-flex; align-items: center; min-height: 2.65rem; gap: .42rem; border: 1px solid var(--line); border-radius: 100vw; padding: .55rem .9rem; color: var(--green); text-decoration: none; font-size: .88rem; font-weight: 675; white-space: nowrap; }
.nav-link:hover { background: var(--pale); border-color: #a1b09f; }

.hero { display: grid; grid-template-columns: 1fr minmax(0, .96fr); align-items: center; gap: clamp(1.2rem, 5vw, 5rem); isolation: isolate; padding: clamp(1.8rem, 5vw, 3.55rem); border-radius: 1.5rem; background: #e8eddf; color: #20382d; }
.hero-copy > p:last-child, .admin-intro > p:last-child { margin: .85rem 0 0; color: #425c50; font-size: 1rem; }
.eyebrow { margin: 0 0 .55rem; color: #415b4d; font-size: .75rem; font-weight: 750; letter-spacing: .17em; }
.eyebrow span { display: inline-block; width: .49rem; height: .49rem; margin-right: .28rem; vertical-align: .065rem; border-radius: 50%; background: #547750; }
.hero h1, .admin-intro h1 { margin: 0; font: 700 clamp(2.8rem, 6.4vw, 5.2rem)/1.03 var(--serif); letter-spacing: -.065em; }
.hero h1 span, .admin-intro h1 span { color: #547750; }
.hero-art { margin: 0; }
.hero-art img { display: block; width: 100%; height: auto; border-radius: 1.25rem; box-shadow: 0 12px 26px #24382a24; }

.gallery { min-height: 23rem; padding: clamp(2rem, 5vw, 3.65rem) 0 2.5rem; scroll-margin-block-start: 1rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: .85rem; margin: 0 0 .95rem; }
.section-copy h2 { margin: 0; font: 700 clamp(1.6rem, 3.2vw, 2.25rem)/1.15 var(--serif); letter-spacing: -.02em; }
.section-copy .eyebrow { margin-bottom: .42rem; }
.count { margin: 0 0 .15rem; border: 1px solid var(--line); border-radius: 100vw; padding: .24rem .68rem; color: var(--muted); font-size: .86rem; font-weight: 650; white-space: nowrap; }
.gallery-message { display: grid; align-content: center; justify-items: center; gap: .27rem; min-height: 12.75rem; padding: 1.3rem; border: 1px dashed #b5c4b6; border-radius: 1rem; background: #fbfbf6; text-align: center; }
.empty-icon { display: block; width: 3rem; height: 3rem; margin-bottom: .2rem; stroke: #4e735c; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.message-title { margin: 0; font-size: 1.08rem; font-weight: 725; }
.message-copy { margin: 0; color: var(--muted); font-size: .95rem; }
.gallery-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin: 0; padding: 0; }
.photo { min-width: 0; }
.photo-card { display: block; width: 100%; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); text-align: start; }
.photo-card:hover { border-color: #869d8a; }
.photo-frame { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--pale); }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .24s ease; }
.photo-card:hover img { transform: scale(1.035); }
.photo-frame .broken-image { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.photo-meta { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .5rem; padding: .72rem .76rem .78rem; }
.photo-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.photo-meta time { color: var(--muted); font-size: .77rem; white-space: nowrap; }
.gallery-actions { text-align: center; }
.gallery-actions .button { margin: 1.15rem auto 0; }
.inline-error { margin: .65rem auto 0; color: var(--danger); text-align: center; }
.site-footer { display: flex; justify-content: space-between; gap: .75rem; border-top: 1px solid var(--line); padding-block: 1.15rem 1.55rem; color: var(--muted); font-size: .85rem; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.7rem; border: 1px solid transparent; border-radius: .65rem; padding: .54rem .95rem; font-size: .92rem; font-weight: 680; line-height: 1.35; text-decoration: none; }
.button:disabled { opacity: .55; }
.button-primary { background: var(--green); color: white; }
.button-primary:not(:disabled):hover { background: #173c2c; }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--green); }
.button-secondary:not(:disabled):hover { background: var(--pale); border-color: #9aaf9b; }
.button-danger { background: #fff8f4; border-color: #e4c4ba; color: var(--danger); }
.button-danger:not(:disabled):hover { background: #f8e5df; }

.lightbox { width: min(67rem, 94vw); max-width: 94vw; max-height: 95vh; max-height: 95dvh; padding: 0; overflow: auto; border: 1px solid #53705f; border-radius: 1rem; background: #172a22; color: #f5f7ed; }
.lightbox::backdrop { background: #101912df; }
body:has(.lightbox[open]) { overflow: hidden; }
.lightbox-layout { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: .55rem; padding: .75rem; }
.lightbox-head, .lightbox-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.lightbox-count { margin: 0 0 0 .3rem; color: #d7e4d6; }
.lightbox-stage { display: grid; grid-template-columns: 2.65rem minmax(0, 1fr) 2.65rem; align-items: center; gap: .45rem; }
.lightbox-stage img { display: block; width: 100%; height: min(67vh, 54rem); height: min(67dvh, 54rem); object-fit: contain; text-align: center; }
.icon-button { display: grid; width: 2.65rem; height: 2.65rem; place-items: center; padding: 0; border: 1px solid #678475; border-radius: .55rem; background: #263e31; color: #f6f7ed; font-size: 1.5rem; line-height: 1; }
.icon-button:hover:not(:disabled) { background: #3b5647; }
.icon-button:disabled { opacity: .3; }
.lightbox-foot > div { min-width: 0; }
.lightbox-foot h2 { margin: 0; overflow-wrap: anywhere; color: #fbfcf3; font-size: 1rem; }
.lightbox-foot p { margin: 0; color: #d7e4d6; font-size: .84rem; }
.lightbox-foot .button { flex-shrink: 0; }

.admin-main { max-width: 52rem; }
.admin-intro { margin: .8rem 0 1.2rem; padding: clamp(1.5rem, 4.5vw, 2.9rem); border-radius: 1.35rem; background: #e8eddf; }
.admin-intro h1 { font-size: clamp(2.5rem, 6vw, 4.15rem); }
.admin-card { margin: 0 0 1.1rem; padding: clamp(1.1rem, 3.5vw, 2rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.admin-card .section-copy h2 { font-size: clamp(1.3rem, 2.7vw, 1.8rem); }
.admin-card .section-heading .button { flex-shrink: 0; }
#login-form { display: grid; justify-items: start; gap: .45rem; margin-top: 1.15rem; }
#login-form label { font-weight: 700; }
#admin-key { width: min(100%, 27rem); min-height: 2.8rem; padding: .45rem .68rem; border: 1px solid #a2b1a3; border-radius: .55rem; background: #fcfdf8; color: var(--ink); }
#login-form .button { margin-top: .45rem; }
.field-help { margin: 0; color: var(--muted); font-size: .88rem; }
.admin-disclosure { margin: 0 0 1.1rem; color: var(--muted); }
.drop-zone { position: relative; display: grid; justify-items: center; align-content: center; gap: .34rem; min-height: 10.6rem; margin-bottom: .75rem; padding: .8rem; border: 1px dashed #8ba38d; border-radius: .7rem; background: var(--soft); color: var(--green); text-align: center; }
.drop-zone:hover, .drop-zone.is-over { border-style: solid; background: #e1ebdc; }
.drop-zone:focus-within { outline: 3px solid #62864c; outline-offset: 3px; }
.drop-zone label { font-size: 1.02rem; font-weight: 750; cursor: pointer; }
.drop-zone label::after { content: ""; position: absolute; inset: 0; }
.drag-hint { margin-left: .4rem; font-size: .9rem; font-weight: 500; }
.drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.drop-zone.is-disabled { opacity: .6; }
.drop-zone.is-disabled label { cursor: default; }
.form-status { margin: .7rem 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.form-status.is-error { color: var(--danger); }
.file-list { list-style: none; display: grid; gap: .55rem; margin: 0; padding: 0; }
.file-list:not(:empty) { margin-block: .7rem; }
.file-row { display: flex; align-items: center; gap: .6rem; padding: .53rem .6rem; border: 1px solid var(--line); border-radius: .55rem; background: #f9faf5; }
.file-row img { width: 3.25rem; height: 2.65rem; flex: 0 0 3.25rem; object-fit: cover; border-radius: .35rem; background: var(--pale); }
.file-details { display: grid; min-width: 0; flex: 1; gap: .15rem; }
.file-details strong { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.file-details small { color: var(--muted); font-size: .82rem; }
.file-details label { color: var(--muted); font-size: .82rem; }
.file-details input { width: 100%; max-width: 20rem; margin-top: .1rem; padding: .34rem .5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); font-size: .9rem; }
.file-row .button { margin-left: auto; flex-shrink: 0; }

@media (max-width: 54rem) {
  .shell { width: calc(100% - 3rem); }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .shell { width: calc(100% - 2rem); }
  .site-header { min-height: 4.6rem; }
  .hero { grid-template-columns: 1fr; padding: 1.35rem; gap: 1rem; border-radius: 1rem; }
  .hero h1 br { display: none; }
  .hero h1 { font-size: clamp(1.95rem, 8.1vw, 3.05rem); }
  .hero-copy > p:last-child { margin-top: .52rem; }
  .hero-art { max-width: 25rem; }
  .hero-art img { width: min(100%, 23rem); border-radius: .75rem; }
  .gallery { padding-top: 1.85rem; }
  .gallery-grid { gap: .65rem; }
  .photo-card { border-radius: .68rem; }
  .photo-meta { grid-template-columns: 1fr; gap: .08rem; padding: .48rem .52rem .53rem; }
  .photo-meta strong { font-size: .9rem; }
  .lightbox-stage { grid-template-columns: 2.2rem minmax(0, 1fr) 2.2rem; gap: .15rem; }
  .lightbox-stage .icon-button { width: 2.2rem; }
  .lightbox-stage img { height: 56dvh; }
}
@media (max-width: 22rem) {
  .brand { font-size: .95rem; }
  .nav-link { padding-inline: .64rem; }
  .gallery-grid { grid-template-columns: 1fr; }
  .drag-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
