/* Longtake design tokens — the single source of every colour, size and space on every surface
   (WEB-364). The studio, the public site, the help and guides, the Academy, /verify and the admin
   load this file before their own stylesheet; a stylesheet keeps only layout and its components.

   The rules, and the test that holds them (test/unit/design-tokens.test.js):
   - spacing (padding, margin, gap) — only var(--sp-*), 0, auto or 1px;
   - font-size — only var(--fs-*) or a relative em/% for text inside text;
   - border-radius — only var(--r-*), 50% or 0;
   - colour — only var(--*) from here; a new colour is a new token, never a literal in a page;
   - the admin host serves only its own folder, so public/admin/tokens.css is a byte-for-byte copy
     of this file — edit this one and copy it over (the test compares them).

   The look itself is not ours to drift: it was taken from higgsfield.ai on the user's request —
   #0D0E10, lime #D1FE17, Space Grotesk headings (docs/HISTORY.md, «UI (public/)»). */
:root {
  color-scheme: dark;

  /* ── surfaces: page → panel → card → raised; each step one notch lighter ── */
  --bg: #0d0e10;
  --panel: #131416;
  --card: #1a1c1e;
  --card-2: #222426;
  --media-bg: #08090a;               /* behind a video or a picture until it paints */
  --scrim: rgba(8, 9, 10, .72);      /* behind a dialog */
  --scrim-strong: rgba(8, 9, 10, .86); /* the lightbox; the dark end of a gradient under text on video */
  --glass: rgba(13, 14, 16, .92);    /* a bar over content (sticky header, toolbar on media) */
  --glass-soft: rgba(13, 14, 16, .6); /* a label laid over a picture */
  --veil: rgba(13, 14, 16, .34);      /* dims a frame around the part that stays in focus */

  /* ── lines ── */
  --line: rgba(255, 255, 255, .07);        /* dividers, card edges */
  --line-strong: rgba(255, 255, 255, .14); /* controls at rest */
  --line-hover: rgba(255, 255, 255, .28);  /* controls under the pointer */
  --wash: rgba(255, 255, 255, .04);        /* the quietest fill: a hovered row, a ghost button */

  --white: #fff;   /* text on --pink, the hover of a white button */
  --black: #000;   /* a letterbox behind media */

  /* ── text: four steps, never a fifth grey ── */
  --text: #f2f3f5;   /* headings and anything a person acts on */
  --prose: #cfd2d6;  /* long reading — pure --text at 16px glares */
  --muted: #9aa0a6;  /* secondary text, descriptions */
  --dim: #888d93;    /* meta: dates, counters, captions — AA for small text on every surface (4.7:1 on --card-2) */
  --faint: rgba(255, 255, 255, .46); /* quieter than --dim and still AA (4.6:1): the secondary line under a lime heading */

  /* ── accent: lime is action and "yours", never decoration ── */
  --lime: #d1fe17;
  --lime-hover: #e0ff42;
  --lime-dim: #a8cd12;
  --on-lime: #101201;                  /* text on a lime fill */
  --lime-soft: rgba(209, 254, 23, .07); /* a selected card, a hint box */
  --lime-line: rgba(209, 254, 23, .4);  /* the edge of a selected card, a lime outline */
  --lime-ghost: rgba(209, 254, 23, .26); /* a halo: the ring around a lime dot, a quiet lime edge */
  --lime-tint: rgba(209, 254, 23, .14);  /* a lime-soft thing under the pointer or pressed */
  --on-lime-line: rgba(16, 18, 1, .3);   /* a divider or ring inside a lime fill */
  --on-lime-dim: rgba(16, 18, 1, .55);   /* secondary text on a lime fill */

  /* ── states ── */
  --pink: #ff005b;                      /* error, destructive */
  --pink-text: #ff5c92;                 /* error text: --pink itself is too dark on --bg */
  --pink-soft: rgba(255, 0, 91, .07);
  --pink-line: rgba(255, 0, 91, .45);
  --amber: #e8c36a;                     /* warning and advice: lapsed, almost full, a face in a picture */
  --amber-soft: rgba(232, 195, 106, .1);
  --amber-line: rgba(232, 195, 106, .45);

  /* ── type ── */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* the scale: 10 is the floor (caps labels only), 16 is reading and every field on a phone
     (iOS zooms into a smaller one), the display steps are fluid */
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-28: 28px;
  --fs-32: 32px;
  --fs-40: 40px;
  --fs-48: 48px;
  --fs-lead-s: clamp(13px, 1.25vw, 16px);   /* small fluid text beside a display line */
  --fs-lead: clamp(16px, 1.4vw, 18px);      /* the lead paragraph under a page title */
  --fs-title: clamp(22px, 2.6vw, 32px);     /* a section title */
  --fs-display-s: clamp(26px, 3.4vw, 40px);
  --fs-display-m: clamp(28px, 4.4vw, 56px);
  --fs-display-l: clamp(34px, 5.6vw, 72px);
  --fs-display-xl: clamp(36px, 6.4vw, 86px); /* the hero line of a page, once */

  --lh-display: .92;  /* caps display lines */
  --lh-tight: 1.1;    /* headings */
  --lh-snug: 1.3;     /* titles of cards, two-line labels */
  --lh-ui: 1.4;       /* controls, menus, table cells */
  --lh-body: 1.55;    /* paragraphs */
  --lh-prose: 1.65;   /* long reading */
  --lh-loose: 2.05;   /* a ruled table of figures: room between the dotted rules */

  --ls-tighter: -.035em; /* big caps display */
  --ls-tight: -.02em;   /* headings */
  --ls-snug: -.01em;
  --ls-wide: .04em;     /* caps buttons and display-font labels */
  --ls-caps: .08em;     /* caps labels, eyebrows */
  --ls-caps-wide: .12em; /* tiny caps (10–11 px) */

  /* ── space: a 4 px grid; 2 and 6 only inside a control ── */
  /* fluid steps of the public pages: the full step on a desktop, about half on a phone */
  --sp-fluid-24: clamp(16px, 2.2vw, 24px);
  --sp-fluid-32: clamp(20px, 3vw, 32px);
  --sp-fluid-40: clamp(24px, 3.4vw, 40px);
  --sp-fluid-48: clamp(24px, 4vw, 48px);
  --sp-fluid-64: clamp(32px, 4.6vw, 64px);
  --sp-fluid-80: clamp(40px, 6vw, 80px);
  --sp-fluid-96: clamp(48px, 7vw, 96px);
  --sp-2: 2px;
  --sp-4: 4px;
  --sp-6: 6px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-40: 40px;
  --sp-48: 48px;
  --sp-64: 64px;
  --sp-80: 80px;
  --sp-96: 96px;

  /* ── shape ── */
  --r-2: 2px;     /* a bar, a progress track */
  --r-4: 4px;     /* a tag, a key cap, a code chip */
  --r-8: 8px;     /* a field, a menu item, a small card */
  --r-12: 12px;   /* a card, a menu, a dialog on a phone */
  --r-16: 16px;   /* a dialog, a large panel */
  --r-pill: 999px; /* every button and chip */

  /* ── depth: three heights, nothing in between ── */
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .45);      /* a menu, a tooltip, a popover */
  --shadow-overlay: 0 16px 40px rgba(0, 0, 0, .55); /* a panel over the page */
  --shadow-dialog: 0 32px 90px rgba(0, 0, 0, .6);   /* a modal dialog, a lightbox */
  --shadow-side: 24px 0 60px rgba(0, 0, 0, .5);      /* a drawer from the left */
  --shadow-side-r: -24px 0 60px rgba(0, 0, 0, .5);   /* a drawer from the right */
  --shadow-up: 0 -16px 40px rgba(0, 0, 0, .5);       /* a sheet from the bottom */
  --glow-lime: 0 10px 34px rgba(209, 254, 23, .24); /* the one primary action of a hero */

  /* ── controls: three heights; under a finger the small one grows to 36, the middle one to 44 ── */
  --ctl-xs: 24px;  /* a button laid over media or inside a chip: close, a card's own action */
  --ctl-sm: 32px;  /* a button inside a card, a toolbar, a table row */
  --ctl-md: 40px;  /* the default: dialogs, forms, page actions */
  --ctl-lg: 48px;  /* the one call to action of a page */

  /* ── icons: drawn in the markup (<svg width height>), so the scale lives here as a rule, not as
     variables: 10 (a caret), 12, 14, 16, 20, 24; 22 is the mark; 32 and up are illustrations ── */

  /* ── layout ── */
  --header-h: 56px;     /* every header of every surface */
  --gutter: clamp(16px, 3.4vw, 48px); /* the page edge */
  --container: 1320px;  /* public pages: the widest row of content */
  --mark: 22px;         /* the Longtake mark in every header */

  /* ── motion ── */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: .12s;  /* hover, press */
  --dur: .2s;        /* open, close */
  --dur-slow: .35s;  /* a sheet, a page-level change */
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0s; --dur: 0s; --dur-slow: 0s; }
}
@media (pointer: coarse) {
  :root { --ctl-sm: 36px; --ctl-md: 44px; }
}

