/* ==========================================================================
   clear-brand.css — Clear's visual language as plain CSS, for TIA marketing
   mockups. No Tailwind, no build step: <link rel="stylesheet"> and go.

   Extracted 2026-09-28 from The-Infinite-Actuary/core @ c89b48ff1:
     apps/clear/src/index.css            theme tokens, fonts, radius, easings
     apps/clear/index.html               Google Fonts link
     packages/ui/src/system/text-styles.ts   semantic type roles
     packages/ui/src/system/{button,badge,surface-card,tinted-styles}.tsx/ts
     packages/ui/src/pill-styles.ts, apps/clear/src/components/system/pill-tabs.tsx
     .claude/rules/ui-conventions.md     radius ladder, pill vs rectangle, colour roles

   Every hex below is Clear's own value, under Clear's own role name.
   Anything that is NOT in Clear is marked "MARKETING EXTENSION".

   Theme scopes (each is complete, so they nest — a dark band inside a light
   page, or three previews side by side, all work):
     :root / .theme-light     slate light  (the default)
     .dark / .theme-dark      slate dark
     .theme-terminal          terminal (dark-only, all-mono, square corners)
     .theme-warm / .theme-warm-dark   optional; Clear's third palette

   Naming note (read before building a CTA):
     .btn-primary  = Clear's `primary`: the TINTED green action (the default).
     .btn-commit   = Clear's `commit`:  the SOLID green button. Clear reserves it
                     for a dialog's final commit or a screen whose ONLY action
                     is that button (the Today welcome's "Get started", login).
                     On a landing page: the one hero CTA, once per viewport.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700&family=Literata:ital,opsz,wght@0,7..72,400..700;1,7..72,400..700&family=JetBrains+Mono:wght@400;500;600;700&display=swap");

/* --------------------------------------------------------------------------
   1. Theme-independent tokens + aliases (re-resolved in every theme scope)
   -------------------------------------------------------------------------- */
:root,
.theme-light,
.dark,
.theme-dark,
.theme-warm,
.theme-warm-dark,
.theme-terminal {
  /* Faces. UI = Schibsted Grotesk. Reading (lesson prose, flashcards,
     problems; serif so it matches MathJax's serif maths) = Literata.
     Mono (shortcut keys, the terminal theme) = JetBrains Mono.
     --font-display is the wordmark seam: today the same family as UI. */
  --font-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-reading: "Literata", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radius ladder (Clear: --radius 0.5rem; sm/md/lg/xl/2xl/3xl/4xl = r-4 .. r+16).
     chips & pills  → full      buttons, inputs, small controls → lg (8px)
     cards & rows   → xl (12px) page-level panels (SurfaceCard)  → 2xl (16px) */
  --radius: 0.5rem;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-4xl: 24px;
  --radius-full: 9999px;

  /* Role aliases — one colour per job, identical map in every theme. */
  --info: var(--muted-foreground);
  --ring: var(--primary-text);
  --input-border: var(--border-strong);
  --primary-tint-foreground: var(--primary-text);
  --primary-tint-border: var(--primary-text);
  --destructive: var(--danger);
  --flag: var(--warning-mark);
  --cta: var(--warning);
  --discuss: var(--muted-foreground); /* Clear gives Discuss no hue (#6068) */
  --sidebar-primary: var(--primary-text);
  --sidebar-ring: var(--primary-text);
  --sidebar-border: var(--border);
}

