:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --surface: rgba(255, 253, 248, 0.82);
  --surface-strong: #fffdf8;
  --text: #1e211c;
  --muted: #74776e;
  --line: rgba(36, 41, 33, 0.14);
  --accent: #b65332;
  --accent-ink: #fff9f1;
  --shadow: 0 28px 70px rgba(43, 34, 25, 0.12);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11130f;
  --surface: rgba(28, 31, 25, 0.84);
  --surface-strong: #1b1e18;
  --text: #f1eee6;
  --muted: #a5a79f;
  --line: rgba(239, 236, 227, 0.13);
  --accent: #e17950;
  --accent-ink: #17130f;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 35rem),
    var(--bg);
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.site-header {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 720;
  letter-spacing: .08em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 50% 50% 47% 53% / 56% 48% 52% 44%;
  font-family: Georgia, "Times New Roman", serif;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.header-actions form { margin: 0; }
.icon-button, .admin-link, .text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.admin-link { font-size: 14px; }

.intro {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(70px, 11vw, 160px) 0 clamp(55px, 7vw, 100px);
  transition: padding .4s ease;
}
.intro.compact { padding: 48px 0 22px; }
.intro h1, .admin-heading h1 {
  max-width: 900px;
  margin: 12px 0 18px;
  font-family: Georgia, "Songti SC", "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 104px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}
.intro.compact h1, .intro.compact p:not(.eyebrow) { display: none; }
.intro > p:not(.eyebrow), .admin-heading > p:not(.eyebrow) {
  max-width: 580px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.7;
}
.eyebrow, .step {
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .2em;
}

.content { width: min(1400px, calc(100% - 40px)); margin: 0 auto; }
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.section-heading h2 { margin: 0; font: 500 clamp(28px, 4vw, 46px)/1.1 Georgia, serif; }
.text-button { padding: 8px 0; }
.text-button:hover, .admin-link:hover { color: var(--accent); }

.album-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
}
.album-card {
  grid-column: span 4;
  padding: 0;
  text-align: left;
  color: var(--text);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}
.album-card:nth-child(5n + 1), .album-card:nth-child(5n + 4) { grid-column: span 5; }
.album-card:nth-child(5n + 2), .album-card:nth-child(5n + 5) { grid-column: span 7; }
.album-cover {
  display: block;
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--surface-strong) 80%, var(--accent));
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .35s ease, filter .35s ease;
}
.album-card:hover .album-cover { transform: translateY(-5px); filter: saturate(1.08); }
.album-copy { display: flex; justify-content: space-between; gap: 18px; padding: 15px 5px 38px; }
.album-copy strong { font-size: 19px; font-weight: 620; }
.album-copy span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.album-title { margin: 0; font: 500 clamp(34px, 5vw, 64px)/1.08 Georgia, "Songti SC", serif; }
.album-description { max-width: 680px; margin: -8px 0 32px; color: var(--muted); line-height: 1.7; }

.photo-grid { columns: 3; column-gap: 18px; }
.photo-card {
  width: 100%;
  display: inline-block;
  position: relative;
  margin: 0 0 18px;
  padding: 0;
  overflow: hidden;
  color: white;
  border: 0;
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 16px 40px rgba(22, 19, 16, .1);
  cursor: default;
}
.photo-card img, .photo-card video { width: 100%; height: auto; min-height: 180px; display: block; object-fit: cover; transition: transform .45s ease; }
.photo-card:hover img, .photo-card:hover video { transform: scale(1.018); }
.photo-card span {
  position: absolute;
  inset: auto 0 0;
  padding: 50px 18px 16px;
  text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.66));
  opacity: 0;
  transition: opacity .25s ease;
}
.photo-card:hover span { opacity: 1; }
.video-badge {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 50%;
  background: rgba(16,17,14,.46);
  transform: translate(-50%, -50%);
}
.video-badge svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }

