/*
 * AEVUM - a predictive-history concept study (fiction showcase).
 * THE DESCENT: seven strata, one continuous drop into the Archive.
 * Page-scoped skin for the CE Scroll Engine. Loads ONLY on the AEVUM page
 * (see functions.php gate) and never touches Core Framework config or any
 * other page. All engine-consumed variable names are remapped inside this
 * page's scope. Companion script: js/aevum.js.
 */

/* Lenis helper (engine requirement) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* Root scope: html gets .aevum from the functions.php pre-paint script.
 * font-size 100% undoes Core Framework's 62.5% root so rem = 16px here.
 * --text-title on html feeds the engine's particle color. */
html.aevum {
  font-size: 100%;
  background: #0B0908;
  --text-title: #EAE0CE;
}

/* Fonts: reuse the child theme's self-hosted variable fonts (no CDN). */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-Var.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-Italic-Var.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Var.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ *
 * Tokens (scoped to the AEVUM page body only)
 * ------------------------------------------------------------------ */
body.aevum {
  --av-black: #070605;
  --av-bg: #0B0908;
  --av-surface: #16120E;
  --av-gold: #C89B4B;
  --av-gold-bright: #E4B463;
  --av-parchment: #EAE0CE;
  --av-dim: #A2947C;
  --av-line: rgba(200, 155, 75, 0.16);

  --bg-body: var(--av-bg);
  --bg-surface: var(--av-surface);
  --text-title: var(--av-parchment);
  --text-body: var(--av-dim);
  --primary: var(--av-gold);
  --secondary: var(--av-gold-bright);
  --light: var(--av-black);

  --text-xs: 0.72rem;
  --text-s: 0.88rem;
  --text-l: 1.3rem;
  --text-2xl: 2.2rem;
  --text-4xl: clamp(2.8rem, 6vw, 5.2rem);

  --radius-s: 2px;
  --radius-m: 2px;

  --grain-opacity: 0.05;
  --vignette-strength: 0.55;
  --particle-opacity: 0.3;
  --tint-strength: 0.05;
}

/* ------------------------------------------------------------------ *
 * Base + stage deepening (body darkens as you descend)
 * ------------------------------------------------------------------ */
body.aevum {
  background: var(--av-bg);
  color: var(--av-dim);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background 1.4s ease;
}
body.aevum.av-s3 { background: #0A0807; }
body.aevum.av-s4 { background: #090707; }
body.aevum.av-s5 { background: #090606; }
body.aevum.av-s6 { background: #080606; }
body.aevum.av-s7 { background: #070605; }
body.aevum ::selection { background: var(--av-gold); color: var(--av-black); }
body.aevum :focus-visible { outline: 2px solid var(--av-gold); outline-offset: 3px; }

body.aevum .brxe-section { display: block; width: 100%; padding: 0; }

/* Serif voice for engine-styled display text */
body.aevum .ce-scroll__title {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-weight: 260;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,.6), 0 0 26px rgba(0,0,0,.55), 0 0 62px rgba(0,0,0,.4);
}
body.aevum .ce-scroll__title .av-ch { display: inline-block; will-change: transform; }
body.aevum .ce-scroll__title .av-word { display: inline-block; white-space: nowrap; }
body.aevum .ce-scroll__title em { color: var(--av-gold-bright); font-weight: 300; }
body.aevum .ce-scroll__lead { font-weight: 320; line-height: 1.65; max-width: 38ch; }
body.aevum .ce-scroll__eyebrow { color: var(--av-gold); }
body.aevum .ce-scroll__cta {
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  padding: 0.9rem 2rem;
}

/* Hero scrub pacing */
body.aevum [data-ce-motion="frame-scroll"] { --scroll-height: 700vh; }

/* ------------------------------------------------------------------ *
 * Loader ritual: serif mark tracks in, curtain lifts when ready
 * ------------------------------------------------------------------ */
body.aevum .ce-scroll__loader {
  gap: 1.1rem;
  transition: transform 0.78s cubic-bezier(0.7, 0, 0.3, 1);
}
body.aevum .ce-scroll__loader.is-hidden {
  opacity: 1;
  filter: none;
  transform: translateY(-101%);
}
body.aevum .ce-scroll__loader-mark {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.7rem;
  text-transform: uppercase;
  color: var(--av-parchment);
  letter-spacing: 0.45em;
  padding-left: 0.45em; /* optically recenter the tracking */
  animation: av-track-in 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes av-track-in {
  from { letter-spacing: 0.7em; opacity: 0; }
  to { letter-spacing: 0.45em; opacity: 1; }
}
.aevum .av-loader-sub {
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--av-dim);
  opacity: 0.8;
}

/* ------------------------------------------------------------------ *
 * Fixed chrome: wordmark, attribution, stratum HUD
 * ------------------------------------------------------------------ */
.aevum .av-mark {
  position: fixed;
  top: 2rem;
  left: 2.4rem;
  z-index: 300;
  font-size: 0.82rem;
  letter-spacing: 0.42em;
  color: var(--av-parchment);
  text-transform: uppercase;
}
.aevum .av-mark::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 0.55em;
  background: var(--av-gold);
  vertical-align: 0.14em;
}
.aevum .av-attr {
  position: fixed;
  top: 2.05rem;
  right: 2.4rem;
  z-index: 300;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--av-dim);
  text-decoration: none;
  transition: color 0.3s ease;
}
.aevum .av-attr:hover { color: var(--av-gold-bright); }

/* Header backdrop: transparent at rest, blurs in once scrolling starts */
.aevum .av-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4.6rem;
  z-index: 290;
  pointer-events: none;
  opacity: 0;
  background: rgba(11, 9, 8, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(200, 155, 75, 0.12);
  transition: opacity 0.4s ease;
}
body.aevum.av-scrolled .av-topbar { opacity: 1; }

.aevum .av-hud {
  position: fixed;
  left: 2.4rem;
  bottom: 2rem;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.9em;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--av-dim);
  pointer-events: none;
}
.aevum .av-hud::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--av-gold);
  opacity: 0.65;
}
.aevum .av-hud span { transition: opacity 0.22s ease; }

