/* studio.css — the "Studio" lesson experience (uiMode = "studio").

   EVERY rule in this file MUST be scoped under html[data-ui-mode="studio"] so it
   can never touch the default "Straightforward" path. This file is loaded AFTER
   css/app.css, so scoped rules win specificity ties without !important.

   Phase 2 — the craft layer. Same brand (amber / Fraunces / graph-paper / dark
   base) executed with more care: a layered, warmer lesson surface, a measured
   reading column, Fraunces headings with rhythm, one easing curve, and restrained
   motion. No logic here — this restyles the existing lesson pane, so toggling
   Studio is already a visible, demoable change before the new loop lands. */

/* ---- Studio design tokens (scoped: cascade only inside Studio) ---- */
html[data-ui-mode="studio"] {
  /* one geometric spacing scale (~1.6) — rhythm, not arbitrary gaps */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 13px; --sp-4: 21px; --sp-5: 34px; --sp-6: 55px;
  /* one easing curve (reuse app's --ease), a small set of durations */
  --dur-fast: 160ms; --dur-mid: 280ms; --dur-slow: 460ms;
  /* persistent concept colors — a quantity keeps one color across prose,
     widget and reveal. Seeded from the existing brand/semantic palette. */
  --ck-1: var(--accent);   /* the quantity in focus (amber) */
  --ck-2: var(--blue);
  --ck-3: var(--violet);
}

/* ---- the lesson surface: warmer, layered, with an earned amber rail ---- */
html[data-ui-mode="studio"] .learn-pane {
  padding: var(--sp-5) var(--sp-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background-color: var(--bg-2);
  /* faint amber-tinted graph paper over a soft top-lit gradient — the brand's
     graph-paper identity, made tactile instead of flat-black gloom */
  background-image:
    repeating-linear-gradient(0deg,  rgba(224,168,46,.038) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(224,168,46,.038) 0 1px, transparent 1px 30px),
    linear-gradient(180deg, var(--bg-3), var(--bg-2) 220px);
  /* inset amber rail (left) + a top edge-highlight that catches light, then lift */
  box-shadow:
    inset 3px 0 0 var(--accent),
    inset 0 1px 0 rgba(255,255,255,.05),
    var(--shadow-lift);
}

/* ---- the eyebrow: a small amber pill instead of bare mono text ---- */
html[data-ui-mode="studio"] .step-kicker {
  display: inline-block;
  margin-bottom: var(--sp-3);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---- headings in Fraunces, with optical sizing and tighter tracking ---- */
html[data-ui-mode="studio"] .learn-pane h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 25px;
  font-weight: 560;
  letter-spacing: -.02em;
  line-height: 1.16;
  margin: 0 0 var(--sp-3);
  color: var(--ink-strong);
}
html[data-ui-mode="studio"] .player-top h2 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 19px;
  letter-spacing: -.015em;
}

/* ---- a measured, calm reading column ---- */
html[data-ui-mode="studio"] .learn-pane .md {
  max-width: 62ch;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--ink);
}

/* ---- the prompt reads like a question someone is asking, not a label ---- */
html[data-ui-mode="studio"] .quizbox .q-prompt {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -.01em;
  line-height: 1.3;
  margin-bottom: var(--sp-3);
}

