/* AKSELIKS — Causality
   tokens · fonts · base · scene · character stage · beherit · layout · type · links · states · motion · responsive · a11y */

/* ------------------------------------------------------------------ fonts */
@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-lat.woff2") format("woff2");
  font-weight: 300 560;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-italic-lat.woff2") format("woff2");
  font-weight: 400 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ----------------------------------------------------------------- tokens */
:root {
  /* Golden Age palette */
  --porcelain: #edebe6;
  --ivory: #e4dfd4;
  --pale-silver: #bcc3ca;
  --cloud: #989da8;
  --steel: #687584;
  --graphite: #262b32;
  --antique-gold: #9f8a5e;
  --beherit-crimson: #8c1423;

  /* Eclipse palette */
  --void: #080609;
  --black-plum: #150e1b;
  --femto-violet: #2d2035;
  --dried-crimson: #490d17;
  --blood: #850f20;
  --corona: #c73c35;
  --ash: #b5a7aa;

  /* Themed surface roles (Golden Age — cool silver-pearl, never warm beige) */
  --page: #e3e6ec;
  --ink: var(--graphite);
  --ink-soft: #414b57;
  --ink-faint: #56606d;
  --label-halo: rgb(231 234 240 / 0.92);
  --rule: rgb(38 43 50 / 0.17);
  --accent: var(--beherit-crimson);
  --focus: var(--graphite);
  --select-bg: rgb(140 20 35 / 0.18);
  --select-fg: #1b2026;
  --scroll-thumb: rgb(104 117 132 / 0.45);

  /* Typography */
  --font-display: "Cormorant", "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-caps: "Cinzel", "Cormorant", "Trajan Pro", Georgia, serif;
  --font-jp: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", "MS PMincho", serif;
  --size-name: clamp(3.35rem, 6.2vw, 9.6rem);
  --size-epithet: clamp(1.12rem, 0.72rem + 0.8vw, 1.62rem);
  --size-link: clamp(1.18rem, 1rem + 0.32vw, 1.42rem);
  --size-caps: clamp(0.72rem, 0.68rem + 0.11vw, 0.8rem);

  /* Spacing */
  --pad-x: clamp(1.5rem, 5.4vw, 6.5rem);
  --pad-y: clamp(1.5rem, 5vh, 3.5rem);
  --gutter: clamp(1rem, 2vw, 2rem);

  /* Motion */
  --ease-ui: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-space: cubic-bezier(0.45, 0, 0.2, 1);
  --dur-ui: 210ms;
  --dur-theme: 650ms;

  /* World & character geometry:
     --fx: 0.08 keeps the upper-left sun / Black Sun 100% inside 16:10 & 4:3 viewports
     while framing the dream castle cleanly behind Griffith's shoulder. */
  --fx: 0.08;
  --fy: 0.5;
  --ww: max(100vw, 100lvh * 16 / 9);
  --wh: max(100lvh, 100vw * 9 / 16);
  --parallax: 11px;
  --sun-x: 0.088;
  --sun-y: 0.236;
  --sun-w: 0.108;

  /* Exact 3:4 character stage locked to viewport right so Griffith/Femto never squash or clip */
  --fig-h: min(95lvh, 52vw * 4 / 3);
  --fig-w: calc(var(--fig-h) * 3 / 4);
  --fig-right: clamp(0.35rem, 2vw, 2.75rem);
  --fig-top: calc(100lvh - var(--fig-h) + 2.2lvh);

  color-scheme: light;
  scrollbar-color: var(--scroll-thumb) transparent;
}

[data-theme="eclipse"] {
  --page: #0b070d;
  --ink: #efe6e5;
  --ink-soft: #d2c4c7;
  --ink-faint: #ad9da1;
  --label-halo: rgb(11 7 13 / 0.88);
  --rule: rgb(181 167 170 / 0.2);
  --accent: #d44b42;
  --focus: #f3d6cf;
  --select-bg: rgb(199 60 53 / 0.32);
  --select-fg: #f8efee;
  --scroll-thumb: rgb(181 167 170 / 0.28);
  color-scheme: dark;
}

