/* Lantern & Leaf: the app's own lamplit palette (ui/theme/Theme.kt), Literata for reading and Figtree for the rest. */
:root {
  color-scheme: dark;
  --bg: #09130e;
  --surface: #112119;
  --surface-high: #1a3025;
  --ink: #eef2de;
  --ink-dim: #8fa88f;
  --lantern: #ffc46b;
  --lantern-deep: #e8a84b;
  --leaf: #7fd08a;
  --line: rgba(238, 242, 222, 0.1);
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--lantern); text-underline-offset: 3px; }
a:hover { color: #ffd892; }
:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface-high); padding: 8px 14px; border-radius: 10px; }

/* ---------- header ---------- */
.top {
  position: absolute; inset: 0 0 auto 0; z-index: 5;
  padding: 18px 0;
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { white-space: nowrap; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font: 600 19px/1 var(--serif); }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 0 24px rgba(255, 196, 107, 0.25); }
.brand:hover { color: var(--ink); }
.top nav { display: flex; gap: clamp(14px, 3vw, 28px); font-size: 15px; }
.top nav a { color: var(--ink-dim); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: min(100svh, 920px);
  display: flex; align-items: center;
  padding: 120px 0 80px;
  background:
    radial-gradient(60% 55% at 72% 46%, rgba(255, 196, 107, 0.2), transparent 70%),
    radial-gradient(40% 40% at 10% 100%, rgba(127, 208, 138, 0.1), transparent 70%),
    var(--bg);
  overflow: hidden;
}
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 40px; }
.eyebrow { color: var(--leaf); font-size: 15px; letter-spacing: 0.04em; margin: 0 0 18px; }
.hero h1 {
  font: 600 clamp(48px, 8.4vw, 104px)/0.98 var(--serif);
  letter-spacing: -0.02em;
  margin: 0;
  text-shadow: 0 0 60px rgba(255, 196, 107, 0.25);
}
.hero h1 .amp { color: var(--lantern); font-style: italic; font-weight: 400; }
.tagline { font: italic 400 clamp(20px, 2.6vw, 28px)/1.35 var(--serif); color: var(--leaf); margin: 22px 0 0; }
.lede { max-width: 34em; color: var(--ink-dim); font-size: 18px; margin: 18px 0 0; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 34px; }
.button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 26px; border-radius: 999px;
  background: var(--lantern); color: var(--bg);
  font: 600 16px/1 var(--sans); text-decoration: none;
  box-shadow: 0 10px 40px rgba(255, 196, 107, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.button:hover { color: var(--bg); transform: translateY(-2px); box-shadow: 0 14px 48px rgba(255, 196, 107, 0.42); }
.button svg { width: 18px; height: 18px; }
.cta small { color: var(--ink-dim); font-size: 14px; }

.hero-art { position: relative; justify-self: center; width: min(100%, 420px); }
.hero-art::before {
  content: ""; position: absolute; left: 50%; bottom: 6%; width: 70%; aspect-ratio: 1; translate: -50% 0;
  background: radial-gradient(circle, rgba(255, 196, 107, 0.55), rgba(255, 196, 107, 0) 65%);
  filter: blur(10px);
  animation: flicker 5s ease-in-out infinite;
}
.hero-art img { position: relative; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.5)); }
@keyframes flicker {
  0%, 100% { opacity: 0.9; scale: 1; }
  30% { opacity: 1; scale: 1.04; }
  55% { opacity: 0.8; scale: 0.98; }
  75% { opacity: 0.95; scale: 1.02; }
}

/* ---------- sections ---------- */
section { position: relative; }
.band { padding: clamp(72px, 10vw, 128px) 0; }
.band + .band { padding-top: 0; }
.kicker { color: var(--leaf); font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 12px; }
h2 { font: 600 clamp(32px, 4.6vw, 52px)/1.08 var(--serif); letter-spacing: -0.015em; margin: 0; }
.intro { max-width: 40em; color: var(--ink-dim); font-size: 18px; margin: 18px 0 0; }

