/* Every visual decision lives here. */
@import url("https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..800&display=swap");

:root {
  color-scheme: light;

  /* Type */
  --font-display: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --weight-display: 600;
  --tracking-display: -0.035em;
  --size-body: 16px;        /* step 0: all reading text */
  --size-small: 14px;       /* sub-body, body minus 2px: secondary lines only (labels, captions, meta, tags, footer), never a paragraph */
  --size-lead: 20px;        /* Major third (1.25): step 1 */
  --size-h3: 20px;          /* step 1, same size as intro text, set apart by weight */
  --size-h2: 39px;        /* step 4 */
  --size-h1: 61px;        /* step 6 */
  --leading-body: 1.6;
  --leading-display: 1.12;

  /* Colour, in three layers.
     1. Reading surfaces stay neutral: page, cards, lines and text are pure grey, so reading never fights a tint.
     2. One accent marks what you act on or what's picked (buttons, the picked option, the highlighted row).
     3. A supporting palette colours content: six hues taken from the accent by a harmony rule,
        all at one OKLCH lightness and chroma, so none shouts louder than another. Each team role keeps its hue
        everywhere (avatars, tags, the diagram); magnitudes (chart, memory layers) are steps of the accent.
     --dark goes 0 (light) to 1 (dark); --contrast 0 (soft) to 1 (crisp); --amount 0 (grey) to 1 (full). */
  --accent-h: 265;          /* accent hue, degrees */
  --accent-c: 0.15;
  --amount: 0.8;            /* how much colour the supporting palette carries */
  --contrast: 0.6;
  --dark: 0;
  /* Harmony: each role's hue offset from the accent (Split) */
  --o1: 0; --o2: 150; --o3: -150; --o4: -30; --o5: 180; --o6: 30;

  /* Each role's lightness, light and dark, nudged by contrast */
  --l-paper: calc(1 - 0.835 * var(--dark));
  --l-alt:   calc(0.975 - 0.785 * var(--dark));
  --l-surface: calc(1 - 0.77 * var(--dark));
  --l-line:  calc(0.92 - 0.04 * var(--contrast) - (0.62 - 0.1 * var(--contrast)) * var(--dark));
  --l-ink:   calc(0.30 - 0.18 * var(--contrast) + (0.62 + 0.24 * var(--contrast)) * var(--dark));
  --l-soft:  calc(0.58 - 0.16 * var(--contrast) + (0.12 + 0.30 * var(--contrast)) * var(--dark));
  /* Accent lightness: dark enough for white text on light pages, light enough to read on dark ones */
  --l-accent: calc(0.53 + 0.22 * var(--dark));

  --paper:     oklch(var(--l-paper) 0 0);
  --paper-alt: oklch(var(--l-alt) 0 0);
  --surface:   oklch(var(--l-surface) 0 0);
  --line:      oklch(var(--l-line) 0 0);
  --sep:       color-mix(in oklch, var(--ink) calc(7% + 5% * var(--dark)), transparent);  /* v164 (user 18 Nov): separator rules, gentler than --line; same as the team traits rules */
  --ink:       oklch(var(--l-ink) 0 0);
  --ink-soft:  oklch(var(--l-soft) 0 0);
  --accent:    oklch(var(--l-accent) var(--accent-c) var(--accent-h));
  /* Primary button: soft charcoal (lighter than the text, user 18 Nov) with a hint of the accent hue; flips to near-white in dark */
  --btn:       oklch(calc(0.27 + 0.67 * var(--dark)) 0.012 var(--accent-h));
  --btn-hover: oklch(calc(0.38 + 0.52 * var(--dark)) 0.014 var(--accent-h));
  --btn-ink:   oklch(calc(0.98 - 0.8 * var(--dark)) 0 0);
  /* White text on a dark accent, near-black on a light one, switching at lightness 0.62, where both read about equally */
  --accent-ink: oklch(from var(--accent) clamp(0.16, (0.62 - l) * 1000, 1) 0 0);

  /* Supporting palette: a soft tint to sit on, and a tone for marks and text on that tint.
     A role class (.r1 to .r6) sets --h; style.css builds the colours where --h is known
     (a custom property resolves where it's declared, so they can't be worked out here). */
  --l-tint: calc(0.925 - 0.60 * var(--dark));
  --l-tone: calc(0.47 + 0.38 * var(--dark));
  --c-tint: calc(0.06 * var(--amount));
  --c-tone: calc(0.16 * var(--amount));
  /* The hero's backdrop: a soft wash from the accent to a near neighbour, whatever the harmony */
  --wash-a: oklch(calc(0.90 - 0.62 * var(--dark)) calc(0.07 * var(--amount)) var(--accent-h));
  --wash-b: oklch(calc(0.93 - 0.64 * var(--dark)) calc(0.06 * var(--amount)) calc(var(--accent-h) + 40));
  --shade: calc(1 + 2.5 * var(--dark));  /* shadows read deeper on a dark page */

  /* Space: five knobs. Every gap is a step on one scale, step n = unit x ratio^n,
     with a smaller ratio on phones, so big spaces shrink most and small ones barely. */
  --space-unit: 8px;
  --space-ratio-wide: 1.333;
  --space-ratio-phone: 1.25;  /* phone pass 18 Nov: 1.3 kept desktop-sized gaps (s8 65, s9 85); 1.25 gives s8 48, s9 60 */
  --page-width: 1200px;

  --space-ratio: var(--space-ratio-wide);
  --s0: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 0)), 1px);
  --s1: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 1)), 1px);
  --s2: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 2)), 1px);
  --s3: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 3)), 1px);
  --s4: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 4)), 1px);
  --s5: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 5)), 1px);
  --s6: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 6)), 1px);
  --s7: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 7)), 1px);
  --s8: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 8)), 1px);
  --s9: round(nearest, calc(var(--space-unit) * pow(var(--space-ratio), 9)), 1px);

  /* Corners: four knobs. Controls (things you press or type in) have their own radius, up to a pill.
     Surfaces grow their radius with their size: one base and one step, sm = base / step,
     md = base, lg = base x step, xl = base x step^2. A surface inside a padded surface is
     concentric (outer radius minus the padding, never under 2px; a box wrapping sm surfaces is their radius plus the padding); with nesting off the inner takes sm.
     Circles (avatars, round icon buttons) stay circles. */
  --r-control: 999px;    /* pill */
  --r-base: 16px;
  --r-step: 2;
  --r-nest: 1;
  --r-sm: round(nearest, calc(var(--r-base) / var(--r-step)), 1px);
  --r-md: var(--r-base);
  --r-lg: round(nearest, calc(var(--r-base) * var(--r-step)), 1px);
  --r-xl: round(nearest, calc(var(--r-base) * var(--r-step) * var(--r-step)), 1px);
  /* Elevation is three levels */
  --rim: color-mix(in oklch, var(--ink) calc(6% + 4% * var(--dark)), transparent);
  /* Task pills' lift: one drop shadow, set like a design tool's (X, Y, blur, spread, opacity) */
  --lift-x: 0px; --lift-y: 4px; --lift-blur: 6px; --lift-spread: -6px; --lift-alpha: .40;  /* the user's pick, 17 Nov */
  --shadow-lift: var(--lift-x) var(--lift-y) var(--lift-blur) var(--lift-spread) rgb(0 0 0 / calc(var(--lift-alpha) * var(--shade)));
  --shadow-1: 0 1px 2px rgb(0 0 0 / calc(.06 * var(--shade))), 0 0 0 1px var(--rim);
  --shadow-2: 0 6px 16px -4px rgb(0 0 0 / calc(.10 * var(--shade))), 0 0 0 1px var(--rim);
  --shadow-bar: 0 5.33px 10.67px rgb(0 0 0 / calc(.10 * var(--shade)));  /* top bar once scrolled: 0 4pt 8pt, after tablomat.com */
  --shadow-3: 0 32px 64px -16px rgb(0 0 0 / calc(.22 * var(--shade))), 0 8px 20px -8px rgb(0 0 0 / calc(.10 * var(--shade))), 0 0 0 1px var(--rim);

  /* Proximity: how related two things are sets how close they sit, so the eye groups them before it reads them.
     Three levels inside a component, two steps apart on the scale:
     tight = one group (a title and its text, a figure and its caption);
     group = between groups (a tag, the title block, a footer);
     a surface's padding = its group gap, so the card holds together as one block instead of floating its content.
     Every gap is measured ink to ink: text is trimmed to cap height and baseline (text-box in style.css),
     so line height never adds hidden space to a gap.
     Floor: a gap next to running text sits at least one step above that text's own line gap (the space
     between its lines), or the two read as one paragraph. Body's line gap is 14 (s2), so tight is s3;
     section heads below follow the same rule at a larger scale. */
  --gap-tight: var(--s3);
  --gap-group: var(--s4);

  /* What each gap uses */
  --gutter: var(--s5);         /* side margin */
  --section-space: var(--s9);  /* hero and closing edges */
  --section-pad: var(--s8);    /* each side of a content section; two meet between sections (v137: s9 + s9 read too far apart, user 18 Nov) */
  /* Section heads use the same ladder at section scale, each level a step further out:
     kicker + title are one unit (tight, s3; s2 read cramped against a 39px title, user 16 Nov);
     title to intro text is a group gap sized to the title (s5);
     the title block to what follows is wider again (s6 for buttons, s7 for content). */
  --space-text: var(--s3);     /* kicker to title */
  --space-lead: var(--s5);     /* title to intro text */
  --space-actions: var(--s6);  /* title block to buttons */
  --space-head: var(--s7);     /* title block to content (cards, stats, the hero window) */
  --row-pad: var(--s4);        /* above and below each list row */
  --gap-col: var(--s7);        /* between columns */
  --gap-row: var(--s6);        /* between rows of the feature grid */
  --card-pad: var(--gap-group); /* inside cards and panels */
  --gap-card: var(--s4);       /* between cards in a grid or carousel */
}

