/* ============================================================
   ENKIDU — warm clay, lapis night, gold accents
   ============================================================ */

:root {
  --parchment: #f3ead9;
  --parchment-2: #ecdfc8;
  --clay-line: #d9c4a4;
  --terra: #b6552f;
  --terra-deep: #8f3f20;
  --ink: #3b2f26;
  --ink-soft: #6b5847;
  --lapis: #2f4d8f;
  --night: #131c33;
  --night-deep: #0c1226;
  --gold: #d9a441;
  --cream: #f0e6d2;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Newsreader", Georgia, serif;
  --cune: "Noto Sans Cuneiform", "Segoe UI Historic", serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (color: oklch(50% 0.1 50)) {
  :root {
    --parchment: oklch(94.5% 0.024 82);
    --parchment-2: oklch(91% 0.033 80);
    --clay-line: oklch(83% 0.05 78);
    --terra: oklch(56% 0.135 42);
    --terra-deep: oklch(46% 0.125 38);
    --ink: oklch(28% 0.025 60);
    --ink-soft: oklch(45% 0.035 62);
    --lapis: oklch(43% 0.11 262);
    --night: oklch(22% 0.055 268);
    --night-deep: oklch(17% 0.05 268);
    --gold: oklch(75% 0.115 82);
    --cream: oklch(92.5% 0.028 84);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--parchment);
  overflow-x: hidden;
}

/* fine clay grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--terra); color: var(--parchment); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 48px);
}

h1, h2, h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 100;
  line-height: 1.04;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2.1rem, 1.4rem + 3.4vw, 3.6rem);
  font-weight: 640;
  margin-bottom: clamp(18px, 3vw, 30px);
}

em { font-style: italic; }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 1000;
  background: transparent;
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--terra), var(--gold));
  transform-origin: left;
  transform: scaleX(0);
}

/* ---------- kicker labels ---------- */
.kicker {
  font-family: var(--body);
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 14px;
  font-weight: 600;
}
.kicker__wedge {
  font-family: var(--cune);
  font-size: 1rem;
  margin-right: 8px;
  letter-spacing: 0;
}
.kicker--night { color: var(--gold); }

/* ---------- glossary tooltips ---------- */
.gloss {
  position: relative;
  cursor: help;
  border-bottom: 2px dotted var(--terra);
  transition: background-color 0.25s var(--ease-out);
}
.gloss:hover { background: color-mix(in srgb, var(--gold) 24%, transparent); }
.gloss .tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 6px);
  width: max-content;
  max-width: min(270px, 70vw);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--body);
  font-size: 0.88rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(30, 20, 10, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  z-index: 60;
}
.gloss .tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--ink);
}
.gloss .tip--up {
  bottom: auto;
  top: calc(100% + 12px);
  transform: translate(-50%, -6px);
}
.gloss .tip--up::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}
.gloss:hover .tip,
.gloss:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
.gloss .tip strong { color: var(--gold); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(600px 400px at var(--mx, 70%) var(--my, 30%),
      color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%),
    linear-gradient(175deg, var(--parchment) 55%, var(--parchment-2));
}
#dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(70px, 10vh, 120px) clamp(90px, 12vh, 140px);
  width: 100%;
}