/* ════════════════════════════════════════════════════════════════════════════════════════════
   Components shared by every surface. A surface's own stylesheet may place them (flex, width,
   margins), never restyle them: a new look is a new variant here.
   ════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── Button. One shape everywhere: a pill, Space Grotesk 700, sentence case (caps belong to
   headings and labels, never to an action). Older names of the same component: .pill and its
   variants in the studio, .help-btn in the help. Size and look are picked with classes; a context
   that needs another size sets --btn-h / --btn-px / --btn-fs to one of the steps below. ── */
.btn, .pill, .help-btn {
  --btn-h: var(--ctl-md);
  --btn-px: var(--sp-20);
  --btn-fs: var(--fs-13);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-8);
  min-height: var(--btn-h); padding: 0 var(--btn-px);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--card-2); color: var(--text);
  font-family: var(--font-display); font-size: var(--btn-fs); font-weight: 700; line-height: var(--lh-snug);
  letter-spacing: 0; text-transform: none; text-decoration: none; text-align: center; white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.btn:hover, .pill:hover, .help-btn:hover { border-color: var(--line-hover); text-decoration: none; }
/* focus: a solid lime outline off the edge — survives forced-colors (a box-shadow ring does not)
   and keeps the pill's shape against a page's own :focus-visible radius */