:root {
  /* Motion — Clear's three named curves. */
  --ease-signature: cubic-bezier(0.16, 1, 0.3, 1);   /* strong ease-out: default entrance/exit */
  --ease-flip: cubic-bezier(0.4, 0, 0.2, 1);         /* balanced: card flip, long-travel dismiss */
  --ease-emphasis: cubic-bezier(0.34, 1.56, 0.64, 1);/* overshoot: rare reward moments only */
  /* Durations (ui-conventions "Motion"): 150 hover/colour, 200–300 reveals, 500 large moves. */
  --dur-micro: 150ms;
  --dur-reveal: 250ms;
  --dur-large: 500ms;

  /* Shadows — Tailwind v4 defaults, which Clear uses as-is. shadow-sm on the
     app content panel, the active pill tab and the login card; shadow-2xl on
     modal panels; lg/xl on popovers and floating controls. */
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Type sizes. --text-body (15px) is Clear's named body size and the
     document base size (body.font-sans { font-size: 0.9375rem }). */
  --text-body: 0.9375rem;
  --text-reading: 1rem; /* .reading-body: 16px / 1.75, Literata */
}

/* --------------------------------------------------------------------------
   2. Slate LIGHT — the default (apps/clear/src/index.css `:root`)
   -------------------------------------------------------------------------- */
:root,
.theme-light {
  color-scheme: light;
  --background: #eef2f6;
  --foreground: #202733;
  --card: #f8fafc;
  --card-foreground: #161d28;
  --popover: #f8fafc;
  --popover-elevated: #f8fafc;
  --popover-foreground: #161d28;
  --surface-raised: #f8fafc;

  --brand: #1a6b3c;          /* the logo's green — app CHROME only */
  --primary: #1a6b3c;        /* the one solid command (white label 6.5:1) */
  --primary-foreground: #ffffff;
  --primary-text: #1a6b3c;   /* primary as text: links, focus ring */
  --primary-tint: #dde9e5;   /* pre-mixed tint behind the default primary button */
  --primary-tint-hover: #ccddd6;
  --on-accent-fill: #ffffff;

  --selection: #44608f;      /* every selected answer/chip/row/tab — blue, never green */
  --selection-solid: #44608f;
  --selection-solid-foreground: #ffffff;

  --success: #3a660a;        /* correct/saved/done — yellower than brand, always with ✓ */
  --warning: #735808;        /* amber as TEXT */
  --warning-mark: #9e6e08;   /* amber as a MARK/fill (3:1) */
  --danger: #b61623;
  --cta-foreground: #ffffff;

  --learn: #0a6190;          /* section hues (lanes) */
  --practice: #4c1b82;       /* synced to Clear index.css after #6068: violet */
  --flashcards: #923f67;     /* pink */
  --exams: #9c4200;
  --mono-pink: #923f67;      /* Discuss */
  --streak: #a47b42;         /* FILL-ONLY in light (fails 4.5:1 as text) */

  --secondary: #dde4ec;
  --secondary-foreground: #202733;
  --muted: #d3dbe6;          /* one step above --card: row hovers, wells, pill track */
  --muted-2: #bdc6d3;
  --muted-foreground: #55606d;
  --on-tint-muted: #4d5764;  /* secondary text INSIDE a 10–20% tint */
  --accent: #dde4ec;
  --accent-foreground: #161d28;
  --border: #b8c3d1;         /* decorative hairline */
  --border-strong: #6f7b8c;  /* control edge, 3:1 */
  --input: #d3dbe6;

  --mono-surface: #dfe6ee;   /* one step above --background; never on a card */
  --mono-surface-alt: #d6dee8;
  --mono-deep: #e5ebf2;      /* the app shell behind the rounded content panel */
  --sidebar: #e7edf4;
  --sidebar-foreground: #202733;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #d9e1ea;
  --sidebar-accent-foreground: #161d28;
  --sidebar-hover: #d5ddea;

  --problem-highlight-bg: #fff1a8;
  --problem-highlight-border: #d8b84c;
  --content-blue: #2a5a9e;
  --content-orange: #9c4200;
  --content-purple: #6838a8;
  --backdrop: rgb(15 23 42 / 0.45);
  --overlay: #000000;
  --figure-backing: #ffffff;
  --contrast-anchor: #000000;
}

/* --------------------------------------------------------------------------
   3. Slate DARK (apps/clear/src/index.css `.dark`)
   -------------------------------------------------------------------------- */