/* ------------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }

::selection {
  background: var(--select-bg);
  color: var(--select-fg);
}

html {
  background: var(--page);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 2rem;
  scroll-padding-bottom: 2rem;
  transition: background-color var(--dur-theme) var(--ease-space);
}
@media (min-width: 1900px) and (min-height: 1000px) { html { font-size: 114%; } }
@media (min-width: 2400px) and (min-height: 1300px) { html { font-size: 135%; } }

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.45;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: none; }
p, h1, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ scene */
.scene {
  position: fixed;
  inset: 0 0 auto;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(#cfd3da, #e7e5e0 60%, #d9dad9);
}

.world {
  position: absolute;
  left: calc((100vw - var(--ww)) * var(--fx));
  top: calc((100lvh - var(--wh)) * var(--fy));
  width: var(--ww);
  height: var(--wh);
  transform: scale(1.028);
}

.depth {
  position: absolute;
  inset: 0;
  transform: translate3d(
    calc(var(--px, 0) * var(--depth) * var(--parallax) * -1),
    calc(var(--py, 0) * var(--depth) * var(--parallax) * -0.55),
    0
  );
}

.plate,
.castle-hold,
.castle-hold > img,
.shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plate--eclipse { opacity: 0; }

.shade { opacity: 0; mix-blend-mode: multiply; }
.shade--dim { background: linear-gradient(#6f7685, #8d929d 55%, #7c818c); }
.shade--blood {
  background:
    radial-gradient(ellipse 44% 50% at 9% 24%, #d0574a, #6e1a29 55%, #261224 100%);
}

.castle-hold {
  opacity: 0;
  isolation: isolate;
  -webkit-mask-image: radial-gradient(ellipse 30% 36% at 72% 40%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 30% 36% at 72% 40%, #000 58%, transparent 100%);
}

/* Sun & Black Sun Corona */
.sun {
  position: absolute;
  left: calc(var(--sun-x) * 100%);
  top: calc(var(--sun-y) * 100%);
  width: calc(var(--sun-w) * 100%);
  aspect-ratio: 1;
  translate: -50% -50%;
}
.sun__rest {
  position: absolute;
  inset: -42%;
  display: none;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 253 247 / 0.88) 0 24%, rgb(255 250 240 / 0.45) 48%,
    rgb(255 247 232 / 0.14) 72%, rgb(255 246 230 / 0) 100%);
}
.sun__core {
  position: absolute;
  inset: -38%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fffdf7 0 50%, rgb(255 251 242 / 0.6) 60%, rgb(255 248 236 / 0) 100%);
  opacity: 0;
}
.sun__breath {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 272.5%;
  translate: -50% -48.2%;
}
.sun__corona {
  width: 100%;
  height: auto;
  opacity: 0;
  -webkit-mask-image: radial-gradient(closest-side at 50% 48.2%, #000 50%, rgb(0 0 0 / 0.5) 72%, transparent 100%);
  mask-image: radial-gradient(closest-side at 50% 48.2%, #000 50%, rgb(0 0 0 / 0.5) 72%, transparent 100%);
}
.sun__moon {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 44% 42%, #1c0f15, #090508 72%);
  opacity: 0;
}

/* Drifting atmospheric mist */
.mist {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
}
.mist--far { top: 55%; height: 25%; }
.mist--near { bottom: -3.5%; height: 24%; }
.mist > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 200%;
  background: url("../textures/mist-light.webp") 0 0 / 50% 100% repeat-x;
  animation: drift 155s linear infinite;
}
.mist--near > i { animation-duration: 92s; opacity: 0.82; }
.mist > .mist__dark { background-image: url("../textures/mist-dark.webp"); opacity: 0; }

/* Midground Eclipse organic structures — framed cleanly between the Beherit and Femto */
.hand {
  position: absolute;
  left: 33.5%;
  top: 18%;
  width: 36.5%;
  aspect-ratio: 587 / 527;
  opacity: 0;
}
.hand__art { position: absolute; inset: 0; width: 100%; height: 100%; }
.hand__glow {
  position: absolute;
  inset: -14% -12% 8%;
  background: radial-gradient(ellipse 52% 48% at 48% 42%, rgb(199 60 53 / 0.3), rgb(133 15 32 / 0.12) 56%, transparent 76%);
  opacity: 0;
}

.terrain {
  position: absolute;
  left: 29%;
  top: 61%;
  width: 72%;
  height: auto;
  opacity: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%);
  mask-image: linear-gradient(90deg, transparent, #000 20%);
}

@property --umbra {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
.umbra {
  --r: calc(var(--umbra) * 118%);
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at calc(var(--sun-x) * 100%) calc(var(--sun-y) * 100%),
    #060309 calc(var(--r) * 0.74), rgb(16 7 15 / 0.94) calc(var(--r) * 0.86),
    rgb(96 16 30 / 0.5) calc(var(--r) * 0.95), rgb(150 30 40 / 0.18) calc(var(--r) * 0.985),
    transparent var(--r));
}

/* -------------------------------------------------------- character stage */
/* Exact 3:4 portrait proportion (1152x1536) anchored relative to the visible viewport
   inside the parallax world so Griffith and Femto stand tall, sharp, and unstretched. */
.figure {
  position: absolute;
  right: calc((var(--ww) - 100vw) * (1 - var(--fx)) + var(--fig-right));
  top: calc((var(--wh) - 100lvh) * var(--fy) + var(--fig-top));
  width: var(--fig-w);
  height: var(--fig-h);
  aspect-ratio: 3 / 4;
  transform-origin: 52% 94%;
  /* Gentle bottom blend into the foreground mist so no harsh cutout edge ever floats */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 90%, rgb(0 0 0 / 0.65) 96.5%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 90%, rgb(0 0 0 / 0.65) 96.5%, transparent 100%);
}

.figure > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 92%;
}

.figure__eclipse { opacity: 0; }

/* Atmospheric separation auras behind the subject silhouette */
.figure__aura {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}
.figure__aura--golden {
  inset: 1% 10% 24% 8%;
  background: radial-gradient(ellipse 52% 48% at 50% 34%,
    rgb(242 243 247 / 0.42), rgb(222 227 235 / 0.16) 52%, transparent 78%);
}
.figure__aura--eclipse {
  inset: -2% 4% 14% 2%;
  opacity: 0;
  background: radial-gradient(ellipse 54% 52% at 46% 36%,
    rgb(180 38 48 / 0.34), rgb(78 18 42 / 0.22) 48%, transparent 76%);
}

/* Organic dark wing-cocoon veil active ONLY during Act V Rebirth (GPU transform + opacity) */
.figure__shroud {
  position: absolute;
  inset: -2% -4% 0;
  opacity: 0;
  transform-origin: 50% 88%;
  background: radial-gradient(ellipse 46% 54% at 50% 48%,
    #08040b 0%, rgb(18 9 22 / 0.94) 46%, rgb(62 14 28 / 0.36) 72%, transparent 90%);
}

/* Subtle crimson reflection cast onto Griffith's raised silver gauntlet when the Beherit is hovered */
.figure__cast {
  position: absolute;
  left: 12%;
  top: 15%;
  width: 34%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 52%, rgb(156 24 38 / 0.28), transparent 70%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 280ms var(--ease-ui);
}
body:has(.beherit:enabled:hover) [data-state="golden-age"] .figure__cast,
body:has(.beherit:focus-visible) [data-state="golden-age"] .figure__cast {
  opacity: 1;
}

.bones {
  position: absolute;
  right: calc((var(--ww) - 100vw) * (1 - var(--fx)) - 2vw);
  bottom: calc((var(--wh) - 100lvh) * (1 - var(--fy)) - 2.5lvh);
  width: min(33vw, 31rem);
  height: auto;
  opacity: 0;
  filter: brightness(0.72) saturate(0.92);
}

.pulse {
  position: absolute;
  left: var(--pulse-x, 54%);
  top: var(--pulse-y, 34%);
  width: 220vmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(140 20 35 / 0) 48%, rgb(132 18 34 / 0.54) 65%, rgb(140 20 35 / 0) 84%);
  mix-blend-mode: multiply;
  opacity: 0;
  transform: scale(0.04);
}

/* Readability veil for the left editorial column; clears the upper-left sun */
.scrim {
  position: absolute;
  inset: 0;
  --scrim-mask: linear-gradient(180deg, rgb(0 0 0 / 0.85) 0, rgb(0 0 0 / 0.82) 6%, transparent 13%,
    transparent 29%, rgb(0 0 0 / 0.72) 38%, #000 47%);
  -webkit-mask-image: var(--scrim-mask);
  mask-image: var(--scrim-mask);
}
.scrim--golden {
  background: linear-gradient(90deg,
    rgb(228 231 237 / 0.92) 0%, rgb(228 231 237 / 0.84) 24%,
    rgb(228 231 237 / 0.44) 39%, rgb(228 231 237 / 0) 53%);
}
.scrim--eclipse {
  opacity: 0;
  background: linear-gradient(90deg,
    rgb(11 7 12 / 0.88) 0%, rgb(13 8 14 / 0.72) 24%,
    rgb(13 8 14 / 0.3) 39%, rgb(13 8 14 / 0) 52%);
}

.particles { position: absolute; inset: 0; width: 100%; height: 100%; }

.grain {
  position: absolute;
  inset: 0;
  background: url("../textures/grain.webp") 0 0 / 256px 256px;
  mix-blend-mode: soft-light;
  opacity: 0.21;
}

.is-missing { display: none; }

/* ----------------------------------------------------------------- layout */
.frame {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto minmax(2.2rem, 1fr) auto auto auto;
  column-gap: var(--gutter);
  padding:
    max(var(--pad-y), env(safe-area-inset-top))
    max(var(--pad-x), env(safe-area-inset-right))
    max(var(--pad-y), env(safe-area-inset-bottom))
    max(var(--pad-x), env(safe-area-inset-left));
}

.era { grid-area: 1 / 1 / 2 / 7; }
.seal {
  position: fixed;
  top: max(var(--pad-y), env(safe-area-inset-top));
  right: clamp(1.1rem, 2.1vw, 2.4rem);
  z-index: 2;
}
.masthead { grid-area: 3 / 1 / 4 / 7; }
.links { grid-area: 4 / 1 / 5 / 6; margin-top: clamp(1.85rem, 6.2vh, 4.25rem); }
.colophon { grid-area: 5 / 1 / 6 / 7; margin-top: clamp(1.35rem, 3.6vh, 2.4rem); }

/* -------------------------------------------------------- crimson beherit */
/* Suspended in the dramatic focal space directly before Griffith/Femto's raised right hand */
.relic-slot {
  position: fixed;
  z-index: 3;
  right: calc(var(--fig-right) + var(--fig-w) * 0.855);
  top: calc(var(--fig-top) + var(--fig-h) * 0.185);
  pointer-events: none;
}

.beherit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(4.6rem, 6.1vw, 6.35rem);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.beherit:disabled {
  cursor: default;
  opacity: 0.78;
}
.beherit[aria-disabled="true"] { cursor: progress; }

/* Subtle tarnished-bronze cord rising into the upper mist */
.beherit__cord {
  position: absolute;
  bottom: 95.5%;
  left: 50%;
  width: 1px;
  height: clamp(4.5rem, 15vh, 11rem);
  translate: -50% 0;
  background: linear-gradient(180deg, transparent 0%, rgb(142 118 76 / 0.34) 45%, rgb(138 112 68 / 0.72) 100%);
  pointer-events: none;
  transition: opacity var(--dur-theme) var(--ease-space);
}
[data-theme="eclipse"] .beherit__cord {
  background: linear-gradient(180deg, transparent 0%, rgb(138 66 64 / 0.24) 45%, rgb(162 112 82 / 0.58) 100%);
}

.beherit__pendulum {
  position: relative;
  display: block;
  width: 100%;
  transform-origin: 50% 4%;
  animation: relic-sway 7.8s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}
[data-state]:not([data-state="golden-age"]) .beherit__pendulum {
  animation-play-state: paused;
}

.beherit__halo {
  position: absolute;
  inset: 10% -18% -10%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 54%,
    rgb(140 20 35 / 0.32) 0%, rgb(140 20 35 / 0.1) 46%, transparent 74%);
  opacity: 0.28;
  transform: scale(0.92);
  transition: opacity 260ms var(--ease-ui), transform 260ms var(--ease-ui);
}
[data-state="femto"] .beherit__halo {
  opacity: 0.65;
  background: radial-gradient(circle at 50% 54%,
    rgb(199 60 53 / 0.42) 0%, rgb(133 15 32 / 0.18) 48%, transparent 76%);
  animation: relic-pulse 5.6s var(--ease-space) infinite alternate;
}

.beherit__vessel {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 480 / 696;
  filter: drop-shadow(0 12px 20px rgb(24 14 20 / 0.34));
  transition: transform 240ms var(--ease-ui), filter 240ms var(--ease-ui);
}
[data-theme="eclipse"] .beherit__vessel {
  filter: drop-shadow(0 14px 24px rgb(5 2 6 / 0.72));
}

.beherit__vessel > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.beherit__awakened { opacity: 0; }

/* Brief dark shadow veil across the Beherit's face during its awakening morph */
.beherit__veil {
  position: absolute;
  inset: 14% 8% 4%;
  border-radius: 48% 48% 50% 50%;
  background: radial-gradient(circle at 50% 48%, rgb(24 4 10 / 0.88), rgb(56 8 18 / 0.55) 62%, transparent 86%);
  opacity: 0;
  pointer-events: none;
}

.beherit__label {
  margin-top: 0.62rem;
  font-family: var(--font-caps);
  font-size: clamp(0.71rem, 0.69rem + 0.08vw, 0.76rem);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0.86;
  text-shadow:
    0 0 0.14em var(--label-halo),
    0 0 0.36em var(--label-halo),
    0 0 0.75em var(--label-halo),
    0 1px 0.95em var(--label-halo);
  transition: opacity var(--dur-ui) var(--ease-ui), transform var(--dur-ui) var(--ease-ui), color var(--dur-theme) var(--ease-space);
}

@media (hover: hover) {
  .beherit:enabled:hover .beherit__vessel {
    transform: translateY(-2px) scale(1.045);
  }
  .beherit:enabled:hover .beherit__halo {
    opacity: 0.78;
    transform: scale(1.06);
  }
  .beherit:enabled:hover .beherit__label {
    opacity: 1;
    transform: translateY(1px);
  }
}

[data-state]:not([data-state="golden-age"]):not([data-state="femto"]) .beherit__label {
  opacity: 0;
}

/* --------------------------------------------------------------- swapping */
.era,
.seal,
.epithet,
.beherit__label { display: grid; }

.swap {
  grid-area: 1 / 1;
  transition: opacity var(--dur-theme) var(--ease-space), visibility 0s;
}
[data-theme="golden"] .swap--eclipse,
[data-theme="eclipse"] .swap--golden {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-theme) var(--ease-space), visibility 0s var(--dur-theme);
}