.btn:focus-visible, .pill:focus-visible, .help-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: var(--r-pill); }
.btn:disabled, .pill:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; }

/* primary — the one action a screen is for; a screen has one */
.btn-primary, .pill-lime, .help-btn { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }
.btn-primary:hover, .pill-lime:hover, .help-btn:hover { background: var(--lime-hover); border-color: var(--lime-hover); color: var(--on-lime); }
/* ghost — a quiet second action beside a primary one */
.btn-ghost, .pill-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover, .pill-ghost:hover { background: var(--wash); color: var(--text); }
/* danger — deletes or cancels something that cost money */
.btn-danger, .pill-danger { background: transparent; border-color: var(--pink-line); color: var(--pink-text); }
.btn-danger:hover, .pill-danger:hover { background: var(--pink); border-color: var(--pink); color: var(--white); }

/* sizes */
.btn-sm, .pill-sm { --btn-h: var(--ctl-sm); --btn-px: var(--sp-12); --btn-fs: var(--fs-12); }
.btn-lg { --btn-h: var(--ctl-lg); --btn-px: var(--sp-32); --btn-fs: var(--fs-14); }
/* a hero's primary action lifts a little under the pointer — only there */
.btn-lg.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow-lime); }

/* ── Eyebrow: the caps label over a field, a group or a heading. Mono caps are a different
   thing — data and meta (a take number, a counter, a formula), never a label. ── */
.eyebrow {
  font-family: var(--font-display); font-size: var(--fs-11); font-weight: 700; line-height: var(--lh-ui);
  letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted);
}

/* ── Header pieces. Every surface's header is var(--header-h) tall with a line under it, the mark
   (var(--mark)) and the wordmark on the left, the language switch and one action on the right.
   Wordmark: .help-brand (help, pricing, guides), .logo (landing, compare, verify), .brand (studio,
   Academy, admin) — one look under three names. ── */
.wordmark, .help-brand, .logo {
  display: inline-flex; align-items: center; gap: var(--sp-12);
  font-family: var(--font-display); font-size: var(--fs-13); font-weight: 700;
  letter-spacing: var(--ls-caps-wide); text-transform: uppercase; white-space: nowrap;
  color: var(--text); text-decoration: none;
}
.wordmark:hover, .help-brand:hover, .logo:hover { text-decoration: none; color: var(--text); }
.wordmark svg, .help-brand svg, .logo svg { flex: none; width: var(--mark); height: var(--mark); }