.dark,
.theme-dark {
  color-scheme: dark;
  --background: #13161b;
  --foreground: #d1d2d3;
  --card: #272a2f;
  --card-foreground: #e0e0e2;
  --popover: #2c2f34;
  --popover-elevated: #373b40;
  --popover-foreground: #e0e0e2;
  --surface-raised: #2f3338;

  --brand: #49da85;
  --primary: #1b8249;        /* deep green fill, white label 4.84:1 — too dark to be TEXT */
  --primary-foreground: #ffffff;
  --primary-text: #49da85;   /* lighter brand green for text/links/ring */
  --primary-tint: #2c433b;
  --primary-tint-hover: #2e5142;
  --on-accent-fill: #121315;

  --selection: #82a3fc;
  --selection-solid: #4d6db0;
  --selection-solid-foreground: #ffffff;

  --success: #5ac576;
  --warning: #d3ac41;
  --warning-mark: #d3ac41;
  --danger: #fc938b;
  --cta-foreground: #0a0a0a;

  --learn: #60b9f3;
  --practice: #ba8fff;
  --flashcards: #f095bd;
  --exams: #f29c5d;
  --mono-pink: #f095bd;
  --streak: #f5c842;

  --secondary: #272a2f;
  --secondary-foreground: #d1d2d3;
  --muted: #1b1e24;
  --muted-2: #101419;
  --muted-foreground: #a1a8b2;
  --on-tint-muted: #b4bcc6;
  --accent: #272a2f;
  --accent-foreground: #e0e0e2;
  --border: #3e434a;
  --border-strong: #7f8792;
  --input: #272a2f;

  --mono-surface: #272a2f;   /* deliberately == --card in dark */
  --mono-surface-alt: #2c2f34;
  --mono-deep: #0e1115;
  --sidebar: #0e1115;
  --sidebar-foreground: #b5b7b9;
  --sidebar-primary-foreground: #121315;
  --sidebar-accent: #272a2f;
  --sidebar-accent-foreground: #e0e0e2;
  --sidebar-hover: #111418;

  --problem-highlight-bg: #4d3b12;
  --problem-highlight-border: #eada8a;
  --content-blue: #78b8f8;
  --content-orange: #e8a858;
  --content-purple: #b898f8;
  --backdrop: rgb(0 0 0 / 0.62);
  --overlay: #000000;
  --figure-backing: #ffffff;
  --contrast-anchor: #ffffff;
}

/* --------------------------------------------------------------------------
   4. Terminal (dark-only; `.dark[data-color-theme="terminal"]`)
      Everything goes JetBrains Mono and every corner goes square.
      Brand, primary, success and selection are all the same neon green here,
      so ✓/✕ marks (not colour) carry correct/incorrect.
   -------------------------------------------------------------------------- */
