/* ============================================================
   The Grove — Stylesheet
   A research organism in a former Catholic school.
   Manuscript page treatment with dark marble frame.
   ============================================================ */


/* — Palette — */
:root {
  /* Scroll-paper tones */
  --color-bg:           #efe5d0;
  --color-bg-warm:      #e8dcc6;
  --color-bg-panel:     #f2ead8;

  /* Text hierarchy — warm near-black to gray */
  --color-text:         #1c1912;
  --color-text-body:    #302d24;
  --color-text-soft:    #5a5648;
  --color-text-muted:   #6d6552;
  --color-text-ghost:   #8f856f;

  /* Accent — gold-olive (erdtree-touched) */
  --color-accent:       #5a6038;
  --color-accent-dark:  #3e4428;

  /* Structural rules — warm gold */
  --color-rule:         #c0ad88;
  --color-rule-light:   #d4c5a4;
  --color-rule-faint:   #e2d8c4;

  /* Selection */
  --color-selection-bg:   #d4c5a4;
  --color-selection-text: #1c1912;
}


/* — Typography — */
:root {
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  --size-display: clamp(3.5rem, 7.5vw, 6rem);
  --size-h2:      clamp(1.35rem, 2.2vw, 1.75rem);
  --size-h3:      clamp(1.05rem, 1.3vw, 1.2rem);
  --size-body:    clamp(0.9375rem, 1.05vw, 1.0625rem);
  --size-small:   clamp(0.8125rem, 0.92vw, 0.875rem);
  --size-tiny:    clamp(0.6875rem, 0.78vw, 0.75rem);

  --leading-body:  1.62;
  --leading-tight: 1.2;

  --tracking-display: 0.08em;
  --tracking-caps:    0.14em;
}


/* — Layout — */
:root {
  --content-narrow: 640px;
  --content-wide:   1060px;
  --section-pad-y:  clamp(3rem, 6vh, 5rem);
  --section-pad-x:  clamp(1.5rem, 4vw, 2.5rem);

  /* Manuscript frame dimensions */
  --frame:        clamp(18px, 2.8vmin, 38px);
  --inner-inset:  clamp(12px, 1.8vmin, 24px);
}


/* — Reset — */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;

  /* ═══ Dark Green Marble / Malachite Background ═══ */
  background:
    /* Fine veining lines */
    repeating-linear-gradient(
      138deg,
      transparent 0px,
      transparent 20px,
      rgba(45,85,50,0.07) 20px,
      rgba(45,85,50,0.07) 21px
    ),
    repeating-linear-gradient(
      112deg,
      transparent 0px,
      transparent 28px,
      rgba(55,95,60,0.05) 28px,
      rgba(55,95,60,0.05) 29px
    ),
    /* Cloud veining */
    radial-gradient(ellipse at 15% 30%, rgba(35,72,40,0.45) 0%, transparent 50%),
    radial-gradient(ellipse at 78% 12%, rgba(22,58,28,0.5) 0%, transparent 45%),
    radial-gradient(ellipse at 88% 72%, rgba(32,68,38,0.35) 0%, transparent 42%),
    radial-gradient(ellipse at 38% 88%, rgba(28,62,32,0.42) 0%, transparent 48%),
    radial-gradient(ellipse at 58% 48%, rgba(42,78,48,0.2) 0%, transparent 58%),
    /* Lighter veins */
    radial-gradient(ellipse at 28% 62%, rgba(60,105,68,0.12) 0%, transparent 28%),
    radial-gradient(ellipse at 68% 38%, rgba(55,98,62,0.1) 0%, transparent 22%),
    /* Base gradient — deep polished stone */
    linear-gradient(148deg, #18361f, #0d2414, #15301d, #0b2112, #132c1b);
}


/* — Base — */
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  color: var(--color-text-body);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ============================================================
   MANUSCRIPT PAGE — Scrolling parchment container
   ============================================================ */
