/*
 * Dreamteam web design tokens.
 *
 * Normalised from the Figma homepage (file 8Nf3Ce2LhIj32oZUyB3zdh), which
 * uses 29 font sizes, 32 radii and 92 colour values, almost none of them
 * bound to variables. Every Figma value maps to the nearest token below; the
 * mapping is listed on /styleguide/ for the designer.
 *
 * Three layers. Components use only the semantic layer and the scales:
 *   1. Primitives — the brand palette (brand book) and a neutral ramp.
 *   2. Semantic   — what a colour is for (text, surface, border, accent).
 *   3. Scales     — type, space, radius, shadow, motion, layout.
 */

/* Telegraf for display; Inter for everything else (Google Fonts, in the page head). */
@font-face { font-family: 'Telegraf'; src: url('fonts/PPTelegraf-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Telegraf'; src: url('fonts/PPTelegraf-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Telegraf'; src: url('fonts/PPTelegraf-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  /* ================================================================== */
  /* 1. Primitives                                                       */
  /* ================================================================== */

  /* Brand (brand book p27–32) */
  --red-500: #f92810; /* Active Pulse */
  --red-700: #b70c02; /* Critical Focus */
  --red-300: #fe9a8c; /* Early Signal */
  --red-100: #fee4e0;
  --red-50: #fff1ee;
  --gold-300: #eedd91; /* Soft Presence */
  --gold-100: #f7efc4;
  --gold-50: #fff4d9;
  --slate-100: #e2e7ed; /* Open Blue */
  --ink-900: #1c1d1f; /* Black Wire */
  --ink-700: #272e2c; /* Figma headline / body ink */
  --ember-900: #181010; /* dark sections */

  /* Brand ribbon (slat ribbon roles). The accent is the Figma ribbon's side
     fill #E5413A — deeper than Active Pulse, so a 20% red budget reads as
     shadow, not fill. The edge is the Figma ribbon highlight #FFF2C8. */
  --ribbon-body: #ffcabe;
  --ribbon-shade: #ffa497;
  --ribbon-edge: #fff2c8;
  --ribbon-accent: #e5413a;
  --ribbon-glint: #fffaf2;
  --ribbon-line: #ebb2ae; /* the Figma line waves' stroke (68:30905) */

  /* Neutrals — Figma's Neutral/300–700 variables, completed into a ramp */
  --neutral-0: #ffffff;
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;

  /* Warm paper — the product UI and card surfaces */
  --sand-50: #fcfbf8;
  --sand-100: #f7f5ef;
  --sand-200: #f5f1e7;
  --sand-300: #e6e0c8;

  /* Product status colours (task types in the app UI). The 600s are Figma's;
     the 700s are the same hues darkened to pass WCAG AA (≥ 4.5:1) as small
     text on their 50 fills — Figma's pairs measure 3.2–3.8:1. */
  --amber-600: #d56816;
  --amber-700: #ae5512;
  --amber-50: #fff4d9;
  --blue-600: #3974f6;
  --blue-700: #3267da;
  --blue-50: #edf4ff;
  --green-600: #2c9b5f;
  --green-700: #237d4c;
  --green-50: #ecf8f0;

  /* ================================================================== */
  /* 2. Semantic                                                         */
  /* ================================================================== */

  --color-bg: var(--neutral-0);
  --color-text: var(--ink-700);
  --color-text-strong: var(--ink-900);
  --color-text-muted: var(--neutral-600);
  --color-text-subtle: var(--neutral-500);
  --color-text-faint: var(--neutral-400);
  --color-text-inverse: var(--neutral-0);
  --color-text-inverse-muted: rgb(255 255 255 / 0.62);

  --color-accent: var(--red-500);
  --color-accent-strong: var(--red-700);
  --color-accent-soft: var(--red-100);
  --color-accent-faint: var(--red-50);
  --color-highlight: var(--gold-300);

  --color-surface: var(--neutral-0);
  --color-surface-warm: var(--sand-50);
  --color-surface-muted: var(--neutral-50);
  --color-surface-sunken: var(--sand-200);
  --color-surface-inverse: var(--ink-900);
  --color-surface-ember: var(--ember-900);
  --color-surface-fade: var(--neutral-200); /* end of light section gradients (Figma #E0E0E0) */

  --color-border: rgb(0 0 0 / 0.09);
  --color-border-strong: var(--neutral-300);
  --color-border-inverse: rgb(255 255 255 / 0.12);

  --color-focus: var(--red-500);

  /* Status pairs: text on soft fill, all AA as small text */
  --status-meeting: var(--amber-700);
  --status-meeting-bg: var(--amber-50);
  --status-email: var(--blue-700);
  --status-email-bg: var(--blue-50);
  --status-deal: var(--green-700);
  --status-deal-bg: var(--green-50);
  --status-urgent: var(--red-700);
  --status-urgent-bg: var(--red-50);

  /* --color-accent (#F92810) is 3.9:1 on white: large text and graphics only.
     Small accent text uses --color-accent-strong (6.9:1). */

  /* ================================================================== */
  /* 3. Scales                                                           */
  /* ================================================================== */

  /* Type families */
  --font-display: 'Telegraf', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Google Sans Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Type scale. Fluid between a 390 and a 1440 viewport; the max is the Figma size. */
  --text-display: clamp(2.75rem, 1.6rem + 3.35vw, 4.5rem); /* 44 → 72  hero */
  --text-title: clamp(2.125rem, 1.4rem + 2.1vw, 3.25rem); /* 34 → 52  section titles */
  --text-heading: clamp(1.5rem, 1.15rem + 1.05vw, 1.875rem); /* 24 → 30  card titles */
  --text-subheading: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem); /* 20 → 24  labels, tabs */
  --text-lead: clamp(1.125rem, 1.05rem + 0.25vw, 1.25rem); /* 18 → 20 */
  --text-body-lg: 1.125rem; /* 18 */
  --text-body: 1rem; /* 16 */
  --text-sm: 0.875rem; /* 14 */
  --text-xs: 0.75rem; /* 12 */

  --leading-display: 0.94;
  --leading-title: 1.04;
  --leading-heading: 1.15;
  --leading-snug: 1.25;
  --leading-normal: 1.45;

  --tracking-display: -0.032em;
  --tracking-title: -0.03em;
  --tracking-heading: -0.02em;

  /* Space — 4px base */
  --space-0-5: 0.125rem; /* 2 */
  --space-1: 0.25rem; /* 4 */
  --space-1-5: 0.375rem; /* 6 */
  --space-2: 0.5rem; /* 8 */
  --space-2-5: 0.625rem; /* 10 */
  --space-3: 0.75rem; /* 12 */
  --space-4: 1rem; /* 16 */
  --space-5: 1.25rem; /* 20 */
  --space-6: 1.5rem; /* 24 */
  --space-8: 2rem; /* 32 */
  --space-10: 2.5rem; /* 40 */
  --space-12: 3rem; /* 48 */
  --space-16: 4rem; /* 64 */
  --space-20: 5rem; /* 80 */
  --space-24: 6rem; /* 96 */
  --space-30: 7.5rem; /* 120 */

  /* Vertical rhythm between sections: 64 on phones → 120 at 1440 */
  --section-space: clamp(4rem, 2.6rem + 5.4vw, 7.5rem);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 999px;

  /* Shadows — layered, low-opacity (beautiful-shadows) */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05); /* Figma Shadows/shadow-xs */
  --shadow-sm: 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-md: 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 1px -0.5px rgb(0 0 0 / 0.06), 0 3px 3px -1.5px rgb(0 0 0 / 0.06),
    0 6px 6px -3px rgb(0 0 0 / 0.06), 0 12px 12px -6px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 0 0 1px rgb(0 0 0 / 0.05), 0 2px 4px -1px rgb(0 0 0 / 0.04), 0 8px 16px -4px rgb(0 0 0 / 0.06),
    0 24px 40px -12px rgb(17 24 39 / 0.12);
  /* Figma Shadows/shadow-xs-skeuomorphic: buttons */
  --shadow-button: 0 1px 2px 0 rgb(0 0 0 / 0.05), inset 0 -2px 0 0 rgb(0 0 0 / 0.05), inset 0 0 0 1px rgb(0 0 0 / 0.18);
  --ring-focus: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-focus);

  /* Blur (glass surfaces) */
  --blur-glass: 10px;

  /* Weight */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Opacity */
  --opacity-inactive: 0.55; /* not-taken branches, idle states */
  --opacity-disabled: 0.4;

  /* Motion (Emil: UI ease-out ≤ 300ms) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --duration-ambient: 14s; /* slow background drift (glows), not UI feedback */

  /* Layout */
  --tap-target: 2.75rem; /* 44 */
  --measure-title: 12em; /* headings break into balanced lines */
  --measure-body: 34em; /* ~70 characters */
  --container: 75rem; /* 1200 */
  --container-wide: 88.5rem; /* 1416: full-width cards (footer) */
  --container-pad: clamp(1rem, 0.6rem + 1.6vw, 2rem);

  /* Layers */
  --z-raised: 1;
  --z-sticky: 50;
  --z-overlay: 100;

  /* Breakpoints (documentation only; use in @media / @container):
     sm 480 · md 768 · lg 1024 · xl 1280 */

  /* ------------------------------------------------------------------ */
  /* Legacy aliases — the names the first build used. Kept so nothing   */
  /* breaks mid-refactor; remove once no section references them.       */
  /* ------------------------------------------------------------------ */
  --white: var(--neutral-0);
  --ink: var(--color-text);
  --accent: var(--color-accent);
  --alert: var(--color-accent-strong);
  --alert-surface: var(--color-accent-soft);
  --button-dark: var(--color-surface-inverse);
  --surface-warm: var(--color-surface-warm);
  --surface-dark: var(--color-surface-ember);
  --ui-muted: var(--neutral-600);
  --text-md: var(--text-body);
  --text-lede: var(--text-lead);
  --lh-xs: 1.125rem;
  --lh-sm: 1.25rem;
  --lh-md: 1.5rem;
  --lh-lede: 1.4;
  --display-xl: var(--text-display);
  --display-xl-lh: var(--leading-display);
  --display-xl-track: var(--tracking-display);
  --spacing-xxs: var(--space-0-5);
  --spacing-xs: var(--space-1);
  --spacing-sm: var(--space-1-5);
  --spacing-md: var(--space-2);
  --spacing-lg: var(--space-3);
  --spacing-xl: var(--space-4);
  --spacing-2xl: var(--space-5);
  --spacing-3xl: var(--space-6);
  --spacing-4xl: var(--space-8);
  --shadow-xs-skeuomorphic: var(--shadow-button);
  --page: 90rem;
  --gutter: 7.5rem;
}