/* ------------------------------------------------------------------ *
 * Hero extras: the Descend cue
 * ------------------------------------------------------------------ */
.aevum .av-cue,
.aevum .av-cue.is-visible {
  top: auto;
  bottom: 2.6rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: none;
  text-align: center;
}
.aevum .av-cue-label {
  font-size: 0.66rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--av-dim);
}
.aevum .av-cue-line {
  width: 1px;
  height: 44px;
  margin: 0.9rem auto 0;
  background: linear-gradient(to bottom, var(--av-gold), transparent);
  animation: av-descend 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes av-descend {
  0% { transform: scaleY(0); opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ------------------------------------------------------------------ *
 * Strata scaffolding: sediment lines, ghost numerals, reveal masks
 * ------------------------------------------------------------------ */
.aevum .av-sline {
  position: absolute;
  top: 0;
  left: 4%;
  right: 4%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 155, 75, 0.35), transparent);
  transform: scaleX(0);
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.aevum .in-view > .av-sline,
.aevum .in-view .av-sline { transform: scaleX(1); }

.aevum .av-ghost {
  position: absolute;
  top: 50%;
  right: -2%;
  transform: translateY(-50%);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 200;
  font-size: min(26vw, 22rem);
  line-height: 1;
  color: var(--av-gold-bright);
  opacity: 0.045;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Line masks: hidden only when JS runs (html.aevum is JS-injected) */
.aevum .av-line { display: block; overflow: hidden; }
.aevum .av-line-in { display: block; }
html.aevum .av-line-in {
  transform: translateY(112%);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
html.aevum .av-line:nth-child(2) .av-line-in { transition-delay: 0.14s; }
html.aevum .in-view .av-line-in { transform: none; }

/* Label + body copy fade in with the section */
html.aevum [data-stratum] .av-label,
html.aevum [data-stratum] .av-body {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
html.aevum [data-stratum] .av-label { transition-delay: 0.05s; }
html.aevum [data-stratum] .av-body { transition-delay: 0.4s; }
html.aevum [data-stratum].in-view .av-label,
html.aevum [data-stratum].in-view .av-body { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ *
 * Dwell sections (shared bones)
 * ------------------------------------------------------------------ */
.aevum .av-dwell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem clamp(1.25rem, 6vw, 5rem);
  position: relative;
  overflow: clip;
}
.aevum .av-dwell-inner { max-width: 58rem; margin-inline: auto; width: 100%; position: relative; z-index: 1; }
.aevum .av-label {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--av-gold);
  margin-bottom: 1.6rem;
}
.aevum .av-h2 {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-weight: 240;
  font-size: clamp(2.3rem, 5.4vw, 4.4rem);
  line-height: 1.07;
  color: var(--av-parchment);
  letter-spacing: -0.01em;
}
.aevum .av-h2 em { font-style: italic; font-weight: 300; color: var(--av-gold-bright); }
.aevum .av-body {
  font-size: clamp(1.02rem, 1.35vw, 1.28rem);
  font-weight: 330;
  line-height: 1.75;
  color: var(--av-dim);
  max-width: 46ch;
  margin-top: 2.2rem;
}

/* Stratum 02 - DOCTRINE: asymmetric two-liner */
.aevum .av-thesis .av-h2 { font-size: clamp(2.5rem, 6vw, 5rem); }
.aevum .av-thesis .av-line--gold { padding-left: clamp(2.5rem, 16vw, 14rem); font-size: 1.08em; }
.aevum .av-thesis .av-body { margin-left: clamp(2.5rem, 16vw, 14rem); }

/* Stratum 05 - THE LAW: verdict + marginalia */
.aevum .av-verdict {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 3rem;
  align-items: end;
}
.aevum .av-method .av-h2 { font-size: clamp(2.6rem, 6.2vw, 5rem); }
.aevum .av-marginalia { font-size: 0.9rem; line-height: 1.8; margin-top: 0; max-width: none; }

/* ------------------------------------------------------------------ *
 * Stratum 04 - THE LEDGER: archive plates + pressure curve
 * ------------------------------------------------------------------ */
.aevum .av-ledger {
  position: relative;
  padding: 7rem 0 9rem;
  overflow: clip;
}
.aevum .av-ledger-head {
  max-width: 1400px;
  margin-inline: auto;
  padding: 0 clamp(1.25rem, 6vw, 5rem);
}
.aevum .av-curve {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  height: 52%;
  width: 100%;
  opacity: 0.5;
  pointer-events: none;
}
.aevum .av-curve path { stroke: var(--av-gold); stroke-width: 1.6; fill: none; }

body.aevum #av-stats {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.9rem, 1.6vw, 1.5rem);
  padding-block: 3rem 0;
}
.aevum .av-plate {
  position: relative;
  padding: 2.8rem 1.9rem 2.2rem;
  background: rgba(22, 18, 14, 0.82);
  border: 1px solid var(--av-line);
  border-top-color: rgba(200, 155, 75, 0.45);
  border-radius: 2px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.aevum .av-plate-serial {
  position: absolute;
  top: 0.95rem;
  right: 1.1rem;
  font-size: 0.56rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--av-dim);
  opacity: 0.7;
}
.aevum .av-stat-num {
  font-family: 'Fraunces', serif;
  font-weight: 280;
  font-size: clamp(2.1rem, 3.4vw, 3.3rem);
  line-height: 1;
  color: var(--av-gold-bright);
  font-variant-numeric: tabular-nums;
}
.aevum .av-num-unit { font-size: 0.45em; letter-spacing: 0.08em; color: var(--av-gold); }
.aevum .av-stat-label {
  margin-top: 1.1rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.55;
  color: var(--av-dim);
}

/* ------------------------------------------------------------------ *
 * Stratum 06 - THE VAULT: editorial artifact grid
 * ------------------------------------------------------------------ */
.aevum .av-vault-wrap { position: relative; overflow: clip; }
.aevum .av-vault {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(1rem, 2vw, 1.8rem);
  max-width: 1400px;
  margin-inline: auto;
  padding: 6rem clamp(1.25rem, 6vw, 5rem) 10rem;
}
.aevum .av-vault-label { grid-column: 1 / -1; margin-bottom: 2rem; }
.aevum .av-artifact { position: relative; margin: 0; }
.aevum .av-artifact:nth-of-type(1) { grid-column: 1 / 6; }
.aevum .av-artifact:nth-of-type(2) { grid-column: 6 / 10; margin-top: 5rem; }
.aevum .av-artifact:nth-of-type(3) { grid-column: 10 / 13; margin-top: 10rem; }
.aevum .av-art-serial {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--av-gold);
  opacity: 0.85;
  margin-bottom: 0.7rem;
}
.aevum .av-art-img { position: relative; overflow: hidden; border-radius: 2px; }
html.aevum .av-artifact .av-art-img {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
html.aevum .av-artifact.in-view .av-art-img { clip-path: inset(0 0 0 0); }
.aevum .av-art-img img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.aevum .av-artifact:hover .av-art-img img { transform: scale(1.04); }
.aevum .av-art-img::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--av-gold);
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.aevum .av-artifact:hover .av-art-img::after { opacity: 0.9; transform: none; }
.aevum .av-cap { padding: 1.1rem 0.2rem 0; }
.aevum .av-cap-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 340;
  font-size: 1.12rem;
  color: var(--av-parchment);
}
.aevum .av-cap-text {
  margin-top: 0.4rem;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--av-dim);
  max-width: 34ch;
}