.page {
  position: fixed;
  top: calc(var(--frame) + env(safe-area-inset-top, 0px));
  left: calc(var(--frame) + env(safe-area-inset-left, 0px));
  right: calc(var(--frame) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--frame) + env(safe-area-inset-bottom, 0px));
  z-index: 1;

  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;

  /* ═══ Gilt edge — gold leaf border molding ═══ */
  border: 4px solid #b49545;

  /* Scroll paper with age stains and fiber texture */
  background:
    /* Horizontal fiber grain (papyrus/scroll feel) */
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 3px,
      rgba(160,135,85,0.025) 3px,
      rgba(160,135,85,0.025) 4px
    ),
    /* Subtle vertical cross-fibers */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 8px,
      rgba(145,120,70,0.012) 8px,
      rgba(145,120,70,0.012) 9px
    ),
    /* Age/water stains — larger, warmer, more visible */
    radial-gradient(ellipse at 15% 10%, rgba(170,130,65,0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(155,115,55,0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 75% 80%, rgba(165,125,60,0.12) 0%, transparent 48%),
    radial-gradient(ellipse at 5% 75%, rgba(145,105,45,0.09) 0%, transparent 38%),
    radial-gradient(ellipse at 45% 40%, rgba(150,118,58,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 20%, rgba(140,110,50,0.05) 0%, transparent 30%),
    radial-gradient(ellipse at 30% 65%, rgba(160,125,60,0.07) 0%, transparent 35%),
    /* Edge darkening — scroll edges darken naturally */
    radial-gradient(ellipse at center, transparent 30%, rgba(110,88,45,0.12) 100%),
    /* Base scroll paper */
    var(--color-bg);

  /* Depth: gilt glow, inset vignette, heavy drop shadow */
  box-shadow:
    inset 0 0 0 1px rgba(180,160,120,0.15),      /* Inner gold hairline */
    inset 0 0 120px rgba(100,80,35,0.12),          /* Deep vignette */
    inset 0 0 40px rgba(80,65,30,0.06),             /* Secondary vignette */
    0 0 0 1px rgba(80,60,20,0.25),                  /* Outer dark hairline */
    0 4px 30px rgba(0,0,0,0.35),                    /* Primary drop shadow */
    0 0 80px rgba(0,0,0,0.18),                      /* Ambient shadow */
    0 0 20px rgba(180,150,70,0.15);                  /* Gilt glow onto marble */
}

/* Scroll paper grain texture — coarser, more visible */
.page::after {
  content: '';
  position: fixed;
  top: calc(var(--frame) + env(safe-area-inset-top, 0px));
  left: calc(var(--frame) + env(safe-area-inset-left, 0px));
  right: calc(var(--frame) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--frame) + env(safe-area-inset-bottom, 0px));
  opacity: 0.06;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Marble grain texture (covers whole viewport including frame) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 10000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}


/* ============================================================
   ORNAMENTAL FRAME — Double-rule with corner flourishes
   ============================================================ */
.page-frame {
  position: fixed;
  top: calc(var(--frame) + var(--inner-inset) + env(safe-area-inset-top, 0px));
  left: calc(var(--frame) + var(--inner-inset) + env(safe-area-inset-left, 0px));
  right: calc(var(--frame) + var(--inner-inset) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--frame) + var(--inner-inset) + env(safe-area-inset-bottom, 0px));
  border: 1.5px solid #a8903c;
  pointer-events: none;
  z-index: 100;
  opacity: 1;
}

/* Inner second rule for double-line effect */
.page-frame::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #a8903c;
  opacity: 0.7;
}

/* Corner flourish SVGs */
.frame-corner {
  position: absolute;
  overflow: visible;
}

.frame-corner--tl { top: -14px; left: -14px; }
.frame-corner--tr { top: -14px; right: -14px; transform: scaleX(-1); }
.frame-corner--bl { bottom: -14px; left: -14px; transform: scaleY(-1); }
.frame-corner--br { bottom: -14px; right: -14px; transform: scale(-1); }

/* Side diamond ornaments */
.frame-diamond {
  position: absolute;
}

.frame-diamond--top    { top: -10px;   left: 50%; transform: translateX(-50%); }
.frame-diamond--bottom { bottom: -10px; left: 50%; transform: translateX(-50%); }
.frame-diamond--left   { left: -10px;  top: 50%;  transform: translateY(-50%); }
.frame-diamond--right  { right: -10px; top: 50%;  transform: translateY(-50%); }