.hero__glyphs {
  font-family: var(--cune);
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  color: var(--terra);
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.glyph {
  border-bottom: none;
  cursor: help;
  transition: transform 0.3s var(--ease-out), color 0.3s;
  display: inline-block;
}
.glyph:hover { transform: translateY(-5px) rotate(-4deg); color: var(--terra-deep); }
.hero__glyphs-hint {
  font-family: var(--body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  align-self: center;
  margin-left: 6px;
}

.hero__title {
  font-size: clamp(3.4rem, 1.4rem + 9.5vw, 10.5rem);
  white-space: nowrap;
  font-weight: 560;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-left: -0.04em;
  user-select: none;
  cursor: default;
}
.hero__title .lt {
  display: inline-block;
  transition: font-weight 0.25s ease-out, transform 0.25s ease-out, color 0.25s;
}

.hero__tag {
  font-family: var(--display);
  font-style: italic;
  font-weight: 460;
  font-size: clamp(1.25rem, 1rem + 1.3vw, 1.9rem);
  color: var(--terra-deep);
  margin-top: clamp(10px, 2vh, 20px);
  text-wrap: balance;
}
.hero__sub {
  max-width: 56ch;
  margin-top: clamp(14px, 2.5vh, 24px);
  color: var(--ink-soft);
}

/* medallion */
.medallion {
  justify-self: center;
  perspective: 900px;
  text-align: center;
}
.medallion__tilt {
  position: relative;
  width: clamp(220px, 26vw, 340px);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transition: transform 0.35s var(--ease-out);
  will-change: transform;
  border-radius: 50%;
  filter: drop-shadow(0 22px 34px rgba(90, 50, 25, 0.32));
}
.medallion__tilt svg { width: 100%; height: 100%; display: block; }
.medallion__shine {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(140px 140px at var(--sx, 30%) var(--sy, 25%),
    rgba(255, 245, 225, 0.45), transparent 60%);
  pointer-events: none;
  mix-blend-mode: soft-light;
}
.medallion__caption {
  margin-top: 16px;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* scroll cue */
.scrollcue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.3s;
}
.scrollcue:hover { color: var(--terra); }
.scrollcue__wedge {
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 11px solid var(--terra);
  animation: bob 2s var(--ease-out) infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(7px); }
}

/* ============================================================
   SECTIONS shared
   ============================================================ */
.section { padding-block: clamp(70px, 11vw, 140px); }

.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.14s);
}
.reveal.in-view { opacity: 1; transform: none; }

.wedge-divider {
  height: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='26' viewBox='0 0 46 26'%3E%3Cpath d='M23 3 L31 15 L15 15 Z M21.5 14 h3 v9 h-3 Z' fill='%23c9a06b'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  opacity: 0.55;
  margin-inline: clamp(20px, 12vw, 160px);
}

/* ============================================================
   ORIGIN + clay slab
   ============================================================ */
.origin__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(30px, 6vw, 80px);
  align-items: center;
}
.origin__text p + p { margin-top: 1em; }

.slab-wrap { justify-self: center; width: min(100%, 460px); }
.slab {
  position: relative;
  aspect-ratio: 5 / 4;
  border-radius: 18px 22px 16px 24px;
  background:
    radial-gradient(120% 100% at 30% 20%, #cf8a5c, transparent 60%),
    linear-gradient(150deg, #c07a4e, #a05a34 70%, #8f4c29);
  box-shadow:
    inset 0 3px 10px rgba(255, 235, 210, 0.35),
    inset 0 -10px 22px rgba(70, 35, 15, 0.4),
    0 18px 34px rgba(90, 50, 25, 0.28);
  transform: rotate(-2deg);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 2 L19 13 L5 13 Z' fill='%233b2f26'/%3E%3Crect x='10.5' y='12' width='3' height='10' fill='%233b2f26'/%3E%3C/svg%3E") 12 4, pointer;
  overflow: hidden;
  touch-action: none;
  transition: transform 0.4s var(--ease-out);
}
.slab:hover { transform: rotate(-1deg) scale(1.015); }
.slab__hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font-style: italic;
  color: rgba(58, 30, 14, 0.75);
  padding: 20px;
  transition: opacity 0.6s;
  pointer-events: none;
}
.slab__hint small { font-size: 0.8em; opacity: 0.75; }
.slab__hint.hide { opacity: 0; }

.stampmark {
  position: absolute;
  font-family: var(--cune);
  color: rgba(52, 26, 11, 0.85);
  text-shadow:
    0 1.5px 1px rgba(255, 226, 190, 0.5),
    0 -1px 2px rgba(40, 18, 6, 0.55);
  pointer-events: none;
  animation: press 0.35s var(--ease-out) both, stampfade 6s linear forwards;
  will-change: transform, opacity;
}
@keyframes press {
  0% { scale: 1.7; opacity: 0; }
  60% { scale: 0.94; opacity: 1; }
  100% { scale: 1; }
}
@keyframes stampfade {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}
.slab__caption {
  margin-top: 16px;
  text-align: center;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ============================================================
   WILD YEARS + scene
   ============================================================ */
.wild { padding-bottom: 0; }
.wild__head { max-width: 700px; }
.wild__text {
  max-width: 58ch;
  margin-top: 8px;
  margin-left: clamp(0px, 8vw, 120px); /* asymmetric nudge */
  color: var(--ink-soft);
}
.wild__text strong { color: var(--terra-deep); }

.scene {
  position: relative;
  margin-top: clamp(36px, 6vw, 70px);
  height: clamp(220px, 32vw, 320px);
  overflow: hidden;
  cursor: pointer;
  background: var(--parchment-2);
}
.scene__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scene__hint {
  position: absolute;
  left: clamp(14px, 3vw, 32px);
  top: 14px;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--terra-deep);
  opacity: 0.85;
  background: color-mix(in srgb, var(--parchment) 72%, transparent);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
}

.runner {
  position: absolute;
  bottom: 12%;
  left: 0;
  width: clamp(90px, 13vw, 150px);
  transform: translateX(-30vw);
  pointer-events: none;
}
.scene.running .runner--main {
  animation: lope 9s linear infinite;
}
.runner--clone { animation: lope var(--dur, 6.5s) linear 1 both; }
.runner__bob { animation: gallop 0.55s ease-in-out infinite; }
.gazelle-svg { width: 100%; display: block; }

@keyframes lope {
  0% { transform: translateX(-30vw); }
  78% { transform: translateX(104vw); }
  100% { transform: translateX(104vw); }
}
@keyframes gallop {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-13px) rotate(-3deg); }
}

