/*
 * The look of cswithvarun (Varun's site), copied: its seven colour palettes in light and
 * dark, Geist and JetBrains Mono, white cards with a soft border and shadow, pill buttons
 * with an accent fill, tags, filter pills and callouts.
 *
 * The palette blocks below are cswithvarun's, value for value (tests/tokens.spec.js pins
 * them). Its [data-theme='dark'] selector is written here as .dark, which is how this app
 * marks the dark theme. Everything after the palettes is derived from them.
 *
 * Layout, spacing and type sizes are Tailwind utilities in the markup. This file holds what
 * utilities express badly: the tokens, the fonts, and components whose look depends on
 * state (buttons, answer options, the progress strip, the switch, the timer, callouts).
 *
 * These rules are not inside a cascade layer, so they win over Tailwind utilities that set
 * the same property. Do not put a bg-, border- or text-color utility on an element styled
 * here; change the rule instead.
 */

/* ---------- Fonts ----------
 * Self-hosted (SIL Open Font License 1.1; licence texts beside the files).
 * Geist for all text, JetBrains Mono for code. Nothing loads from another site.
 */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

/* ---------- Tokens that do not change with the theme ---------- */

:root {
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-primary: "Geist", var(--font-system);
  --font-heading: "Geist", var(--font-system);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --border-radius-2xs: 4px; /* inline code, callouts */
  --border-radius-xs: 8px; /* code blocks */
  --border-radius-sm: 10px;
  --border-radius-field: 14px; /* answer options, like the site's form fields */
  --border-radius: 20px; /* cards */
  --border-radius-lg: 28px;
  --border-radius-full: 9999px; /* buttons, tags, filter pills */

  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
}

/* ---------- Palettes ----------
 * Mint is the default (no data-palette). Rose, Sky, Slate, Lavender, Graphite and Mauve
 * are chosen in the footer and kept in the browser.
 */

/* ---- Copied from cswithvarun assets/css/palette.css ----
   Palette: Soft (mint surfaces, forest-green text, fresh-green accents)
   The default (mint) palette. Optional visitor palettes live in palette-<name>.css.
   Other colours derive from these tokens (theme.css), and
   scripts/generate-brand-assets.mjs reads the accent and surface colours from here
   for the logo, favicons and share images.
   Text colours are all 4.5:1 or better against every surface they sit on.
 */
:root {
  /* LOCKED: light palette approved by the site owner on 2026-11-22.
  Do not change these light-mode values without the owner's explicit request. */
  color-scheme: light;

  /* Surfaces: pale mint page, mint section bands, white cards on top */
  --bg-primary: #f1f8ee;
  --bg-secondary: #e4f2de;
  --bg-tertiary: #d6ebce;
  --bg-card: #fff;

  /* Text: dark forest green instead of black (11.9:1 on the page) */
  --text-primary: #14391c;
  --text-secondary: #2f4a35;
  --text-muted: #4b6650;

  /* Accent, in three roles:
  text    - links and small labels; must reach 4.5:1 on every surface
  fill    - buttons, active pills, chips, logo; a fresh mint with dark text on it (8.7:1)
  display - large headlines and big numbers; brighter, as large text needs only 3:1 */
  --color-primary: #1f6b38;
  --color-secondary: #14391c;
  --accent-fill: #8ad897;
  --on-accent: #0f2e17;
  --accent-display: #2b9147;
  --color-danger: #b91c1c;

  /* Borders: soft mint card edges; stronger edge for form controls (3:1) */
  --border-color: #d5e6ce;
  --border-strong: #6f8a72;
  --focus-ring: var(--color-primary);

  /* Platform badges */
  --platform-medium: #047857;
  --platform-substack: #9a3412;

  /* Code */
  --code-bg: #e8f3e3;
  --code-inline: var(--color-primary);
  --code-comment: #4b6650;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0e7490;
  --code-builtin: #9d174d;

  /* Soft, green-tinted shadows */
  --shadow-sm: 0 1px 2px rgb(20 57 28 / 0.05), 0 1px 3px rgb(20 57 28 / 0.05);
  --shadow-md: 0 4px 16px rgb(20 57 28 / 0.07);
  --shadow-lg: 0 12px 32px rgb(20 57 28 / 0.09);
}

.dark {
  /* LOCKED: dark palette approved by the site owner on 2026-11-22.
  Do not change these dark-mode values without the owner's explicit request. */
  color-scheme: dark;

  /* Neutral greys (no green tint) so the mint accent reads cleanly */
  --bg-primary: #0f0f10;
  --bg-secondary: #161618;
  --bg-tertiary: #1f1f22;
  --bg-card: #18181b;

  --text-primary: #ededef;
  --text-secondary: #c8c8cd;
  --text-muted: #a0a0a8;

  --color-primary: #86d494;
  --color-secondary: #ade6b6;
  --accent-fill: #86d494;
  --on-accent: #0f0f10;
  --accent-display: #86d494;
  --color-danger: #f87171;

  --border-color: #2a2a2e;
  --border-strong: #707078;

  --platform-medium: #34d399;
  --platform-substack: #fb923c;

  --code-bg: #161618;
  --code-comment: #a0a0a8;
  --code-keyword: #c4b5fd;
  --code-string: #6ee7b7;
  --code-number: #fcd34d;
  --code-name: #67e8f9;
  --code-builtin: #f9a8d4;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45);
}