/* ============================================================
   MARGINALIA — Cybernetic growth system emerging from corners
   ============================================================ */
.marginalia {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.marginalia path,
.marginalia circle,
.marginalia line {
  stroke: #a8903c;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Primary vine/dendrite paths — depth-based weight */
.marginalia__vine--d0 { opacity: 0.75; stroke-width: 1.6; }
.marginalia__vine--d1 { opacity: 0.65; stroke-width: 1.3; }
.marginalia__vine--d2 { opacity: 0.50; stroke-width: 1.0; }
.marginalia__vine--d3 { opacity: 0.38; stroke-width: 0.7; }
.marginalia__vine--d4 { opacity: 0.28; stroke-width: 0.5; }

/* Sacred geometry nodes */
.marginalia__node {
  opacity: 0.55;
  stroke-width: 0.8;
}

/* Architectural grid traces */
.marginalia__grid {
  opacity: 0.28;
  stroke-width: 0.5;
  stroke-dasharray: 3 5;
}

/* Mycelium terminal filaments */
.marginalia__filament {
  opacity: 0.25;
  stroke-width: 0.4;
}

/* Draw-in animation — each path is a single continuous curve */
@keyframes drawMarginalia {
  from { stroke-dashoffset: var(--path-len); }
  to   { stroke-dashoffset: 0; }
}

@keyframes fadeMarginalia {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.marginalia__draw {
  stroke-dasharray: var(--path-len);
  stroke-dashoffset: var(--path-len);
  animation: drawMarginalia var(--draw-dur, 2s) ease-out var(--draw-delay, 0s) forwards;
}

.marginalia__fade-in {
  opacity: 0;
  animation: fadeMarginalia 1.5s ease-out var(--fade-delay, 2s) forwards;
}

/* Post-draw ambient animations */
@keyframes breatheNode {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.75; }
}

@keyframes driftFilament {
  0%, 100% { opacity: 0.18; }
  50%      { opacity: 0.38; }
}

@keyframes pulseVine {
  0%, 100% { opacity: var(--pulse-base, 0.65); }
  50%      { opacity: var(--pulse-peak, 0.85); }
}

.marginalia__breathe {
  animation: breatheNode var(--breathe-dur, 8s) ease-in-out infinite;
}

.marginalia__drift {
  animation: driftFilament var(--drift-dur, 10s) ease-in-out infinite;
}

.marginalia__pulse {
  animation: pulseVine var(--pulse-dur, 14s) ease-in-out infinite;
}

/* Reduced motion: skip all animation, show final state */
@media (prefers-reduced-motion: reduce) {
  .marginalia__draw {
    animation: none;
    stroke-dashoffset: 0;
  }
  .marginalia__fade-in {
    animation: none;
    opacity: 1;
  }
  .marginalia__breathe,
  .marginalia__drift,
  .marginalia__pulse {
    animation: none;
  }
}

/* Hide on tablet/mobile (same breakpoint as corners/diamonds) */
@media (max-width: 900px) {
  .marginalia {
    display: none;
  }
}


/* — Selection — */
::selection {
  background: var(--color-selection-bg);
  color: var(--color-selection-text);
}


/* — Scrollbar (on .page) — */
.page::-webkit-scrollbar       { width: 5px; }
.page::-webkit-scrollbar-track  { background: transparent; }
.page::-webkit-scrollbar-thumb  { background: var(--color-rule-light); border-radius: 3px; }
.page::-webkit-scrollbar-thumb:hover { background: var(--color-rule); }


/* — Sections — */
.section {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--section-pad-y) var(--section-pad-x);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
}


/* ============================================================
   HERO
   ============================================================ */
.section--hero {
  text-align: center;
}

/* Subtle radial glow behind hero content */
.section--hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 253, 248, 0.5) 0%, transparent 60%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
}

