/* Staging DIRT art layer, carried over from the Nov 2026 staging build (original art owned by Solid State Strategies).
   Contents: design tokens, SVG scene motion, live plate tokens, motion layer. Gate: data-motion on <html>. */
/* DIRT app visual tokens (BGT-048 lane L3).
   Author: BGT Video Producer, original, 2026-11-16. Owned by Solid State Strategies.
   Sources: DIRT app src/css/app.css (live staging, sha aca362f9), playbgt.com bgt-site.css
   (sha 6668906b), BGT-COVER-STANDARD.md section 3. Values that already exist in the app are
   kept identical so Dev Lead can adopt this file without a visual regression.
   Contrast ratios: DESIGN-TOKENS.md. */

:root {
  /* ---------- color: app surfaces (existing DIRT app values) ---------- */
  --dirt-bg: #FFF9EE;            /* cream page */
  --dirt-surface: #FFFFFF;       /* cards */
  --dirt-surface-2: #F4ECDD;     /* hover, wells */
  --dirt-ink: #263238;           /* body text, icon stroke */
  --dirt-muted: #5C6766;         /* secondary text, 5.59:1 on cream */
  --dirt-border: #E8E0D2;        /* decorative divider only */
  --dirt-line-strong: #9C8F7A;   /* input and control edges, 3.03:1 on cream */

  /* ---------- color: DIRT quadrants (fills, art, letter tokens) ---------- */
  --dirt-d: #E8734A;  --dirt-d-soft: #FBE4DA;  --dirt-d-ink: #A4401E;  /* Demands */
  --dirt-i: #E3B341;  --dirt-i-soft: #FBF0D2;  --dirt-i-ink: #7A5A00;  /* Investments */
  --dirt-r: #5BAA83;  --dirt-r-soft: #DFF1E7;  --dirt-r-ink: #2C6E50;  /* Reactions */
  --dirt-t: #557DBD;  --dirt-t-soft: #E1E9F6;  --dirt-t-ink: #345C9C;  /* Trash */
  /* *-ink variants are new: use them for quadrant-colored TEXT on cream (all 5.8:1 or higher). */

  /* ---------- color: chapter tints (from playbgt.com bgt-site.css) ---------- */
  --dirt-ch-empty: #D9ECF8;
  --dirt-ch-sort: #D5F0EA;
  --dirt-ch-see: #F7EBD3;
  --dirt-ch-act: #F8D9D7;
  --dirt-ch-return: #EFE8F6;     /* new, matches the app's existing "ret" scene tint */

  /* ---------- color: action and status ---------- */
  --dirt-action: #5E4486;        /* primary button, links (violet-ink) */
  --dirt-action-press: #3F2C5E;  /* button base shadow */
  --dirt-action-soft: #EFE7F6;
  --dirt-violet: #8B6BB1;        /* art only */
  --dirt-ok: #2F7A60;
  --dirt-danger: #A6361A;
  --dirt-focus: #5E4486;

  /* ---------- color: BGT brand anchors (premium, dark surfaces) ---------- */
  --bgt-navy: #0F253E;           /* cover navy, onboarding and paywall-style hero panels */
  --bgt-navy-2: #123A5C;         /* site navy */
  --bgt-cream: #FEF0DB;          /* text on navy, 13.81:1 */
  --bgt-cream-muted: #C9D4DE;    /* secondary text on navy, 10.30:1 */
  --bgt-gold: #FCC14A;           /* highlight, rays, focus ring on navy */
  --bgt-teal: #358784;           /* cover pill, large bold text only */
  --bgt-teal-deep: #2C6E6B;      /* app pill, any text size, 5.92:1 with white */
  --bgt-teal-2: #4FA6A0;         /* rules, art */
  --bgt-coral: #E4573D;          /* art, large text only */
  --bgt-coral-deep: #C9442C;     /* coral with small white text */
  --bgt-lavender: #9A86B8;       /* arcs, art */
  --bgt-glow-1: #F2B85A;
  --bgt-glow-2: #FDE7CA;
  --bgt-wood: #A27F62;
  --bgt-wood-dark: #6D5851;

  /* ---------- typography (self-hosted OFL fonts already in the app) ---------- */
  --dirt-font-head: "Nunito", "Atkinson Hyperlegible", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --dirt-font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --dirt-text-xs: .75rem;  --dirt-text-sm: .875rem;  --dirt-text-md: 1rem;  --dirt-text-body: 1.0625rem;
  --dirt-text-lg: 1.25rem; --dirt-text-xl: 1.75rem;  --dirt-text-2xl: clamp(2rem, 5vw, 3.25rem);
  --dirt-weight-body: 400; --dirt-weight-strong: 700; --dirt-weight-head: 900;
  --dirt-leading-body: 1.6; --dirt-leading-head: 1.15;
  --dirt-tracking-eyebrow: .14em;

  /* ---------- spacing (4px base, 8px rhythm) ---------- */
  --dirt-space-1: 4px;  --dirt-space-2: 8px;  --dirt-space-3: 12px; --dirt-space-4: 16px;
  --dirt-space-5: 24px; --dirt-space-6: 32px; --dirt-space-7: 48px; --dirt-space-8: 64px;
  --dirt-touch: 48px;   --dirt-touch-min: 44px;

  /* ---------- radius ---------- */
  --dirt-radius-xs: 6px;  --dirt-radius-sm: 12px; --dirt-radius-md: 14px;
  --dirt-radius-lg: 20px; --dirt-radius-xl: 24px; --dirt-radius-pill: 999px;

  /* ---------- shadow (ink-tinted, soft; navy-tinted for dark panels) ---------- */
  --dirt-shadow-sm: 0 1px 2px rgb(38 50 56 / .06), 0 2px 8px rgb(38 50 56 / .05);
  --dirt-shadow-md: 0 8px 24px rgb(38 50 56 / .08);
  --dirt-shadow-lg: 0 14px 32px rgb(38 50 56 / .14);
  --dirt-shadow-press: 0 4px 0 var(--dirt-action-press);
  --dirt-shadow-token: inset 0 -3px 0 rgb(0 0 0 / .12), 0 2px 4px rgb(38 50 56 / .18);
  --dirt-shadow-navy: 0 18px 40px rgb(15 37 62 / .35);
  --dirt-glow-gold: 0 0 0 6px rgb(252 193 74 / .18);

  /* ---------- motion ---------- */
  --dirt-dur-instant: 90ms;   /* press */
  --dirt-dur-fast: 140ms;     /* hover, panel exit */
  --dirt-dur-check: 160ms;    /* check glyph in */
  --dirt-dur-base: 220ms;     /* chip pulse, toggles */
  --dirt-dur-connector: 280ms;
  --dirt-dur-panel: 320ms;    /* step forward and back */
  --dirt-dur-scene: 480ms;    /* illustration entrances */
  --dirt-dur-hero: 720ms;     /* onboarding hero, once per session */
  --dirt-stagger: 80ms;       /* between scene pieces, cap at 8 pieces */
  --dirt-ease-out: cubic-bezier(.22, 1, .36, 1);     /* existing app ease */
  --dirt-ease-in: cubic-bezier(.55, 0, 1, .45);
  --dirt-ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dirt-ease-pop: cubic-bezier(.2, .9, .3, 1.25);   /* existing popIn overshoot */
  --dirt-ease-settle: cubic-bezier(.34, 1.3, .64, 1);/* token placed on board */
  --dirt-distance-panel: 24px;
  --dirt-distance-lift: 2px;
  --dirt-scale-press: .98;
  --dirt-scale-pulse: 1.06;

  /* ---------- icon ---------- */
  --dirt-icon-sm: 20px; --dirt-icon-md: 24px; --dirt-icon-lg: 32px;
  --dirt-icon-stroke: 1.75;
}

