/* Design tokens: the only place colours, fonts, sizes and radii are defined (ADR 0007, docs/design/README.md).
   Brand: The Communication Clinic. Restyle by editing this file first; components.css only refers to these names.
   Contrast ratios for every text/control pair are listed in docs/design/README.md (WCAG 2.2 AA). */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.825fabef695f.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Brand palette (raw). Decorative ones (teal-logo, mint, rose-logo) never carry text. */
  --ink: #1f3b37;          /* body text, 12:1 on white */
  --ink-soft: #55706b;     /* secondary text, 5.4:1 */
  --teal: #137a71;         /* headings, links, 5.2:1 (brighter, 1 Dec 2026) */
  --teal-deep: #0d5c55;    /* hover and strong badges, 7.5:1 on mist */
  --teal-logo: #2fa36b;    /* logo green: shapes only */
  --mint: #8fd1ae;         /* strokes only */
  --mint-soft: #bfe6dc;    /* text on dark */
  --mist: #f4fbf8;         /* pale section background (lighter) */
  --rose: #b8285e;         /* primary buttons, focus ring */
  --rose-deep: #8f1d48;    /* button hover, error text */
  --rose-logo: #d74586;    /* logo pink: shapes only */
  --blush: #fff2f7;        /* pale pink background (lighter) */
  --line: #dbeee8;         /* borders (lighter) */
  --night: #10242a;        /* header, footer, logo background */
  --night-2: #183740;      /* raised surface on night */
  --field-line: #6b8681;   /* form field border, 3.9:1 (WCAG 1.4.11) */
  --white: #ffffff;
  --amber-bg: #fff8e6;     /* warning background */
  --amber-ink: #6b4500;    /* warning text and border */
  --green-bg: #eaf8f1;     /* success background */
  --green-ink: #175a3a;    /* success text */
  --teal-tint: #e3f3ee;    /* selected nav item, today column, chip when ticked (teal-deep text 8.9:1) */
  --canvas: #f8fcfa;       /* the staff app's page background behind white panels */
  --line-strong: #c3e0d7;  /* panel borders that need to be seen (decorative) */

  /* Semantic aliases: components use these. */
  --color-bg: var(--white);
  --color-surface: var(--white);
  --color-surface-alt: var(--mist);
  --color-border: var(--line);
  --color-field-border: var(--field-line);
  --color-text: var(--ink);
  --color-text-muted: var(--ink-soft);
  --color-heading: var(--teal);
  --color-link: var(--teal);
  --color-link-hover: var(--teal-deep);
  --color-primary: var(--rose);
  --color-primary-hover: var(--rose-deep);
  --color-primary-text: var(--white);
  --color-secondary-text: var(--teal);
  --color-secondary-border: var(--teal);
  --color-secondary-hover-bg: var(--mist);
  --color-danger: var(--rose-deep);
  --color-danger-hover: #6e1336;
  --color-danger-text: var(--white);
  --color-error-text: var(--rose-deep);
  --color-focus: var(--rose);
  --color-stroke: var(--mint);
  --color-shape-a: var(--teal-logo);
  --color-shape-b: var(--rose-logo);

  --color-info-bg: var(--mist);
  --color-info-border: var(--teal);
  --color-success-bg: var(--green-bg);
  --color-success-text: var(--green-ink);
  --color-success-border: var(--green-ink);
  --color-warning-bg: var(--amber-bg);
  --color-warning-text: var(--amber-ink);
  --color-warning-border: var(--amber-ink);
  --color-error-bg: var(--blush);
  --color-error-border: var(--rose-deep);


  --color-canvas: var(--canvas);
  --color-selected-bg: var(--teal-tint);
  --color-selected-text: var(--teal-deep);
  --color-border-strong: var(--line-strong);
  --color-quiet-action-bg: var(--teal-deep);  /* "+ New": solid but not rose, so the page keeps one rose action */

  --color-badge-bg: var(--mist);
  --color-badge-text: var(--ink);
  --color-badge-strong-bg: var(--teal-deep);
  --color-badge-strong-text: var(--white);
  --color-badge-alarm-bg: var(--rose-deep);
  --color-badge-alarm-text: var(--white);

  /* Type: one family. Fluid scale, ratio 1.25, 18px base. */
  --font-body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-size-base: 1.125rem;
  --font-size-small: 0.95rem;
  --font-size-h3: 1.25rem;
  --font-size-h2: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem);
  --font-size-h1: clamp(1.75rem, 1.45rem + 1.4vw, 2.45rem);
  --font-size-display: clamp(2rem, 1.6rem + 2vw, 3rem);
  --font-weight-body: 400;
  --font-weight-strong: 650;
  --font-weight-heading: 780;
  --tracking-heading: -0.015em;
  --line-height: 1.55;
  --line-height-tight: 1.15;
  --measure: 68ch;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.75rem;
  --space-12: 3.5rem;

  /* Shape */
  --radius-bubble: 1.75rem;   /* hero and feature panels */
  --radius-tail: 0.375rem;    /* the "tail" corner of a speech bubble */
  --radius-card: 1.25rem;
  --radius-field: 0.75rem;
  --radius-pill: 999px;
  --radius: var(--radius-field);
  --border-width: 1px;
  --stroke-width: 3px;        /* logo-like stroke */
  --focus-ring: 3px solid var(--color-focus);

  --page-max-width: 72rem;
  --tap-target: 3rem;
  --nav-target: 2.75rem;
  --logo-size: 2.5rem;

  /* Client-facing (public) pages: bigger everything. */
  --public-font-size: 1.25rem;      /* 20px body */
  --public-font-size-h1: clamp(1.9rem, 1.6rem + 1.4vw, 2.5rem);
  --public-tap-target: 3.5rem;      /* 56px buttons */
  --public-max-width: 40rem;        /* one task per screen, one column */
  --icon-size: 1.5em;

  /* Staff app shell */
  --topbar-height: 3.5rem;
  --rail-width: 15rem;
  --app-max-width: 84rem;
  --shadow-menu: 0 0.5rem 1.5rem rgb(16 36 42 / 0.12);  /* only on menus that float over content */
  --tabular: tabular-nums;
}

/* Staff pages (<body class="app">) are working screens: a denser scale (16px base, ratio 1.2) and smaller targets
   (40px, still well above WCAG 2.5.8's 24px). Client-facing pages keep the big scale above. */
.app {
  --font-size-base: 1rem;
  --font-size-small: 0.875rem;
  --font-size-h3: 1.0625rem;
  --font-size-h2: 1.25rem;
  --font-size-h1: clamp(1.5rem, 1.35rem + 0.6vw, 1.875rem);
  --line-height: 1.5;
  --tap-target: 2.5rem;
  --nav-target: 2.25rem;
  --radius-card: 0.875rem;
  --radius-field: 0.5rem;
  --page-max-width: var(--app-max-width);
  background: var(--color-canvas);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height);
  overflow-wrap: break-word;
}

h1, h2, h3 {
  color: var(--color-heading);
  font-weight: var(--font-weight-heading);
  letter-spacing: var(--tracking-heading);
  line-height: var(--line-height-tight);
}
h2 { font-size: var(--font-size-h2); margin: var(--space-8) 0 var(--space-3); }
h3 { font-size: var(--font-size-h3); }

p, li, dd { max-width: var(--measure); }

a { color: var(--color-link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--color-link-hover); text-decoration-thickness: 2px; }

code { font-family: inherit; font-weight: var(--font-weight-strong); letter-spacing: 0.04em; overflow-wrap: anywhere; }

img { max-width: 100%; height: auto; }

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

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