/* ---------- Reset & tokens ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #050403; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
  --ink:        #050403;       /* near-black */
  --ink-2:      #0a0908;
  --ash:        #1a1816;
  --bone:       #ece5d6;       /* warm parchment */
  --bone-dim:   #c9c1ae;
  --gold:       #b8945d;       /* candle gold */
  --gold-soft:  #8a6d44;
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ease-cinema: cubic-bezier(.2, .7, .2, 1);
  --t-slow: 1200ms;
  --t-veryslow: 3000ms;
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: rgba(184, 148, 93, 0.35); color: var(--bone); }

/* ---------- Film grain ---------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--ink);
}

.hero-stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: default;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}
.hero-stage:focus { outline: none; }

.hero-frame {
  position: absolute;
  inset: 0;
  background-position: center 30%;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity var(--t-veryslow) ease-in-out, transform 14000ms linear;
  filter: grayscale(1) contrast(1.05) brightness(0.78);
  will-change: opacity, transform;
}

.hero-frame.is-active {
  opacity: 1;
  transform: scale(1.0);
}

/* Vignette + soft top/bottom shading for atmosphere */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(5,4,3,0.45) 75%, rgba(5,4,3,0.92) 100%),
    linear-gradient(to bottom, rgba(5,4,3,0.55) 0%, rgba(5,4,3,0.15) 35%, rgba(5,4,3,0.15) 65%, rgba(5,4,3,0.8) 100%);
  pointer-events: none;
  z-index: 2;
}

.hero-caption {
  position: absolute;
  left: clamp(20px, 4vw, 56px);
  bottom: clamp(96px, 11vw, 132px);
  z-index: 3;
  color: var(--bone);
  pointer-events: none;
  max-width: min(560px, 50vw);
}

.hero-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 4.2vw, 56px);
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: var(--bone);
  transition: opacity 1400ms ease;
  opacity: 0.92;
}

.hero-meta {
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
  transition: opacity 1400ms ease;
  opacity: 0.85;
}

.hero-dates { display: inline-block; }

.hero-sep {
  display: inline-block;
  width: 18px;
  height: 1px;
  background: rgba(184, 148, 93, 0.55);
}

.hero-fate {
  display: inline-block;
  color: var(--bone-dim);
  letter-spacing: 0.28em;
}

.hero-name.is-fading,
.hero-meta.is-fading,
.hero-dates.is-fading { opacity: 0; }

/* Quote: opposite corner from name. Italic, hushed, gold cast. */
.hero-quote {
  position: absolute;
  right: clamp(20px, 4vw, 56px);
  bottom: clamp(96px, 11vw, 132px);
  z-index: 3;
  margin: 0;
  padding: 0;
  max-width: min(520px, 46vw);
  text-align: right;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(17px, 1.55vw, 24px);
  line-height: 1.4;
  color: var(--bone);
  opacity: 0.82;
  letter-spacing: 0.006em;
  transition: opacity 1400ms ease;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55);
  pointer-events: none;
}

.hero-quote::before {
  content: "\201C";
  position: absolute;
  right: 100%;
  top: -0.15em;
  margin-right: 0.12em;
  font-size: 1.4em;
  color: var(--gold);
  opacity: 0.5;
}

.hero-quote.is-fading { opacity: 0; }

/* Top-anchored chapter heading: italic small caps between hairline gold rules. */
.hero-motto {
  position: absolute;
  top: clamp(22px, 3vw, 34px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  opacity: 0.50;
  pointer-events: auto;
  cursor: default;
  user-select: none;
  text-align: center;
  transition: opacity 1800ms ease, letter-spacing 1800ms var(--ease-cinema);
}
.hero-motto-rule {
  height: 1px;
  background: var(--gold);
  opacity: 0.65;
}
.hero-motto-rule--wide { width: clamp(80px, 9vw, 130px); }
.hero-motto-rule--narrow { width: clamp(46px, 5.4vw, 78px); }
.hero-motto-line {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(11px, 0.95vw, 14px);
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: var(--bone);
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0,0,0,0.78), 0 0 22px rgba(0,0,0,0.55);
}
.hero-motto:hover {
  opacity: 0.85;
  transition: opacity 900ms ease;
}

/* Constellation strip — tiny portrait dots along the bottom of hero. */
.hero-constellation {
  position: absolute;
  left: 50%;
  bottom: clamp(22px, 3.5vw, 38px);
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  max-width: min(92vw, 880px);
  flex-wrap: nowrap;
}

/* Dot is a fixed-size square hit target (24x24) so the mouse always lands on it.
   The visible disc is a child pseudo-element that scales in place — the bounding
   box never moves, so dots never appear to "flee" the cursor. */
.con-dot {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.con-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-image: inherit;
  background-size: cover;
  background-position: center 28%;
  filter: grayscale(1) contrast(1.05) brightness(0.85);
  opacity: 0.45;
  border: 1px solid rgba(236, 229, 214, 0.25);
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  transition:
    transform 220ms var(--ease-cinema),
    opacity 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    filter 220ms ease;
  pointer-events: none;
  will-change: transform, opacity;
}