/* grass sway (blades injected by JS) */
.tuft {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: sway 3.4s ease-in-out infinite;
}
.scene:hover .tuft { animation-duration: 1.5s; }
@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(5deg); }
}

/* ============================================================
   TABLETS (tabs)
   ============================================================ */
.tablets__intro { max-width: 52ch; color: var(--ink-soft); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-block: clamp(26px, 4vw, 44px) clamp(22px, 3vw, 36px);
}
.chip {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--terra-deep);
  background: linear-gradient(160deg, #ddc8a6, #d0b68d);
  border: 1.5px solid var(--clay-line);
  border-radius: 10px 14px 10px 14px;
  padding: 10px 18px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 #b99a68, 0 6px 14px rgba(90, 50, 25, 0.14);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
              background 0.3s, color 0.3s;
}
.chip:hover { transform: translateY(-3px); box-shadow: 0 6px 0 #b99a68, 0 12px 20px rgba(90, 50, 25, 0.18); }
.chip:active { transform: translateY(1px); box-shadow: 0 1px 0 #b99a68; }
.chip[aria-selected="true"] {
  background: linear-gradient(160deg, var(--terra), var(--terra-deep));
  color: var(--cream);
  border-color: var(--terra-deep);
  box-shadow: 0 3px 0 #6e2f16, 0 8px 18px rgba(120, 55, 25, 0.3);
}

.panels { position: relative; min-height: 380px; }
.panel {
  max-width: 760px;
  animation: panelIn 0.55s var(--ease-out) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}
.panel__icon {
  width: 54px;
  height: 54px;
  color: var(--terra);
  margin-bottom: 14px;
  transition: transform 0.4s var(--ease-out);
}
.panel__icon:hover { transform: rotate(-8deg) scale(1.12); }
.panel__icon svg { width: 100%; height: 100%; }
.panel__ref {
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.panel h3 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  font-weight: 600;
  margin-bottom: 14px;
}
.panel blockquote {
  margin-top: 22px;
  padding-left: 22px;
  border-left: 4px solid var(--gold);
  font-family: var(--display);
  font-style: italic;
  font-weight: 480;
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.5rem);
  color: var(--terra-deep);
  text-wrap: balance;
  transition: border-color 0.3s, padding-left 0.3s var(--ease-out);
}
.panel blockquote:hover { border-color: var(--terra); padding-left: 30px; }

/* ============================================================
   NIGHT / LEGACY
   ============================================================ */
.night {
  position: relative;
  background: linear-gradient(180deg, var(--night) 0%, var(--night-deep) 100%);
  color: var(--cream);
  overflow: hidden;
}
#skyCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.night__grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(36px, 6vw, 90px);
  align-items: center;
}
.night h2 { color: var(--cream); }
.night__text p + p { margin-top: 1em; }
.night__text p { color: color-mix(in srgb, var(--cream) 82%, var(--night)); }
.night__text strong { color: var(--gold); }
.night__skynote { font-style: italic; }
.night__trace { color: var(--gold); }

