:root {
  --paper: #f3ead9;
  --paper-2: #e9dcc3;
  --ink: #2a211b;
  --ink-soft: #6e5f52;
  --line: rgba(42, 33, 27, 0.13);
  --card: #faf4e8;
  --accent: #b14f2a;
  --accent-ink: #fff8ef;
  --gold: #d9a441;
  --night: #140f0b;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 24px rgba(60, 40, 20, 0.08);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, 0.08), 0 18px 40px rgba(60, 40, 20, 0.18);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17120e;
    --paper-2: #211a14;
    --ink: #f0e6d4;
    --ink-soft: #b4a590;
    --line: rgba(240, 230, 212, 0.12);
    --card: #211a15;
    --accent: #d0693e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17120e;
  --paper-2: #211a14;
  --ink: #f0e6d4;
  --ink-soft: #b4a590;
  --line: rgba(240, 230, 212, 0.12);
  --card: #211a15;
  --accent: #d0693e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.in-player { overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: -0.005em; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.i { flex: none; display: block; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px; font-weight: 600; margin: 0 0 10px; opacity: 0.85; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11.5px; font-weight: 600; color: var(--accent); margin: 0 0 6px; }

/* ---- header and footer ----------------------------------------------------- */

.brand { font-family: var(--serif); font-weight: 600; font-size: 28px; letter-spacing: 0.02em; text-decoration: none; line-height: 1; }
.site-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10; color: #fff8ef;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(rgba(12, 9, 6, 0.55), transparent);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.site-head nav { display: flex; gap: 4px; }
.site-head nav a {
  text-decoration: none; font-size: 14px; font-weight: 500; padding: 7px 14px; border-radius: 999px;
  color: rgba(255, 248, 239, 0.85); transition: background 0.2s, color 0.2s;
}
.site-head nav a:hover { background: rgba(255, 248, 239, 0.14); color: #fff8ef; }
.site-head nav a[aria-current="page"] { background: rgba(255, 248, 239, 0.92); color: #2a211b; }
@media (max-width: 640px) {
  .brand { font-size: 24px; }
  .site-head .wrap { height: 58px; }
  .site-head nav a { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 360px) { .site-head nav a { padding: 6px 7px; } }

.foot { margin-top: 88px; padding: 36px 0 calc(36px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.foot .brand { color: var(--ink); font-size: 24px; }
.foot p { margin: 0; }

/* ---- heroes ------------------------------------------------------------------ */

.hero {
  position: relative; overflow: hidden; color: #fff8ef; background: var(--night);
  min-height: min(68vh, 620px); display: flex; align-items: flex-end;
}
.hero-home { min-height: min(86vh, 760px); }
.hero-art { position: absolute; inset: 0; }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(14, 10, 7, 0.92), rgba(14, 10, 7, 0.45) 38%, transparent 65%),
    linear-gradient(to right, rgba(14, 10, 7, 0.55), transparent 60%);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; display: block; animation: pan 30s ease-in-out infinite alternate; }
.hero-text { position: relative; width: 100%; padding-top: 120px; padding-bottom: 56px; }
.hero-text h1 { font-size: clamp(44px, 7.5vw, 92px); max-width: 14ch; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35); }
.hero-text .lede { max-width: 560px; font-size: clamp(16px, 1.6vw, 19px); margin: 14px 0 0; color: rgba(255, 248, 239, 0.88); }
.hero-text .eyebrow { color: var(--gold); opacity: 1; }
.hero-text .mode-buttons { margin-top: 26px; }
.hero > .hero-text, .hero .hero-text { animation: fadeUp 0.9s ease both; }
@media (max-width: 640px) {
  .hero { min-height: 64vh; }
  .hero-home { min-height: 78vh; }
  .hero-text { padding-bottom: 36px; }
  .hero-art img { object-position: 60% 50%; }
}

/* ---- sections ------------------------------------------------------------------ */

.row { margin-top: 72px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.row-head h2 { font-size: clamp(30px, 3.6vw, 40px); }
.row-head p { margin: 0; color: var(--ink-soft); font-size: 14px; }
@media (max-width: 640px) { .row { margin-top: 52px; } .row-head { margin-bottom: 16px; } .row-head p { display: none; } }

.intro { text-align: center; margin-top: 64px; }
.tagline {
  font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.8vw, 32px); line-height: 1.3;
  max-width: 720px; margin: 0 auto; color: var(--ink-soft);
}
.tagline::before, .tagline::after { content: ""; display: block; width: 44px; height: 1px; background: var(--gold); margin: 0 auto 20px; opacity: 0.8; }
.tagline::after { margin: 20px auto 0; }

/* ---- cards ------------------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
@media (max-width: 640px) { .cards { gap: 16px; } }
.card {
  display: block; text-decoration: none; background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.35s ease;
}
a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.cover { aspect-ratio: 16 / 10; overflow: hidden; position: relative; display: block; background: #2a1d14; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.3, 1); }
a.card:hover .cover img, .story-row .cover:hover img { transform: scale(1.05); }
.card-body { padding: 16px 18px 20px; }
.card-body h3 { font-size: 27px; }
.card-body p:last-child { margin: 6px 0 0; color: var(--ink-soft); font-size: 14.5px; }

.badge {
  position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(14, 10, 7, 0.6); color: #fff8ef; backdrop-filter: blur(6px);
}
.play-hint {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 248, 239, 0.92); color: #2a211b;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); opacity: 0; transform: scale(0.85); transition: opacity 0.3s, transform 0.3s;
}
.play-hint .i { margin-left: 3px; }
a.card:hover .play-hint, .cover:hover .play-hint, .cover:focus-visible .play-hint { opacity: 1; transform: none; }
@media (hover: none) { .play-hint { opacity: 0.9; transform: scale(0.8); } }

/* mythology tiles: tall pictures with the name on top */
.myth-card { position: relative; color: #fff8ef; border: none; }
.myth-card .cover { aspect-ratio: 4 / 5; }
.myth-card .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(14, 10, 7, 0.9), rgba(14, 10, 7, 0.2) 50%, transparent 70%); }
.myth-card-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; }
.myth-card-text .eyebrow { color: var(--gold); margin-bottom: 6px; opacity: 1; }
.myth-card-text h3 { font-size: 42px; }
.myth-card-text p:last-child { margin: 4px 0 0; font-size: 14px; color: rgba(255, 248, 239, 0.8); }
@media (max-width: 640px) {
  .myth-cards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 72%; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 12px; scrollbar-width: none; }
  .myth-cards::-webkit-scrollbar { display: none; }
  .myth-card { scroll-snap-align: start; }
  .myth-card-text h3 { font-size: 36px; }
}