/* the language switch: a two-segment pill, the current language in lime. Links (public pages)
   and buttons (the studio) look the same; a separator some pages carry is not shown. */
.lang-pick, .lang {
  display: inline-flex; align-items: center; flex: none; gap: var(--sp-2); padding: var(--sp-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
}
.lang-pick > i, .lang > i { display: none; }
.lang-pick a, .lang-pick button, .lang a {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--sp-8);
  border: 0; border-radius: var(--r-pill); background: none; cursor: pointer;
  font: 700 var(--fs-11) / 1 var(--font-display); letter-spacing: var(--ls-wide);
  color: var(--muted); text-decoration: none;
}
.lang-pick a:hover, .lang-pick button:hover, .lang a:hover { color: var(--text); text-decoration: none; }
.lang-pick a.on, .lang-pick button.on, .lang a.on { background: var(--lime); color: var(--on-lime); }

/* a narrow phone keeps the mark and drops the word: the header row then fits 320 px with the
   language switch and the button to the studio */
@media (max-width: 400px) {
  .wordmark, .help-brand, .logo { font-size: 0; gap: 0; }
}

/* ── Field: every text input, number, select and textarea. An element-level baseline — specificity
   (0,0,1): it beats the pages' `* { margin: 0; padding: 0 }` reset (0,0,0) and loses to any class,
   so a surface's own rule for a particular field always wins; the look itself is not repeated
   there. Single-line fields are as tall as a default button, so a field and a button in one row
   line up. A search field may be a pill (.search-input); nothing else changes the shape. ── */
input:where(:not([type]), [type="text"], [type="email"], [type="search"], [type="url"],
  [type="password"], [type="number"], [type="tel"]), select, textarea {
  box-sizing: border-box;
  min-height: var(--ctl-md);
  padding: var(--sp-8) var(--sp-12);
  border: 1px solid var(--line); border-radius: var(--r-12);
  background: var(--card); color: var(--text);
  font: 400 var(--fs-14) / var(--lh-ui) var(--font-body);
  transition: border-color var(--dur-fast);
}
textarea { padding: var(--sp-12); line-height: var(--lh-body); resize: vertical; }
select {
  padding-right: var(--sp-32); cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23888D93' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-12) center; background-size: 10px;
}
:where(input, select, textarea):hover { border-color: var(--line-strong); }
/* focus: the edge turns lime — the caret shows where you are; a 2 px outline on top of a field
   (the pages' own :focus-visible) reads as an error, so it is taken off here with real specificity */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--lime-line); }
:where(input, textarea)::placeholder { color: var(--dim); opacity: 1; }
:where(input[type="range"]) { accent-color: var(--lime); }
/* below 16 px iOS Safari zooms the page into the field */
@media (max-width: 640px) {
  input:where(:not([type]), [type="text"], [type="email"], [type="search"], [type="url"],
    [type="password"], [type="number"], [type="tel"]), select, textarea { font-size: var(--fs-16); }
}

/* ── Chip: a toggle or a filter in a row — a ratio, a feed filter, a reply option. Sentence case;
   the pressed one is lime. Older name: .sc-chip (the Supercomputer's replies). ── */
.chip, .sc-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-6);
  min-height: var(--ctl-sm); padding: var(--sp-4) var(--sp-12);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--text);
  font: 500 var(--fs-12) / var(--lh-snug) var(--font-display); letter-spacing: 0; text-transform: none;
  cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.chip:hover, .sc-chip:hover { border-color: var(--line-hover); }
.chip:disabled, .sc-chip:disabled { opacity: .45; cursor: default; }
.chip:focus-visible, .sc-chip:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.chip.active, .chip[aria-pressed="true"], .sc-chip[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }

/* ── Tag: a static label — a lesson's length, "required", "new tool". Mono, never clickable; the
   accent one is lime. ── */
.tag {
  display: inline-flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-8);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font: 400 var(--fs-11) / var(--lh-ui) var(--font-mono); color: var(--dim); white-space: nowrap;
}
.tag.hot, .tag.key, .tag.req, .tag-accent { color: var(--lime); border-color: var(--lime-ghost); }

/* ── Dialog backdrop: one veil under every modal. ── */
:where(dialog)::backdrop { background: var(--scrim-strong); backdrop-filter: blur(6px); }
