/* ------------------------------------------------------------------
   Client gallery. Warm darkroom palette by default, paper palette as
   the light theme. Colours live in the variables below.
   ------------------------------------------------------------------ */
:root {
  --bg: #1a1714;
  --bg2: #24201c;
  --bg3: #302a25;
  --ink: #f1e8d6;
  --mute: #a69c89;
  --line: rgba(241, 232, 214, .14);
  --accent: #d8b77a;
  --on-accent: #1a1714;
  --serif: "Cormorant Garamond", Cochin, "Hoefler Text", Didot, Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pad: clamp(14px, 3.6vw, 56px);
  --bar: 64px;
  --gap: 8px;
}
[data-theme="light"] {
  --bg: #f6f2ea;
  --bg2: #ebe5d8;
  --bg3: #e0d8c8;
  --ink: #221e19;
  --mute: #7b7366;
  --line: rgba(34, 30, 25, .14);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100svh;
}
body.no-scroll { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.eyebrow {
  font: 500 12px/1.4 var(--sans);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mute);
}
.muted { color: var(--mute); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 22px;
  border-radius: 999px;
  font: 500 14px/1 var(--sans); letter-spacing: .04em;
  transition: background .25s, color .25s, border-color .25s, transform .25s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-light { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-light:hover { background: #fff; color: #1a1714; border-color: #fff; }
.btn-solid { background: var(--accent); color: var(--on-accent); }
.btn-solid:hover { filter: brightness(1.08); }
.btn-outline { border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: rgba(128, 128, 128, .2); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.on svg.heart { fill: var(--accent); stroke: var(--accent); }
.icon-btn .badge {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
  font: 600 11px/18px var(--sans); text-align: center;
}

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--bar);
  padding: 0 calc(var(--pad) - 8px) 0 var(--pad);
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: background .35s, color .35s, border-color .35s;
  border-bottom: 1px solid transparent;
}
.bar.solid {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
.route-root .bar:not(.solid) { color: #fff; }
.brand { font: 500 21px/1 var(--serif); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-lg { font-size: 24px; }
.bar-actions { display: flex; align-items: center; gap: 2px; flex: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 480px;
  background: #0f0d0b; color: #fff;
}
body:not(.route-root) .hero { display: none; }
.hero-media, .hero-shade { position: absolute; inset: 0; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover;
  animation: hero-in 2.2s cubic-bezier(.2, .6, .2, 1) both;
}
@keyframes hero-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
.hero-shade {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0) 22%),
    linear-gradient(to top, rgba(10, 8, 6, .78), rgba(10, 8, 6, .18) 46%, rgba(10, 8, 6, 0) 68%);
}
.hero-text {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 var(--pad) clamp(34px, 7vh, 84px);
  animation: rise 1.1s .25s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.hero .eyebrow { color: rgba(255, 255, 255, .82); margin-bottom: 14px; }
.hero h1 {
  font: 500 clamp(46px, 9.2vw, 132px)/.94 var(--serif);
  letter-spacing: -.012em;
  max-width: 16ch;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.hero-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin-top: clamp(22px, 4vh, 40px); }
.hero-count { font: 500 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .75); }

/* ---------- main view ---------- */
.view { padding: clamp(28px, 5vw, 64px) var(--pad) 40px; min-height: 60vh; }
body:not(.route-root) .view { padding-top: calc(var(--bar) + clamp(28px, 5vw, 60px)); }
.state { display: grid; place-items: center; gap: 18px; min-height: 40vh; text-align: center; color: var(--mute); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.note {
  max-width: 62ch; margin: 0 auto clamp(30px, 5vw, 60px);
  font: italic 400 clamp(20px, 2.4vw, 27px)/1.5 var(--serif);
  text-align: center; white-space: pre-line; color: var(--ink);
}
.section-label { display: flex; align-items: baseline; gap: 14px; margin: 0 0 16px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-gap { margin-top: clamp(34px, 5vw, 64px); }

/* folder header */
.fhead { margin-bottom: clamp(22px, 3.4vw, 40px); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.crumbs a { color: var(--mute); transition: color .2s; display: inline-flex; align-items: center; gap: 8px; }
.crumbs a:hover { color: var(--ink); }
.crumbs svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.crumbs .sep { color: var(--line); }
.fhead h2 { font: 500 clamp(38px, 6.4vw, 84px)/1 var(--serif); letter-spacing: -.01em; text-wrap: balance; overflow-wrap: break-word; }
.fhead .count { margin-top: 12px; }
.fhead-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.fhead-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.chips { display: flex; gap: 8px; margin: 22px calc(var(--pad) * -1) 0; padding: 0 var(--pad) 4px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; padding: 0 18px; border-radius: 999px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); color: var(--mute);
  font: 500 13px/1 var(--sans); letter-spacing: .03em;
  transition: color .2s, border-color .2s, background .2s;
}
.chip:hover { color: var(--ink); border-color: var(--mute); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- chapter cards (sub-folders) ---------- */
.chapters { display: grid; gap: clamp(8px, 1.2vw, 16px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.chapters.few { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.chapters.one { grid-template-columns: minmax(0, 560px); }
.chapter {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 4 / 3; border-radius: 3px;
  background: var(--bg2); color: #fff;
  isolation: isolate;
}
.chapters.few .chapter { aspect-ratio: 3 / 4; }
@media (max-width: 640px) { .chapters.few .chapter, .chapter { aspect-ratio: 16 / 10; } }
.chapter img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .6, .2, 1), opacity .6s; opacity: 0; }
.chapter img.on, .home-list .chapter img { opacity: 1; }
.chapter:hover img { transform: scale(1.045); }
.chapter::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 8, 6, .74), rgba(10, 8, 6, .06) 55%); z-index: 1; }
.chapter-label { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: clamp(16px, 2vw, 26px); display: flex; flex-direction: column; gap: 8px; }
.chapter-label strong { font: 500 clamp(27px, 2.8vw, 40px)/1.02 var(--serif); letter-spacing: -.005em; overflow-wrap: break-word; }
.chapter-label small { font: 500 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.chapter .go {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .55);
  opacity: 0; transform: translate(-6px, 6px); transition: opacity .35s, transform .35s;
}
.chapter .go svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chapter:hover .go { opacity: 1; transform: none; }

/* ---------- justified photo grid ---------- */
.grid { --gap: 8px; }
.grid .row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.ph {
  position: relative; flex: none; display: block; overflow: hidden;
  background: var(--bg2); cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.ph img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s, transform .9s cubic-bezier(.2, .6, .2, 1); }
.ph img.on { opacity: 1; }
@media (hover: hover) { .ph:hover img { transform: scale(1.025); } }
.ph .fav {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(15, 13, 11, .42); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s, transform .25s;
}
.ph .fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.ph:hover .fav, .ph .fav:focus-visible { opacity: 1; }
.ph.is-fav .fav { opacity: 1; color: var(--accent); }
.ph.is-fav .fav svg { fill: currentColor; }
.ph .fav:active { transform: scale(.86); }
@media (hover: none) { .ph:not(.is-fav) .fav { display: none; } }
.ph .play {
  position: absolute; inset: 0; margin: auto;
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(15, 13, 11, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.ph .play svg { width: 20px; height: 20px; fill: #fff; margin-left: 3px; }
.ph .dur { position: absolute; left: 8px; bottom: 8px; padding: 3px 7px; border-radius: 3px; background: rgba(15, 13, 11, .6); color: #fff; font: 500 11px/1.2 var(--sans); }

/* ---------- footer ---------- */
.foot {
  padding: 46px var(--pad) calc(46px + env(safe-area-inset-bottom));
  margin-top: 30px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
  color: var(--mute); font-size: 13px; letter-spacing: .04em;
}
.foot a { color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 1px; transition: border-color .2s; }
.foot a:hover { border-color: var(--accent); }
.foot-brand a { font: 500 19px/1 var(--serif); letter-spacing: .01em; }

/* ---------- lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 100;
  background: #0b0a09; color: #fff;
  display: flex; flex-direction: column;
  animation: fade .25s both;
  touch-action: pinch-zoom; user-select: none; -webkit-user-select: none;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lb-top {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  padding: calc(8px + env(safe-area-inset-top)) 10px 26px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  transition: opacity .3s;
}
.lb-info { min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.lb-count { font: 500 13px/1 var(--sans); letter-spacing: .14em; flex: none; }
.lb-name { font-size: 12px; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-btns { display: flex; gap: 2px; flex: none; }
.lb-stage { position: relative; flex: 1; overflow: hidden; }
.lb-slide { position: absolute; inset: 0; display: grid; place-items: center; will-change: transform; }
.lb-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; pointer-events: none; }
.lb-slide iframe { width: min(100%, 1280px); height: min(100% - 120px, 720px); border: 0; background: #000; }
.lb-slide .lb-msg { text-align: center; display: grid; gap: 18px; justify-items: center; padding: 24px; }
.lb-nav {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); transition: background .2s, opacity .2s;
}
.lb-nav:hover { background: rgba(255, 255, 255, .2); }
.lb-nav svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-nav[disabled] { opacity: 0; pointer-events: none; }
@media (hover: none) { .lb-nav { display: none; } }
.lb.idle .lb-top, .lb.idle .lb-nav { opacity: 0; }
.lb-spin { position: absolute; left: 50%; bottom: 22px; margin-left: -10px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite; z-index: 3; }

/* ---------- popover / modal / toast ---------- */
.pop {
  position: fixed; z-index: 60; min-width: 270px; max-width: calc(100vw - 24px);
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  padding: 8px; animation: pop .18s both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pop button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 14px; border-radius: 8px; text-align: left; font-size: 14px; font-weight: 500; }
.pop button:hover { background: var(--bg3); }
.pop button small { color: var(--mute); font-weight: 400; white-space: nowrap; }
.pop p { padding: 8px 14px 6px; font-size: 12px; line-height: 1.5; color: var(--mute); max-width: 300px; }

.modal-wrap { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(8, 7, 6, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s both; }
.modal { width: min(100%, 440px); background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.modal h3 { font: 500 30px/1.1 var(--serif); margin-bottom: 10px; }
.modal p { color: var(--mute); font-size: 14px; }
.modal label { display: block; margin-top: 16px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.modal input, .modal textarea, .lock-form input {
  width: 100%; margin-top: 6px; padding: 13px 14px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font: 400 16px/1.4 var(--sans);
}
.modal textarea { min-height: 90px; resize: vertical; }
.modal input:focus, .modal textarea:focus, .lock-form input:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.progress { height: 4px; border-radius: 2px; background: var(--bg3); overflow: hidden; margin: 20px 0 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 200;
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 12px 20px; border-radius: 999px;
  font: 500 14px/1.2 var(--sans); white-space: nowrap;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  animation: toast .3s both;
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.admin-pill {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  padding: 10px 16px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font: 600 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

/* ---------- simple centred pages (404, password, home) ---------- */
.page-center { display: grid; place-items: center; padding: 24px; }
.card-center { width: min(100%, 460px); text-align: center; display: grid; gap: 18px; justify-items: center; }
.card-center .brand-lg { margin-bottom: 26px; color: var(--mute); }
.title-md { font: 500 clamp(36px, 7vw, 54px)/1.02 var(--serif); text-wrap: balance; }
.title-lg { font: 500 clamp(44px, 8vw, 92px)/.98 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.lock-form { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.lock-form input { margin: 0; flex: 1; min-width: 0; border-radius: 999px; padding-left: 20px; height: 46px; }
.form-error { color: #e2866f; font-size: 14px; }
.home { padding: clamp(60px, 10vw, 130px) var(--pad) 60px; }
.home-head { display: grid; gap: 16px; justify-items: start; margin-bottom: clamp(34px, 6vw, 70px); }
.card-center .home-head { justify-items: center; margin: 0; }

@media (max-width: 640px) {
  :root { --bar: 56px; }
  .grid { --gap: 4px; }
  .brand { font-size: 19px; }
  .icon-btn { width: 40px; height: 40px; }
  .foot { flex-direction: column; }
  .lb-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