/* ---- Copied from cswithvarun assets/css/palette-rose.css ----
   Optional palette: Rose
   Applies only when a visitor picks it (data-palette="rose" on <html>, set by
   theme-init.js from their saved choice). The default mint palette in
   palette.css is untouched. Text colours are 4.5:1 or better on every surface;
   large display text is 3:1 or better.
 */
:root[data-palette="rose"] {
  color-scheme: light;

  /* Surfaces: soft blush page, pink section bands, white cards */
  --bg-primary: #fdf3f6;
  --bg-secondary: #fbe7ee;
  --bg-tertiary: #f6d9e3;
  --bg-card: #fff;

  /* Text: deep plum-magenta instead of black */
  --text-primary: #4a0f2a;
  --text-secondary: #6b2a45;
  --text-muted: #874a63;

  /* Accent roles (see palette.css): text, fill, display */
  --color-primary: #b0175a;
  --color-secondary: #7d0f40;
  --accent-fill: #d6336c;
  --on-accent: #fff;
  --accent-display: #db2777;
  --color-danger: #b91c1c;

  --border-color: #f3d6e0;
  --border-strong: #a86e86;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #fbeaf0;
  --code-inline: var(--color-primary);
  --code-comment: #874a63;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0e7490;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(120 20 60 / 0.05), 0 1px 3px rgb(120 20 60 / 0.05);
  --shadow-md: 0 4px 16px rgb(120 20 60 / 0.08);
  --shadow-lg: 0 12px 32px rgb(120 20 60 / 0.1);
}

/* Dark rose: the same neutral greys as the default dark mode, with a pink accent */
:root[data-palette="rose"].dark {
  color-scheme: dark;

  --bg-primary: #0f0f10;
  --bg-secondary: #161618;
  --bg-tertiary: #1f1f22;
  --bg-card: #18181b;

  --text-primary: #ededef;
  --text-secondary: #c8c8cd;
  --text-muted: #a0a0a8;

  --color-primary: #f48fb1;
  --color-secondary: #f9a8c4;
  --accent-fill: #f48fb1;
  --on-accent: #0f0f10;
  --accent-display: #f48fb1;
  --color-danger: #f87171;

  --border-color: #2a2a2e;
  --border-strong: #707078;

  --platform-medium: #34d399;
  --platform-substack: #fb923c;

  --code-bg: #161618;
  --code-comment: #a0a0a8;
  --code-keyword: #c4b5fd;
  --code-string: #6ee7b7;
  --code-number: #fcd34d;
  --code-name: #67e8f9;
  --code-builtin: #f9a8d4;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45);
}

/* ---- Copied from cswithvarun assets/css/palette-sky.css ----
   Optional palette: Sky (icy blue, after the "Flinex" reference)
   Applies only when a visitor picks it (data-palette="sky" on <html>).
   Text is 4.5:1 or better on every surface; large display text 3:1 or better.
 */
:root[data-palette="sky"] {
  color-scheme: light;

  /* Surfaces: frosted pale-blue page, white cards */
  --bg-primary: #eef4fc;
  --bg-secondary: #e2ecf9;
  --bg-tertiary: #d3e2f6;
  --bg-card: #fff;

  /* Text: deep ink blue */
  --text-primary: #0f1b2d;
  --text-secondary: #33445c;
  --text-muted: #4b5b73;

  /* Accent roles: text, fill, display */
  --color-primary: #1858c4;
  --color-secondary: #0f3d8c;
  --accent-fill: #1f6feb;
  --on-accent: #fff;
  --accent-display: #2470e8;
  --color-danger: #b91c1c;

  --border-color: #d6e3f3;
  --border-strong: #61759a;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #e8f0fb;
  --code-inline: var(--color-primary);
  --code-comment: #4b5b73;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0e7490;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(20 50 100 / 0.05), 0 1px 3px rgb(20 50 100 / 0.05);
  --shadow-md: 0 4px 16px rgb(20 50 100 / 0.08);
  --shadow-lg: 0 12px 32px rgb(20 50 100 / 0.1);
}