.theme-terminal {
  color-scheme: dark;
  --font-sans: "JetBrains Mono", ui-monospace, monospace;
  --font-display: "JetBrains Mono", ui-monospace, monospace;
  --font-reading: "JetBrains Mono", ui-monospace, monospace;
  --radius: 0rem;
  --radius-sm: 0; --radius-md: 0; --radius-lg: 0; --radius-xl: 0;
  --radius-2xl: 0; --radius-3xl: 0; --radius-4xl: 0; --radius-full: 0;

  --background: #0a0a0a;
  --foreground: #22cc55;
  --card: #1a1a1a;
  --card-foreground: #33ff66;
  --popover: #1a1a1a;
  --popover-elevated: #2a2a2a;
  --popover-foreground: #33ff66;
  --surface-raised: #222222;

  --brand: #33ff66;
  --primary: #33ff66;
  --primary-foreground: #0a0a0a;
  --primary-text: #33ff66;
  --primary-tint: #1e3a25;
  --primary-tint-hover: #204c2b;
  --on-accent-fill: #0a0a0a;

  --selection: var(--primary-text);
  --selection-solid: var(--primary);
  --selection-solid-foreground: var(--primary-foreground);

  --success: #33ff66;
  --warning: #ffdd33;
  --warning-mark: #ffdd33;
  --danger: #ff5c5c;
  --cta-foreground: #0a0a0a;

  --learn: #33aaff;
  --practice: #33ffee;
  --flashcards: #b07aff;
  --exams: #ffaa33;
  --mono-pink: #ff66aa;
  --streak: #ffdd33;

  --secondary: #1a1a1a;
  --secondary-foreground: #22cc55;
  --muted: #111111;
  --muted-2: #000000;
  --muted-foreground: #30a948;
  --on-tint-muted: #51c563;
  --accent: #1a1a1a;
  --accent-foreground: #33ff66;
  --border: #1e3a1e;
  --border-strong: #428342;
  --input: #1a1a1a;

  --mono-surface: #1a1a1a;
  --mono-surface-alt: #151515;
  --mono-deep: #050505;
  --sidebar: #050505;
  --sidebar-foreground: #22aa44;
  --sidebar-primary-foreground: #0a0a0a;
  --sidebar-accent: #0f1a0f;
  --sidebar-accent-foreground: #33ff66;
  --sidebar-hover: #0e0e0e;

  --problem-highlight-bg: #4d3b00;
  --problem-highlight-border: #ffdd33;
  --content-blue: #50b0ff;
  --content-orange: #ffa830;
  --content-purple: #c080ff;
  --backdrop: rgb(0 0 0 / 0.62);
  --overlay: #000000;
  --figure-backing: #ffffff;
  --contrast-anchor: #ffffff;
}
/* Clear forces square corners on everything in terminal. */
.theme-terminal *,
.theme-terminal *::before,
.theme-terminal *::after { border-radius: 0 !important; }
/* …except progress tracks/fills and numeral discs (Clear's .progress-pill). */
.theme-terminal .keep-round,
.theme-terminal .keep-round > * { border-radius: 9999px !important; }

/* --------------------------------------------------------------------------
   5. Warm (OPTIONAL — Clear's third palette). Note warm's primary is a
      caramel, not green; marketing should stay on slate.
   -------------------------------------------------------------------------- */