.con-dot:hover::before,
.con-dot:focus-visible::before {
  transform: translate(-50%, -50%) scale(2.0);
  opacity: 1;
  filter: grayscale(0) contrast(1.05) brightness(1);
  border-color: rgba(184, 148, 93, 0.85);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}

.con-dot.is-active::before {
  transform: translate(-50%, -50%) scale(1.6);
  opacity: 1;
  filter: grayscale(0) contrast(1.05) brightness(1);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(184, 148, 93, 0.35), 0 4px 12px rgba(0,0,0,0.6);
}

.con-dot[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--bone);
  background: rgba(5, 4, 3, 0.72);
  padding: 4px 10px;
  border: 1px solid rgba(184, 148, 93, 0.18);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease 60ms, transform 220ms var(--ease-cinema) 60ms;
}

.con-dot:hover[data-tip]::after,
.con-dot:focus-visible[data-tip]::after {
  opacity: 0.92;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Gallery ---------- */
.gallery {
  position: relative;
  padding: clamp(80px, 12vh, 160px) 0 clamp(40px, 6vh, 72px);
  background: var(--ink);
}

.carousel-wrap {
  position: relative;
  width: 100%;
}

.carousel {
  display: flex;
  gap: clamp(28px, 4vw, 56px);
  padding: 0 clamp(20px, 4vw, 72px);
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.carousel::-webkit-scrollbar { display: none; }
.carousel { scrollbar-width: none; }

.card {
  flex: 0 0 auto;
  width: clamp(280px, 28vw, 420px);
  scroll-snap-align: center;
  position: relative;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1600ms var(--ease-cinema), transform 1600ms var(--ease-cinema);
  outline: none;
}

.card.is-revealed { opacity: 1; transform: translateY(0); }

.card-portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #0d0c0a;
}

.card-portrait::before {
  content: "";
  position: absolute; inset: 0;
  background-image: var(--bg);
  background-size: cover;
  background-position: var(--pos, center 30%);
  filter: grayscale(1) contrast(1.06) brightness(0.86);
  transition: transform 2600ms var(--ease-cinema), filter 1400ms ease;
  transform: scale(1.01);
  will-change: transform;
}

.card:hover .card-portrait::before,
.card:focus-visible .card-portrait::before {
  transform: scale(1.06);
  filter: grayscale(1) contrast(1.08) brightness(0.7);
}

/* whispered truth on hover */
.card-whisper {
  position: absolute;
  inset: auto 0 0 0;
  padding: clamp(20px, 2.6vw, 40px) clamp(18px, 2.2vw, 30px);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.35;
  color: var(--bone);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 900ms ease, transform 900ms var(--ease-cinema);
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.card:hover .card-whisper,
.card:focus-visible .card-whisper { opacity: 1; transform: translateY(0); }

.card-body {
  padding: 22px 4px 0;
}

.card-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(22px, 1.7vw, 27px);
  line-height: 1.15;
  color: var(--bone);
  letter-spacing: 0.005em;
}

.card-meta {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 400;
}

.card-dates { color: var(--gold); }

.card-sep {
  display: inline-block;
  width: 14px;
  height: 1px;
  background: rgba(184, 148, 93, 0.45);
}

.card-fate {
  color: var(--bone-dim);
  letter-spacing: 0.28em;
}

.card:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 6px;
}

/* ---------- (closing removed) ---------- */

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-caption {
    left: 20px;
    right: 20px;
    bottom: clamp(118px, 22vw, 160px);
    max-width: none;
  }
  .hero-meta {
    gap: 10px;
    font-size: 10px;
    letter-spacing: 0.26em;
  }
  .hero-sep { width: 12px; }
  .hero-motto {
    top: 16px;
    gap: 7px;
    opacity: 0.55;
  }
  .hero-motto-line {
    font-size: 10px;
    letter-spacing: 0.36em;
  }
  .hero-motto-rule--wide { width: 70px; }
  .hero-motto-rule--narrow { width: 42px; }
  .hero-quote {
    right: 20px;
    left: 20px;
    bottom: clamp(82px, 16vw, 110px);
    max-width: none;
    text-align: left;
    font-size: clamp(15px, 3.8vw, 19px);
  }
  .hero-quote::before {
    position: static;
    margin-right: 0.18em;
  }
  .hero-constellation {
    bottom: 20px;
    gap: 6px;
  }
  .con-dot { width: 22px; height: 22px; border-radius: 50%; }
  .con-dot::before { width: 9px; height: 9px; }
  .con-dot:hover::before, .con-dot:focus-visible::before { transform: translate(-50%, -50%) scale(2.2); }
  .con-dot.is-active::before { transform: translate(-50%, -50%) scale(1.7); }
  .card { width: 78vw; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-frame { transition: opacity 600ms ease; transform: none; }
  .card { transition: opacity 400ms ease; transform: none; }
  .card-portrait::before { transition: none; }
}