/* ------------------------------------------------------------- typography */
.era,
.seal__word {
  font-family: var(--font-caps);
  font-size: var(--size-caps);
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  line-height: 1.2;
}

.era { color: var(--ink); transition: color var(--dur-theme) var(--ease-space); }

.era,
.seal,
.epithet,
.colophon {
  text-shadow: 0 0 0.14em var(--label-halo), 0 0 0.4em var(--label-halo), 0 0 0.95em var(--label-halo);
}
.era > .swap { display: flex; align-items: center; white-space: nowrap; }
.era__rule {
  display: inline-block;
  width: 2.6em;
  height: 1px;
  margin: 0 1.05em 0 0.85em;
  background: currentColor;
  opacity: 0.52;
}

.seal { color: var(--ink); transition: color var(--dur-theme) var(--ease-space); }
.seal > .swap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.05em;
}
.seal__glyph {
  writing-mode: vertical-rl;
  font-family: var(--font-jp);
  font-size: clamp(0.94rem, 0.8rem + 0.26vw, 1.18rem);
  letter-spacing: 0.3em;
  line-height: 1;
}
.seal__word { writing-mode: vertical-rl; letter-spacing: 0.3em; font-size: 0.72rem; font-weight: 500; }

/* Sculpted wordmark with optical kerning across open diagonals (A-K, K-S, L-I) and straight stems (I-K) */
.name {
  font-family: var(--font-display);
  font-size: var(--size-name);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: 0.038em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-left: -0.055em;
  color: var(--ink);
  font-feature-settings: "kern", "liga";
  transition: color var(--dur-theme) var(--ease-space);
}
.k-a { letter-spacing: -0.006em; }
.k-k { letter-spacing: 0.022em; }
.k-l { letter-spacing: 0.02em; }
.k-i { letter-spacing: 0.058em; }