.state {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 18px;
  padding: 50px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.state.error { color: #c7483c; }
.state a { color: var(--accent); font-weight: 650; }

.pagination {
  position: relative;
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 44px auto 0;
  padding: 18px 24px 22px;
  color: var(--muted);
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, transparent), var(--surface));
  box-shadow: 0 16px 45px color-mix(in srgb, var(--text) 8%, transparent);
  overflow: hidden;
}
.pagination::before, .pagination::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  height: 3px;
  opacity: .42;
  background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 15px);
}
.pagination::before { top: 7px; }
.pagination::after { bottom: 7px; }
.pagination-caption {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .2em;
  white-space: nowrap;
}
.pagination-caption::before, .pagination-caption::after { content: ""; width: 28px; height: 1px; background: currentColor; opacity: .45; }
.pagination-controls { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 100%; }
.pagination a { color: var(--text); text-decoration: none; transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease; }
.pagination a:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.pagination-pages { display: flex; align-items: center; gap: 6px; }
.pagination-page, .pagination-ellipsis {
  min-width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50% 50% 47% 53% / 54% 47% 53% 46%;
  font-family: Georgia, "Songti SC", "Times New Roman", serif;
  font-size: 16px;
}
.pagination-page.current {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 700;
  transform: rotate(-2deg);
}
.pagination-ellipsis { min-width: 24px; border-color: transparent; }
.pagination-edge {
  min-width: 82px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  text-align: center;
  white-space: nowrap;
}
.pagination-edge.disabled { opacity: .38; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 30px;
  color: white;
  border: 0;
  background: rgba(8, 9, 7, .94);
}
.lightbox::backdrop { background: rgba(0,0,0,.8); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { margin: 0; max-width: min(88vw, 1600px); max-height: 90vh; display: grid; place-items: center; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 82vh; object-fit: contain; }
.lightbox figcaption { width: 100%; display: flex; justify-content: space-between; gap: 20px; padding-top: 14px; color: #d4d4ce; }
.lightbox figcaption span { color: #8d8e88; }
.lightbox-close, .lightbox-info, .lightbox-original, .lightbox-nav {
  position: fixed;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  color: white;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}
.lightbox-close { top: 24px; right: 24px; }
.lightbox-info { top: 24px; right: 84px; }
.lightbox-original { top: 24px; right: 144px; }
.lightbox-close svg, .lightbox-info svg, .lightbox-original svg, .lightbox-nav svg {
  width: 48px;
  height: 48px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lightbox-close .control-ring, .lightbox-info .control-ring, .lightbox-original .control-ring, .lightbox-nav .control-ring {
  fill: rgba(0,0,0,.2);
  stroke: rgba(255,255,255,.2);
  stroke-width: 1;
}
.lightbox-info.active .control-ring { fill: rgba(255,255,255,.18); stroke: rgba(255,255,255,.7); }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }

.exif-panel {
  position: fixed;
  z-index: 3;
  top: 88px;
  right: 24px;
  width: min(390px, calc(100vw - 48px));
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 20px;
  color: #f1f1ed;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: rgba(18, 20, 17, .92);
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
}
.exif-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.exif-heading button { padding: 2px 7px; color: #aaa; border: 0; background: transparent; cursor: pointer; font-size: 24px; line-height: 1; }
.exif-panel p { color: #aaa; }
.exif-panel dl { display: grid; gap: 0; margin: 0; }
.exif-panel dl div { display: grid; grid-template-columns: minmax(110px, 42%) 1fr; gap: 14px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.09); }
.exif-panel dt { color: #999; font-size: 12px; overflow-wrap: anywhere; }
.exif-panel dd { margin: 0; color: #eee; font-size: 13px; overflow-wrap: anywhere; }
.exif-panel .exif-error { color: #ff9e93; }

footer { width: min(1400px, calc(100% - 40px)); margin: 110px auto 0; padding: 30px 0 50px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }

.admin-shell { width: min(980px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 100px; }
.admin-heading { padding: 80px 0 50px; }
.admin-heading h1 { font-size: clamp(44px, 7vw, 76px); }
.panel {
  margin-bottom: 22px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(30, 25, 20, .06);
  backdrop-filter: blur(18px);
}
.panel h2 { margin: 5px 0 8px; font: 500 28px/1.2 Georgia, serif; }
.panel p { color: var(--muted); line-height: 1.6; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.step { margin: 0; }
.status-pill { padding: 8px 12px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; font-size: 12px; white-space: nowrap; }
.inline-form, .form-grid { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.form-grid { grid-template-columns: 1fr 1fr; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--surface-strong);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.primary-button {
  min-height: 46px;
  padding: 0 20px;
  color: var(--accent-ink);
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  cursor: pointer;
  font-weight: 680;
}
.primary-button:disabled { opacity: .55; cursor: wait; }
.upload-form { display: grid; gap: 18px; }
.file-drop { padding: 24px; place-items: center; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface-strong); }
.file-drop input { border: 0; padding: 4px; background: transparent; }
.activity { display: grid; gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.activity li { display: grid; grid-template-columns: 55px 1fr; gap: 14px; padding-top: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.activity time { color: var(--accent); font-size: 12px; }
.activity li.error span { color: #c7483c; }
.operation-progress { display: grid; gap: 9px; margin-top: 18px; color: var(--muted); }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--surface-strong)); }
.progress-track > span { height: 100%; display: block; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.progress-track.indeterminate::after {
  content: "";
  width: 38%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--accent);
  animation: progress-scan 1.15s ease-in-out infinite;
}
@keyframes progress-scan {
  from { transform: translateX(-105%); }
  to { transform: translateX(265%); }
}
.share-duration { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.share-result { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin-top: 22px; }
.share-result small { grid-column: 1 / -1; color: var(--muted); }
.share-list { display: grid; gap: 0; margin-top: 28px; border-top: 1px solid var(--line); }
.share-list-heading, .share-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.share-list-heading { grid-template-columns: 1fr auto; }
.share-list-heading small, .share-row small { display: block; margin-top: 4px; color: var(--muted); }
.share-state { min-width: 56px; padding: 5px 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; text-align: center; font-size: 12px; }
.share-state.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.danger-button { padding: 9px 12px; color: #b43c32; border: 1px solid color-mix(in srgb, #b43c32 35%, transparent); border-radius: 10px; background: transparent; cursor: pointer; }
.danger-button:disabled { opacity: .5; cursor: wait; }
.form-error { margin: 18px 0 0; color: #c7483c !important; }
.access-shell { max-width: 760px; }
code { padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 10%, transparent); }

@media (max-width: 800px) {
  .album-card, .album-card:nth-child(n) { grid-column: span 6; }
  .photo-grid { columns: 2; }
  .inline-form { grid-template-columns: 1fr; }
  .lightbox-nav { top: auto; bottom: 28px; }
}

@media (max-width: 560px) {
  .site-header, .intro, .content, footer, .admin-shell { width: min(100% - 28px, 1400px); }
  .site-header { min-height: 72px; }
  .intro { padding-top: 70px; }
  .album-grid { gap: 14px; }
  .album-card, .album-card:nth-child(n) { grid-column: 1 / -1; }
  .album-copy { padding-bottom: 25px; }
  .photo-grid { columns: 1; }
  .photo-card span { opacity: 1; }
  .section-heading { align-items: start; flex-direction: column; }
  .pagination { width: 100%; padding-inline: 14px; }
  .pagination-controls { width: 100%; justify-content: flex-start; overflow-x: auto; padding: 2px 0 7px; }
  .pagination-pages, .pagination-edge { flex: 0 0 auto; }
  .lightbox { padding: 14px; }
  .lightbox-close { top: 14px; right: 14px; }
  .lightbox-info { top: 14px; right: 70px; }
  .lightbox-original { top: 14px; right: 126px; }
  .lightbox-nav.prev { left: 14px; }
  .lightbox-nav.next { right: 14px; }
  .lightbox figcaption { flex-direction: column; gap: 5px; }
  .exif-panel { top: 76px; right: 14px; width: calc(100vw - 28px); max-height: calc(100vh - 90px); }
  .admin-heading { padding-top: 55px; }
  .panel-heading, .form-grid { grid-template-columns: 1fr; display: grid; }
  .share-result { grid-template-columns: 1fr; }
  .share-result small { grid-column: 1; }
  .share-list-heading { grid-template-columns: 1fr; }
  .share-row { grid-template-columns: 1fr auto; }
  .share-row > div { grid-column: 1 / -1; }
  .status-pill { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .progress-track.indeterminate::after { animation-duration: 2.5s; }
}