/* Glow-along: a lamplit page where the light follows the narrator */
.glow {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(32px, 6vw, 72px); align-items: center;
}
.page {
  position: relative;
  padding: clamp(26px, 4vw, 44px);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #0d1a13, #070f0b);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.page-head { display: flex; justify-content: space-between; color: var(--ink-dim); font-size: 13px; margin-bottom: 18px; }
.page p {
  margin: 0;
  font: 400 clamp(17px, 1.9vw, 21px)/1.75 var(--serif);
  color: rgba(238, 242, 222, 0.38);
  transition: color 0.4s ease;
}
.page .s { transition: color 0.5s ease, text-shadow 0.5s ease, background-color 0.5s ease; border-radius: 6px; padding: 1px 0; }
.page .s.lit { color: var(--ink); background-color: rgba(255, 196, 107, 0.09); box-shadow: 0 0 0 4px rgba(255, 196, 107, 0.09); }
.page .w.now { color: #fff3d6; text-shadow: 0 0 18px rgba(255, 196, 107, 0.85); }
.page .halo {
  position: absolute; width: 340px; height: 340px; left: 0; top: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 196, 107, 0.16), transparent 62%);
  translate: -50% -50%;
  transition: transform 0.9s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.player {
  display: flex; align-items: center; gap: 14px;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--ink-dim); font-size: 13px;
}
.player .play {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--lantern); color: var(--bg); display: grid; place-items: center;
}
.player .play svg { width: 16px; height: 16px; }
.bar { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-high); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--leaf), var(--lantern)); transition: width 0.4s linear; }
.page .source { margin-top: 12px; font-size: 12px; color: var(--ink-dim); opacity: 0.7; }

.points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.points li { display: flex; gap: 12px; color: var(--ink-dim); }
.points li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 10px; border-radius: 50%; background: var(--lantern); box-shadow: 0 0 12px var(--lantern); }
.points b { color: var(--ink); font-weight: 600; }

/* feature cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.card {
  position: relative;
  padding: 28px 26px 30px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), rgba(17, 33, 25, 0.55));
  border: 1px solid var(--line);
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.card:hover { border-color: rgba(255, 196, 107, 0.35); transform: translateY(-3px); }
.card .icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 18px;
  background: rgba(255, 196, 107, 0.1); color: var(--lantern);
}
.card .icon.leaf { background: rgba(127, 208, 138, 0.1); color: var(--leaf); }
.card .icon svg { width: 24px; height: 24px; }
.card h3 { font: 600 22px/1.25 var(--serif); margin: 0 0 8px; }
.card p { margin: 0; color: var(--ink-dim); font-size: 16px; }

/* Ember */
.ember {
  display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(28px, 6vw, 80px); align-items: center;
  padding: clamp(28px, 5vw, 56px);
  border-radius: calc(var(--radius) + 8px);
  background:
    radial-gradient(70% 90% at 20% 80%, rgba(255, 196, 107, 0.18), transparent 70%),
    var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ember img { width: min(100%, 360px); justify-self: center; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.45)); }
.ember p { color: var(--ink-dim); font-size: 18px; margin: 18px 0 0; }

