/* Cairn's look: typefaces, colours for the dark and light themes, and the finish on shared components.
   This file is loaded last, so what it says wins over the older definitions in the other stylesheets. */

/* ---------- typefaces (hosted with the site; see app/fonts/README.txt) ---------- */
@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono Variable"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* Box-drawing, block, arrow, maths, Greek and Cyrillic glyphs of the same typeface. Without them the diagrams in lessons
   fall back to another font with a different character width, and their lines stop meeting. */
@font-face { font-family: "JetBrains Mono Variable"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-symbols-normal.woff2") format("woff2");
  unicode-range: U+0370-03FF,U+0400-045F,U+2070-209F,U+2190,U+2192,U+2194-21FF,U+2200-2211,U+2213-2214,U+2216-22FF,U+2300-23FF,U+2500-25FF,U+2600-266F,U+2713-2717; }

:root {
  --font-body: "Inter Variable", Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Inter Variable", Inter, "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", "Cascadia Code", "Cascadia Mono", Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ---------- colours ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0e;
  --sidebar: #0d0e12;
  --panel: #13151a;
  --panel-2: #1a1d23;
  --field: #0e1014;
  --ink: #f3f4f6;
  --ink-soft: #c9cdd4;
  --muted: #8d939d;
  --faint: #5f6570;
  --line: #22252c;
  --line-hover: #383d46;
  --hover: rgba(255, 255, 255, .055);
  --selected: rgba(255, 255, 255, .09);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --card-shadow: none;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --c-drill: #38bdf8;
  --c-build: #a3e635;
  --c-project: #fbbf24;
  --c-lesson: #c084fc;
  --code-bg: #0e1014;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --sidebar: #fbfbfc;
  --panel: #ffffff;
  --panel-2: #f2f3f6;
  --field: #ffffff;
  --ink: #0e1116;
  --ink-soft: #2b313a;
  --muted: #5d6570;
  --faint: #929aa5;
  --line: #e3e6eb;
  --line-hover: #c6cbd3;
  --hover: rgba(14, 17, 22, .045);
  --selected: rgba(14, 17, 22, .075);
  --shadow: 0 18px 44px rgba(15, 23, 42, .14);
  --card-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 1px rgba(15, 23, 42, .03);
  --good: #15803d;
  --bad: #dc2626;
  --warn: #b45309;
  --info: #2563eb;
  --c-drill: #0369a1;
  --c-build: #4d7c0f;
  --c-project: #b45309;
  --c-lesson: #7e22ce;
  --code-bg: #ffffff;
}

