/* Site themes (Research beta). Deep Blue is the default and needs no overrides.
   Hand-tuned theme variables and backgrounds live here; themes.generated.css re-colours the
   hard-coded colours in the other stylesheets (tools/build-themes.mjs). Load this file last. */

/* ---------- Light Mode: white surfaces, near-black text ---------- */
html[data-theme="light"]{
  --bg:#ffffff; --bg-2:#f5f7fa; --surface:#ffffff; --surface-2:#eef1f5;
  --ink:#0b0f14; --muted:#56616f; --line:#dde2e9; --line-2:#c6cdd7;
  --accent:#1d5fae; --accent-ink:#ffffff; --accent-soft:#e7eef8;
  --steel:linear-gradient(135deg,#1c2533 0%,#0b0f14 55%,#232d3b 100%);
  --steel-text:linear-gradient(180deg,#1a2230 0%,#0b0f14 100%);
  --brass:#3a4656; --brass-soft:#f1f4f8;
  --good:#1d8a57; --good-soft:#e5f5ec; --warn:#a86a08; --warn-soft:#fbf1df; --bad:#c23b2f; --bad-soft:#fbe9e7;
  --k-speed:#d0573a; --k-race:#a8822a; --k-end:#4c63c8; --k-aero:#2c7fbf; --k-tech:#5d6c7c; --k-kick:#8a5fbf; --k-easy:#9aa6b5; --k-acyc:#2f9a63;
  color-scheme:light;
}
html[data-theme="light"] body{background:var(--bg)}
html[data-theme="light"] .btn.primary{color:#fff}

/* ---------- Damascus: forged black and grey, flowing steel pattern behind everything ---------- */
html[data-theme="damascus"]{
  --bg:#0b0b0c; --bg-2:rgba(17,17,19,.9); --surface:rgba(21,21,23,.88); --surface-2:rgba(31,31,34,.92);
  --ink:#ecebe8; --muted:#a19f9a; --line:#2b2b2e; --line-2:#3d3d41;
  --accent:#cfd2d6; --accent-ink:#0b0b0c; --accent-soft:#25262a;
  --steel:linear-gradient(135deg,#f2f2f0 0%,#bdbdbb 42%,#ececea 58%,#9b9b99 100%);
  --steel-text:linear-gradient(180deg,#f4f4f2 0%,#dcdcda 48%,#a2a2a0 52%,#d4d4d2 100%);
  --brass:#cfcfcc; --brass-soft:rgba(24,24,26,.9);
  color-scheme:dark;
}
html[data-theme="damascus"] body{
  background:#0b0b0c url("img/damascus-texture.webp") center/720px repeat fixed;
}
/* A soft vignette keeps text crisp over the pattern. */
html[data-theme="damascus"] body::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
  background:radial-gradient(ellipse at 50% 30%,rgba(8,8,9,.35) 0%,rgba(8,8,9,.72) 70%,rgba(8,8,9,.86) 100%)}
html[data-theme="damascus"] .top{background:rgba(10,10,11,.86)}
html[data-theme="damascus"] body::before{background:#0b0b0c}

/* Smooth hand-off when switching themes (skipped with reduced motion). */
@media (prefers-reduced-motion:no-preference){
  html.theme-switching,html.theme-switching *{transition:background-color .25s ease,color .25s ease,border-color .25s ease!important}
}

/* ---------- Theme picker (Profile & data) ---------- */
.theme-picker{display:grid;gap:10px;margin-top:6px}
.theme-picker-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.theme-beta{font-size:9.5px;font-weight:700;letter-spacing:var(--track);text-transform:uppercase;color:var(--accent);border:1px solid var(--line-2);padding:1px 6px}
.theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.theme-option{display:grid;gap:8px;align-content:start;padding:8px;border:1px solid var(--line-2);border-radius:4px;background:var(--surface);color:var(--ink);text-align:left;cursor:pointer;font:inherit}
.theme-option:hover:not(:disabled){border-color:var(--muted)}
.theme-option[aria-checked="true"]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.theme-option:disabled{opacity:.55;cursor:not-allowed}
.theme-swatch{height:58px;border-radius:3px;border:1px solid rgba(128,128,128,.35);position:relative;overflow:hidden}
.theme-swatch::after{content:"";position:absolute;left:10px;right:34%;bottom:10px;height:8px;border-radius:2px;background:var(--sw-ink)}
.theme-swatch::before{content:"";position:absolute;left:10px;top:10px;width:38%;height:12px;border-radius:2px;background:var(--sw-accent)}
.theme-swatch[data-swatch="deep-blue"]{background:linear-gradient(125deg,#172637,#0a0e14);--sw-ink:#e6ebf2;--sw-accent:#7fb2ec}
.theme-swatch[data-swatch="light"]{background:#fff;--sw-ink:#0b0f14;--sw-accent:#1d5fae}
.theme-swatch[data-swatch="damascus"]{background:#0b0b0c url("img/damascus-texture.webp") center/260px;--sw-ink:#ecebe8;--sw-accent:#cfd2d6}
.theme-option-name{font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.theme-picker .scope{font-size:12px}
@media(max-width:520px){.theme-options{grid-template-columns:1fr}.theme-option{grid-template-columns:88px 1fr;align-items:center}.theme-swatch{height:44px}}