/* Reduced motion: every state must already be complete and readable at time zero.
   Matches the app's rule: system setting OR the in-app Motion toggle (data-motion="off"). */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="on"]) {
    --dirt-dur-instant: 0ms; --dirt-dur-fast: 0ms; --dirt-dur-check: 0ms; --dirt-dur-base: 0ms;
    --dirt-dur-connector: 0ms; --dirt-dur-panel: 0ms; --dirt-dur-scene: 0ms; --dirt-dur-hero: 0ms;
    --dirt-stagger: 0ms; --dirt-distance-panel: 0px; --dirt-distance-lift: 0px;
    --dirt-scale-press: 1; --dirt-scale-pulse: 1;
  }
}
:root[data-motion="off"] {
  --dirt-dur-instant: 0ms; --dirt-dur-fast: 0ms; --dirt-dur-check: 0ms; --dirt-dur-base: 0ms;
  --dirt-dur-connector: 0ms; --dirt-dur-panel: 0ms; --dirt-dur-scene: 0ms; --dirt-dur-hero: 0ms;
  --dirt-stagger: 0ms; --dirt-distance-panel: 0px; --dirt-distance-lift: 0px;
  --dirt-scale-press: 1; --dirt-scale-pulse: 1;
}

/* Icon base class for the icons/ set (stroke-based, currentColor). */
.dirt-icon { width: var(--dirt-icon-md); height: var(--dirt-icon-md); flex: none; color: inherit; vertical-align: middle; }
.dirt-icon.sm { width: var(--dirt-icon-sm); height: var(--dirt-icon-sm); }
.dirt-icon.lg { width: var(--dirt-icon-lg); height: var(--dirt-icon-lg); }