/* accent colours: [name] -> dark / light */
html[data-theme="dark"]  { --accent: #f2b84b; }
html[data-theme="light"] { --accent: #a8620a; }
html[data-theme="dark"][data-accent="indigo"]  { --accent: #8f96ff; }
html[data-theme="light"][data-accent="indigo"] { --accent: #4f46e5; }
html[data-theme="dark"][data-accent="violet"]  { --accent: #b99cff; }
html[data-theme="light"][data-accent="violet"] { --accent: #7c3aed; }
html[data-theme="dark"][data-accent="teal"]    { --accent: #3fd6b8; }
html[data-theme="light"][data-accent="teal"]   { --accent: #0d7d6c; }
html[data-theme="dark"][data-accent="rose"]    { --accent: #fb8fb5; }
html[data-theme="light"][data-accent="rose"]   { --accent: #be3a6c; }
html[data-theme="dark"][data-accent="blue"]    { --accent: #6fa8ff; }
html[data-theme="light"][data-accent="blue"]   { --accent: #2563eb; }
html[data-theme="dark"][data-accent="iron"]    { --accent: #b4bfcc; }
html[data-theme="light"][data-accent="iron"]   { --accent: #4b5766; }
html[data-theme="dark"][data-accent="ember"]   { --accent: #ff8a5c; }
html[data-theme="light"][data-accent="ember"]  { --accent: #c2410c; }
html { --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent); --accent-ink: color-mix(in srgb, var(--accent) 10%, #0b0c0f); }
html[data-theme="light"] { --accent-ink: #ffffff; --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent); }

/* ---------- type ---------- */
body { letter-spacing: -.006em; font-optical-sizing: auto; text-rendering: optimizeLegibility; }
.display, h2.section, .brand-name, .stat b, .empty h3, .continue .where, .trail-card .t, .modal h3, .flash-q, .card-head h3, .login-card h1, .pitch-title,
.prose h2, .lesson-foot .card div, .side-course-head .name, .side-course .name, .wb-top .title, .admin-stats .stat b, .boot-text {
  font-family: var(--font-display); font-weight: 650; letter-spacing: -.021em;
}
.display { font-weight: 700; letter-spacing: -.032em; font-size: calc(36px * var(--text-scale)); line-height: 1.1; }
.display.small { font-size: calc(27px * var(--text-scale)); }
.pitch-title { font-weight: 720; letter-spacing: -.038em; line-height: 1.04; }
h2.section { font-size: calc(20px * var(--text-scale)); letter-spacing: -.02em; }
h2.section .aside { font-weight: 400; letter-spacing: 0; }
.brand-name { font-weight: 700; letter-spacing: -.03em; }
.stat b, .admin-stats .stat b { font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.continue .where { font-size: 23px; letter-spacing: -.025em; }
.card h3 { font-weight: 600; letter-spacing: -.012em; }
.lede { color: var(--muted); line-height: 1.6; }
.eyebrow { font-weight: 600; letter-spacing: .13em; }
.chip, .side-label, .ms-title, .stat span, .brand-sub, .cap-label, .saved-title { font-weight: 550; }
code, pre, kbd, .mono { font-family: var(--font-mono); }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }

/* ---------- surfaces ---------- */
.card { box-shadow: var(--card-shadow); border-radius: var(--radius); }
.card.link { transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
html[data-theme="light"] .card.link:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, .08); }
.list { box-shadow: var(--card-shadow); }
.continue { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, var(--panel)), var(--panel) 58%); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.site-header { background: color-mix(in srgb, var(--sidebar) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
html[data-theme="light"] .site-header { box-shadow: 0 1px 0 rgba(15, 23, 42, .03); }
.modal, .palette, .user-menu { border-radius: 16px; }
.overlay { background: rgba(4, 5, 8, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
html[data-theme="light"] .overlay { background: rgba(15, 23, 42, .28); }
.toast { border-radius: 12px; box-shadow: var(--shadow); }
.toast.update { display: flex; align-items: center; gap: 14px; }
body, .card, .site-header, .sidebar, .btn, input, textarea, select { transition: background-color .18s, border-color .18s, color .18s; }

/* ---------- controls ---------- */
.btn { font-weight: 550; border-radius: 10px; letter-spacing: -.005em; box-shadow: var(--card-shadow); transition: background-color .15s, border-color .15s, color .15s, filter .15s, transform .08s, box-shadow .15s; }
.btn.small { border-radius: 9px; }
.btn.ghost { box-shadow: none; }
.btn.primary { font-weight: 620; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .22); }
html[data-theme="light"] .btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(15, 23, 42, .18); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:focus-visible, .icon-btn:focus-visible, .hnav:focus-visible, .nav-item:focus-visible, .lesson-link:focus-visible, .h-user:focus-visible, .h-search:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn { border-radius: 9px; }
input[type="text"], input[type="number"], input[type="password"], textarea, select, .field-input, .login-card input { border-radius: 10px; transition: border-color .15s, box-shadow .15s, background-color .18s; }
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, textarea:focus, select:focus, .field-input:focus, .login-card input:focus, #app .card textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.login-card label.keep input:focus { box-shadow: none; }
.seg { border-radius: 11px; }
.seg button { border-radius: 8px; font-weight: 500; }
.seg button.on { background: var(--panel); box-shadow: 0 0 0 1px var(--line), var(--card-shadow); }
html[data-theme="dark"] .seg button.on { background: var(--panel-2); }
kbd { border-radius: 6px; font-size: 10px; background: var(--panel-2); border-color: var(--line); }
.chip { letter-spacing: .07em; }
.bar { background: var(--selected); }

/* ---------- navigation ---------- */
.hnav { font-weight: 520; }
.hnav.active { font-weight: 600; }
.nav-item { border-radius: 9px; font-weight: 480; }
.nav-item.active { font-weight: 580; background: var(--selected); }
.lesson-link { border-radius: 8px; }
.side-label { letter-spacing: .13em; }
.h-search, .h-user, .h-course { transition: border-color .15s, background-color .18s; }
.h-streak b { font-variant-numeric: tabular-nums; }

/* ---------- light theme: details that need their own treatment ---------- */
html[data-theme="light"] .brand-tile { color: #ffffff; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); }
html[data-theme="light"] .badge.earned .badge-icon { color: #ffffff; }
html[data-theme="light"] .heat i, html[data-theme="light"] .heat-legend i { background: #e7e9ee; }
html[data-theme="light"] .heat i[data-l="1"], html[data-theme="light"] .heat-legend i[data-l="1"] { background: color-mix(in srgb, var(--accent) 28%, #fff); }
html[data-theme="light"] .heat i[data-l="2"], html[data-theme="light"] .heat-legend i[data-l="2"] { background: color-mix(in srgb, var(--accent) 52%, #fff); }
html[data-theme="light"] .heat i[data-l="3"], html[data-theme="light"] .heat-legend i[data-l="3"] { background: color-mix(in srgb, var(--accent) 78%, #fff); }
html[data-theme="light"] .heat i[data-l="4"], html[data-theme="light"] .heat-legend i[data-l="4"] { background: var(--accent); }
html[data-theme="light"] .login-page { background: radial-gradient(1100px 600px at 12% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%),
  radial-gradient(800px 500px at 100% 110%, color-mix(in srgb, var(--info) 9%, transparent), transparent 60%), var(--bg); }
html[data-theme="light"] .pitch-code { box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
html[data-theme="light"] .login-card { box-shadow: 0 12px 40px rgba(15, 23, 42, .10); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, .18); background-clip: content-box; border: 3px solid transparent; }

/* ---------- the sign-in page ---------- */
.login-card h1 { font-size: 25px; }
.pitch-points b { font-weight: 620; letter-spacing: -.01em; }
.lang { font-weight: 500; }
.saved-account b { font-weight: 620; }

/* ---------- home ---------- */
.activity-card { display: flex; flex-direction: column; }
.activity-card .heat-wrap { margin-block: auto; padding-block: 6px; }
.activity-card .heat { grid-template-rows: repeat(7, 13px); gap: 4px; justify-content: space-between; }
.activity-card .heat i { width: 13px; height: 13px; border-radius: 4px; }
.badge { opacity: .7; }

/* ---------- light theme: the milestone and course colours are pastels made for a dark page ---------- */
html[data-theme="light"] .ms-title, html[data-theme="light"] .ms-mini, html[data-theme="light"] .summary-card .label { color: color-mix(in srgb, var(--ms, var(--accent)) 50%, #0e1116); }
html[data-theme="light"] .course-card .glyph, html[data-theme="light"] .side-course-head .glyph { color: color-mix(in srgb, var(--cc, var(--accent)) 52%, #0e1116); }
html[data-theme="light"] .eyebrow[style*="color"] { filter: brightness(.58) saturate(1.7); }
html[data-theme="light"] .lesson-link.done .tick { background: color-mix(in srgb, var(--ms, var(--good)) 62%, #0e1116); color: #ffffff; }
html[data-theme="light"] .status-dot.passed { color: #ffffff; }
html[data-theme="light"] .side-progress i { background: color-mix(in srgb, var(--cc, var(--accent)) 70%, #0e1116); }

/* ---------- course map and menu details ---------- */
.card.link.trail-card { display: flex; }                 /* the progress ring sits at the right of the card */
.side-course-head .name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.2; }
html[data-theme="light"] .chip[style*="--c"] { filter: brightness(.6) saturate(1.7); }
html[data-theme="light"] .trail-node { color: color-mix(in srgb, var(--ms) 45%, #0e1116); border-color: color-mix(in srgb, var(--ms) 72%, #0e1116); }
html[data-theme="light"] .trail-node.done { color: #ffffff; background: color-mix(in srgb, var(--ms) 62%, #0e1116); }
html[data-theme="light"] .trail-card { border-left-color: color-mix(in srgb, var(--ms) 75%, #0e1116); }
