/* ═══════════════════════════════════════════════════════════════════
   Jarvis Playground v3 — Theme: Ember (warm)
   ─────────────────────────────────────────────────────────────────
   The warm variant. Amber → coral → copper brand ramp over deep
   amber-maroon surfaces. "Ember" = the dying coals in a firepit:
   candlelight amber leading, burnt-copper body, coral tail.

   Contract (mirrors themes/aurora.css exactly):
     • ACTIVE when <html data-theme="ember"> is present.
           ember  ⇔ html[data-theme="ember"]
           aurora ⇔ html:not([data-theme="ember"])
     • Every rule is scoped to the ember partition; the two theme
       files never overlap, so load order between them is
       irrelevant and no !important is needed.
     • Only semantic tokens + theme-owned chrome (body background,
       selection, scrollbar) are set. Components reference roles,
       so this remap re-skins the entire v3 layer — including every
       color-mix() tint and glow — with zero component edits.
     • DIFFERENCES FROM AURORA (intentional, per design brief):
         – warmer dark surfaces (amber/maroon undertone, not blue)
         – orange/red accent family instead of cyan/purple
         – gradient direction 115deg (top-right → bottom-left)
           vs aurora's 135deg — the light source is mirrored
         – softer radii (rounded coals vs crisp ice)
         – warmer shadow color (brown-black, not blue-black)

   Palette:
     bg base      #140b08   bg raised    #1c110b
     bg surface   #241610   bg elevated  #2c1c12
     text         #f5e9dc   (warm cream)
     amber        #ffb347   coral        #ff6b4a
     copper       #c1663e   gold         #e8a33d
   ═══════════════════════════════════════════════════════════════════ */