/* Dark sky: the same neutral greys as the default dark mode, with a light-blue accent */
:root[data-palette="sky"].dark {
  color-scheme: dark;

  --bg-primary: #0f0f10;
  --bg-secondary: #161618;
  --bg-tertiary: #1f1f22;
  --bg-card: #18181b;

  --text-primary: #ededef;
  --text-secondary: #c8c8cd;
  --text-muted: #a0a0a8;

  --color-primary: #8ab8ff;
  --color-secondary: #b3d0ff;
  --accent-fill: #8ab8ff;
  --on-accent: #0f0f10;
  --accent-display: #8ab8ff;
  --color-danger: #f87171;

  --border-color: #2a2a2e;
  --border-strong: #707078;

  --platform-medium: #34d399;
  --platform-substack: #fb923c;

  --code-bg: #161618;
  --code-comment: #a0a0a8;
  --code-keyword: #c4b5fd;
  --code-string: #6ee7b7;
  --code-number: #fcd34d;
  --code-name: #67e8f9;
  --code-builtin: #f9a8d4;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45);
}

/* ---- Copied from cswithvarun assets/css/palette-slate.css ----
   Optional palette: Slate (dusty slate blue with peach, after the "Dog Magazine" reference)
   Applies only when a visitor picks it (data-palette="slate" on <html>).
   Unlike the other palettes, its dark mode keeps a slate-blue tint: that is the look.
   Text is 4.5:1 or better on every surface; large display text 3:1 or better.
 */
:root[data-palette="slate"] {
  color-scheme: light;

  /* Surfaces: misty blue-grey page, white cards */
  --bg-primary: #eef1f5;
  --bg-secondary: #e3e8ef;
  --bg-tertiary: #d6dde8;
  --bg-card: #fff;

  /* Text: deep slate */
  --text-primary: #1c2636;
  --text-secondary: #3a4658;
  --text-muted: #4f5c6f;

  /* Accent roles: terracotta text, peach fill, warm display */
  --color-primary: #93461f;
  --color-secondary: #6e3214;
  --accent-fill: #e8b894;
  --on-accent: #1c2636;
  --accent-display: #b25d2e;
  --color-danger: #b91c1c;

  --border-color: #dbe1ea;
  --border-strong: #66738a;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #e7ebf1;
  --code-inline: var(--color-primary);
  --code-comment: #4f5c6f;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0c6680;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(28 38 54 / 0.05), 0 1px 3px rgb(28 38 54 / 0.05);
  --shadow-md: 0 4px 16px rgb(28 38 54 / 0.08);
  --shadow-lg: 0 12px 32px rgb(28 38 54 / 0.1);
}

/* Dark slate: dusty slate-blue page, charcoal cards, peach accent */
:root[data-palette="slate"].dark {
  color-scheme: dark;

  --bg-primary: #3f4f69;
  --bg-secondary: #37465d;
  --bg-tertiary: #2f3c50;
  --bg-card: #323944;

  --text-primary: #f4f1ec;
  --text-secondary: #dde2ea;
  --text-muted: #c3cbd8;

  --color-primary: #f2c7a2;
  --color-secondary: #f7dcc4;
  --accent-fill: #f2c7a2;
  --on-accent: #1f2733;
  --accent-display: #f2c7a2;
  --color-danger: #fdb8b8;

  --border-color: #4a5870;
  --border-strong: #95a2b6;

  --platform-medium: #6ee7b7;
  --platform-substack: #fdba74;

  --code-bg: #2b3544;
  --code-comment: #c3cbd8;
  --code-keyword: #d8ccff;
  --code-string: #a7f3d0;
  --code-number: #fde68a;
  --code-name: #a5f3fc;
  --code-builtin: #fbcfe8;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.25);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.3);
}

/* ---- Copied from cswithvarun assets/css/palette-lavender.css ----
   Optional palette: Lavender
   Pale lilac with a soft, dusty violet accent (between Rose and Sky).
   Applies only when a visitor picks it (data-palette="lavender" on <html>).
   Dark mode uses the same neutral greys as the default palette.
   Text is 4.5:1 or better on every surface; large display text 3:1 or better.
 */
:root[data-palette="lavender"] {
  color-scheme: light;

  --bg-primary: #f6f3fd;
  --bg-secondary: #ece6fb;
  --bg-tertiary: #e0d7f7;
  --bg-card: #fff;

  --text-primary: #2a1f4d;
  --text-secondary: #463b6b;
  --text-muted: #5d5180;

  /* Accent roles: text, fill, display */
  --color-primary: #5a4a96;
  --color-secondary: #3f3270;
  --accent-fill: #cbbcf0;
  --on-accent: #2a1f4d;
  --accent-display: #7f6bbf;
  --color-danger: #b91c1c;

  --border-color: #e3dcf6;
  --border-strong: #7f74a6;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #efeafb;
  --code-inline: var(--color-primary);
  --code-comment: #5d5180;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0c6680;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(60 40 140 / 0.05), 0 1px 3px rgb(60 40 140 / 0.05);
  --shadow-md: 0 4px 16px rgb(60 40 140 / 0.08);
  --shadow-lg: 0 12px 32px rgb(60 40 140 / 0.1);
}

