/* Light theme (.docs/specs/2026-11-28-light-dark-themes). Dark is the base in site.css (:root);
   an inline script in <head> resolves Sistema/Claro/Escuro to html[data-theme] before first paint. */

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e8;          /* parchment */
  --bg-2: #fffdf8;
  --bg-3: #efe7da;
  --text: #1f1b17;
  --muted: #5a5149;
  --steel: #3a332c;
  --ember-ink: #a9410f;   /* forge orange dark enough for small text (AA on parchment) */
  --ember-line: rgba(194, 80, 30, .45);
  --line: rgba(43, 33, 24, .14);
  --line-strong: rgba(43, 33, 24, .38);
  --scrim: rgba(246, 241, 232, .6);
  --window-bg: linear-gradient(180deg, #fffdf8, #f7f0e4);
  --nav-scrolled: rgba(5, 5, 5, .82);
  --shadow: rgba(80, 50, 20, .22);
  --error: #b3261e;
  --error-line: #c2410c;
}
html[data-theme="dark"] { color-scheme: dark; }

/* D2: the forge stays lit at night. Heroes and the nav keep the dark tokens in both themes:
   the 3D forge, fire and incandescent mark need a dark backdrop for their glow. */
html[data-theme="light"] :is(.hero, .page-hero, .nav) {
  color-scheme: dark;
  --bg: #050505; --bg-2: #0e0e0f; --bg-3: #161618;
  --text: #e6e9ef; --muted: #a9b4b6; --steel: #c2cecf;
  --ember-ink: var(--ember); --ember-line: rgba(242, 107, 56, .55);
  --line: rgba(194,206,207,.12); --line-strong: rgba(194,206,207,.35);
  --scrim: rgba(5,5,5,.55); --window-bg: linear-gradient(180deg, rgba(22,22,24,.92), rgba(10,10,11,.92));
  --shadow: rgba(0,0,0,.9);
  color: var(--text);
}
html[data-theme="light"] :is(.hero, .page-hero) { background-color: var(--bg); box-shadow: inset 0 -1px 0 rgba(242, 107, 56, .35); }

/* Light sections: line-art images and ember particles were drawn for a dark page. */
html[data-theme="light"] .bg-layer--pattern { filter: invert(1); opacity: .16; }
html[data-theme="light"] .bg-layer--particles { mix-blend-mode: multiply; opacity: .55; }
/* the mold of the process timeline is dark metal in both themes: keep its number light */
html[data-theme="light"] .step__num { color: #d8cfc4; }
html[data-theme="light"] .tile3d__face { color: #e89766; }

/* Characters kit on light sections: invert the marble sheets into ink, use ink line tokens. */
html[data-theme="light"][data-hf-palette="marble"] { --hf-line: #2b2b2b; --hf-key: #8fa1a1; --hf-paper: var(--bg); }
html[data-theme="light"] .hf-bg { opacity: .35; }
html[data-theme="light"] .hf-bg--agora { opacity: 1; }
html[data-theme="light"] :is(.hf-bg, .hf-divider, .hf-stage) :is(.hf-sprite, .hf-stage__anvil) { filter: invert(1) hue-rotate(180deg); }

/* ---------- Theme setting (nav) ---------- */
.theme-switch { display: inline-flex; gap: 2px; margin: 0 0 0 10px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; }
.theme-switch__opt { position: relative; display: grid; place-items: center; width: 34px; height: 30px; border-radius: 999px; color: var(--steel); cursor: pointer; }
.theme-switch__opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.theme-switch__opt svg { width: 16px; height: 16px; pointer-events: none; }
.theme-switch__opt:hover { color: var(--text); }
.theme-switch__opt:has(input:checked) { background: var(--ember); color: #0a0a0a; }
.theme-switch__opt:has(input:focus-visible) { outline: 2px solid var(--ember); outline-offset: 2px; }
@media (max-width: 899px) {
  .theme-switch { align-self: flex-start; margin: 0; }
  .theme-switch__opt { width: 48px; height: 40px; }
}

/* ---------- Language switcher (nav) ---------- */
.lang-switch { display: inline-flex; gap: 2px; margin-left: 10px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; }
.lang-switch a { display: grid; place-items: center; min-width: 34px; height: 30px; padding: 0 6px; border-radius: 999px; color: var(--steel); font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a[aria-current="true"] { background: var(--steel); color: #0a0a0a; }
@media (max-width: 899px) { .lang-switch { align-self: flex-start; margin: 0; } .lang-switch a { min-width: 48px; height: 40px; } }