/* ---------- SVG scene motion (state stays visible with zero animation) ---------- */
.scene g[class^="a-"], .target-svg g[class^="a-"] { transform-box: fill-box; transform-origin: center; }
[data-motion="on"] .a-table { animation: fadeIn 260ms ease-out both; animation-delay: var(--d); }
[data-motion="on"] .a-pop { animation: popIn 420ms cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: var(--d); }
[data-motion="on"] .a-drop { animation: dropIn 450ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-slide { animation: slideIn 420ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-roll { animation: rollIn 450ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-fade { animation: fadeIn 300ms ease-out both; animation-delay: var(--d); }
[data-motion="on"] .a-glow, [data-motion="on"] .a-glowcell { animation: glowIn 360ms ease-out both; animation-delay: var(--d); }
[data-motion="on"] .a-draw path[pathLength] { stroke-dasharray: 1; animation: draw 420ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-draw { animation: fadeIn 200ms ease-out both; animation-delay: var(--d); }
[data-motion="on"] .a-search { animation: search 900ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-orbit { animation: orbit 700ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-pass { animation: pass 600ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-advance { animation: advance 450ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-spin { animation: spinIn 600ms var(--ease) both; animation-delay: var(--d); }
[data-motion="on"] .a-ring { animation: glowIn 300ms ease-out 650ms both; }
.a-fadeout { opacity: .22; }
[data-motion="on"] .a-fadeout { animation: fadeOut 500ms ease-in both; animation-delay: var(--d); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: .22; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-44px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
@keyframes rollIn { 0% { opacity: 0; transform: translate(-40px, -20px) rotate(-200deg); } 100% { opacity: 1; transform: none; } }
@keyframes glowIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes search { 0% { opacity: 0; transform: translate(-90px, 30px); } 30% { opacity: 1; transform: translate(-60px, 20px); } 65% { transform: translate(-20px, -14px); } 100% { opacity: 1; transform: none; } }
@keyframes orbit { from { opacity: 0; transform: rotate(-40deg) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes pass { 0% { opacity: 0; transform: translateX(-90px); } 30% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes advance { from { opacity: 0; transform: translate(-46px, 40px); } to { opacity: 1; transform: none; } }
@keyframes spinIn { from { opacity: 0; transform: rotate(-180deg); } to { opacity: 1; transform: none; } }
@keyframes checkIn { from { transform: scale(.6); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* ---------- motion off: in-app toggle or system setting ---------- */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) *, html:not([data-motion="on"]) *::before, html:not([data-motion="on"]) *::after {
    scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important;
  }
}


/* DIRT live plate tokens: placement and settle. BGT Video Producer, original, 2026-11-16. Owned by Solid State Strategies.
   Markup comes from plate-tokens.js: <g class="pt pt-D pt-new" transform="translate(x y)" style="--i:n"><g class="pt-drop">...</g></g>.
   The outer <g> keeps the slot position in its transform attribute; only the inner .pt-drop animates, so CSS never overrides the position.
   Gated like the app's own scene motion: [data-motion="on"] on <html>. The app sets data-motion="off" for prefers-reduced-motion. */
.pt-label { font-family: var(--head, "Nunito"), "Atkinson Hyperlegible", system-ui, sans-serif; }
.pt .pt-drop { transform-box: fill-box; transform-origin: 50% 100%; }

/* Drop in, settle once: falls 30 units, lands with one small squash, settles. 560ms, runs once, no loop. */
[data-motion="on"] .pt-new .pt-drop { animation: ptDrop 560ms cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--pt-delay, 0ms)); }
[data-motion="on"] .pt-new .pt-piece { animation: ptSettle 560ms ease-out both; animation-delay: calc(var(--pt-delay, 0ms)); transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes ptDrop {
  0%   { opacity: 0; transform: translateY(-30px); }
  45%  { opacity: 1; transform: translateY(0); }
  62%  { transform: translateY(-4px); }
  78%  { transform: translateY(0); }
  100% { opacity: 1; transform: none; }
}
@keyframes ptSettle {
  0%, 44% { transform: none; }
  52%  { transform: scale(1.08, .9); }
  70%  { transform: scale(.98, 1.02); }
  100% { transform: none; }
}

/* Several items added at once (a pasted list): stagger by 90ms each via --pt-delay set inline, capped at 8 tokens. */

/* Reduced motion: no movement, a short fade only. Motion off in the app: no animation at all. */
@media (prefers-reduced-motion: reduce) {
  [data-motion="on"] .pt-new .pt-drop { animation: ptFade 160ms linear both; }
  [data-motion="on"] .pt-new .pt-piece { animation: none; }
}
[data-motion="off"] .pt-new .pt-drop, [data-motion="off"] .pt-new .pt-piece { animation: none; }
@keyframes ptFade { from { opacity: 0; } to { opacity: 1; } }

/* DIRT app motion layer (BGT-048 L3). Author: BGT Video Producer, original, 2026-11-16.
   Owned by Solid State Strategies. Requires tokens.css. Works alongside the app's css/app.css:
   it reuses the app's gate ([data-motion="on"] on <html>) and its a-* class pattern, and only ADDS classes.
   Rule: every element is in its final state without this file. Nothing loops. */

/* ---------- new scene piece classes (SVG <g>) ---------- */
.scene g[class^="a-"] { transform-box: fill-box; transform-origin: center; }
[data-motion="on"] .a-settle { animation: dirtSettle var(--dirt-dur-scene) var(--dirt-ease-settle) both; animation-delay: var(--d, 0ms); }
[data-motion="on"] .a-arc    { animation: dirtArc 640ms var(--dirt-ease-out) both; animation-delay: var(--d, 0ms); }
[data-motion="on"] .a-lift   { animation: dirtLift var(--dirt-dur-scene) var(--dirt-ease-out) both; animation-delay: var(--d, 0ms); }
.scene g.a-sweep[class] { transform-box: view-box; transform-origin: 200px 150px; }
[data-motion="on"] .a-sweep  { animation: dirtSweep 900ms var(--dirt-ease-in-out) both; animation-delay: var(--d, 0ms); }
@keyframes dirtSettle { 0% { opacity: 0; transform: translateY(-14px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes dirtArc    { 0% { opacity: 0; transform: translate(var(--fx, -160px), var(--fy, 0px)); } 15% { opacity: 1; } 55% { transform: translate(calc(var(--fx, -160px) * .45), -46px); } 100% { opacity: 1; transform: none; } }
@keyframes dirtLift   { 0% { transform: none; } 100% { transform: translateY(-18px); } }
@keyframes dirtSweep  { 0% { opacity: 0; transform: rotate(-60deg); } 20% { opacity: 1; } 100% { opacity: 1; transform: rotate(240deg); } }
/* a-lift ends lifted: its static (motion off) state is also lifted, so the "picked" card reads with no motion. */
[data-motion="off"] .a-lift, .a-lift { transform: translateY(-18px); }
[data-motion="on"] .a-lift { transform: none; }

/* ---------- step panels: CSS twin of the app's WAAPI transition (forward 24px, back reversed) ---------- */
.dirt-panel-enter { animation: dirtPanelIn var(--dirt-dur-panel) var(--dirt-ease-out) both; }
.dirt-panel-enter.is-back { --dir: -1; }
.dirt-panel-exit { animation: dirtPanelOut var(--dirt-dur-fast) var(--dirt-ease-in) both; }
.dirt-panel-exit.is-back { --dir: -1; }
@keyframes dirtPanelIn  { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * var(--dirt-distance-panel))); } to { opacity: 1; transform: none; } }
@keyframes dirtPanelOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -20px)); } }

/* ---------- onboarding (3 panels, scroll-snap carousel, no autoplay) ---------- */
.dirt-onb { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--bgt-navy); color: var(--bgt-cream); border-radius: var(--dirt-radius-xl); }
.dirt-onb::-webkit-scrollbar { display: none; }
.dirt-onb-panel { scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--dirt-space-4); padding: var(--dirt-space-5); min-height: min(100dvh, 760px); }
.dirt-onb-panel > svg { width: 100%; height: auto; max-height: 56dvh; }
.dirt-onb-panel h2 { font-family: var(--dirt-font-head); font-weight: 900; font-size: var(--dirt-text-xl); color: var(--bgt-cream); margin: 0; }
.dirt-onb-panel p { color: var(--bgt-cream-muted); margin: 0; }
.dirt-onb-dots { display: flex; gap: 8px; justify-content: center; }
.dirt-onb-dots i { width: 8px; height: 8px; border-radius: 999px; background: var(--bgt-cream-muted); opacity: .5; transition: width var(--dirt-dur-base) var(--dirt-ease-out), opacity var(--dirt-dur-base); }
.dirt-onb-dots i[aria-current="step"] { width: 22px; opacity: 1; background: var(--bgt-gold); }
.dirt-onb .btn-gold { background: var(--bgt-gold); color: var(--bgt-navy); box-shadow: 0 4px 0 #C7922A; }
.dirt-onb :focus-visible { outline: 3px solid var(--bgt-gold); outline-offset: 3px; }

/* ---------- chapter card (inline banner above the first step of a chapter; never blocks input) ---------- */
.dirt-chapter-card { display: grid; grid-template-columns: 1fr; gap: var(--dirt-space-2); background: var(--bgt-navy); color: var(--bgt-cream); border-radius: var(--dirt-radius-xl); padding: var(--dirt-space-3); box-shadow: var(--dirt-shadow-navy); }
.dirt-chapter-card svg { width: 100%; height: auto; }
.dirt-chapter-card b { font-family: var(--dirt-font-head); font-weight: 900; font-size: var(--dirt-text-lg); color: var(--bgt-cream); }
[data-motion="on"] .dirt-chapter-card { animation: dirtRise var(--dirt-dur-panel) var(--dirt-ease-out) both; }
@keyframes dirtRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- completion moment (My recap arrival from r2 only) ---------- */
[data-motion="on"] .dirt-moment { animation: dirtRise var(--dirt-dur-hero) var(--dirt-ease-out) both; }

/* ---------- micro-interactions ---------- */
.dirt-press { transition: transform var(--dirt-dur-fast) var(--dirt-ease-out), box-shadow var(--dirt-dur-fast) var(--dirt-ease-out); }
@media (hover: hover) { .dirt-press:hover { transform: translateY(calc(var(--dirt-distance-lift) * -1)); } }
.dirt-press:active { transform: scale(var(--dirt-scale-press)); transition-duration: var(--dirt-dur-instant); }
[data-motion="on"] .dirt-chip-added { animation: dirtPulse var(--dirt-dur-base) ease-out; }
@keyframes dirtPulse { 50% { transform: scale(var(--dirt-scale-pulse)); } }
.dirt-check path { stroke-dasharray: 1; stroke-dashoffset: 0; }
[data-motion="on"] .dirt-check.is-new path { animation: dirtDraw var(--dirt-dur-check) var(--dirt-ease-out) both; }
@keyframes dirtDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
[data-motion="on"] .dirt-token-done { animation: dirtPop var(--dirt-dur-base) var(--dirt-ease-pop) both; }
@keyframes dirtPop { 0% { transform: scale(.7); } 100% { transform: none; } }
.dirt-connector { background: linear-gradient(var(--dirt-ok), var(--dirt-ok)) 0 0 / var(--fill, 0%) 100% no-repeat, var(--dirt-border); transition: background-size var(--dirt-dur-connector) var(--dirt-ease-out); }
.dirt-toast-icon { width: 18px; height: 18px; color: var(--bgt-gold); }

/* ---------- motion off: app toggle or system setting. Final states only. ---------- */
[data-motion="off"] .a-settle, [data-motion="off"] .a-arc, [data-motion="off"] .a-sweep,
[data-motion="off"] .dirt-panel-enter, [data-motion="off"] .dirt-panel-exit, [data-motion="off"] .dirt-chapter-card,
[data-motion="off"] .dirt-moment, [data-motion="off"] .dirt-chip-added, [data-motion="off"] .dirt-check path, [data-motion="off"] .dirt-token-done { animation: none !important; }
[data-motion="off"] .dirt-press, [data-motion="off"] .dirt-connector, [data-motion="off"] .dirt-onb-dots i { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) .a-settle, html:not([data-motion="on"]) .a-arc, html:not([data-motion="on"]) .a-sweep,
  html:not([data-motion="on"]) .dirt-panel-enter, html:not([data-motion="on"]) .dirt-panel-exit,
  html:not([data-motion="on"]) .dirt-chapter-card, html:not([data-motion="on"]) .dirt-moment { animation: none !important; }
  .dirt-onb { scroll-behavior: auto; }
}