/* the three ways to enjoy a story */
.ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 88px; }
.way { padding: 26px; border-radius: var(--radius); background: var(--paper-2); }
.way > .i { width: 26px; height: 26px; color: var(--accent); }
.way h3 { font-size: 26px; margin: 12px 0 4px; }
.way p { margin: 0; color: var(--ink-soft); font-size: 15px; }
@media (max-width: 760px) { .ways { grid-template-columns: 1fr; gap: 12px; margin-top: 56px; } .way { display: grid; grid-template-columns: 26px 1fr; gap: 0 16px; padding: 18px 20px; } .way > .i { grid-row: span 2; margin-top: 4px; } .way h3 { margin: 0; font-size: 24px; } }

/* ---- buttons ----------------------------------------------------------------- */

.mode-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 500 15px/1 var(--sans); padding: 12px 20px 12px 16px; border-radius: 999px;
  cursor: pointer; border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn .i { width: 18px; height: 18px; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.on-dark .btn:not(.primary), .endcard .btn:not(.primary) { background: rgba(255, 248, 239, 0.12); border-color: rgba(255, 248, 239, 0.28); color: #fff8ef; backdrop-filter: blur(8px); }
.on-dark .btn:not(.primary):hover, .endcard .btn:not(.primary):hover { background: rgba(255, 248, 239, 0.22); }
@media (max-width: 400px) { .btn { padding: 11px 16px 11px 13px; font-size: 14.5px; } .mode-buttons { gap: 8px; } }

/* ---- mythology page ------------------------------------------------------------ */

.story-list { display: grid; gap: 20px; }
.story-row {
  display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 32px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.story-row .cover { border-radius: 11px; }
.story-row h3 { font-size: clamp(30px, 3.2vw, 40px); }
.story-row .story-text > p:not(.kicker) { color: var(--ink-soft); margin: 8px 0 22px; font-size: 16px; }
@media (max-width: 720px) {
  .story-row { grid-template-columns: 1fr; gap: 16px; padding: 10px 10px 18px; }
  .story-text { padding: 0 8px; }
}

.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.figure {
  display: grid; justify-items: center; align-content: start; text-align: center; gap: 2px; padding: 22px 12px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: inherit; font: inherit;
  box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.figure:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.figure strong { font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.1; }
.figure > span { font-size: 13.5px; color: var(--ink-soft); }
@media (max-width: 640px) { .figures { grid-template-columns: 1fr 1fr; gap: 12px; } .figure strong { font-size: 22px; } }

.medallion {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--b) 85%, #fff), var(--a) 70%, color-mix(in srgb, var(--a) 70%, #000));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), 0 0 0 1px var(--line), 0 6px 16px rgba(40, 25, 10, 0.2);
}
.medallion span { font-family: var(--serif); font-weight: 600; font-size: 36px; color: #fff8ef; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }

.figure-card {
  border: none; border-radius: 22px; padding: 36px 30px 28px; width: min(440px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.figure-card[open] { animation: fadeUp 0.35s ease both; }
.figure-card::backdrop { background: rgba(14, 10, 7, 0.55); backdrop-filter: blur(4px); }
.figure-card form { position: absolute; top: 12px; right: 12px; }
.figure-card .close { background: var(--paper-2); color: var(--ink); width: 38px; height: 38px; }
.figure-card .medallion { width: 104px; height: 104px; margin: 0 auto 18px; }
.figure-card .medallion span { font-size: 50px; }
.figure-card .eyebrow { color: var(--accent); opacity: 1; margin-bottom: 6px; }
.figure-card h2 { font-size: 46px; }
.figure-card dl { text-align: left; margin: 22px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.figure-card dt { font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); padding-top: 3px; }
.figure-card dd { margin: 0; }
.figure-card dd a { color: var(--accent); }

/* ---- player --------------------------------------------------------------- */

.player { position: fixed; inset: 0; background: var(--night); color: #fff8ef; overflow: hidden; }
.player .eyebrow { color: rgba(255, 248, 239, 0.8); }
.stage { position: absolute; inset: 0; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 14px; z-index: 2;
  padding: max(14px, env(safe-area-inset-top)) 18px 40px;
  background: linear-gradient(rgba(10, 8, 6, 0.65), rgba(10, 8, 6, 0.25) 60%, transparent);
}
.topbar .title { flex: 1; font-family: var(--serif); font-size: 24px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.topbar .title span { display: block; font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.modes { display: flex; background: rgba(20, 15, 11, 0.45); border: 1px solid rgba(255, 248, 239, 0.14); border-radius: 999px; padding: 4px; backdrop-filter: blur(10px); }
.modes button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 500 14px var(--sans); color: inherit; background: none; border: none; padding: 8px 16px 8px 13px; border-radius: 999px; cursor: pointer; transition: background 0.25s, color 0.25s; }
.modes button .i { width: 16px; height: 16px; }
.modes button:hover { background: rgba(255, 248, 239, 0.1); }
.modes button[aria-selected="true"] { background: #fff8ef; color: #2a211b; }

.icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; padding: 0;
  background: rgba(20, 15, 11, 0.4); border: 1px solid rgba(255, 248, 239, 0.16); color: inherit; cursor: pointer; text-decoration: none;
  backdrop-filter: blur(10px); transition: background 0.2s, transform 0.2s;
}
.icon:hover { background: rgba(255, 248, 239, 0.18); }
.icon:active { transform: scale(0.94); }

.caption {
  position: absolute; left: 0; right: 0; bottom: 104px; display: flex; justify-content: center; padding: 0 16px;
  pointer-events: none; z-index: 1;
}
.caption .text {
  max-width: 780px; margin: 0; padding: 18px 26px; border-radius: 18px;
  font-family: var(--serif); font-size: clamp(19px, 1.8vw, 24px); font-weight: 500; line-height: 1.4;
  background: rgba(16, 11, 8, 0.62); backdrop-filter: blur(12px); border: 1px solid rgba(255, 248, 239, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); text-wrap: pretty;
}
.caption .text span { opacity: 0.38; transition: opacity 0.35s ease; }
.caption .text span.said, .caption .text.inked span { opacity: 1; }
.caption .text.fade-in { animation: fadeUp 0.9s ease both; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; justify-items: center; gap: 14px;
  padding: 36px 16px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(10, 8, 6, 0.6));
}
.controls .buttons { display: flex; align-items: center; gap: 18px; }
.controls .play { width: 58px; height: 58px; background: #fff8ef; color: #2a211b; border: none; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.controls .play:hover { background: #fff; }
.controls .play .i { width: 24px; height: 24px; }
.controls .play[aria-label="Play"] .i { margin-left: 3px; }

/* scene progress: one segment per scene */
.dots { display: flex; gap: 6px; width: min(420px, 100%); }
.dots button { flex: 1; height: 4px; border-radius: 4px; border: none; padding: 0; background: rgba(255, 248, 239, 0.25); cursor: pointer; position: relative; transition: background 0.3s; }
.dots button::before { content: ""; position: absolute; inset: -10px 0; }
.dots button.done { background: rgba(255, 248, 239, 0.75); }
.dots button.on { background: var(--gold); }

/* Read: bigger text, picture is tappable */
.mode-read .stage { cursor: pointer; }
.mode-read .caption .text { font-size: clamp(20px, 2vw, 26px); }

/* Listen: picture recedes, a calm "now playing" card */
.listen-card { display: none; }
.mode-listen .stage { opacity: 0.45; transform: scale(1.08); filter: blur(2px); }
.mode-listen .stage::after { content: ""; position: absolute; inset: 0; background: rgba(18, 14, 11, 0.45); }
.mode-listen .listen-card {
  display: block; position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; width: calc(100% - 32px);
}
.mode-listen .listen-card .eyebrow { color: var(--gold); }
.mode-listen .listen-card h2 { font-size: clamp(38px, 6vw, 64px); }
.mode-listen .listen-card .scene-count { opacity: 0.75; }
.mode-listen .caption .text { background: none; backdrop-filter: none; border: none; box-shadow: none; font-size: 21px; }

.endcard {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; padding: 24px;
  background: rgba(16, 11, 8, 0.78); backdrop-filter: blur(12px); animation: fadeUp 1s ease both; overflow-y: auto;
}
.endcard[hidden] { display: none; }
.endcard .eyebrow { color: var(--gold); }
.endcard h2 { font-size: clamp(40px, 6vw, 64px); }
.endcard .note { max-width: 560px; margin: 18px auto 0; font-style: italic; font-family: var(--serif); font-size: 21px; opacity: 0.92; }
.endcard .sources { font-size: 14px; opacity: 0.75; margin: 22px 0 28px; line-height: 1.7; }
.endcard .mode-buttons { justify-content: center; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 12px 28px; }
  .topbar .title { order: 1; flex-basis: calc(100% - 60px); font-size: 21px; }
  .modes { order: 3; width: 100%; }
  .modes button { flex: 1; padding: 9px 8px; }
  .caption { bottom: 128px; padding: 0 12px; }
  .caption .text { padding: 14px 18px; font-size: 19px; }
  .mode-read .caption .text { font-size: 20px; }
  .controls { gap: 16px; }
  .dots { width: calc(100% - 16px); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .caption { bottom: 88px; }
  .caption .text { font-size: 17px; padding: 10px 16px; }
  .controls { grid-auto-flow: column; align-items: center; padding-top: 16px; }
  .dots { width: 200px; }
  .controls .play { width: 48px; height: 48px; }
}

/* ---- scenes ----------------------------------------------------------------
   Pre-painted layers from tools/render-scenes.js, laid out in scene units
   inside .frame, which web/js/scene.js scales to cover the stage. */

.stage { overflow: hidden; transition: opacity 1s ease, transform 1s ease; }
.pan { position: absolute; inset: 0; }
.playing .pan, .mode-read .pan { animation: pan 26s ease-in-out infinite alternate; }
.scene { position: absolute; inset: 0; opacity: 0; transition: opacity 0.45s ease-out; }
.scene.in { opacity: 1; }
.frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.layer { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
.paper { position: absolute; inset: 0; background: url(../scenes/paper.webp) repeat; mix-blend-mode: multiply; pointer-events: none; }
.frame .paper { display: none; }
.flash { position: absolute; inset: -100px; background: #e8f0ff; opacity: 0; animation: lightning 7s linear infinite; }
/* a lamp-lit screen for scenes without art yet */
.scene.lamp {
  background:
    linear-gradient(90deg, rgba(18, 14, 11, 0.7), transparent 30%, transparent 70%, rgba(18, 14, 11, 0.7)),
    linear-gradient(#1f140d, #b8783e 42%, #6b4223 70%, #1f140d);
}

.shake { animation: shake 9s linear infinite; }
.m-drift-slow { animation: drift 40s ease-in-out infinite alternate; }
.m-mist { animation: drift 30s ease-in-out infinite alternate; }
.m-swell { animation: swell 14s ease-in-out infinite alternate; }
.m-sway { animation: sway 7s ease-in-out infinite alternate; }
.m-sway-slow { animation: sway 11s ease-in-out infinite alternate; }
.m-breathe { animation: breathe 6s ease-in-out infinite alternate; }
.m-float { animation: float 7s ease-in-out infinite alternate; }
.m-bob { animation: bob 5s ease-in-out infinite alternate; }
.m-charge { animation: charge 6s ease-in-out infinite alternate; }
.m-thrust { animation: thrust 2.4s ease-in-out infinite alternate; }
.m-aurora { animation: aurora 12s ease-in-out infinite alternate; }
.m-rise { animation: rise 3s cubic-bezier(0.33, 1, 0.68, 1) both; }
.m-sunrise { animation: sunrise 9s cubic-bezier(0.33, 1, 0.68, 1) both; }

.pt { position: absolute; border-radius: 50%; opacity: var(--o); will-change: transform; }
.pt-rain { border-radius: 0; animation: rain linear infinite; }
.pt-fall { animation: fall linear infinite; }
.pt-drift-petal { animation: petal linear infinite; }
.pt-rise-up { animation: rise-up linear infinite; }
.pt-twinkle { animation: twinkle ease-in-out infinite alternate; }

/* distances are scene units, times the layer's own scale (--s) */
@keyframes drift { from { transform: translateX(calc(-30px * var(--s))); } to { transform: translateX(calc(30px * var(--s))); } }
@keyframes swell { from { transform: translateX(0); } to { transform: translateX(calc(-60px * var(--s))); } }
@keyframes sway { from { transform: skewX(-1.5deg); } to { transform: skewX(1.5deg); } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.025); } }
@keyframes float { from { transform: translateY(calc(-10px * var(--s))) rotate(-2deg); } to { transform: translateY(calc(10px * var(--s))) rotate(2deg); } }
@keyframes bob { from { transform: translateY(calc(-6px * var(--s))) rotate(-1.5deg); } to { transform: translateY(calc(6px * var(--s))) rotate(1.5deg); } }
@keyframes charge { from { transform: translateX(calc(-20px * var(--s))); } to { transform: translateX(calc(20px * var(--s))); } }
@keyframes thrust { from { transform: translate(calc(-14px * var(--s)), calc(8px * var(--s))); } to { transform: translate(calc(6px * var(--s)), calc(-4px * var(--s))); } }
@keyframes aurora { from { opacity: 0.6; transform: translateX(calc(-60px * var(--s))) skewX(-4deg); } to { opacity: 1; transform: translateX(calc(60px * var(--s))) skewX(4deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(calc(260px * var(--s))); } }
@keyframes sunrise { from { transform: translateY(calc(220px * var(--s))); } }
@keyframes rain { from { transform: translateY(-40px) rotate(var(--angle)); } to { transform: translateY(960px) rotate(var(--angle)); } }
@keyframes fall { from { transform: translateY(-40px); } to { transform: translateY(960px); } }
@keyframes petal { from { transform: translate(0, -40px) rotate(0); } to { transform: translate(-260px, 960px) rotate(540deg); } }
@keyframes rise-up { from { opacity: 0; transform: translateY(0); } 20% { opacity: calc(0.9 * var(--o)); } to { opacity: 0; transform: translateY(-500px); } }
@keyframes twinkle { from { opacity: calc(0.2 * var(--o)); } to { opacity: var(--o); } }
@keyframes lightning { 0%, 88%, 92%, 100% { opacity: 0; } 89% { opacity: 0.75; } 90% { opacity: 0.1; } 91% { opacity: 0.55; } }
@keyframes shake { 0%, 86%, 100% { transform: none; } 88% { transform: translate(-4px, 2px); } 90% { transform: translate(4px, -2px); } 92% { transform: translate(-2px, 1px); } }
@keyframes pan { from { transform: scale(1.02); } to { transform: scale(1.08) translateX(-1.2%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition-duration: 0.01s !important; }
.reduce-motion .flash { opacity: 0; }