:root[data-palette="lavender"].dark {
  color-scheme: dark;

  --bg-primary: #0f0f10;
  --bg-secondary: #161618;
  --bg-tertiary: #1f1f22;
  --bg-card: #18181b;

  --text-primary: #ededef;
  --text-secondary: #c8c8cd;
  --text-muted: #a0a0a8;

  --color-primary: #c3b6ec;
  --color-secondary: #dcd3f6;
  --accent-fill: #c3b6ec;
  --on-accent: #0f0f10;
  --accent-display: #c3b6ec;
  --color-danger: #fca5a5;

  --border-color: #2a2a2e;
  --border-strong: #707078;

  --platform-medium: #6ee7b7;
  --platform-substack: #fdba74;

  --code-bg: #161618;
  --code-comment: #a0a0a8;
  --code-keyword: #d8ccff;
  --code-string: #a7f3d0;
  --code-number: #fde68a;
  --code-name: #a5f3fc;
  --code-builtin: #fbcfe8;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.4);
}

/* ---- Copied from cswithvarun assets/css/palette-graphite.css ----
   Optional palette: Graphite
   Light grey and white with near-black pill buttons (after the dashboard references).
   Applies only when a visitor picks it (data-palette="graphite" on <html>).
   Dark mode uses the same neutral greys as the default palette.
   Text is 4.5:1 or better on every surface; large display text 3:1 or better.
 */
:root[data-palette="graphite"] {
  color-scheme: light;

  --bg-primary: #f2f2f3;
  --bg-secondary: #e9e9eb;
  --bg-tertiary: #dedee1;
  --bg-card: #fff;

  --text-primary: #111113;
  --text-secondary: #3a3a40;
  --text-muted: #56565e;

  /* Accent roles: text, fill, display */
  --color-primary: #18181b;
  --color-secondary: #3a3a40;
  --accent-fill: #18181b;
  --on-accent: #fff;
  --accent-display: #6b6b74;
  --color-danger: #b91c1c;

  --border-color: #e4e4e7;
  --border-strong: #7c7c85;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #ececee;
  --code-inline: var(--color-primary);
  --code-comment: #56565e;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0c6680;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(17 17 19 / 0.05), 0 1px 3px rgb(17 17 19 / 0.05);
  --shadow-md: 0 4px 16px rgb(17 17 19 / 0.08);
  --shadow-lg: 0 12px 32px rgb(17 17 19 / 0.1);
}

:root[data-palette="graphite"].dark {
  color-scheme: dark;

  --bg-primary: #0f0f10;
  --bg-secondary: #161618;
  --bg-tertiary: #1f1f22;
  --bg-card: #18181b;

  --text-primary: #ededef;
  --text-secondary: #c8c8cd;
  --text-muted: #a0a0a8;

  --color-primary: #ededef;
  --color-secondary: #ffffff;
  --accent-fill: #ededef;
  --on-accent: #0f0f10;
  --accent-display: #a0a0a8;
  --color-danger: #fca5a5;

  --border-color: #2a2a2e;
  --border-strong: #707078;

  --platform-medium: #6ee7b7;
  --platform-substack: #fdba74;

  --code-bg: #161618;
  --code-comment: #a0a0a8;
  --code-keyword: #d8ccff;
  --code-string: #a7f3d0;
  --code-number: #fde68a;
  --code-name: #a5f3fc;
  --code-builtin: #fbcfe8;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.4);
}

/* ---- Copied from cswithvarun assets/css/palette-mauve.css ----
   Optional palette: Mauve
   Dusty rose-grey with a rose-gold accent (a companion to Slate).
   Applies only when a visitor picks it (data-palette="mauve" on <html>).
   Dark mode keeps a dusty mauve tint: that is the look.
   Text is 4.5:1 or better on every surface; large display text 3:1 or better.
 */
:root[data-palette="mauve"] {
  color-scheme: light;

  --bg-primary: #f6f0f2;
  --bg-secondary: #eee4e8;
  --bg-tertiary: #e3d6dc;
  --bg-card: #fff;

  --text-primary: #3a2530;
  --text-secondary: #57414c;
  --text-muted: #6c5561;

  /* Accent roles: text, fill, display */
  --color-primary: #8a3a58;
  --color-secondary: #6a2b43;
  --accent-fill: #e2aaa4;
  --on-accent: #3a2530;
  --accent-display: #b05a6a;
  --color-danger: #b91c1c;

  --border-color: #ebdfe4;
  --border-strong: #85707b;
  --focus-ring: var(--color-primary);

  --platform-medium: #047857;
  --platform-substack: #9a3412;

  --code-bg: #f0e7eb;
  --code-inline: var(--color-primary);
  --code-comment: #6c5561;
  --code-keyword: #6d28d9;
  --code-string: #047857;
  --code-number: #9a4507;
  --code-name: #0c6680;
  --code-builtin: #9d174d;

  --shadow-sm: 0 1px 2px rgb(58 37 48 / 0.05), 0 1px 3px rgb(58 37 48 / 0.05);
  --shadow-md: 0 4px 16px rgb(58 37 48 / 0.08);
  --shadow-lg: 0 12px 32px rgb(58 37 48 / 0.1);
}

