/* ── The Ledger — KingCare Design Tokens (Stage 1) ──────────────────
   Direction: immutable, inspectable records.
   Tokens only — nothing visual changes until Stage 2+.
   ──────────────────────────────────────────────────────────────────── */

/* ── Self-hosted fonts (CSP: font-src 'self') ────────────────────── */

/* Inter — variable weight (400 / 500 / 600) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 400 */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 500 */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* ── Palette ─────────────────────────────────────────────────────── */
  --kc-ink:        #1A2E2A;
  --kc-paper:      #F7F6F2;
  --kc-evergreen:  #2F5D50;
  --kc-sage:       #E4EAE3;
  --kc-amber:      #9C5E1C;  /* was #B8742A (3.77:1 under white badge text); 5.2:1 meets AA, 28 Nov 2026 */
  /* Darkened from #6B7A75 in 9.4. The original was 4.16:1 on paper and 4.00:1
   * on a ledger row — below the 4.5:1 WCAG 2.2 AA floor for text, and this is
   * the colour of every piece of secondary text in the product. #5E6B67 is the
   * smallest step that clears AA on paper, card and ledger-row grounds while
   * keeping the hue and staying clearly distinct from --kc-ink. Checked by
   * AccessibilityTests rather than by eye. */
  --kc-slate:      #5E6B67;

  /* ── Typography — families ───────────────────────────────────────── */
  --kc-font-heading:  'Inter', sans-serif;
  --kc-font-body:     'Inter', sans-serif;
  --kc-font-mono:     'IBM Plex Mono', monospace;  /* timestamps, URNs, IDs, actor names */

  /* ── Typography — weights ────────────────────────────────────────── */
  --kc-weight-heading:     600;
  --kc-weight-body:        400;
  --kc-weight-body-medium: 500;
  --kc-weight-mono:        400;
  --kc-weight-mono-medium: 500;

  /* ── Typography — scale ──────────────────────────────────────────── */
  --kc-text-xs:   0.75rem;
  --kc-text-sm:   0.875rem;
  --kc-text-base: 1rem;
  --kc-text-lg:   1.125rem;
  --kc-text-xl:   1.25rem;
  --kc-text-2xl:  1.5rem;

  /* ── Audit stamp (load-bearing, not decorative) ──────────────────── *
   * Every record row: created/modified timestamp + actor in mono,
   * right-aligned, sealed with a sage left-rule.                      */
  /* Body face with tabular figures, not monospace. Monospace on every date
   * made the product read as a developer tool; tabular Inter keeps the
   * columns aligned without the typewriter. */
  --kc-stamp-font:       var(--kc-font-body);
  --kc-stamp-weight:     var(--kc-weight-body);
  --kc-stamp-size:       var(--kc-text-xs);
  --kc-stamp-color:      var(--kc-slate);
  --kc-stamp-rule-color: var(--kc-sage);
  --kc-stamp-rule-width: 3px;

  /* ── Ledger row ──────────────────────────────────────────────────── */
  --kc-row-fill: var(--kc-sage);

  /* ── Card surface (Stage 3) ────────────────────────────────────── */
  --kc-card-bg:     #FFFFFF;
  /* Neutral, not sage. Every hairline in the product was a green tint, so
   * borders, ledger rows and header bands were all the same colour and the
   * page read as one flat green-grey wash. A warm neutral line lets the
   * evergreen mean something again. (Premium pass, 26 Oct 2026.) */
  --kc-card-border: #E6E3DC;
  --kc-line:        var(--kc-card-border);
  /* Names some pages reached for but nothing defined, so they always drew
   * their hard-coded light fallbacks — slightly off-palette by day and
   * glaring white by night. Aliases, not new colours. */
  --kc-border:        var(--kc-card-border);
  --kc-rule:          var(--kc-card-border);
  --kc-surface-muted: var(--kc-surface-2);
  --kc-surface-2:   #FAF9F6;   /* table heads, quiet wells inside a card   */
  /* Card and panel headers. Were a solid sage band on every card, which made
   * every panel equally loud; a header is now the top of its card. */
  --kc-header-bg:   transparent;
  /* Informational banners inside a record. */
  --kc-info-bg:     #F1F5F3;
  /* Evergreen tints, for active states and quiet emphasis. */
  --kc-evergreen-50:  #F0F5F2;
  --kc-evergreen-100: #E1ECE6;
  --kc-evergreen-700: #234A3F;

  /* ── Semantic — actions ──────────────────────────────────────────── *
   * Evergreen = primary actions and active navigation.                */
  --kc-action-primary:       var(--kc-evergreen);
  --kc-action-primary-hover: #264D42;
  /* Text and icons on a primary button. Was borrowed from the nav rail's
   * active text, which stopped being white when the rail became light. */
  --kc-on-primary:           #FFFFFF;

  /* ── Semantic — statutory overdue ────────────────────────────────── *
   * Amber signals overdue statutory windows ONLY.
   * Never decorative. Never a grade signal.                           */
  --kc-overdue:       var(--kc-amber);
  --kc-overdue-light: #F5E6D0;

  /* --kc-alert: breached statutory deadline ONLY (e.g. overdue Reg 40/45). Never decorative. */
  --kc-alert: #A63A2E;
  /* Ground of an error notice (wrong password, expired link). */
  --kc-alert-light: #F7E4E1;
  /* One step down from --kc-sage: a hover on a drawn region, never a state. */
  --kc-sage-strong: #D3DED1;

  /* ── Nav rail — light text on ink ground (Stage 2) ───────────────── */
  /* A LIGHT RAIL since 26 Oct 2026. The ink slab was the heaviest thing on
   * every screen and made the product read as an admin console; a white rail
   * with an evergreen active state gives the content the weight instead.
   * Every pair is held to AA by AccessibilityTests. */
  --kc-nav-bg:          #FFFFFF;
  --kc-nav-text:        #3B4845;
  --kc-nav-text-active: #1F463B;
  --kc-nav-text-dim:    #5E6B67;
  --kc-nav-hover:       #F3F2EE;
  --kc-nav-active:      #E3EDE7;
  --kc-nav-divider:     #EEECE6;

  /* ══ SPACING — Stage 4 ════════════════════════════════════════════ *
   *
   * A 4px base, and the reason it exists is the reason the product did not
   * feel finished: before this there were EIGHT different paddings in use
   * (0.15, 0.25, 0.35, 0.375, 0.5, 0.6, 0.75, 1rem) chosen one component at
   * a time. None of them is wrong on its own. Together they are why nothing
   * lines up with anything, and inconsistent rhythm is the single clearest
   * signal that software was assembled rather than designed.
   *
   * The scale is deliberately short. A long scale is a scale with choices in
   * it, and choices are what produced the eight.                        */
  --kc-space-1:  0.25rem;   /*  4px — inside a badge                     */
  --kc-space-2:  0.5rem;    /*  8px — label to field                     */
  --kc-space-3:  0.75rem;   /* 12px — inside a dense control             */
  --kc-space-4:  1rem;      /* 16px — the default gap                    */
  --kc-space-5:  1.5rem;    /* 24px — between blocks                     */
  --kc-space-6:  2rem;      /* 32px — between sections                   */
  --kc-space-7:  3rem;      /* 48px — between major regions              */

  /* ══ RADIUS ═══════════════════════════════════════════════════════ *
   * Three, down from five found in use. A records product should look
   * squared and deliberate rather than soft — the direction is a ledger,
   * not a consumer app.                                                 */
  --kc-radius-sm:   6px;    /* badges, inline chips                      */
  --kc-radius:      8px;    /* buttons, inputs                           */
  --kc-radius-lg:   12px;   /* cards and panels                          */
  --kc-radius-full: 999px;

  /* ══ ELEVATION ════════════════════════════════════════════════════ *
   *
   * Almost nothing, on purpose. A ledger does not float. These exist for
   * the two cases where depth carries meaning — something temporarily on
   * top, and something being interacted with — and nowhere else.
   *
   * Tinted with the ink hue rather than pure black, so a shadow over paper
   * reads as the same material rather than as a grey smudge.             */
  /* Revised 26 Oct 2026: cards now sit ON the page rather than being drawn
   * on it. Two-layer shadows (a tight contact shadow and a soft ambient one)
   * are what make a surface read as a surface. */
  --kc-shadow-sm:  0 1px 2px rgba(26, 46, 42, 0.05), 0 1px 3px rgba(26, 46, 42, 0.04);
  --kc-shadow:     0 1px 2px rgba(26, 46, 42, 0.05), 0 4px 12px rgba(26, 46, 42, 0.06);
  --kc-shadow-lg:  0 2px 4px rgba(26, 46, 42, 0.05), 0 12px 32px rgba(26, 46, 42, 0.10);

  /* ══ LINE HEIGHT ══════════════════════════════════════════════════ */
  --kc-leading-tight:  1.2;   /* large headings                          */
  --kc-leading-snug:   1.35;  /* small headings, table cells             */
  --kc-leading:        1.55;  /* body                                    */
  --kc-leading-relaxed: 1.7;  /* long prose a person reads carefully     */

  /* ══ MEASURE ══════════════════════════════════════════════════════ *
   * Prose wider than this is measurably harder to read — the eye loses
   * the line on the way back. Most of this product's explanatory text
   * was previously set to the full width of a 1440px screen.            */
  --kc-measure:       76ch;
  --kc-measure-tight: 58ch;

  /* ══ MOTION ═══════════════════════════════════════════════════════ *
   *
   * One duration and one easing, so nothing in the product moves at a
   * speed nothing else moves at. Fast enough to feel like a response
   * rather than an animation.
   *
   * 9.4's reduced-motion rules override all of this, both from the
   * operating system and from the preference panel.                     */
  --kc-ease:         cubic-bezier(0.2, 0, 0.2, 1);
  --kc-duration:     160ms;
  --kc-duration-lg:  260ms;

  /* ── Layout — frame dimensions (Stage 2) ─────────────────────────── */
  --kc-topbar-bg:     var(--kc-paper);
  --kc-topbar-border: var(--kc-sage);
  --kc-content-max-w: 1140px;
  --kc-content-py:    1.5rem;
  --kc-content-px:    2rem;

  /* ── Bootstrap's theme colours, mapped onto the palette ─────────── *
   * Unmapped, any bg-primary or text-success in markup drew Bootstrap's
   * blue (#0D6EFD) and green (#198754): colours that belong to no part of
   * this product. Warning is deliberately NOT mapped to amber — amber means
   * an overdue statutory window and nothing else.                       */
  --bs-primary:       var(--kc-evergreen);
  --bs-primary-rgb:   47, 93, 80;
  --bs-success:       var(--kc-evergreen);
  --bs-success-rgb:   47, 93, 80;
  --bs-danger:        var(--kc-alert);
  --bs-danger-rgb:    166, 58, 46;
  --bs-secondary-rgb: 94, 107, 103;
  --bs-info-rgb:      94, 107, 103;
}