.epithet {
  margin-top: clamp(0.85rem, 1.9vh, 1.35rem);
  font-size: var(--size-epithet);
  font-weight: 400;
  line-height: 1.28;
  color: var(--ink-soft);
  transition: color var(--dur-theme) var(--ease-space);
}
.epithet > .swap {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65em;
}
.epithet__role {
  font-family: var(--font-caps);
  font-size: max(0.72rem, 0.7em);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}
.epithet__rule {
  display: inline-block;
  width: 1.55em;
  height: 1px;
  background: currentColor;
  opacity: 0.48;
}
.epithet__title {
  font-style: italic;
  letter-spacing: 0.01em;
}

.colophon {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
  transition: color var(--dur-theme) var(--ease-space);
}
.colophon cite { font-style: normal; }

/* ------------------------------------------------------------------ links */
.links__list { max-width: 22.5rem; border-bottom: 1px solid var(--rule); }

.link {
  position: relative;
  display: grid;
  grid-template-columns: 1.15rem 1fr auto;
  align-items: center;
  column-gap: 1.05rem;
  min-height: 3rem;
  padding: 0.35rem 0.15rem 0.35rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 0.2em;
  font-size: var(--size-link);
  font-weight: 500;
  letter-spacing: 0.012em;
  line-height: 1;
  transition: color var(--dur-theme) var(--ease-space), border-color var(--dur-theme) var(--ease-space);
}
.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-ui) var(--ease-ui);
}
.link__icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
  color: var(--ink-soft);
  transition: color var(--dur-ui) var(--ease-ui);
}
.link__name { padding-top: 0.08em; }
.link__arrow {
  width: 0.7rem;
  height: 0.7rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink-faint);
  transition: transform var(--dur-ui) var(--ease-ui), color var(--dur-ui) var(--ease-ui);
}