:root[data-palette="mauve"].dark {
  color-scheme: dark;

  --bg-primary: #463d4f;
  --bg-secondary: #3e3546;
  --bg-tertiary: #352d3c;
  --bg-card: #312a37;

  --text-primary: #f5eef2;
  --text-secondary: #e2d8de;
  --text-muted: #cbbfc6;

  --color-primary: #efbdb3;
  --color-secondary: #f6d6cf;
  --accent-fill: #efbdb3;
  --on-accent: #2b2230;
  --accent-display: #efbdb3;
  --color-danger: #fca5a5;

  --border-color: #55495e;
  --border-strong: #a395a5;

  --platform-medium: #6ee7b7;
  --platform-substack: #fdba74;

  --code-bg: #2e2734;
  --code-comment: #cbbfc6;
  --code-keyword: #d8ccff;
  --code-string: #a7f3d0;
  --code-number: #fde68a;
  --code-name: #a5f3fc;
  --code-builtin: #fbcfe8;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.4);
}


/* ---------- Derived tokens ----------
 * Declared after the palettes so they pick up the active one (cswithvarun's theme.css),
 * plus this app's meanings: right is the palette's green, wrong its danger red, a warning
 * its amber. Each has a tint made the way the site makes its callouts.
 */

:root,
.dark {
  --gradient-primary: var(--accent-fill, var(--color-primary));
  --accent-tint: color-mix(in srgb, var(--color-primary) 8%, transparent);
  --accent-tint-strong: color-mix(in srgb, var(--color-primary) 14%, transparent);
  --accent-glow: color-mix(in srgb, var(--color-primary) 30%, transparent);
  --shadow-primary: 0 4px 12px var(--accent-glow);
  --shadow-xl: 0 15px 40px color-mix(in srgb, var(--color-primary) 20%, transparent);

  --good: var(--platform-medium);
  --bad: var(--color-danger);
  --warn: var(--code-number);
  --good-tint: color-mix(in srgb, var(--good) 9%, var(--bg-card));
  --bad-tint: color-mix(in srgb, var(--bad) 7%, var(--bg-card));
  --warn-tint: color-mix(in srgb, var(--warn) 9%, var(--bg-card));
  --note-tint: color-mix(in srgb, var(--color-primary) 7%, var(--bg-primary));
}

/* ---------- Base ---------- */

body {
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

a {
  color: var(--color-primary);
}

::selection {
  background: var(--accent-fill);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--focus-ring, var(--color-primary));
  outline-offset: 3px;
}

/* Tailwind's transition-colors also animates outline-color. Without a resting value the
   ring would fade in from the element's text colour. */
:where(a, button, input, select, textarea, [tabindex]) {
  outline-color: var(--focus-ring, var(--color-primary));
}

/* Headings that receive focus from script (so screen readers announce the new screen). */
[tabindex="-1"]:focus {
  outline: none;
}

/* ---------- Type ---------- */

