/* Swivo colour themes: 5 accents x light/dark = 10 looks. Set on <html data-theme="violet|blue|green|orange|teal" data-mode="light|dark">
   by js/theme.js (default violet + the visitor's system light/dark; ?theme= / &mode= preview links; the sun/moon toggle).
   Every pair here was checked for WCAG AA (4.5:1) text contrast: ink/muted/accent-text on bg + surface, on-accent on btn
   and btn-hover. --accent is the brand colour for fills/lines (decorative); --accent-text is the accent when used as text.
   Solid colours only. Generated from one palette table; if you change a colour, re-check contrast (shots/test_v6.py does). */

/* violet: fog white / soft black */
html[data-theme="violet"][data-mode="light"]{--bg:#F6F6FA;--surface:#FFFFFF;--soft:#ECECF3;--ink:#17161F;--muted:#5D5C6B;--faint:#9A99A8;--line:#E3E3EB;--chip:#DCDCE6;--accent:#6D5BFF;--btn:#6D5BFF;--btn-hover:#5A47F2;--on-accent:#FFFFFF;--accent-text:#5B48F0;--accent-wash:#EDEBFF;--ok:#2F8F5B;--err:#B3261E;--shadow:rgba(20,20,30,.28);--backdrop:rgba(20,20,30,.28);color-scheme:light}
html[data-theme="violet"][data-mode="dark"]{--bg:#111114;--surface:#1A1A20;--soft:#24242B;--ink:#EEEEF3;--muted:#A3A3B0;--faint:#6B6B78;--line:#2A2A32;--chip:#34343E;--accent:#8B7BFF;--btn:#8B7BFF;--btn-hover:#9F91FF;--on-accent:#111114;--accent-text:#A496FF;--accent-wash:#25223D;--ok:#5FD38D;--err:#FF8A80;--shadow:rgba(0,0,0,.55);--backdrop:rgba(0,0,0,.55);color-scheme:dark}
/* blue: signal blue on paper / night */
html[data-theme="blue"][data-mode="light"]{--bg:#FAFAF8;--surface:#FFFFFF;--soft:#F0F0EC;--ink:#141821;--muted:#5A5F6B;--faint:#9A9EA8;--line:#E6E6E1;--chip:#DEDED8;--accent:#2F6BFF;--btn:#2B64F5;--btn-hover:#2357DD;--on-accent:#FFFFFF;--accent-text:#2459DB;--accent-wash:#EAF0FF;--ok:#2F8F5B;--err:#B3261E;--shadow:rgba(20,20,30,.28);--backdrop:rgba(20,20,30,.28);color-scheme:light}
html[data-theme="blue"][data-mode="dark"]{--bg:#0E1626;--surface:#152035;--soft:#1C2840;--ink:#ECF0F7;--muted:#9EA9BD;--faint:#5A6782;--line:#22304A;--chip:#2C3C5A;--accent:#5B8CFF;--btn:#5B8CFF;--btn-hover:#7AA2FF;--on-accent:#0B1220;--accent-text:#7FA5FF;--accent-wash:#1A2A4A;--ok:#5FD38D;--err:#FF8A80;--shadow:rgba(0,0,0,.55);--backdrop:rgba(0,0,0,.55);color-scheme:dark}
/* green: forest on cream / OSD green on deep green-black */
html[data-theme="green"][data-mode="light"]{--bg:#F7F4EC;--surface:#FFFDF8;--soft:#EEEADF;--ink:#18201B;--muted:#5C6359;--faint:#9C9F94;--line:#E5E0D3;--chip:#DCD6C7;--accent:#1F7A4D;--btn:#1F7A4D;--btn-hover:#196640;--on-accent:#FFFFFF;--accent-text:#1B6E45;--accent-wash:#E3F0E6;--ok:#2F8F5B;--err:#B3261E;--shadow:rgba(20,20,30,.28);--backdrop:rgba(20,20,30,.28);color-scheme:light}
html[data-theme="green"][data-mode="dark"]{--bg:#0E1712;--surface:#14211A;--soft:#1B2B22;--ink:#E8F2EB;--muted:#98AA9E;--faint:#52665A;--line:#1F3128;--chip:#2A4236;--accent:#39FF88;--btn:#39FF88;--btn-hover:#6CFFA6;--on-accent:#0A140E;--accent-text:#39FF88;--accent-wash:#163423;--ok:#5FD38D;--err:#FF8A80;--shadow:rgba(0,0,0,.55);--backdrop:rgba(0,0,0,.55);color-scheme:dark}
/* orange: friendly orange on warm white / warm black (dark text on the orange button) */
html[data-theme="orange"][data-mode="light"]{--bg:#FFFAF5;--surface:#FFFFFF;--soft:#F7EFE6;--ink:#1E1813;--muted:#675D54;--faint:#A89C90;--line:#EFE4D8;--chip:#E8DBCC;--accent:#FF7A1A;--btn:#FF7A1A;--btn-hover:#FF8E3D;--on-accent:#1E1205;--accent-text:#B04A00;--accent-wash:#FFEEDD;--ok:#2F8F5B;--err:#B3261E;--shadow:rgba(20,20,30,.28);--backdrop:rgba(20,20,30,.28);color-scheme:light}
html[data-theme="orange"][data-mode="dark"]{--bg:#141210;--surface:#1D1A17;--soft:#27231F;--ink:#F3EEE9;--muted:#ABA196;--faint:#6E655C;--line:#2C2723;--chip:#3B342E;--accent:#FF8A33;--btn:#FF8A33;--btn-hover:#FFA05A;--on-accent:#140C04;--accent-text:#FF9A4D;--accent-wash:#33230F;--ok:#5FD38D;--err:#FF8A80;--shadow:rgba(0,0,0,.55);--backdrop:rgba(0,0,0,.55);color-scheme:dark}
/* teal: teal on warm white / cyan-teal on carbon (dark text on the teal button) */
html[data-theme="teal"][data-mode="light"]{--bg:#FBFAF7;--surface:#FFFFFF;--soft:#F1F0EB;--ink:#151B1B;--muted:#5A6262;--faint:#9AA1A0;--line:#E6E5E0;--chip:#DEDDD7;--accent:#0FA3A3;--btn:#0FA3A3;--btn-hover:#1BB7B6;--on-accent:#04201F;--accent-text:#0A7676;--accent-wash:#E0F4F3;--ok:#2F8F5B;--err:#B3261E;--shadow:rgba(20,20,30,.28);--backdrop:rgba(20,20,30,.28);color-scheme:light}
html[data-theme="teal"][data-mode="dark"]{--bg:#161718;--surface:#1E2021;--soft:#27292A;--ink:#ECEFEF;--muted:#A0A8A8;--faint:#646B6B;--line:#2B2E2F;--chip:#373B3C;--accent:#22D3C5;--btn:#22D3C5;--btn-hover:#4FDFD3;--on-accent:#061A18;--accent-text:#3ADCCF;--accent-wash:#123331;--ok:#5FD38D;--err:#FF8A80;--shadow:rgba(0,0,0,.55);--backdrop:rgba(0,0,0,.55);color-scheme:dark}

/* ---------- light/dark button (top right) ---------- */
.mode-btn{position:relative;display:grid;place-items:center;flex:none;width:44px;height:44px;margin:-10px -12px -10px 0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer;transition:color .2s}
@media (hover:hover){.mode-btn{width:32px;height:32px;margin:-6px -8px -6px 0}}
.mode-btn:hover{color:var(--ink)}
.mode-btn svg{position:absolute;width:16px;height:16px;overflow:visible}
.mode-btn .sun-core,.mode-btn .sun-rays,.mode-btn .moon{transform-box:view-box;transform-origin:12px 12px;transition:transform .8s cubic-bezier(.16,1,.3,1),opacity .4s ease}
.mode-btn .moon{opacity:0;transform:rotate(-70deg) scale(.4)}
html[data-mode="dark"] .mode-btn .sun-rays{opacity:0;transform:rotate(90deg) scale(.3)}
html[data-mode="dark"] .mode-btn .sun-core{opacity:0;transform:scale(1.6)}
html[data-mode="dark"] .mode-btn .moon{opacity:1;transform:none}

/* The circle wipe: the new colours grow out of the button (View Transitions; js/theme.js decides when).
   600 ms, fast start then a soft finish. Moving the mouse away, clicking, scrolling or a key press finishes it at
   once, and a click made during it still reaches its button (js/theme.js), so the page never feels stuck. */
::view-transition-group(root){animation-duration:.6s}
::view-transition-old(root),::view-transition-new(root){mix-blend-mode:normal}
::view-transition-old(root){z-index:1;animation:none}
::view-transition-new(root){z-index:2;animation:swivo-wipe .6s cubic-bezier(.22,1,.36,1) forwards}
@keyframes swivo-wipe{
  from{clip-path:circle(0px at var(--wipe-x,100%) var(--wipe-y,0px))}
  to{clip-path:circle(150vmax at var(--wipe-x,100%) var(--wipe-y,0px))}
}
@media (prefers-reduced-motion:reduce){
  .mode-btn .sun-core,.mode-btn .sun-rays,.mode-btn .moon{transition:none}
  ::view-transition-new(root){animation:none}
}

/* ---------- palette switcher (bottom left; ?themes=0 hides it) ---------- */
.theme-switch{position:fixed;left:12px;bottom:12px;z-index:60;display:flex;align-items:center;gap:6px;padding:6px 6px 6px 8px;background:var(--surface);border:1px solid var(--chip);border-radius:999px;box-shadow:0 8px 24px -14px var(--shadow);font:500 13px/1 "Geist",ui-sans-serif,system-ui,sans-serif}
.ts-dot{width:22px;height:22px;padding:0;border-radius:50%;border:2px solid var(--surface);outline:1px solid var(--chip);cursor:pointer}
.ts-dot[aria-pressed="true"]{outline:2px solid var(--ink)}
.ts-dot[data-t="violet"]{background:#6D5BFF}
.ts-dot[data-t="blue"]{background:#2F6BFF}
.ts-dot[data-t="green"]{background:#1F7A4D}
.ts-dot[data-t="orange"]{background:#FF7A1A}
.ts-dot[data-t="teal"]{background:#0FA3A3}
.ts-mode{margin-left:2px;min-width:52px;padding:6px 10px;border:1px solid var(--chip);border-radius:999px;background:var(--soft);color:var(--ink);cursor:pointer;font:inherit}