.epithets { text-align: left; }
.epithets__lead {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--cream) 60%, var(--night));
  margin-bottom: 12px;
}
.epithet {
  font-family: var(--display);
  font-style: italic;
  font-weight: 520;
  font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.7rem);
  line-height: 1.15;
  color: var(--gold);
  min-height: 2.4em;
  text-wrap: balance;
}
.epithet.stamping { animation: stampIn 0.5s var(--ease-out) both; }
@keyframes stampIn {
  0% { opacity: 0; transform: scale(1.18); filter: blur(5px); }
  70% { opacity: 1; transform: scale(0.985); filter: blur(0); }
  100% { transform: scale(1); }
}

.seal-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--cream);
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent);
  border-radius: 999px;
  padding: 11px 22px 11px 14px;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s, transform 0.2s var(--ease-out);
}
.seal-btn:hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  transform: translateY(-2px);
}
.seal-btn:active { transform: translateY(1px); }
.seal-btn__cyl {
  width: 34px;
  height: 22px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg,
      var(--gold) 0 3px, transparent 3px 7px,
      var(--gold) 7px 9px, transparent 9px 14px),
    linear-gradient(180deg, #caa04f, #9a743a);
  box-shadow: inset 0 2px 3px rgba(255, 240, 210, 0.5), inset 0 -3px 4px rgba(40, 25, 5, 0.5);
  transition: transform 0.5s var(--ease-out);
}
.seal-btn:hover .seal-btn__cyl { transform: rotate(12deg); }
.seal-btn.rolling .seal-btn__cyl { animation: roll 0.6s var(--ease-out); }
@keyframes roll {
  from { transform: rotate(0) translateX(0); }
  50% { transform: rotate(200deg) translateX(4px); }
  to { transform: rotate(360deg) translateX(0); }
}
.epithets__src {
  margin-top: 18px;
  font-size: 0.83rem;
  font-style: italic;
  color: color-mix(in srgb, var(--cream) 55%, var(--night));
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--ink);
  color: var(--cream);
  padding-block: clamp(56px, 8vw, 90px);
}
.footer__inner { text-align: center; }
.footer__glyphs {
  font-family: var(--cune);
  font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem);
  color: var(--gold);
  display: flex;
  justify-content: center;
  gap: 0.3em;
  margin-bottom: 22px;
}
.footer__glyphs .glyph:hover { transform: translateY(-6px) rotate(4deg); color: var(--cream); }
.footer__line {
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--cream) 62%, var(--ink));
}
.footer__tease {
  margin-top: 14px;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem);
  color: var(--cream);
  text-wrap: balance;
}
.totop {
  margin-top: 34px;
  font-family: var(--body);
  font-size: 0.92rem;
  color: var(--gold);
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.25s var(--ease-out);
}
.totop:hover {
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border-color: var(--gold);
  transform: translateY(-3px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .hero__inner { grid-template-columns: 1fr; text-align: left; }
  .medallion { justify-self: start; margin-top: 8px; }
  .origin__grid, .night__grid { grid-template-columns: 1fr; }
  .wild__text { margin-left: 0; }
  .panels { min-height: 460px; }
  .epithets { padding-bottom: 20px; }
}

@media (max-width: 480px) {
  .hero__glyphs-hint { display: block; width: 100%; margin-left: 0; }
  .chips { gap: 9px; }
  .chip { font-size: 0.86rem; padding: 8px 13px 10px; }
  .panels { min-height: 540px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
  .runner--main { transform: translateX(44vw); } /* gazelle grazes in place */
  .runner--clone { display: none; }
  .medallion__tilt { transform: none !important; }
}