/* — Point Cloud (canvas, driven by JS) — */
.hero__cloud {
  width: clamp(180px, 28vw, 340px);
  height: clamp(180px, 28vw, 340px);
  margin: 0 auto 1.25rem;
  display: block;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--size-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  margin-bottom: 1.25rem;

  /* Constant gold text with pulsing holographic glow */
  background: linear-gradient(
    135deg,
    var(--color-text) 20%,
    #7a6b45 50%,
    var(--color-text) 80%
  );
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: title-glow 10s ease-in-out infinite;
}

.hero__descriptors {
  font-family: var(--font-body);
  font-size: var(--size-small);
  font-weight: 400;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.hero__descriptors .dot {
  margin: 0 0.75em;
  color: var(--color-rule-light);
}

/* Ornamental rule with diamond centerpoint and flanking gradients */
.hero__rule {
  width: 120px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-rule) 30%, var(--color-rule) 70%, transparent);
  margin: 0 auto 2rem;
  position: relative;
}

.hero__rule::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--color-rule);
  transform: translate(-50%, -50%) rotate(45deg);
}

.hero__tagline {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.65;
  color: var(--color-text-soft);
  max-width: 480px;
  margin: 0 auto;
}

/* — Scroll Indicator — animated dot on a thin line */
.hero__scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 36px;
  background: var(--color-rule-faint);
  z-index: 1;
}

.hero__scroll-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-rule);
  animation: scroll-dot 2.4s ease-in-out infinite;
}


/* ============================================================
   ABOUT
   ============================================================ */

/* Subtle radial glow behind about content */
.section--about::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 253, 248, 0.45) 0%, transparent 55%);
  pointer-events: none;
}

.about__content {
  max-width: var(--content-narrow);
  width: 100%;
  position: relative;
  z-index: 1;
  padding-block: 2rem;
}

/* Heading with flanking ornamental rules — mirrors directions heading */
.about__heading {
  display: flex;
  align-items: center;
  gap: 1.5em;
  margin-bottom: clamp(1.5rem, 3.5vh, 2.5rem);
}

.about__heading span {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-text);
  white-space: nowrap;
}

.about__heading::before,
.about__heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to var(--dir, right), var(--color-rule-light), transparent);
}

.about__heading::after {
  --dir: left;
}

/* Illuminated drop cap */
.about__dropcap {
  float: left;
  font-family: var(--font-display);
  font-size: 3.8em;
  font-weight: 600;
  line-height: 0.78;
  margin-right: 0.08em;
  margin-top: 0.05em;
  color: var(--color-accent-dark);
  opacity: 0.85;
}

.about__lede {
  color: var(--color-text-body);
  margin-bottom: 1.25em;
}

/* Ornamental rule with diamond — same motif as hero */
.about__rule {
  width: 80px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-rule) 25%, var(--color-rule) 75%, transparent);
  margin: 0 auto 1.5em;
  position: relative;
}

.about__rule::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  background: var(--color-rule);
  transform: translate(-50%, -50%) rotate(45deg);
}

.about__content p {
  margin-bottom: 1.25em;
  color: var(--color-text-body);
}

.about__content p:last-of-type {
  margin-bottom: 0;
}

/* Closing line — distinct, mic-drop register */
.about__closing {
  font-size: var(--size-small);
  color: var(--color-text-soft);
  margin-top: 0.5em;
  letter-spacing: 0.01em;
}

/* Constellation knowledge graph */
.about__constellation {
  display: block;
  width: 100%;
  height: 260px;
  margin: 0.5rem auto 0;
  opacity: 0.8;
}

/* Ornamental mark centered below prose */
.about__mark {
  display: block;
  text-align: center;
  margin-top: 2.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--color-rule);
  user-select: none;
}


/* ============================================================
   DIRECTIONS — Three-Column Broadside Layout
   ============================================================ */
.section--directions {
  padding-top: clamp(2.5rem, 5vh, 4rem);
  padding-bottom: clamp(1.5rem, 3vh, 2.5rem);
}

.directions__content {
  max-width: var(--content-wide);
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Heading with flanking ornamental rules */
.directions__heading {
  display: flex;
  align-items: center;
  gap: 1.5em;
  margin-bottom: clamp(1.5rem, 3.5vh, 2.5rem);
}

.directions__heading span {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-text);
  white-space: nowrap;
}