@media (hover: hover) {
  .link:hover::after { transform: scaleX(1); }
  .link:hover .link__arrow { transform: translate(2px, -2px); color: var(--accent); }
  .link:hover .link__icon { color: var(--ink); }
}
.link:focus-visible::after { transform: scaleX(1); }

/* ----------------------------------------------------------------- states */
[data-state="femto"] .sun__breath { animation: breathe 9s var(--ease-space) infinite alternate; }

.no-js .relic-slot { display: none; }

/* ----------------------------------------------------------------- motion */
@keyframes drift { to { transform: translateX(-50%); } }

@keyframes relic-sway {
  0%, 100% { transform: rotate(-1.35deg) translateY(0); }
  50% { transform: rotate(1.35deg) translateY(2px); }
}

@keyframes relic-pulse {
  from { transform: scale(0.96); opacity: 0.52; }
  to { transform: scale(1.06); opacity: 0.82; }
}

@keyframes breathe {
  from { transform: scale(1); opacity: 0.94; }
  to { transform: scale(1.018); opacity: 1; }
}

/* ------------------------------------------------------------- responsive */
/* Laptops and compact landscape screens */
@media (max-width: 1220px) and (min-width: 761px) and (orientation: landscape) {
  :root {
    --size-name: clamp(3rem, 5.8vw, 5.8rem);
    --fig-h: min(92lvh, 48vw * 4 / 3);
    --fig-right: clamp(0.25rem, 1.4vw, 1.5rem);
  }
  .masthead { grid-column-end: 8; }
  .seal { display: none; }
}