/* ==================================================================== */
/* Base                                                                  */
/* ==================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

p,
h1,
h2,
h3,
h4,
figure,
blockquote {
  margin: 0;
}

:where(ul[role='list'], ol[role='list']) {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ==================================================================== */
/* Layout primitives                                                     */
/* ==================================================================== */

/* Content column: 1200 max, fluid side padding. Backgrounds stay full-bleed. */
.container {
  width: min(var(--container), 100% - 2 * var(--container-pad));
  margin-inline: auto;
}

.container--wide {
  width: min(var(--container-wide), 100% - 2 * var(--space-3));
}

/* Old name, kept until the sections are migrated. */
.fg-container {
  width: min(var(--container), 100% - 2 * var(--container-pad));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: var(--section-space);
}

/* First stop for keyboard users: hidden until focused, then pinned top-left above everything. */
.skip-link {
  position: fixed;
  inset-block-start: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: var(--z-overlay);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  font-weight: var(--weight-medium);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  translate: 0 calc(-100% - var(--space-6));
}

.skip-link:focus-visible {
  translate: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==================================================================== */
/* Text styles — one class per role. These are what the Figma text      */
/* styles should be named, one to one.                                   */
/* ==================================================================== */

.t-display,
.t-title,
.t-heading,
.t-subheading {
  font-family: var(--font-display);
  font-weight: 400;
  text-wrap: balance;
}

.t-display {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
}

.t-title {
  font-size: var(--text-title);
  line-height: var(--leading-title);
  letter-spacing: var(--tracking-title);
}

.t-heading {
  font-size: var(--text-heading);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
}

.t-subheading {
  font-size: var(--text-subheading);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-heading);
}

.t-lead {
  font-size: var(--text-lead);
  line-height: 1.4;
  text-wrap: pretty;
}

.t-body-lg {
  font-size: var(--text-body-lg);
  line-height: var(--leading-normal);
  text-wrap: pretty;
}

.t-body {
  font-size: var(--text-body);
  line-height: 1.5;
}

.t-sm {
  font-size: var(--text-sm);
  line-height: 1.43;
}

.t-xs {
  font-size: var(--text-xs);
  line-height: 1.5;
}

.t-muted {
  color: var(--color-text-muted);
}

.t-accent {
  color: var(--color-accent);
}
