/* Nova — gallery styles
   Palette pulled from a Sphynx: warm peach skin, lilac-grey undertone, deep plum ink. */
:root {
  --paper: #EFE8EB;
  --paper-2: #F8F3F5;
  --ink: #2B1F29;
  --ink-soft: #6F5D6B;
  --skin: #E39C82;
  --skin-deep: #C97C62;
  --mauve: #A5869E;
  --line: rgba(43, 31, 41, 0.14);
  --rail-w: 72px;
  --pad: clamp(16px, 3vw, 40px);
  --gap: 6px;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--skin-deep); outline-offset: 3px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: end;
  gap: 0 var(--pad);
  padding: var(--pad);
  padding-right: calc(var(--pad) + var(--rail-w));
  overflow: hidden;
}
.hero-photo {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  height: calc(100svh - var(--pad) * 2);
  border-radius: 10px;
  overflow: hidden;
  background: var(--mauve);
  opacity: 0;
  transform: scale(1.06);
  animation: hero-photo 1.4s cubic-bezier(.2,.7,.2,1) .15s forwards;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.hero-photo-cap {
  position: absolute; left: 18px; bottom: 16px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border-radius: 8px;
  background: rgba(43, 31, 41, .55);
  color: var(--paper-2);
  backdrop-filter: blur(8px);
  font-size: 13px;
}
.hero-photo-cap b { font-family: var(--display); font-weight: 500; font-size: 17px; font-variation-settings: "SOFT" 100, "opsz" 24; }
.hero-photo-cap span { opacity: .75; }

.hero-text {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  padding-bottom: 8vh;
  max-width: 40ch;
}
.hero-name {
  margin: 0 0 18px -0.05em;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(88px, 17vw, 240px);
  line-height: .85;
  letter-spacing: -.035em;
  font-variation-settings: "SOFT" 100, "opsz" 144;
  display: flex;
}
.hero-name span {
  display: inline-block;
  opacity: 0; transform: translateY(.35em) rotate(2deg);
  animation: rise 1s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero-name span:nth-child(1) { animation-delay: .05s; }
.hero-name span:nth-child(2) { animation-delay: .13s; }
.hero-name span:nth-child(3) { animation-delay: .21s; }
.hero-name span:nth-child(4) { animation-delay: .29s; }
.hero-line, .hero-today, .hero-count {
  margin: 0;
  opacity: 0; animation: rise .9s cubic-bezier(.2,.7,.2,1) .55s forwards;
}
.hero-line { font-size: 17px; }
.hero-today { font-size: 17px; animation-delay: .65s; }
.hero-today b { font-family: var(--display); font-weight: 500; font-size: 22px; font-variation-settings: "SOFT" 100, "opsz" 32; color: var(--skin-deep); }
.hero-count { color: var(--ink-soft); font-size: 14px; margin-top: 10px; animation-delay: .75s; }

.hero-cue {
  position: absolute; left: var(--pad); bottom: var(--pad);
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--ink-soft); text-decoration: none;
  opacity: 0; animation: rise .9s ease 1.1s forwards;
}
.hero-cue svg { animation: nudge 2.4s ease-in-out 2s infinite; }
.hero-cue:hover { color: var(--ink); }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes hero-photo { to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- Chapters ---------- */
.gallery {
  padding: 0 calc(var(--pad) + var(--rail-w)) 0 var(--pad);
}
.chapter { padding: 9vh 0 3vh; scroll-margin-top: 2vh; }
.chapter + .chapter { border-top: 1px solid var(--line); }
.chapter-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 22px;
  margin-bottom: 26px;
}
.chapter-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(38px, 5.5vw, 76px);
  line-height: 1;
  letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "opsz" 96;
}
.chapter-head h2 em { font-style: italic; color: var(--skin-deep); }
.chapter-head p { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* ---------- Photos: justified rows, packed edge to edge ---------- */
.mosaic { display: flex; flex-direction: column; gap: var(--gap); }
.mosaic-row { display: flex; gap: var(--gap); }
.tile {
  position: relative; margin: 0; flex: 0 0 auto;
  overflow: hidden; border-radius: 6px;
  background: color-mix(in srgb, var(--mauve) 35%, var(--paper));
  cursor: zoom-in;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover;
  /* photos "develop" as they come into view */
  filter: blur(16px) saturate(.35) brightness(1.08);
  transform: scale(1.08);
  transition: filter 1.2s cubic-bezier(.2,.7,.2,1) var(--d, 0s), transform 1.2s cubic-bezier(.2,.7,.2,1) var(--d, 0s);
}
.tile.in img { filter: none; transform: scale(1); }
.tile.in:hover img { transform: scale(1.035); transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.tile figcaption {
  position: absolute; inset: auto 0 0 0;
  padding: 26px 12px 10px;
  display: flex; flex-direction: column;
  color: var(--paper-2);
  background: linear-gradient(to top, rgba(43,31,41,.72), rgba(43,31,41,0));
  opacity: 0; transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.tile figcaption b { font-family: var(--display); font-weight: 500; font-size: 16px; line-height: 1.2; font-variation-settings: "SOFT" 100, "opsz" 24; }
.tile figcaption span { font-size: 12px; opacity: .8; }
.tile:hover figcaption, .tile:focus-visible figcaption { opacity: 1; transform: none; }

/* ---------- Rail ---------- */
.rail {
  position: fixed; right: 18px; top: 50%;
  transform: translateY(-50%);
  height: min(62vh, 560px);
  width: 40px;
  display: flex; flex-direction: column; align-items: center;
  z-index: 20;
  font-size: 11px; color: var(--ink-soft);
  opacity: 0; transition: opacity .5s ease;
}
.rail.show { opacity: 1; }
.rail-top, .rail-bottom { line-height: 1; padding: 6px 0; }
.rail-track { margin: 14px 0; }
.rail-track { position: relative; flex: 1; width: 2px; background: var(--line); border-radius: 2px; }
.rail-ticks { position: absolute; inset: 0; }
.rail-tick {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 2px; background: var(--ink-soft);
  border: 0; padding: 0; cursor: pointer; opacity: .55;
}
.rail-tick::after {
  content: attr(data-n);
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-family: var(--display); font-size: 12px; color: var(--ink-soft); font-variation-settings: "opsz" 12;
}
.rail-tick:hover { opacity: 1; }
.rail-knob {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--skin); border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--skin-deep);
  cursor: grab; padding: 0;
  transition: top .35s cubic-bezier(.2,.7,.2,1);
  touch-action: none;
}
.rail.dragging .rail-knob { transition: none; cursor: grabbing; }
.rail-knob-label {
  position: absolute; right: 34px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; pointer-events: none;
  padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: var(--paper-2);
  font-family: var(--display); font-size: 14px; font-weight: 500; font-variation-settings: "SOFT" 100, "opsz" 20;
  opacity: 0; transition: opacity .25s ease;
}
.rail.dragging .rail-knob-label, .rail-knob:hover .rail-knob-label, .rail-knob:focus-visible .rail-knob-label { opacity: 1; }

/* ---------- Empty state / footer ---------- */
.empty { padding: 10vh var(--pad); max-width: 52ch; }
.empty h2 { font-family: var(--display); font-weight: 300; font-size: 44px; margin: 0 0 10px; }
.empty code { background: var(--paper-2); padding: 1px 6px; border-radius: 4px; }
.foot {
  padding: 12vh var(--pad) 8vh;
  color: var(--ink-soft); font-size: 14px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.foot p { margin: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 19, 28, .93);
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  color: var(--paper-2);
  animation: fade .25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.lb-figure { margin: 0; justify-self: center; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lb-figure img { max-height: 80vh; max-width: calc(100vw - 140px); border-radius: 8px; object-fit: contain; animation: pop .35s cubic-bezier(.2,.7,.2,1); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.lb-figure figcaption { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.lb-figure figcaption b { font-family: var(--display); font-weight: 400; font-size: 28px; font-variation-settings: "SOFT" 100, "opsz" 40; color: var(--skin); }
.lb-figure figcaption span { font-size: 13px; opacity: .75; }
.lb-close, .lb-nav {
  background: none; border: 0; color: var(--paper-2); cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; opacity: .7; transition: opacity .2s, background .2s;
}
.lb-close:hover, .lb-nav:hover { opacity: 1; background: rgba(255,255,255,.08); }
.lb-close { position: absolute; top: 16px; right: 16px; }
.lb-nav { justify-self: center; }
.lb-nav[disabled] { opacity: .15; cursor: default; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  :root { --rail-w: 0px; }
  .hero { grid-template-columns: 1fr; padding-right: var(--pad); min-height: auto; padding-bottom: 80px; }
  .hero-photo { grid-column: 1; grid-row: 1; height: 62svh; }
  .hero-text { grid-row: 2; padding: 22px 0 0; }
  .hero-name { font-size: clamp(88px, 28vw, 140px); }
  .hero-cue { bottom: 22px; }
  .gallery { padding-right: var(--pad); }
  .rail { display: none; }
  .tile figcaption { opacity: 1; transform: none; padding: 20px 8px 6px; }
  .tile figcaption b { font-size: 13px; }
  .tile figcaption span { display: none; }
  .lightbox { grid-template-columns: 40px 1fr 40px; }
  .lb-figure img { max-width: calc(100vw - 88px); max-height: 70vh; }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-photo, .hero-name span, .hero-line, .hero-today, .hero-count, .hero-cue { animation: none; opacity: 1; transform: none; }
  .hero-cue svg { animation: none; }
  .tile img { filter: none; transform: none; transition: none; }
  .rail-knob { transition: none; }
}