.r1 { --h: calc(var(--accent-h) + var(--o1)); }
.r2 { --h: calc(var(--accent-h) + var(--o2)); }
.r3 { --h: calc(var(--accent-h) + var(--o3)); }
.r4 { --h: calc(var(--accent-h) + var(--o4)); }
.r5 { --h: calc(var(--accent-h) + var(--o5)); }
.r6 { --h: calc(var(--accent-h) + var(--o6)); }

@media (max-width: 760px) {
  /* Phone: a tighter space scale, and the type ladder two steps shorter at the top (h1 61 ran five lines at 390) */
  :root { --space-ratio: var(--space-ratio-phone); }
  /* Phone shadows one step softer: half the reach and about two thirds the darkness, sized to the smaller cards (user, 18 Nov) */
  :root {
    --shadow-2: 0 4px 12px -4px rgb(0 0 0 / calc(.07 * var(--shade))), 0 0 0 1px var(--rim);
    --shadow-3: 0 16px 32px -8px rgb(0 0 0 / calc(.14 * var(--shade))), 0 4px 12px -4px rgb(0 0 0 / calc(.07 * var(--shade))), 0 0 0 1px var(--rim);
  }
  body { --size-h1: 40px; --size-h2: 30px; --size-lead: 18px; --size-h3: 18px; }
}
