/* self-hosted variable fonts — latin subset only */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/cinzel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Cinematic dusk-over-water palette — single mode, always dark for the epic version */
:root {
  --bg:         #0c1014;
  --bg-deep:    #06080b;
  --surface:    rgba(220, 230, 245, 0.04);
  --surface-hi: rgba(220, 230, 245, 0.09);
  --border:     rgba(220, 230, 245, 0.10);
  --border-hi:  rgba(220, 230, 245, 0.32);
  --text:       #e8eef5;
  --text-dim:   #9aa3b0;
  --text-faint: #5f6773;
  --accent:     #5fb4c4;
  --accent-warm:#e36a4d;
  --glow:       rgb(95 180 196 / 0.35);

  --ink-rgb:    220 230 245;
  --ember-rgb:  227 106 77;
  --accent-rgb: 95 180 196;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  color: var(--text);
  background: #06080b;
  min-height: 100vh;
  padding: 0 18px 80px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* WebGL scene — fixed full-viewport behind everything */
#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -3;
  display: block;
  pointer-events: none;
}

/* radial vignette — darkens edges, focuses attention on center */
.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 65% at 50% 45%, transparent 30%, rgba(0,0,0,0.55) 100%),
    radial-gradient(ellipse 100% 50% at 50% 0%, rgba(95,180,196,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(227,106,77,0.05) 0%, transparent 60%);
}

/* film grain — cheap data URI, GPU translate animation */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.55;
  mix-blend-mode: overlay;
  animation: grain-drift 80s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes grain-drift {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-3%, 2%, 0); }
}

main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

/* ───── HERO ───────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0 40px;
  text-align: center;
  position: relative;
}

.hero-title {
  font-family: 'Cinzel', serif;
  font-weight: 500;
  font-size: clamp(56px, 13vw, 128px);
  letter-spacing: 0.18em;
  line-height: 1;
  color: var(--text);
  text-shadow:
    0 0 40px rgba(95,180,196,0.25),
    0 0 80px rgba(95,180,196,0.12);
  display: flex;
  justify-content: center;
  gap: 0.04em;
}
.hero-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
  animation: letter-rise 1400ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.hero-title span:nth-child(1) { animation-delay: 600ms; }
.hero-title span:nth-child(2) { animation-delay: 720ms; }
.hero-title span:nth-child(3) { animation-delay: 840ms; }
.hero-title span:nth-child(4) { animation-delay: 960ms; }
.hero-title span:nth-child(5) { animation-delay: 1080ms; }
.hero-title span:nth-child(6) { animation-delay: 1200ms; }
.hero-title span:nth-child(7) { animation-delay: 1320ms; }

@keyframes letter-rise {
  0%   { opacity: 0; transform: translateY(40px); filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.hero-ripple {
  display: block;
  width: 96px;
  height: 18px;
  margin: 22px auto 18px;
  opacity: 0;
  animation:
    fade-up 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 1500ms forwards,
    ripple-sway 7s ease-in-out 1500ms infinite alternate;
  will-change: transform;
}
@keyframes ripple-sway {
  0%   { transform: translateX(-6px) scaleY(0.94); }
  50%  { transform: translateX(0)    scaleY(1.08); }
  100% { transform: translateX(6px)  scaleY(0.94); }
}

.hero-sub {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--text-dim);
  text-transform: lowercase;
  opacity: 0;
  animation: fade-up 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 1700ms forwards;
}

.epigraph {
  position: relative;
  max-width: 440px;
  margin: 28px auto 0;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-dim);
  font-style: italic;
  opacity: 0;
  animation: fade-up 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 1900ms forwards;
}
.epigraph::before,
.epigraph::after {
  content: '·';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-warm);
  font-style: normal;
  font-size: 14px;
  line-height: 1;
}
.epigraph::before { top: -14px; }
.epigraph::after  { bottom: -14px; }

.scroll-cue {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--text-faint);
  text-transform: lowercase;
  opacity: 0;
  animation:
    fade-up 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 2400ms forwards,
    scroll-bob 2.4s ease-in-out 2600ms infinite;
}
.scroll-cue svg { color: var(--accent); }
@keyframes scroll-bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.6; }
  50%      { transform: translate(-50%, 6px); opacity: 1; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ───── CHAPTERS ───────────────────────────────────────── */
.chapter {
  margin: 80px auto 0;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms cubic-bezier(0.2, 0.7, 0.2, 1), transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.chapter.is-in {
  opacity: 1;
  transform: translateY(0);
}

.chapter-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
  padding: 0 4px;
}
.chapter-num {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-warm);
  letter-spacing: 0.12em;
  min-width: 18px;
  text-align: center;
}
.chapter-title {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.18em;
  color: var(--text);
  text-transform: lowercase;
  line-height: 1;
}
.chapter-kicker {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  text-transform: lowercase;
  font-style: italic;
  margin-left: 2px;
}