/* Short landscape phones */
@media (max-height: 560px) and (orientation: landscape) {
  :root {
    --size-name: clamp(2.4rem, 6.2vw, 3.8rem);
    --pad-y: 1.15rem;
    --fig-h: 94lvh;
  }
  .frame { grid-template-rows: auto 1rem auto auto auto; }
  .links { margin-top: 1.15rem; }
  .link { min-height: 2.75rem; }
  .seal { display: none; }
}

/* Portrait phones & tablets: dedicated vertical editorial composition */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  :root {
    --fx: 0.72;
    --size-name: clamp(2.65rem, 14.4vw, 5.6rem);
    --size-link: 1.26rem;
    /* Place resting/eclipsed sun cleanly below the epithet and above the Beherit */
    --sun-x: 0.58;
    --sun-y: 0.315;
    --sun-w: 0.076;
    --pad-x: clamp(1.35rem, 6vw, 3.25rem);
  }

  .scene {
    position: absolute;
    height: 100svh;
    min-height: 40rem;
  }

  .frame {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(16.5rem, 44svh) auto auto;
    min-height: 0;
    overflow-x: clip;
  }

  .era { grid-area: 1 / 1; }
  .seal { display: none; }
  .masthead {
    grid-area: 2 / 1;
    margin-top: clamp(1rem, 3.4svh, 2.2rem);
  }

  /* Beherit sits inside the open left-center stage beside Griffith's raised hand */
  .relic-slot {
    position: relative;
    grid-area: 3 / 1;
    right: auto;
    top: auto;
    align-self: center;
    justify-self: start;
    margin-left: clamp(0.35rem, 3.5vw, 1.75rem);
    margin-top: 2.4rem;
  }
  .beherit {
    width: clamp(4.35rem, 18vw, 5.4rem);
  }
  .beherit__cord {
    height: 1.7rem;
  }

  .links {
    grid-area: 4 / 1;
    margin-top: clamp(0.75rem, 2.5svh, 1.75rem);
  }
  .links__list { max-width: none; }
  .colophon { grid-area: 5 / 1; }

  .sun__rest { display: block; }

  /* Portrait character stage: true 3:4 proportions on the right, head & raised hand unobstructed */
  .figure {
    right: calc((var(--ww) - 100vw) * (1 - var(--fx)) - 4vw);
    top: calc((var(--wh) - 100svh) * var(--fy) + clamp(8.2rem, 19svh, 11.5rem));
    width: min(68vw, 21rem);
    height: auto;
    aspect-ratio: 3 / 4;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 68%, rgb(0 0 0 / 0.35) 86%, transparent 98%);
    mask-image: linear-gradient(180deg, #000 0%, #000 68%, rgb(0 0 0 / 0.35) 86%, transparent 98%);
  }

  .hand {
    left: 55%;
    top: 20%;
    width: 24%;
  }
  .terrain {
    left: 48%;
    top: 52%;
    width: 44%;
  }
  .bones {
    right: calc((var(--ww) - 100vw) * (1 - var(--fx)) - 3vw);
    bottom: calc((var(--wh) - 100svh) * (1 - var(--fy)) + 32svh);
    width: min(56vw, 17rem);
    opacity: 0;
  }

  .scrim { --scrim-mask: none; }
  .scrim--golden {
    background: linear-gradient(180deg,
      rgb(228 231 237 / 0.88) 0%, rgb(228 231 237 / 0.68) 18%, rgb(228 231 237 / 0) 32%,
      rgb(228 231 237 / 0) 50%, rgb(227 230 236 / 0.88) 63%, rgb(227 230 236 / 0.97) 74%, #e3e6ec 100%);
  }
  .scrim--eclipse {
    background: linear-gradient(180deg,
      rgb(11 7 13 / 0.84) 0%, rgb(11 7 13 / 0.54) 18%, rgb(11 7 13 / 0) 32%,
      rgb(11 7 13 / 0) 50%, rgb(11 7 13 / 0.88) 63%, rgb(11 7 13 / 0.97) 74%, #0b070d 100%);
  }
}

@media (max-width: 380px) {
  :root { --size-name: clamp(2.25rem, 13.8vw, 3.2rem); }
  .era__rule { width: 1.6em; margin: 0 0.75em 0 0.55em; }
  .beherit { width: 4.1rem; }
}

/* ---------------------------------------------------------- accessibility */
:focus-visible {
  outline: 1.5px solid var(--focus);
  outline-offset: 5px;
}
.link:focus-visible { outline-offset: 3px; }
.beherit:focus-visible {
  outline: none;
}
.beherit:focus-visible .beherit__vessel {
  outline: 1.5px solid var(--focus);
  outline-offset: 6px;
  border-radius: 2.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-theme: 260ms; }
  .mist > i,
  .beherit__pendulum,
  [data-state="femto"] .beherit__halo,
  [data-state="femto"] .sun__breath { animation: none; }
  .particles { display: none; }
}

@media (forced-colors: active) {
  .scene { display: none; }
  .link, .beherit { forced-color-adjust: auto; }
}