.t-page-title {
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.t-card-title {
  font-size: 1.125rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* The score: the site's big-number style (metric-number), in the display accent. */
.t-headline-figure {
  color: var(--accent-display);
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.t-figure-lg {
  font-size: 1.375rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.t-label {
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ---------- Cards ----------
 * White cards on the page with a soft edge and shadow; tiles (the site's metric boxes)
 * sit inside them on the section-band colour.
 */

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.tile {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* ---------- Buttons ----------
 * Pills. The one main action has the accent fill; the rest are white with a soft edge.
 * On hover a button lifts a little, as on the site.
 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base),
    background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

@media (min-width: 40rem) {
  .btn {
    min-height: 40px;
    padding: 0.5rem 1.375rem;
  }
}

.btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--color-primary);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary,
.btn-primary:hover {
  background: var(--gradient-primary);
  color: var(--on-accent);
  border-color: transparent;
}

.btn-primary {
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  box-shadow: var(--shadow-xl);
}

/* Accent-outlined (the site's "View all posts"): used for Start quiz. */
.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--accent-fill);
  color: var(--on-accent);
  border-color: var(--accent-fill);
  box-shadow: var(--shadow-primary);
}

.link-button {
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--color-secondary);
}

/* The round theme toggle. */
.theme-toggle {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

@media (min-width: 40rem) {
  .theme-toggle {
    width: 40px;
    height: 40px;
  }
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Filter pills (Missed / All). The chosen one has the accent fill. */
.filter-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--border-radius-full);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

@media (min-width: 40rem) {
  .filter-btn {
    min-height: 36px;
  }
}

.filter-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-btn[aria-pressed="true"],
.filter-btn[aria-pressed="true"]:hover {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-accent);
}

/* ---------- Tags ----------
 * Informational, not interactive: the site's tags, plus coloured ones for a meaning.
 */

.tag {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag-good {
  border-color: color-mix(in srgb, var(--good) 35%, transparent);
  background-color: var(--good-tint);
  color: var(--good);
  font-weight: 600;
}

.tag-warn {
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background-color: var(--warn-tint);
  color: var(--warn);
  font-weight: 600;
}

.tag-lg {
  padding: 0.25rem 0.875rem;
  font-size: 0.8125rem;
}

/* ---------- Callouts ----------
 * The site's callout blockquote: a coloured edge on the left, a faint tint of the same
 * colour, the title in that colour. Used for feedback after answering and for notices.
 */

.callout {
  --callout-color: var(--color-primary);
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--callout-color);
  border-radius: var(--border-radius-2xs);
  background: var(--note-tint);
  color: var(--text-primary);
}

.callout-good {
  --callout-color: var(--good);
  background: var(--good-tint);
}

.callout-bad {
  --callout-color: var(--bad);
  background: var(--bad-tint);
}

.callout-warn {
  --callout-color: var(--warn);
  background: var(--warn-tint);
}

.callout-title {
  color: var(--callout-color);
  font-family: var(--font-heading);
  font-weight: 600;
}

/* ---------- Code ---------- */

.inline-code {
  padding: 0.1em 0.35em;
  border-radius: var(--border-radius-2xs);
  background: var(--code-bg);
  color: var(--code-inline);
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 400;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

/* Inside an answer option, code is only a font: no tint and no accent colour. Otherwise
   options written as code look highlighted next to options in words, and the difference
   can point at (or away from) the answer. */
.option .inline-code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.9em;
}

/* Code blocks scroll sideways rather than wrap, so snippets keep their shape. */
.code-block {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xs);
  background: var(--code-bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
}

.code-block code {
  font-family: inherit;
}

/* ---------- Progress strip ----------
 * One segment per question. Height carries the result as well as colour:
 * tall = correct, short = missed, hairline = not reached yet.
 */

.strip {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 12px;
}

.strip > span {
  flex: 1 1 0;
  min-width: 2px;
  height: 3px;
  border-radius: 1.5px;
  background: var(--border-color);
}

.strip > .is-current {
  height: 12px;
  background: var(--accent-fill);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.strip > .is-correct {
  height: 12px;
  background: var(--good);
}

.strip > .is-wrong {
  height: 6px;
  background: var(--bad);
}

/* Answered, while an "end" mode quiz is running (right or wrong isn't shown yet). */
.strip > .is-answered {
  height: 8px;
  background: var(--border-strong);
}

/* ---------- Answer options ----------
 * Like the site's form fields: white, a visible border-strong edge, 14px corners.
 */

.option {
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.875rem;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--border-radius-field);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Only on devices with a real pointer; on touch screens :hover sticks after a tap. */
@media (hover: hover) {
  .option:hover:not([aria-disabled="true"]) {
    border-color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 5%, var(--bg-card));
  }
}

.option[aria-disabled="true"] {
  cursor: default;
}

.option.is-correct {
  border-color: var(--good);
  background: var(--good-tint);
  box-shadow: inset 0 0 0 1px var(--good);
}

.option.is-wrong {
  border-color: var(--bad);
  background: var(--bad-tint);
  box-shadow: inset 0 0 0 1px var(--bad);
}

/* Chosen, in "end" mode: the site's focused-field look. */
.option.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-tint-strong);
}

.option.is-dimmed {
  border-color: var(--border-color);
  color: var(--text-muted);
}

.option-key {
  box-sizing: border-box;
  display: grid;
  flex: none;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--border-radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.option.is-correct .option-key {
  background: var(--good);
  color: var(--bg-card);
}

.option.is-wrong .option-key {
  background: var(--bad);
  color: var(--bg-card);
}

.option.is-selected .option-key {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.option.is-dimmed .option-key {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

/* ---------- Feedback after answering ---------- */

.feedback {
  animation: feedback-in 0.18s ease-out;
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ---------- Timer ----------
 * Plain text until time is nearly up, then a warning tag. The padding and border are
 * always there, so nothing moves when it changes.
 */

.timer {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 22px;
  padding: 0 0.5rem;
  margin-right: -0.5rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius-full);
}

.timer.is-low {
  margin-right: 0;
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-tint);
  color: var(--warn);
  font-weight: 600;
}

/* ---------- Switch (timed mode) ---------- */

.switch {
  box-sizing: border-box;
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 1.375rem;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--border-radius-full);
  background: var(--bg-card);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--border-strong);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch:checked {
  border-color: var(--color-primary);
  background: var(--accent-fill);
}

.switch:checked::after {
  background: var(--on-accent);
  transform: translateX(1.125rem);
}

/* ---------- Palette picker ----------
 * The site's footer picker: a pill holding one button per palette, each with a swatch.
 * The chosen one has the accent fill.
 */

.palette-picker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: var(--bg-card);
}