.theme-warm {
  color-scheme: light;
  --background: #faf8f5; --foreground: #3b3228;
  --card: #ffffff; --card-foreground: #2a2218;
  --popover: #ffffff; --popover-elevated: #ffffff; --popover-foreground: #2a2218; --surface-raised: #ffffff;
  --brand: #3d7020;
  --primary: #8c5d25; --primary-foreground: #ffffff; --primary-text: #8c5d25;
  --primary-tint: #f4efe9; --primary-tint-hover: #eee7de; --on-accent-fill: #ffffff;
  --selection: var(--primary-text); --selection-solid: var(--primary); --selection-solid-foreground: var(--primary-foreground);
  --success: #0c7335; --warning: #7c600c; --warning-mark: #aa7609; --danger: #c0252c; --cta-foreground: #ffffff;
  --learn: #0e6a9b; --practice: #0f706c; --flashcards: #7850aa; --exams: #a0446d; --mono-pink: #8e4c89; --streak: #b07520;
  --secondary: #f3ede4; --secondary-foreground: #3b3228;
  --muted: #ede7dc; --muted-2: #d6cdbb; --muted-foreground: #706559; --on-tint-muted: #645a4e;
  --accent: #f3ede4; --accent-foreground: #2a2218;
  --border: #ddd5c8; --border-strong: #8f816f; --input: #ede7dc;
  --mono-surface: #f3ede4; --mono-surface-alt: #ede7dc; --mono-deep: #f5f1eb;
  --sidebar: #f5f1eb; --sidebar-foreground: #5a4e3e; --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #ede7dc; --sidebar-accent-foreground: #2a2218; --sidebar-hover: #e8e1d5;
  --problem-highlight-bg: #fff1a8; --problem-highlight-border: #d8b84c;
  --content-blue: #2a5a9e; --content-orange: #985010; --content-purple: #6838a8;
  --backdrop: rgb(35 28 20 / 0.45); --overlay: #000000; --figure-backing: #ffffff; --contrast-anchor: #000000;
}
.theme-warm-dark {
  color-scheme: dark;
  --background: #1e1812; --foreground: #d4c8b8;
  --card: #302922; --card-foreground: #e8ddd0;
  --popover: #362f28; --popover-elevated: #433c34; --popover-foreground: #e8ddd0; --surface-raised: #3b342d;
  --brand: #7ad86a;
  --primary: #c88a40; --primary-foreground: #1a1510; --primary-text: #dc9c54;
  --primary-tint: #453728; --primary-tint-hover: #4b3b2a; --on-accent-fill: #1a1510;
  --selection: var(--primary-text); --selection-solid: var(--primary); --selection-solid-foreground: var(--primary-foreground);
  --success: #5ec97a; --warning: #d6af45; --warning-mark: #d6af45; --danger: #fd9890; --cta-foreground: #0a0a0a;
  --learn: #63bcf7; --practice: #47c6bf; --flashcards: #c8a3fe; --exams: #fa95bd; --mono-pink: #e49cdd; --streak: #e0a530;
  --secondary: #302922; --secondary-foreground: #d4c8b8;
  --muted: #282018; --muted-2: #1c140d; --muted-foreground: #b5a99a; --on-tint-muted: #bfb3a3;
  --accent: #302922; --accent-foreground: #e8ddd0;
  --border: #4c4237; --border-strong: #978775; --input: #302922;
  --mono-surface: #302922; --mono-surface-alt: #362f28; --mono-deep: #18110b;
  --sidebar: #18110b; --sidebar-foreground: #b0a494; --sidebar-primary-foreground: #1a1510;
  --sidebar-accent: #302922; --sidebar-accent-foreground: #e8ddd0; --sidebar-hover: #1c160f;
  --problem-highlight-bg: #5a4312; --problem-highlight-border: #d0b060;
  --content-blue: #78b8f0; --content-orange: #e8a858; --content-purple: #bb9af0;
  --backdrop: rgb(0 0 0 / 0.62); --overlay: #000000; --figure-backing: #ffffff; --contrast-anchor: #ffffff;
}

/* --------------------------------------------------------------------------
   6. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.5;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* A nested theme scope paints its own page colour and face. */
.theme-light, .theme-dark, .theme-terminal, .theme-warm, .theme-warm-dark,
:not(html).dark {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
}

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

/* --------------------------------------------------------------------------
   7. Type roles — packages/ui/src/system/text-styles.ts, 1:1
   -------------------------------------------------------------------------- */

/* Wordmark: the ONLY roles in --font-display, at 700 — a weight Clear's UI
   never uses for words — with tight tracking. Colour is the text colour, not
   green: the green lives in the mark beside it. */
.t-wordmark    { font-family: var(--font-display); font-size: 14px; line-height: 20px; font-weight: 700; letter-spacing: -0.025em; color: var(--card-foreground); }
.t-wordmark-lg { font-family: var(--font-display); font-size: 16px; line-height: 24px; font-weight: 700; letter-spacing: -0.025em; color: var(--card-foreground); }