/* ------------------------------------------------------------------ *
 * Stratum 07 - THRESHOLD: the seal
 * ------------------------------------------------------------------ */
.aevum .av-close {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem clamp(1.25rem, 6vw, 5rem) 6rem;
  position: relative;
  overflow: clip;
}
.aevum .av-close .av-h2 { font-size: clamp(2.6rem, 6vw, 5rem); }
.aevum .av-seal {
  display: inline-block;
  margin-top: 3rem;
  padding: 1.15rem 3.2rem;
  border: 1px solid var(--av-gold);
  border-radius: 2px;
  color: var(--av-gold-bright);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}
.aevum .av-seal:hover {
  background: var(--av-gold);
  color: var(--av-black);
  box-shadow: 0 0 44px rgba(200, 155, 75, 0.28);
  transform: translateY(-2px);
}
.aevum .av-sub {
  margin-top: 1.6rem;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: var(--av-dim);
}
.aevum .av-ref {
  margin-top: 1.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--av-dim);
  opacity: 0.65;
}
.aevum .av-note {
  margin-top: 4.2rem;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--av-dim);
  opacity: 0.8;
}
.aevum .av-note a { color: var(--av-gold); text-decoration: none; border-bottom: 1px solid var(--av-line); }
.aevum .av-note a:hover { color: var(--av-gold-bright); }