/* ---- options that feel tactile: more padding, a real press ---- */
html[data-ui-mode="studio"] .q-opt {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
html[data-ui-mode="studio"] .q-opt:hover:not(:disabled) { transform: translateY(-1px); }
html[data-ui-mode="studio"] .q-opt:active:not(:disabled) { transform: translateY(0); }

/* ---- feedback animates in with the one Studio curve ---- */
html[data-ui-mode="studio"] .q-explain {
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  animation: studioReveal var(--dur-mid) var(--ease) both;
}

/* ---- generous, deliberate action row ---- */
html[data-ui-mode="studio"] .pane-actions { margin-top: var(--sp-5); gap: var(--sp-2); }
html[data-ui-mode="studio"] .pane-actions .btn-primary {
  padding-left: var(--sp-4); padding-right: var(--sp-4);
}

/* ---- step dots: a touch larger and smoother ---- */
html[data-ui-mode="studio"] .stepdots i { transition: all var(--dur-mid) var(--ease); }
html[data-ui-mode="studio"] .stepdots i.now { width: 22px; }

/* ---- persistent concept-color helpers (used by the Studio loop in Phase 3) ---- */
html[data-ui-mode="studio"] .ck-1 { color: var(--ck-1); font-weight: 600; }
html[data-ui-mode="studio"] .ck-2 { color: var(--ck-2); font-weight: 600; }
html[data-ui-mode="studio"] .ck-3 { color: var(--ck-3); font-weight: 600; }

/* ---- one entrance keyframe for the pane, one for revealed content.
        Prefixed studio* so they cannot collide with app.css keyframes. ---- */
@keyframes studioStepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes studioReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* The whole pane drifts up on each step (Straightforward already animates
   .view children; this is the Studio-specific, slightly weightier version). */
html[data-ui-mode="studio"] .learn-pane {
  animation: studioStepIn var(--dur-slow) var(--ease) both;
}

/* ---- respect reduced motion: no entrance/feedback motion, no FLIP.
        (app.css already neuters durations globally; this also flips the
        --studio-motion flag the Phase 3 JS reads to skip transforms.) ---- */
@media (prefers-reduced-motion: reduce) {
  html[data-ui-mode="studio"] { --studio-motion: 0; }
  html[data-ui-mode="studio"] .learn-pane,
  html[data-ui-mode="studio"] .q-explain { animation: none; }
}
html[data-ui-mode="studio"] { --studio-motion: 1; }

/* ---- Studio loop regions (manipulate / predict / reveal) ---- */
html[data-ui-mode="studio"] .studio-manip { margin: var(--sp-4) 0; }
html[data-ui-mode="studio"] .studio-predict { margin-top: var(--sp-4); }
/* the reveal is the payoff — it slides in calmly on an amber-tinted card */
html[data-ui-mode="studio"] .studio-reveal {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: studioReveal var(--dur-mid) var(--ease) both;
}
html[data-ui-mode="studio"] .studio-reveal-eye {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 5px;
}
html[data-ui-mode="studio"] .studio-reveal .md { font-size: 14.5px; }
@media (prefers-reduced-motion: reduce) {
  html[data-ui-mode="studio"] .studio-reveal { animation: none; }
}

/* ============================================================
   S1 — whole-site craft layer (chrome). Same scoping rule: every
   selector under html[data-ui-mode="studio"]. Makes the app feel
   crafted everywhere in Studio mode, not only inside a lesson.
   ============================================================ */

/* cards & panels: a soft top-lit surface + inset edge-highlight.
   (.learn-pane is excluded — it keeps its own amber-rail treatment.) */
html[data-ui-mode="studio"] .card:not(.learn-pane),
html[data-ui-mode="studio"] .ksum,
html[data-ui-mode="studio"] .rating-cell,
html[data-ui-mode="studio"] .tier,
html[data-ui-mode="studio"] .forecast,
html[data-ui-mode="studio"] .ach-card {
  border-radius: var(--radius-lg);
  background-image: linear-gradient(180deg, rgba(255,255,255,.022), rgba(255,255,255,0) 120px);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.06);
}

/* hero: bigger, optically-sized Fraunces, a calmer measure */
html[data-ui-mode="studio"] .hero h1 { font-optical-sizing: auto; letter-spacing: -.04em; }
html[data-ui-mode="studio"] .hero p.lede { font-size: 17px; line-height: 1.6; }

/* section eyebrows get a small amber lead-tick */
html[data-ui-mode="studio"] .section-h::before {
  content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 9px;
  vertical-align: middle; background: var(--accent); border-radius: 2px; opacity: .85;
}

/* chapter cards: warmer, with a clearer lift and the amber language */
html[data-ui-mode="studio"] .chapter-card {
  padding: 17px 20px; border-radius: var(--radius-lg);
  transition: transform var(--dur-mid) var(--ease), border-color var(--dur-mid) var(--ease),
              box-shadow var(--dur-mid) var(--ease), background var(--dur-mid) var(--ease);
}
html[data-ui-mode="studio"] .chapter-card:hover:not(.locked) {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 14px 30px -16px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.06);
}
html[data-ui-mode="studio"] .chapter-card h3 { font-family: var(--font-display); font-size: 17px; letter-spacing: -.01em; }
html[data-ui-mode="studio"] .chapter-card.done { box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.06), inset 3px 0 0 var(--accent); }
html[data-ui-mode="studio"] .chapter-card.current { box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.06), inset 3px 0 0 var(--blue); }

/* lesson rows: tactile, with an amber rail that appears on hover */
html[data-ui-mode="studio"] .lesson-row {
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
html[data-ui-mode="studio"] .lesson-row:hover:not(.locked) {
  transform: translateX(3px);
  box-shadow: var(--shadow-card), inset 3px 0 0 var(--accent);
}
html[data-ui-mode="studio"] .lesson-row h4 { font-size: 15px; }

/* chapter head + tiers in the display face */
html[data-ui-mode="studio"] .chapter-head h1 { font-family: var(--font-display); font-optical-sizing: auto; letter-spacing: -.02em; }
html[data-ui-mode="studio"] .tier-name { font-family: var(--font-display); font-size: 16px; }
html[data-ui-mode="studio"] .tier-head { transition: background var(--dur-mid) var(--ease); }

/* topbar: a touch more presence and a soft divider shadow */
html[data-ui-mode="studio"] .topbar { box-shadow: 0 1px 0 rgba(255,255,255,.03), 0 10px 22px -20px rgba(0,0,0,.85); }
html[data-ui-mode="studio"] .brand-name { letter-spacing: -.02em; }

/* modals: layered, rounder */
html[data-ui-mode="studio"] .modal { border-radius: var(--radius-lg); box-shadow: var(--shadow-lift), inset 0 1px 0 rgba(255,255,255,.06); }