.palette-label {
  padding: 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.palette-option {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 40px;
  padding: 0.25rem 0.75rem;
  border: none;
  border-radius: var(--border-radius-full);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

@media (min-width: 40rem) {
  .palette-option {
    min-height: 34px;
  }
}

.palette-option:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.palette-option[aria-pressed="true"] {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.palette-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
}

/* Fixed colours: a swatch previews its palette whichever one is active. */
.palette-swatch-mint { background: #8ad897; }
.palette-swatch-rose { background: #d6336c; }
.palette-swatch-sky { background: #1f6feb; }
.palette-swatch-slate { background: linear-gradient(135deg, #3f4f69 50%, #e8b894 50%); }
.palette-swatch-lavender { background: #9d8bd6; }
.palette-swatch-graphite {
  background: #18181b;
  /* light ring so the near-black dot stays visible on dark backgrounds */
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.45), 0 0 0 1px rgb(0 0 0 / 0.15);
}
.palette-swatch-mauve { background: linear-gradient(135deg, #463d4f 50%, #e2aaa4 50%); }

/* Small screens: drop the label; with seven options the picker wraps onto two rows, so
   it uses a softer radius than a single-row pill. */
@media (max-width: 480px) {
  .palette-picker {
    justify-content: center;
    border-radius: 16px;
  }

  .palette-label {
    display: none;
  }
}

/* ---------- Dense table (recent attempts) ---------- */

table.dense {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

table.dense th,
table.dense td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  white-space: nowrap;
}

table.dense th:first-child,
table.dense td:first-child {
  padding-left: 0;
  white-space: normal;
}

table.dense th:last-child,
table.dense td:last-child {
  padding-right: 0;
}

@media (min-width: 40rem) {
  table.dense th,
  table.dense td {
    padding: 0.5rem 0.75rem;
  }

  table.dense th:first-child,
  table.dense td:first-child {
    padding-left: 0;
  }

  table.dense th:last-child,
  table.dense td:last-child {
    padding-right: 0;
  }
}

table.dense thead th {
  border-bottom-color: var(--border-strong);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

table.dense tbody tr:last-child > * {
  border-bottom: 0;
}

/* ---------- Site frame: navbar ----------
 * cswithvarun's navbar: sticky, translucent page colour with a blur, a hairline under it,
 * the logo mark in the accent fill, and pill-shaped links (the current one a white pill).
 */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  transition: border-color var(--transition-base);
}

/* The translucent, blurred background sits on a layer of its own: a backdrop-filter on the
   navbar itself would make it the box that the phone's full-screen Explore panel (fixed)
   is positioned in, and the panel would collapse to the navbar's height. */
.site-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: color-mix(in srgb, var(--bg-primary) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color var(--transition-base);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-base), transform var(--transition-base);
}

a.brand:hover {
  color: var(--color-primary);
  transform: translateY(-2px);
}

.logo-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-fill);
  color: var(--on-accent);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.375rem 0.875rem;
  border-radius: var(--border-radius-full);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
  background-color: color-mix(in srgb, var(--bg-card) 70%, transparent);
  color: var(--text-primary);
}

/* Links that only fit from the small breakpoint up. */
@media (max-width: 39.99rem) {
  .nav-link-wide {
    display: none;
  }
}

.nav-link[aria-current="page"] {
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

/* ---------- Explore menu ----------
 * Udemy's Explore panel in this site's style: a white card dropping from the navbar,
 * subjects on the left, the chosen subject's topics on the right. On a phone it fills
 * the screen under the navbar and shows one list at a time.
 */

.explore-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  min-height: 40px;
  padding: 0.375rem 0.75rem 0.375rem 0.875rem;
  border: 0;
  border-radius: var(--border-radius-full);
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.explore-button:hover,
.explore-button.is-open {
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.explore-button svg {
  transition: transform var(--transition-fast);
}

.explore-button.is-open svg {
  transform: rotate(180deg);
}

.explore-panel {
  position: fixed;
  inset: 64px 0 0 0;
  z-index: 60;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  animation: explore-in 0.14s ease-out;
}

@media (min-width: 48rem) {
  .explore-panel {
    position: absolute;
    inset: auto auto auto 1rem;
    top: calc(100% + 6px);
    width: min(46rem, calc(100vw - 2rem));
    max-height: min(36rem, calc(100vh - 6rem));
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
  }
}

@keyframes explore-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.explore-search {
  padding: 1rem 1rem 0;
}

.explore-columns {
  display: grid;
}

@media (min-width: 48rem) {
  .explore-columns {
    grid-template-columns: 17rem minmax(0, 1fr);
    max-height: inherit;
  }

  .explore-columns.is-single {
    grid-template-columns: minmax(0, 1fr);
  }
}

.explore-col {
  padding: 0.75rem;
}

@media (min-width: 48rem) {
  .explore-col {
    max-height: min(36rem, calc(100vh - 6rem));
    overflow-y: auto;
  }

  .explore-subjects {
    border-right: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-secondary) 45%, var(--bg-card));
  }
}

/* Phone: one list at a time. */
@media (max-width: 47.99rem) {
  .explore-panel[data-level="subjects"] .explore-topics,
  .explore-panel[data-level="topics"] .explore-subjects {
    display: none;
  }
}

.explore-heading {
  margin: 0;
  padding: 0.5rem 0.75rem 0.625rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.explore-heading h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.explore-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.explore-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

@media (min-width: 48rem) {
  .explore-item {
    min-height: 38px;
  }
}

@media (hover: hover) {
  .explore-item:hover {
    background: var(--bg-tertiary);
  }
}

.explore-item[aria-current="true"] {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.explore-item > svg {
  flex: none;
  color: var(--text-muted);
}

.explore-item[aria-current="true"] > svg {
  color: var(--color-primary);
}

.explore-quick {
  margin-bottom: 0.25rem;
  color: var(--color-primary);
  font-weight: 600;
}

.explore-quick > svg {
  color: var(--color-primary);
}

.explore-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Phone only: on a wider screen both lists show, so there is nothing to go back to. */
@media (min-width: 48rem) {
  .explore-back {
    display: none !important;
  }
}

.explore-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  margin: 0 0 0.25rem;
  padding: 0 0.5rem;
  border: 0;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.explore-all {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.explore-all:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Search (navbar and the Explore menu) ---------- */

.search {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.875rem;
  display: flex;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 1rem 0.5rem 2.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--border-radius-full);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

@media (min-width: 48rem) {
  .search-input {
    min-height: 40px;
  }
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-tint-strong);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 70;
  max-height: 22rem;
  margin: 0;
  padding: 0.375rem;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  list-style: none;
}

.search-results[hidden] {
  display: none;
}

.search-option {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
}

.search-option:hover,
.search-option[aria-selected="true"] {
  background: var(--bg-tertiary);
}

.search-option-name {
  color: var(--text-primary);
  font-weight: 500;
}

.search-option-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.search-empty {
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
}

/* A topic card opened from the menu or search: a brief ring so the eye finds it. */
.is-spotlit {
  animation: spotlight 1.6s ease-out;
}

@keyframes spotlight {
  0%,
  40% {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--accent-tint-strong), var(--shadow-md);
  }
}

/* ---------- Site frame: hero ----------
 * cswithvarun's home hero: a soft diagonal gradient of the page colours, a faint accent
 * glow in the top corner, a very large tight title and a quieter line under it.
 */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}

.hero::before {
  content: "";
  position: absolute;
  top: -200px;
  right: -200px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-tint-strong) 0%, transparent 70%);
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.t-hero {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(2rem, 5.5vw, 3.75rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero-lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(0.9375rem, 1.6vw, 1.125rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.crumb {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.crumb:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Figures under the title: small versions of the site's stat cards. */
.stat {
  display: flex;
  min-width: 7.5rem;
  flex-direction: column-reverse;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
}

.stat-value {
  margin: 0;
  color: var(--accent-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}

.hero .btn {
  min-height: 48px;
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

/* ---------- Sections and cards on the browsing screens ---------- */

.section-title {
  margin: 0 0 1.5rem;
  color: var(--text-primary);
  font-size: clamp(1.375rem, 1.1rem + 1.2vw, 2rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
}

/* Cards that are one big link (the subjects): the link covers the card, as on the site. */
.card-link-host {
  position: relative;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card-link-host:hover,
.card-link-host:focus-within {
  transform: translateY(-6px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-xl);
}

.card-link {
  color: inherit;
  text-decoration: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.card-link:focus-visible {
  outline: none;
}

.card-link:focus-visible::after {
  outline: 2px solid var(--focus-ring, var(--color-primary));
  outline-offset: 3px;
}

.card-link-cta {
  color: var(--color-primary);
  font-weight: 600;
}

/* Cards that hold a button: only the edge lights up, as on the site. */
.card-lift {
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.card-lift:hover {
  border-color: var(--color-primary);
}

.timed-setting {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-card);
  cursor: pointer;
}

.timed-setting .switch {
  margin-top: 0.125rem;
}

/* ---------- Site frame: footer ---------- */

.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-muted);
}

.footer-heading {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: var(--color-primary);
}

/* ---------- Results: score by topic ---------- */

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.topic-track {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: var(--border-radius-full);
  background: var(--bg-tertiary);
}

.topic-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .btn:hover,
  .brand:hover,
  .card-link-host:hover,
  .card-link-host:focus-within {
    transform: none;
  }
}