.t-page-eyebrow, .eyebrow { font-size: 11px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted-foreground); }
.t-page-title    { font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; color: var(--card-foreground); margin: 0; }
@media (min-width: 768px) { .t-page-title { font-size: 32px; } }
.t-section-label { font-size: 11px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); }
.t-section-title { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.025em; color: var(--card-foreground); margin: 0; }
.t-card-label, .card-label { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); }
.t-field-label   { font-size: 11px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted-foreground); }
.t-table-header  { font-size: 11px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted-foreground); }
.t-body          { font-size: 15px; line-height: 24px; color: var(--card-foreground); }
.t-body-muted    { font-size: 15px; line-height: 24px; color: var(--muted-foreground); }
.t-row-title     { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--card-foreground); }
.t-list-row-title{ font-size: 14px; line-height: 20px; color: var(--card-foreground); }
.t-row-description { font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.t-pill-label    { font-size: 13px; line-height: 18px; color: var(--card-foreground); }
.t-metric-value  { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.025em; color: var(--card-foreground); }
.t-metric-value-lg { font-size: 26px; line-height: 1; font-weight: 600; letter-spacing: -0.025em; color: var(--card-foreground); }
.t-score-strip   { font-size: 40px; line-height: 1; font-weight: 700; }
.t-overlay-title { font-size: 18px; line-height: 28px; font-weight: 600; color: var(--card-foreground); margin: 0; }
.t-overlay-description { font-size: 13px; line-height: 20px; color: var(--muted-foreground); }
.t-stat-value    { font-size: 18px; line-height: 28px; font-weight: 600; color: var(--card-foreground); }
.t-stat-label    { font-size: 10px; line-height: 14px; color: var(--muted-foreground); }
.t-quiet         { font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.t-mono          { font-family: var(--font-mono); }

/* Reading face — lesson prose, flashcard faces, problem statements. */
.t-reading {
  font-family: var(--font-reading);
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.75;
  color: var(--foreground);
}
.measure { max-width: 42rem; }        /* Clear's reading column (~72 chars) */
.measure-wide { max-width: 48rem; }

/* MARKETING EXTENSION — display sizes. Precedent: Clear's own Today welcome
   hero headline is `text-2xl sm:text-[34px] md:text-[46px] font-bold
   leading-[1.1] tracking-tight`. Same face, same 700, same tight tracking;
   only the size climbs. */
.t-display-xl { font-size: clamp(40px, 5.6vw, 72px); line-height: 1.04; font-weight: 700; letter-spacing: -0.03em; color: var(--card-foreground); margin: 0; }
.t-display    { font-size: clamp(32px, 4vw, 46px); line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; color: var(--card-foreground); margin: 0; }
.t-display-sm { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; color: var(--card-foreground); margin: 0; }
.t-lede       { font-size: 18px; line-height: 1.6; color: var(--muted-foreground); }
/* The brand word inside a headline ("Today makes a Clear plan."). */
.brand-word   { color: var(--primary-text); }

/* --------------------------------------------------------------------------
   8. Components
   -------------------------------------------------------------------------- */

/* SurfaceCard — the page-level panel: rounded-2xl, 1px hairline, card fill. */
.surface-card {
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
  padding: 20px;
}
.surface-card--sm { padding: 16px; }
.surface-card--lg { padding: 24px; }
.surface-card--subtle { border-color: color-mix(in oklab, var(--border) 60%, transparent); background: color-mix(in oklab, var(--card) 60%, transparent); }
.surface-card--muted  { border-color: color-mix(in oklab, var(--border) 50%, transparent); background: color-mix(in oklab, var(--mono-surface) 60%, transparent); }
.surface-card--on-card { background: var(--muted); } /* a card sitting ON a card */

/* A row / inner tile inside a card: rounded-xl. */
.row-tile { border-radius: var(--radius-xl); border: 1px solid var(--border); background: var(--card); padding: 16px; }
.row-tile--well { background: var(--muted); border-color: transparent; }

.hairline { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Buttons — Clear's Button primitive. Commands are RECTANGLES (radius-lg). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 600;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  background: transparent; color: var(--card-foreground);
  transition: background-color var(--dur-micro) ease, color var(--dur-micro) ease, border-color var(--dur-micro) ease;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 12px; line-height: 16px; }
.btn-lg { min-height: 48px; padding: 10px 24px; font-size: 16px; line-height: 24px; }
.btn-block { width: 100%; }

/* primary = the TINT (default look of THE action on a screen) */
.btn-primary { background: var(--primary-tint); color: var(--primary-tint-foreground); border-color: var(--primary-tint-border); }
.btn-primary:hover:not(:disabled) { background: var(--primary-tint-hover); }
/* commit = SOLID green (dialog's final commit / single-action screen / hero CTA) */
.btn-commit { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn-commit:hover:not(:disabled) { background: color-mix(in oklab, var(--primary) 90%, transparent); }
/* secondary = quiet companion: Cancel, Back, Not now */
.btn-secondary { border-color: var(--border); color: var(--muted-foreground); }
.btn-secondary:hover:not(:disabled) { background: var(--muted); color: var(--card-foreground); }
/* outline = neutral optional action / Retry */
.btn-outline { border-color: var(--border); color: var(--card-foreground); }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
/* ghost = tertiary in a busy row */
.btn-ghost { color: var(--muted-foreground); }
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--card-foreground); }
/* tone = strong lane tint launcher (neutral label; never same-hue text) */
.btn-tone { border-color: color-mix(in oklab, var(--tone, var(--practice)) 60%, transparent); background: color-mix(in oklab, var(--tone, var(--practice)) 20%, transparent); color: var(--card-foreground); }
.btn-tone:hover:not(:disabled) { background: color-mix(in oklab, var(--tone, var(--practice)) 30%, transparent); }
/* destructive commit */
.btn-destructive { border-color: color-mix(in oklab, var(--danger) 50%, transparent); background: color-mix(in oklab, var(--danger) 15%, transparent); color: var(--card-foreground); }
.btn-destructive:hover:not(:disabled) { background: color-mix(in oklab, var(--danger) 25%, transparent); }
/* Disabled is QUIET: bare outline + muted label. Never faded, never grey-filled. */
.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed; opacity: 1; box-shadow: none;
  border-color: var(--border); background: transparent; color: var(--muted-foreground);
}