.aevum .av-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.8rem clamp(1.25rem, 6vw, 5rem);
  border-top: 1px solid var(--av-line);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--av-dim);
}

/* ------------------------------------------------------------------ *
 * Mobile
 * ------------------------------------------------------------------ */
@media (max-width: 900px) {
  body.aevum #av-stats { grid-template-columns: repeat(2, 1fr); }
  .aevum .av-verdict { grid-template-columns: 1fr; gap: 2rem; align-items: start; }
}
@media (max-width: 700px) {
  .aevum .av-mark { top: 1.3rem; left: 1.25rem; }
  .aevum .av-attr { top: 1.35rem; right: 1.25rem; }
  .aevum .av-hud { left: 1.25rem; bottom: 1.1rem; font-size: 0.55rem; }
  .aevum .av-topbar { height: 3.7rem; }
  /* Engine's mobile rule moves overlays to left:1.5rem but keeps the
   * --center translateX(-50%), shoving it off screen. Re-center it. */
  body.aevum .ce-scroll__overlay--center { left: 50%; right: auto; max-width: 88vw; }
  .aevum .av-vault { grid-template-columns: 1fr; padding-bottom: 7rem; }
  .aevum .av-artifact:nth-of-type(1),
  .aevum .av-artifact:nth-of-type(2),
  .aevum .av-artifact:nth-of-type(3) { grid-column: 1 / -1; margin-top: 0; }
  .aevum .av-vault .av-artifact + .av-artifact { margin-top: 2.5rem; }
  .aevum .av-cap-text { max-width: none; }
  .aevum .av-thesis .av-line--gold,
  .aevum .av-thesis .av-body { padding-left: 0; margin-left: 0; }
  .aevum .av-ghost { font-size: 34vw; opacity: 0.035; }
}
@media (max-width: 480px) {
  body.aevum #av-stats { grid-template-columns: 1fr; }
  .aevum .av-plate { padding: 2rem 1.5rem 1.8rem; }
  .aevum .av-dwell { min-height: 88vh; padding-block: 6rem; }
}

/* ------------------------------------------------------------------ *
 * Reduced motion: everything readable, nothing animated
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .aevum .av-cue-line { animation: none; }
  body.aevum .ce-scroll__loader-mark { animation: none; }
  html.aevum .av-line-in { transform: none !important; transition: none !important; }
  html.aevum [data-stratum] .av-label,
  html.aevum [data-stratum] .av-body { opacity: 1 !important; transform: none !important; transition: none !important; }
  html.aevum .av-artifact .av-art-img { clip-path: none !important; transition: none !important; }
  .aevum .av-sline { transform: scaleX(1) !important; transition: none !important; }
  body.aevum { transition: none; }
}