:root[data-theme="ember"] {

  /* ── Backgrounds — deep amber/maroon family ─────────────────── */
  --v3-bg: #140b08;
  --v3-bg-raised: #1c110b;
  --v3-bg-surface: #241610;
  --v3-bg-elevated: #2c1c12;
  --v3-bg-overlay: rgba(20, 11, 8, 0.92);

  /* ── Text — warm cream ──────────────────────────────────────── */
  --v3-text: #f5e9dc;
  --v3-text-secondary: rgba(245, 233, 220, 0.72);
  --v3-text-muted: rgba(245, 233, 220, 0.55);
  --v3-text-inverse: #140b08;

  /* ── Brand hues — the Ember ramp ──────────────────────────────
     Hues are mapped onto the SAME role slots aurora uses, so
     components don't need to know which theme is active:
       --v3-cyan    → amber   (primary accent, "the fire")
       --v3-purple  → copper  (secondary, "the coals")
       --v3-magenta → coral   (hot tail, "the spark")
       --v3-emerald → olive   (success, warm green)
       --v3-amber   → gold    (warning, candlelight)
       --v3-rose    → scarlet (error, deep red) */
  --v3-cyan: #ffb347;
  --v3-purple: #c1663e;
  --v3-magenta: #ff6b4a;
  --v3-emerald: #a8c96a;
  --v3-amber: #ffd166;
  --v3-rose: #e5484d;

  /* ── Brand roles ────────────────────────────────────────────── */
  --v3-accent: var(--v3-cyan);      /* amber */
  --v3-accent-2: var(--v3-purple);  /* copper */
  --v3-accent-3: var(--v3-magenta); /* coral */
  --v3-accent-2-text: #c1663e;      /* copper — ember's accent-2 text hue */

  /* ── Gradients — warm, 115° (top-right → bottom-left) ─────────
     Mirrored direction vs aurora's 135°: in ember the light comes
     from the upper right, like a fire on the right side of the
     frame. */
  --v3-grad-angle: 115deg;
  --v3-grad-brand: linear-gradient(var(--v3-grad-angle),
      var(--v3-cyan) 0%, var(--v3-magenta) 55%, var(--v3-amber) 110%);
  --v3-grad-brand-soft: linear-gradient(var(--v3-grad-angle),
      color-mix(in srgb, var(--v3-cyan) 14%, transparent),
      color-mix(in srgb, var(--v3-magenta) 16%, transparent));
  --v3-grad-text: linear-gradient(var(--v3-grad-angle),
      var(--v3-amber) 0%, var(--v3-cyan) 45%, var(--v3-magenta) 90%);
  --v3-grad-surface: linear-gradient(195deg,
      rgba(255, 220, 180, 0.06) 0%, rgba(255, 220, 180, 0.015) 100%);

  /* ── Semantic state — warm hues ─────────────────────────────── */
  --v3-success: var(--v3-emerald);  /* olive */
  --v3-warning: var(--v3-amber);    /* gold */
  --v3-error: var(--v3-rose);       /* scarlet */
  --v3-info: var(--v3-cyan);        /* amber */

  /* ── Borders — warm white lines, amber focus ────────────────── */
  --v3-border: rgba(245, 233, 220, 0.10);
  --v3-border-strong: rgba(245, 233, 220, 0.20);
  --v3-border-hover: color-mix(in srgb, var(--v3-cyan) 40%, transparent);
  --v3-border-focus: var(--v3-cyan);

  /* ── Shadow color — brown-black, not blue-black ─────────────── */
  --v3-shadow-color: rgba(8, 4, 2, 0.6);

  /* ── Ambient (page background) — firelight wash ───────────────
     A warm ember glow rising from the bottom (like coals) with a
     faint copper field at the top. */
  --v3-ambient-bg:
    radial-gradient(ellipse 100% 70% at 50% 115%,
      color-mix(in srgb, var(--v3-magenta) 14%, transparent), transparent 60%),
    radial-gradient(ellipse 120% 80% at 50% -20%,
      color-mix(in srgb, var(--v3-purple) 10%, transparent), transparent 55%),
    var(--v3-bg);

  /* ── Selection & scrollbar tints ────────────────────────────── */
  --v3-selection-bg: color-mix(in srgb, var(--v3-cyan) 30%, transparent);
  --v3-scroll-thumb: linear-gradient(180deg,
      color-mix(in srgb, var(--v3-cyan) 40%, transparent),
      color-mix(in srgb, var(--v3-magenta) 40%, transparent));
  --v3-scroll-thumb-hover: linear-gradient(180deg,
      color-mix(in srgb, var(--v3-cyan) 70%, transparent),
      color-mix(in srgb, var(--v3-magenta) 70%, transparent));

  /* ── Radii — a touch softer than aurora (rounded coals) ─────── */
  --v3-radius-sm: 8px;
  --v3-radius: 12px;
  --v3-radius-md: 16px;
  --v3-radius-lg: 24px;
  --v3-radius-xl: 30px;

  /* ── Theme identity (consumed by theme-toggle.js) ───────────── */
  --v3-theme-color: #140b08;
}

/* ─────────────────────────────────────────────────────────────────
   Ember chrome — body background, selection, scrollbar.
   Scoped to the ember partition (see contract above).
   ───────────────────────────────────────────────────────────────── */
html[data-theme="ember"] body {
  background: var(--v3-ambient-bg);
  background-attachment: fixed;
  color: var(--v3-text);
}

html[data-theme="ember"] ::selection {
  background: var(--v3-selection-bg);
  color: var(--v3-text);
}

/* scrollbar — warm gradient thumb */
html[data-theme="ember"] {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--v3-accent) 35%, transparent)
                   color-mix(in srgb, var(--v3-text) 4%, transparent);
}
html[data-theme="ember"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="ember"] ::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--v3-text) 2%, transparent);
}
html[data-theme="ember"] ::-webkit-scrollbar-thumb {
  background: var(--v3-scroll-thumb);
  border-radius: var(--v3-radius-full);
  border: 2px solid var(--v3-bg);
}
html[data-theme="ember"] ::-webkit-scrollbar-thumb:hover {
  background: var(--v3-scroll-thumb-hover);
}

/* ─────────────────────────────────────────────────────────────────
   Reduced motion
   ─────────────────────────────────────────────────────────────────
   Same policy as aurora: no keyframes in this file; the global
   kill switch in tokens.css is the safety net. Kept for
   self-containment. */
@media (prefers-reduced-motion: reduce) {
  html[data-theme="ember"] *,
  html[data-theme="ember"] *::before,
  html[data-theme="ember"] *::after {
    animation: none !important;
    transition: none !important;
  }
}