/* Lane tones — set --tone on any toned element. */
.tone-learn      { --tone: var(--learn); }
.tone-practice   { --tone: var(--practice); }
.tone-flashcards { --tone: var(--flashcards); }
.tone-exams      { --tone: var(--exams); }
.tone-discuss    { --tone: var(--mono-pink); }
.tone-success    { --tone: var(--success); }
.tone-warning    { --tone: var(--warning-mark); }
.tone-danger     { --tone: var(--danger); }
.tone-selection  { --tone: var(--selection); }
.tone-brand      { --tone: var(--brand); }
.tone-streak     { --tone: var(--streak); }

/* PillTabs — the segmented tab track (state/selection = PILL shape). */
.pill-track {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; overflow-x: auto;
  border-radius: var(--radius-full); background: var(--muted); padding: 4px;
}
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 0; border-radius: var(--radius-full); padding: 6px 12px;
  background: transparent; color: var(--muted-foreground);
  font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: color var(--dur-micro) ease, background-color var(--dur-micro) ease;
}
.pill:hover { color: var(--foreground); }
.pill:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.pill[aria-selected="true"], .pill.is-active {
  background: var(--popover-elevated); color: var(--foreground);
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);
}

/* Filter chip — a toggle (aria-pressed). Outlined off, selection-blue on. */
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px;
  border-radius: var(--radius-full); border: 1px solid var(--border); padding: 4px 12px;
  background: transparent; color: var(--muted-foreground);
  font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500;
  cursor: pointer; transition: background-color var(--dur-micro) ease, color var(--dur-micro) ease;
}
.chip:hover { background: var(--muted); color: var(--card-foreground); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.chip[aria-pressed="true"], .chip.is-selected {
  border-color: color-mix(in oklab, var(--selection) 40%, transparent);
  background: color-mix(in oklab, var(--selection) 12%, transparent);
  color: var(--card-foreground);
}

/* Solid selected state (chosen segment, picked date, ticked box). Never the primary. */
.selected-solid { background: var(--selection-solid); border-color: var(--selection-solid); color: var(--selection-solid-foreground); }

/* Badge — rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide.
   Neutral by default; add a .tone-* class for a tinted status tag. The label
   stays card-foreground on every tint (never same-hue text on its own tint). */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-full); border: 1px solid var(--border);
  padding: 2px 10px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.025em;
  background: var(--card); color: var(--muted-foreground);
  white-space: nowrap;
}
.badge[class*="tone-"] {
  border-color: color-mix(in oklab, var(--tone) 30%, transparent);
  background: color-mix(in oklab, var(--tone) 15%, transparent);
  color: var(--card-foreground);
}
.badge--sm { padding: 2px 8px; font-size: 10px; line-height: 14px; text-transform: uppercase; }
.badge--lg { gap: 6px; padding: 6px 16px; font-size: 14px; line-height: 20px; } /* celebration only */