.directions__heading::before {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-rule));
}

.directions__heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--color-rule));
}

/* Two-by-two grid */
.directions__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.direction {
  padding: 0 clamp(1.25rem, 2.5vw, 2rem);
  border-left: 1px solid var(--color-rule-faint);
}

.direction.visible {
  transition: opacity 0.8s ease, transform 0.8s ease, background-color 0.3s ease;
}

.direction:hover {
  background-color: rgba(232, 220, 198, 0.4);
}

.direction:nth-child(odd) {
  padding-left: 0;
  border-left: none;
}

.direction:nth-child(even) {
  padding-right: 0;
}

.direction:nth-child(n+3) {
  border-top: 1px solid var(--color-rule-faint);
  padding-top: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(0.5rem, 1.5vw, 1rem);
}

/* Roman numeral anchors */
.direction__numeral {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2.5vw, 2.4rem);
  font-weight: 300;
  color: var(--color-text-muted);
  line-height: 1;
  display: block;
  margin-bottom: 0.65rem;
}

.direction__title {
  font-family: var(--font-display);
  font-size: var(--size-h3);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.direction__descriptor {
  font-family: var(--font-display);
  font-size: var(--size-small);
  font-style: italic;
  font-weight: 300;
  color: var(--color-text-soft);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

.direction__body {
  font-size: var(--size-small);
  line-height: 1.65;
  color: var(--color-text-muted);
}

.direction__body a {
  color: var(--color-accent-dark);
  text-decoration: none;
  border-bottom: 1px solid var(--color-rule-light);
  transition: border-color 0.2s ease;
}

.direction__body a:hover {
  border-color: var(--color-accent);
}

.direction__outcomes {
  margin-top: 0.6rem;
  padding: 0;
  list-style: none;
}

.direction__outcomes li {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 1.1vw, 0.72rem);
  line-height: 1.55;
  color: var(--color-text-muted);
  padding-left: 1.1em;
  text-indent: -1.1em;
}

.direction__outcomes a {
  color: var(--color-accent-dark);
  text-decoration: none;
  border-bottom: 1px solid var(--color-rule-light);
  transition: border-color 0.2s ease;
}

.direction__outcomes a:hover {
  border-color: var(--color-accent);
}

.direction__outcomes li::before {
  content: '\2192\00a0';
  color: var(--color-accent);
}



/* ============================================================
   FOOTER — Monospace digital counterpoint
   ============================================================ */
.footer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  padding-top: 1rem;
  margin-top: auto;
}