/* ───── CARD SLABS ─────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 12px; }

a.card {
  position: relative;
  display: grid;
  /* index | glyph | body(1fr) | arrow — body takes the slack so text sits flush by the sigil */
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  min-height: 72px;
  background:
    linear-gradient(135deg, rgba(95,180,196,0.04), rgba(0,0,0,0.18)),
    var(--surface);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  touch-action: manipulation;
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition:
    background 280ms ease,
    border-color 280ms ease,
    transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 280ms ease;
  overflow: hidden;
  will-change: transform;
}

/* sheen — moves with cursor */
a.card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle 180px at var(--mx, 50%) var(--my, 50%),
    rgb(var(--accent-rgb) / 0.16) 0%,
    transparent 50%);
  opacity: 0;
  transition: opacity 280ms ease;
  pointer-events: none;
}

/* edge highlight — thin shimmer on top edge */
a.card::after {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

a.card:hover {
  background:
    linear-gradient(135deg, rgba(95,180,196,0.10), rgba(0,0,0,0.18)),
    var(--surface-hi);
  border-color: var(--border-hi);
  box-shadow:
    0 24px 60px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px var(--glow),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
a.card:hover::before { opacity: 1; }
a.card:hover .glyph {
  filter: drop-shadow(0 0 14px var(--glow));
  animation: glyph-breath 1600ms ease-in-out infinite;
}
a.card:hover .glyph circle.ring { stroke: var(--accent); }

@keyframes glyph-breath {
  0%, 100% { transform: scale(1)    rotate(0deg); }
  50%      { transform: scale(1.10) rotate(-2deg); }
}

.card-index {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  width: 22px;
  text-align: center;
  transition: color 280ms ease;
}
a.card:hover .card-index { color: var(--accent-warm); }

.glyph {
  width: 36px;
  height: 36px;
  stroke-width: 1.2;
  transform-origin: center;
  transition: filter 280ms ease;
}
.glyph circle.ring { stroke: var(--text-dim); transition: stroke 280ms ease; }

.body {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  column-gap: 14px;
  row-gap: 2px;
}
.title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
}
.url {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: rgba(220, 232, 245, 0.78);
  font-style: italic;
  line-height: 1.4;
}
.arrow {
  color: var(--text-faint);
  transition: color 280ms ease, transform 280ms ease;
  font-family: 'Cinzel', serif;
  font-size: 18px;
}
a.card:hover .arrow { color: var(--accent); transform: translateX(5px); }

/* "Coming soon" placeholder cards — muted, no tilt, soft badge */
a.card.coming { opacity: 0.68; cursor: default; }
a.card.coming:hover {
  background:
    linear-gradient(135deg, rgba(95,180,196,0.04), rgba(0,0,0,0.18)),
    var(--surface);
  border-color: var(--border);
  box-shadow: none;
  transform: perspective(900px) rotateX(0) rotateY(0);
}
a.card.coming:hover .glyph { filter: none; animation: none; }
a.card.coming:hover .arrow { transform: none; color: var(--text-faint); }
a.card.coming .arrow { display: none; }

.badge-soon {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 7px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--bg-deep);
  background: var(--accent-warm);
  border-radius: 3px;
  vertical-align: 2px;
}

.badge-access {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: rgba(220, 232, 245, 0.92);
  background: rgba(95, 180, 196, 0.20);
  border: 1px solid rgba(95, 180, 196, 0.55);
  border-radius: 3px;
  vertical-align: 2px;
}

.soon-toast {
  position: fixed;
  transform: translate(-50%, -100%);
  background: rgba(8, 12, 18, 0.94);
  border: 1px solid var(--accent-warm);
  color: var(--accent-warm);
  padding: 6px 14px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: lowercase;
  border-radius: 4px;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55), 0 0 16px rgba(196, 69, 54, 0.35);
  animation: soon-pop 1.7s ease-out forwards;
}
@keyframes soon-pop {
  0%   { opacity: 0; transform: translate(-50%, -90%); }
  18%  { opacity: 1; transform: translate(-50%, -120%); }
  82%  { opacity: 1; transform: translate(-50%, -120%); }
  100% { opacity: 0; transform: translate(-50%, -140%); }
}

/* cards without index column drop the column gracefully */
a.card:not(.has-index) { grid-template-columns: auto 1fr auto; }
a.card:not(.has-index) .card-index { display: none; }