/* everywhere you are */
.places { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.place { padding: 30px 28px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(17, 33, 25, 0.4); }
.place .icon { color: var(--lantern); margin-bottom: 16px; }
.place .icon svg { width: 34px; height: 34px; }
.place h3 { font: 600 22px/1.25 var(--serif); margin: 0 0 8px; }
.place p { margin: 0; color: var(--ink-dim); font-size: 16px; }

/* promise + closing */
.promise { text-align: center; }
.promise .peek { width: min(300px, 70%); margin: 0 auto -6px; position: relative; z-index: 1; }
.promise-box {
  padding: clamp(36px, 6vw, 64px) var(--gutter);
  border-radius: calc(var(--radius) + 8px);
  background: radial-gradient(80% 120% at 50% 0%, rgba(255, 196, 107, 0.16), transparent 70%), var(--surface);
  border: 1px solid rgba(255, 196, 107, 0.22);
}
.promise h2 { max-width: 16em; margin: 0 auto; }
.promise .intro { margin-left: auto; margin-right: auto; }
.promise .cta { justify-content: center; }
.trio { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 26px 0 0; padding: 0; list-style: none; }
.trio li { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: 15px; background: rgba(9, 19, 14, 0.5); }

/* Ember trotting along the foot of the page */
.trot { position: relative; height: 120px; overflow: hidden; margin-top: 40px; }
.trot::after { content: ""; position: absolute; left: 0; right: 0; bottom: 18px; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); }
.trot .fox {
  position: absolute; bottom: 7px; left: 0; /* the paws sit 12px up the frame, onto the line at 18px */
  /* 3D Ember's walk, rendered by LanternLeaf/tools/ember3d/site_walk.py: 24 frames in a 0.8 s loop */
  width: 174px; height: 100px;
  background: url("img/ember_walk.webp") 0 0 / 2400% 100% no-repeat;
  /* glow.js sets the crossing time from the screen width so she moves at her paws' own 44.7 px/s */
  animation: trot-legs 0.8s steps(24) infinite, trot-across 36s linear infinite;
}
@keyframes trot-legs { to { background-position: 104.3478% 0; } }
@keyframes trot-across { from { transform: translateX(-180px); } to { transform: translateX(calc(100vw + 40px)); } }

/* footer */
footer { border-top: 1px solid var(--line); padding: 30px 0 40px; color: var(--ink-dim); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; }
footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
footer a { color: var(--ink-dim); text-decoration: none; }
footer a:hover { color: var(--ink); }

/* reveal on scroll (only when JS has marked the page) */
.js .reveal { opacity: 0; translate: 0 24px; transition: opacity 0.8s ease, translate 0.8s ease; }
.js .reveal.in { opacity: 1; translate: 0 0; }

/* ---------- document pages (privacy, support) ---------- */
.doc-head {
  padding: 130px 0 40px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 196, 107, 0.14), transparent 70%);
}
.doc-head h1 { font: 600 clamp(38px, 6vw, 60px)/1.05 var(--serif); margin: 0; }
.doc-head p { color: var(--ink-dim); margin: 14px 0 0; }
.doc { max-width: 760px; padding-bottom: 80px; }
.doc h2 { font-size: clamp(24px, 3vw, 30px); margin: 44px 0 10px; }
.doc h3 { font: 600 20px/1.3 var(--serif); margin: 28px 0 6px; }
.doc p, .doc li { color: rgba(238, 242, 222, 0.82); }
.doc ul { padding-left: 1.2em; }
.doc li { margin: 6px 0; }
.doc strong { color: var(--ink); }
.contact {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 28px; padding: 24px 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid rgba(255, 196, 107, 0.25);
}
.contact p { margin: 0; }
details { border-bottom: 1px solid var(--line); padding: 4px 0; }
details summary { cursor: pointer; padding: 14px 0; font: 600 19px/1.35 var(--serif); color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--lantern); font: 400 24px/1 var(--sans); }
details[open] summary::after { content: "\2212"; }
details p { margin: 0 0 16px; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .hero .wrap, .glow, .ember { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 110px; }
  .hero-art { width: min(70%, 320px); order: -1; }
  .cards, .places { grid-template-columns: 1fr 1fr; }
  .ember img { width: min(70%, 280px); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .top nav { gap: 14px; font-size: 14px; }
  .top nav .wide { display: none; }
  .hero-art { width: min(58%, 230px); }
  .cards, .places { grid-template-columns: 1fr; }
  .lede, .intro { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art::before { animation: none; }
  .trot .fox { animation: none; left: 50%; translate: -50% 0; }
  .js .reveal { opacity: 1; translate: 0 0; transition: none; }
  .card, .button { transition: none; }
}