/* Keyboard hint (textStyles.shortcut). */
.kbd {
  display: inline-block; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--mono-surface); padding: 2px 6px;
  font-family: var(--font-mono); font-size: 10px; line-height: 14px; color: var(--card-foreground);
}

/* Lane dot — the coloured source dot (Today hero). Fill-only, so AA-exempt. */
.lane-dot { display: inline-block; width: 10px; height: 10px; border-radius: 9999px; background: var(--tone, var(--brand)); flex-shrink: 0; }

/* Link — primary as text. */
.link { color: var(--primary-text); text-decoration: none; text-underline-offset: 4px; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* Callout/notice — neutral info panel, or a tinted one with a neutral label. */
.notice { border-radius: var(--radius-xl); border: 1px solid var(--border); background: var(--muted); padding: 12px 16px; color: var(--card-foreground); font-size: 14px; line-height: 20px; }
.notice[class*="tone-"] { border-color: color-mix(in oklab, var(--tone) 30%, transparent); background: color-mix(in oklab, var(--tone) 10%, var(--card)); }
.notice .notice__muted { color: var(--muted-foreground); }
.notice[class*="tone-"] .notice__muted { color: var(--on-tint-muted); }

/* Nav "you are here" bar — the brand green's home (app chrome only). */
.accent-bar { display: inline-block; width: 3px; height: 20px; border-radius: 0 9999px 9999px 0; background: var(--brand); box-shadow: 0 0 8px color-mix(in srgb, var(--brand) 31%, transparent); }

/* Logo lockup — mark (brand green) + wordmark (text colour) + hairline + "tia". */
.lockup { display: inline-flex; align-items: center; gap: 8px; }
.lockup__mark { width: 16px; height: auto; color: var(--brand); flex-shrink: 0; }
.lockup__rule { width: 1px; height: 12px; background: var(--border); }
.lockup__tia { font-size: 10px; line-height: 14px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); }
.lockup--lg .lockup__mark { width: 24px; }
.lockup--lg .lockup__rule { height: 14px; }

/* App frame — Clear's shell: --mono-deep behind an inset, rounded-xl,
   shadow-sm --background panel. Use it to frame product screenshots. */
.app-frame { background: var(--mono-deep); padding: 8px; border-radius: var(--radius-2xl); }
.app-frame__panel { background: var(--background); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); overflow: hidden; }

/* --------------------------------------------------------------------------
   9. Motion
   -------------------------------------------------------------------------- */
@keyframes clear-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes clear-bloom   { from { opacity: 0; transform: scale(0.5); }      to { opacity: 1; transform: scale(1); } }
/* Precedent: day-complete label (translateY 8px, 350ms) and logo bloom (scale .5→1, 400ms signature). */
.reveal { animation: clear-fade-up 400ms var(--ease-signature) both; }
.reveal[data-delay="1"] { animation-delay: 80ms; }
.reveal[data-delay="2"] { animation-delay: 160ms; }
.reveal[data-delay="3"] { animation-delay: 240ms; }
.bloom  { animation: clear-bloom 400ms var(--ease-signature) both; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .bloom { animation: none; opacity: 1; transform: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