.footer .dot {
  margin: 0 0.6em;
  color: var(--color-rule-light);
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Fade-in on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered card entrance */
.directions__grid .direction.fade-in:nth-child(1) { transition-delay: 0s; }
.directions__grid .direction.fade-in:nth-child(2) { transition-delay: 0.15s; }
.directions__grid .direction.fade-in:nth-child(3) { transition-delay: 0.3s; }
.directions__grid .direction.fade-in:nth-child(4) { transition-delay: 0.45s; }

/* Pulsing holographic glow */
@keyframes title-glow {
  0%, 100% {
    text-shadow: 0 0 25px rgba(180,149,69,0.10);
    filter: brightness(1);
  }
  35% {
    text-shadow:
      0 0 30px rgba(180,149,69,0.18),
      0 0 60px rgba(180,149,69,0.06);
    filter: brightness(1.02);
  }
  46% {
    text-shadow:
      0 0 20px rgba(140,100,220,0.18),
      0 0 40px rgba(80,180,255,0.12),
      0 0 60px rgba(180,149,69,0.08);
    filter: brightness(1.08);
  }
  50% {
    text-shadow:
      0 0 18px rgba(80,220,180,0.20),
      0 0 35px rgba(200,80,255,0.14),
      0 0 55px rgba(80,180,255,0.10),
      0 0 70px rgba(255,120,200,0.06);
    filter: brightness(1.12);
  }
  54% {
    text-shadow:
      0 0 20px rgba(255,140,180,0.16),
      0 0 40px rgba(120,80,220,0.12),
      0 0 60px rgba(180,149,69,0.08);
    filter: brightness(1.08);
  }
  65% {
    text-shadow:
      0 0 30px rgba(180,149,69,0.18),
      0 0 60px rgba(180,149,69,0.06);
    filter: brightness(1.02);
  }
}

/* Scroll dot drift */
@keyframes scroll-dot {
  0%   { top: 0;    opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { top: 32px; opacity: 0; }
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .hero__scroll-dot {
    animation: none;
  }
  .hero__title {
    animation: none;
  }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet & below: single column */
@media (max-width: 900px) {
  :root {
    --frame: 12px;
    --inner-inset: 8px;
  }

  .section {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  /* Accordion for direction cards */
  .directions__grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .direction {
    padding: clamp(0.75rem, 2vh, 1.25rem) 0;
    border-left: none;
    border-top: none;
    margin-top: 0;
    border-bottom: 1px solid var(--color-rule-faint);
    cursor: pointer;
    transition: none;
  }

  .direction:hover {
    background-color: transparent;
  }

  .direction:first-child {
    padding-top: 0;
  }

  .direction:last-child {
    padding-bottom: 0;
    border-bottom: none;
  }

  .direction__numeral {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
  }

  .direction__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .direction__title::after {
    content: '+';
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-left: 1rem;
    transition: transform 0.3s ease;
  }

  .direction.expanded .direction__title::after {
    content: '\2212';
  }

  .direction__descriptor,
  .direction__body,
  .direction__outcomes {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
    margin-bottom: 0;
  }

  .direction.expanded .direction__descriptor {
    max-height: 5rem;
    opacity: 1;
    margin-bottom: 0.65rem;
  }

  .direction.expanded .direction__body {
    max-height: 20rem;
    opacity: 1;
    margin-top: 0;
  }

  .direction.expanded .direction__outcomes {
    max-height: 10rem;
    opacity: 1;
  }

  /* Reset stagger delays on mobile */
  .directions__grid .direction.fade-in:nth-child(2),
  .directions__grid .direction.fade-in:nth-child(3),
  .directions__grid .direction.fade-in:nth-child(4) {
    transition-delay: 0s;
  }

  .page {
    border-width: 2px;
    scroll-snap-type: y proximity;
  }

  /* Simplify frame on tablet/mobile */
  .frame-corner,
  .frame-diamond {
    display: none;
  }
}

/* Small screens */
@media (max-width: 600px) {
  :root {
    --frame: 8px;
    --inner-inset: 5px;
  }

  .page {
    border-width: 1px;
  }

  .section--hero {
    justify-content: start;
    padding-top: clamp(2rem, 8vh, 5rem);
  }

  .hero__title {
    letter-spacing: 0.15em;
    margin-bottom: 0.6rem;
  }

  .hero__cloud {
    width: 75vw;
    height: 75vw;
    margin-bottom: 0.5rem;
  }

  .hero__descriptors {
    font-size: clamp(0.6rem, 2.8vw, 0.75rem);
    margin-bottom: 0.75rem;
  }

  .hero__descriptors .dot {
    margin: 0 0.4em;
  }

  .hero__rule {
    margin-bottom: 0.75rem;
  }

  .hero__tagline {
    font-size: clamp(0.95rem, 4vw, 1.15rem);
    max-width: 88vw;
    padding: 0 0.5rem;
    line-height: 1.55;
  }

  /* Tighten about section to fit mobile viewport */
  .about__heading {
    margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
  }

  .about__dropcap {
    font-size: 2.8em;
    margin-right: 0.06em;
  }

  .about__lede {
    margin-bottom: 0.75em;
  }

  .about__content p {
    margin-bottom: 0.75em;
    font-size: 0.88rem;
    line-height: 1.55;
  }

  .about__rule {
    margin: 0.5em auto 0.75em;
  }

  .about__closing {
    font-size: 0.78rem;
  }

  .about__mark {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
  }

  .about__constellation {
    height: 140px;
  }
}