/* signal cards: contacts, single line layout (no note) */
[data-section="signal"] a.card { min-height: 64px; padding: 14px 22px; }

/* ───── WHISPER (family note) ──────────────────────────── */
.whisper {
  max-width: 460px;
  margin: 100px auto 0;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  line-height: 2.2;
  color: var(--text-faint);
  font-style: italic;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms ease, transform 900ms ease;
}
.whisper.is-in { opacity: 0.82; transform: translateY(0); }
.whisper span { display: block; }

/* ───── PRIVATE LINK (three pulsing dots → /private) ───── */
.private-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin: 64px 0 0;
  padding: 22px 10px;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms ease, transform 900ms ease, gap 320ms ease;
}
.private-link.is-in { opacity: 1; transform: translateY(0); }
.private-link:hover { gap: 26px; }
.private-link:hover .dot { animation-duration: 1.4s; }
.private-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 12px; }

/* Three dots — sequential pulse so the link reads as "alive". */
.private-link .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: dot-pulse 2.1s ease-in-out infinite;
  box-shadow: 0 0 0 rgba(58, 102, 112, 0);
  transition: background 320ms ease;
}
.private-link .dot:nth-child(1) { animation-delay: 0s;   }
.private-link .dot:nth-child(2) { animation-delay: 0.7s; }
.private-link .dot:nth-child(3) { animation-delay: 1.4s; }

@keyframes dot-pulse {
  0%, 100% {
    opacity: 0.22;
    transform: scale(0.7);
    background: var(--text-faint);
    box-shadow: 0 0 0 rgba(58, 102, 112, 0);
  }
  40% {
    opacity: 1;
    transform: scale(1.45);
    background: var(--accent);
    box-shadow: 0 0 10px rgba(58, 102, 112, 0.55),
                0 0 18px rgba(58, 102, 112, 0.25);
  }
}

/* ───── FOOTER ─────────────────────────────────────────── */
footer {
  margin-top: 80px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}
footer .year::before { content: '·'; margin-right: 14px; color: var(--accent-warm); }
footer .year::after  { content: '·'; margin-left:  14px; color: var(--accent-warm); }

/* Constellation link — floating ★ in the corner, gently pulsing.
   Fixed position so it's always reachable, not buried in the footer. */
.map-link {
  position: fixed;
  right: 28px;
  bottom: 32px;
  z-index: 5;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 32px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(58, 102, 112, 0.15) 0%, transparent 70%);
  filter: drop-shadow(0 0 12px rgba(58, 102, 112, 0.55));
  animation: star-throb 2.6s ease-in-out infinite;
  transition: color 280ms ease, transform 280ms ease, filter 280ms ease;
}
.map-link:hover,
.map-link:focus-visible {
  color: #ffe4a0;
  transform: scale(1.25);
  filter: drop-shadow(0 0 22px rgba(255, 200, 100, 0.85));
  outline: none;
  animation-play-state: paused;
}
@keyframes star-throb {
  0%, 100% { opacity: 0.55; transform: scale(1);    filter: drop-shadow(0 0 8px  rgba(58, 102, 112, 0.4)); }
  50%      { opacity: 1;    transform: scale(1.12); filter: drop-shadow(0 0 18px rgba(58, 102, 112, 0.85)); }
}

@media (max-width: 540px) {
  .map-link { right: 18px; bottom: 22px; width: 44px; height: 44px; font-size: 28px; }
}

/* ───── FOCUS POLISH ───────────────────────────────────── */
a.card:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 18px;
}
summary { outline: none; }

/* ───── REDUCED MOTION ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-title span { opacity: 1; transform: none; filter: none; }
  .hero-ripple, .hero-sub, .epigraph, .scroll-cue { opacity: 1; }
  .chapter, .whisper, .private-link { opacity: 1; transform: none; }
}

/* ───── SMALL SCREEN POLISH ────────────────────────────── */
@media (max-width: 540px) {
  .hero { padding: 64px 0 32px; }
  .chapter { margin-top: 56px; }
  .chapter-head { margin-bottom: 20px; gap: 10px; flex-wrap: wrap; }
  .chapter-kicker { width: 100%; margin-left: 32px; }
  a.card { padding: 14px 16px; gap: 14px; min-height: 64px; }
  .glyph { width: 32px; height: 32px; }
  .body { grid-template-columns: 1fr; row-gap: 1px; }
  .title { font-size: 15px; white-space: normal; }
  .url { font-size: 10.5px; white-space: normal; word-break: break-all; }
  .note { font-size: 11px; }
  .card-index { width: 18px; font-size: 10px; }
}
