/*
 * Counsely — Design System 2.0 (web)
 * Source of truth: the "Counsely — Design System 2.0" tokens, the same
 * tokens.json the iOS app uses (ContractApp/scripts/design-tokens/).
 * Base: Document (paper ground, navy ink, one blue accent).
 * Variation: the Night field (field-1 → field-3) for the privacy band,
 * the closing CTA, the footer and the 404 page.
 * Every page links this file BEFORE its own <style>.
 */

/* Inter 4.0 (OFL-1.1), self-hosted, subset to Latin + Latin Extended. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-700.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/inter-800.woff2") format("woff2"); }

:root {
    /* Document (light) — contrast ratios in the design system's tokens.json */
    --paper: #F6F8FC;          /* page ground, alternating sections */
    --surface: #FFFFFF;        /* cards, the contract sheet, nav */
    --hairline: #E3E8F2;       /* dividers, card borders (decorative) */
    --ink: #0B1B33;            /* headlines and body, 16.2:1 on paper */
    --ink-muted: #3B4A63;      /* sublines, paragraphs, 8.4:1 */
    --ink-subtle: #5B6880;     /* metadata and labels only, 5.3:1 */
    --accent: #2459C7;         /* the only action colour, 5.9:1 on paper */
    --accent-hover: #1D4BAD;   /* hover/pressed of accent fills and links */
    --accent-tint: #E6EDFB;    /* secondary buttons, callouts, icon tiles */
    --on-accent: #FFFFFF;      /* text on accent, 6.3:1 */

    /* Night field (variation B) */
    --field-1: #0A1628;
    --field-2: #111F36;
    --field-3: #1A3A5C;
    --on-field: #FFFFFF;
    --on-field-muted: #C9D3E6; /* 7.7:1 or more on every stop */
    --field-accent: #9DB8FF;   /* eyebrows and links on Night */

    /* Brand rule (app icon gradient): never behind text */
    --icon-start: #5FB4F2;
    --icon-end: #7C8CF0;

    /* Risk scale: always shape + word + colour */
    --risk-critical: #B42318; --risk-critical-tint: #FDECEA; --risk-critical-marker: #F5B4AC;
    --risk-high: #B54708;     --risk-high-tint: #FEF0E3;     --risk-high-marker: #F9C99A;
    --risk-medium: #8A6100;   --risk-medium-tint: #FCF4DC;   --risk-medium-marker: #F2DE9C;
    --risk-low: #167A45;      --risk-low-tint: #E7F5EC;      --risk-low-marker: #BFE5CC;

    /* Type */
    --font-sans: "Inter", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-doc: "Source Serif 4", Georgia, "Times New Roman", serif;

    /* Radius */
    --radius-doc: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-control: 14px;
    --radius-xl: 20px;
    --radius-sheet: 28px;
    --radius-pill: 999px;

    /* Shadow */
    --shadow-doc: 0 16px 36px rgba(11, 27, 51, 0.12);
    --shadow-sheet: 0 0 0 1px rgba(11, 27, 51, 0.08), 0 30px 60px rgba(11, 27, 51, 0.18);

    /* Layout */
    --max-width: 1200px;
    --transition: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    --brand-rule: 6px;

    /* Legacy names used by the pages' own CSS, mapped onto the tokens.
       Do not use them in new CSS. */
    --navy: var(--field-1);
    --navy-mid: var(--field-2);
    --navy-light: var(--field-3);
    --blue: var(--accent);
    --blue-hover: var(--accent-hover);
    --blue-soft: var(--accent-tint);
    --white: #FFFFFF;
    --gray-bg: var(--paper);
    --gray-border: var(--hairline);
    --text: var(--ink);
    --text-secondary: var(--ink-muted);
    --text-tertiary: var(--ink-subtle);
    --radius: var(--radius-control);
    --shadow: 0 2px 20px rgba(11, 27, 51, 0.08);
    --shadow-lg: var(--shadow-sheet);
}

/* The 6px brand rule at the very top of every page. */
.brand-rule {
    position: sticky;
    top: 0;
    z-index: 1001;
    height: var(--brand-rule);
    background: linear-gradient(90deg, var(--icon-start) 0%, var(--icon-end) 100%);
}

/* Risk chips (site and blog). Markup:
   <span class="risk-chip risk-chip--high"><svg …></svg>High</span> */
.risk-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--radius-pill);
    font: 800 11px/1.4 var(--font-sans); letter-spacing: 0.5px; text-transform: uppercase;
}
.risk-chip svg { width: 10px; height: 10px; fill: currentColor; }
.risk-chip--critical { background: var(--risk-critical-tint); color: var(--risk-critical); }
.risk-chip--high { background: var(--risk-high-tint); color: var(--risk-high); }
.risk-chip--medium { background: var(--risk-medium-tint); color: var(--risk-medium); }
.risk-chip--low { background: var(--risk-low-tint); color: var(--risk-low); }

/* Marker behind a flagged clause excerpt. */
.risk-mark--critical { background: linear-gradient(transparent 55%, var(--risk-critical-marker) 55%); color: var(--ink); }
.risk-mark--high { background: linear-gradient(transparent 55%, var(--risk-high-marker) 55%); color: var(--ink); }
.risk-mark--medium { background: linear-gradient(transparent 55%, var(--risk-medium-marker) 55%); color: var(--ink); }

/* Visible keyboard focus everywhere. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* "Not legal advice." line. */
.legal-note { font-size: 13px; color: var(--ink-subtle); }
