/*
 * BunkMaven design tokens: "Camp Ledger" (Sprint 2, decision D1).
 *
 * This is the ONLY stylesheet allowed to hold raw values (colours, font names, sizes, spacing,
 * durations). Every other CSS file uses var(--bm-*). A unit test enforces it
 * (tests/unit/web/test_tokens.py), and another checks WCAG AA contrast for every text/background
 * pair listed in docs/design/tokens.md. To restyle the app, edit this file first.
 *
 * Namespaces: color, font, text, leading, weight, space, radius, rule, shadow, focus, quality,
 * layer, grid, duration, ease, z, print.
 */

/* ---- Fonts (self-hosted, latin subset, OFL; licences next to the files) ------------------- */

@font-face {
  font-family: "Gabarito";
  src: url("fonts/gabarito-latin-600-normal.f505b42944a8.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Gabarito";
  src: url("fonts/gabarito-latin-800-normal.f1e73d251f14.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-400-italic.ac3e6cdbce96.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/ibm-plex-sans-condensed-latin-400-normal.e1273a298af3.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/ibm-plex-sans-condensed-latin-400-italic.33193695750f.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/ibm-plex-sans-condensed-latin-500-normal.25db464417d3.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("fonts/ibm-plex-sans-condensed-latin-600-normal.bac89dc82014.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- Colour: paper and ink ------------------------------------------------------------- */
  --bm-color-paper: oklch(98% 0.004 240);
  --bm-color-paper-raised: oklch(100% 0 0);
  --bm-color-paper-sunk: oklch(95.5% 0.008 240);
  --bm-color-paper-deep: oklch(92% 0.012 240);
  --bm-color-ink: oklch(22.8% 0.07 265);
  --bm-color-ink-muted: oklch(45% 0.035 260);
  --bm-color-ink-pencil: oklch(47% 0.05 255);
  --bm-color-rule: oklch(89% 0.01 245);
  --bm-color-rule-strong: oklch(62% 0.025 250);

  /* ---- Colour: the dark frame (logo navy): sign-in, drawer backdrop, print toolbar, skip link */
  --bm-color-frame: oklch(23.5% 0.088 266.6);
  --bm-color-frame-raised: oklch(31% 0.085 266);
  --bm-color-frame-ink: oklch(100% 0 0);
  --bm-color-frame-ink-muted: oklch(83% 0.03 255);

  /* ---- Colour: the masthead (white under Daylight, with the full-colour logo) ------------ */
  --bm-color-masthead: oklch(100% 0 0);
  --bm-color-masthead-raised: oklch(95.5% 0.008 240);
  --bm-color-masthead-ink: oklch(23.5% 0.088 266.6);
  --bm-color-masthead-ink-muted: oklch(45% 0.035 260);
  --bm-color-masthead-rule: oklch(89% 0.01 245);

  /* ---- Colour: accent (navy) -- used sparingly: nav, primary actions. Links are deep teal -- */
  --bm-color-accent: oklch(33% 0.11 265);
  --bm-color-accent-strong: oklch(26% 0.1 265);
  --bm-color-accent-ink: oklch(100% 0 0);
  --bm-color-accent-tint: oklch(94% 0.025 265);
  --bm-color-link: oklch(46% 0.085 195);
  --bm-color-link-hover: oklch(38% 0.075 197);

  /* ---- Colour: environment ribbon (non-production) --------------------------------------- */
  /* Flat bands in hues the quality layer never uses: amber hatch means WARNING (D1 finding 1). */
  --bm-color-ribbon-staging-bg: oklch(86% 0.07 310);
  --bm-color-ribbon-staging-fg: oklch(24% 0.05 310);
  --bm-color-ribbon-dev-bg: oklch(88% 0.07 230);
  --bm-color-ribbon-dev-fg: oklch(24% 0.04 250);

  /* ---- Colour: messages ------------------------------------------------------------------ */
  --bm-color-success-fg: oklch(39% 0.09 148);
  --bm-color-success-bg: oklch(94.5% 0.045 148);
  --bm-color-info-fg: oklch(36% 0.06 250);
  --bm-color-info-bg: oklch(94% 0.025 250);

  /* ---- Quality (semantic; always paired with a glyph, never colour alone) ----------------- */
  --bm-quality-good-fg: var(--bm-color-ink);
  --bm-quality-good-bg: transparent;
  --bm-quality-good-edge: transparent;
  --bm-quality-warning-fg: oklch(42% 0.1 65);
  --bm-quality-warning-bg: oklch(94.5% 0.055 88);
  --bm-quality-warning-hatch: oklch(89% 0.08 85);
  --bm-quality-warning-edge: oklch(66% 0.145 76);
  --bm-quality-warning-pattern: repeating-linear-gradient(
    135deg,
    var(--bm-quality-warning-bg) 0 6px,
    var(--bm-quality-warning-hatch) 6px 8px
  );
  --bm-quality-bad-fg: oklch(44% 0.17 31);
  --bm-quality-bad-bg: oklch(95.5% 0.025 33);
  --bm-quality-bad-edge: oklch(48% 0.19 29);
  --bm-quality-bad-edge-width: 4px;
  --bm-quality-glyph-warning: "\25B2"; /* ▲ */
  --bm-quality-glyph-bad: "\25CF"; /* ● */
  --bm-quality-glyph-size: 0.8em;

  /* ---- Layer cues (own/bunk plain; unit/camp "pencilled"; overlay stamped) --------------- */
  --bm-layer-own-fg: var(--bm-color-ink);
  --bm-layer-own-bg: transparent;
  --bm-layer-bunk-fg: var(--bm-color-ink);
  --bm-layer-bunk-bg: transparent;
  --bm-layer-unit-fg: var(--bm-color-ink-pencil);
  --bm-layer-unit-bg: transparent;
  --bm-layer-camp-fg: var(--bm-color-ink-pencil);
  --bm-layer-camp-bg: transparent;
  --bm-layer-overlay-fg: oklch(40% 0.12 330);
  --bm-layer-overlay-bg: oklch(94% 0.03 330);
  --bm-layer-pencil-style: italic;

  /* ---- Typography ------------------------------------------------------------------------ */
  /* Gabarito (Scott's pick, 2026-11-15; brand fonts round 2): round and calm like the logo. */
  --bm-font-display: "Gabarito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --bm-font-ui: "IBM Plex Sans", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --bm-font-dense: "IBM Plex Sans Condensed", "Arial Narrow", "IBM Plex Sans", system-ui, sans-serif;
  --bm-font-numeric: tabular-nums;

  --bm-weight-regular: 400;
  --bm-weight-medium: 500;
  --bm-weight-semibold: 600;
  --bm-weight-display: 600;
  --bm-weight-black: 800;

  /* Fluid scale: dense grid text against a large camp/subject title (scale contrast). */
  --bm-text-2xs: clamp(0.6875rem, 0.66rem + 0.1vw, 0.75rem);
  --bm-text-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
  --bm-text-sm: clamp(0.8125rem, 0.79rem + 0.12vw, 0.875rem);
  --bm-text-base: clamp(0.9375rem, 0.9rem + 0.18vw, 1rem);
  --bm-text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --bm-text-xl: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --bm-text-2xl: clamp(1.625rem, 1.3rem + 1.5vw, 2.5rem);
  --bm-text-hero: clamp(2.25rem, 1.5rem + 3.6vw, 4.25rem);

  --bm-leading-tight: 1.1;
  --bm-leading-snug: 1.3;
  --bm-leading-body: 1.5;
  --bm-tracking-display: -0.02em;
  --bm-tracking-caps: 0.08em;

  /* ---- Spacing (deliberately uneven rhythm: 4-based with a few editorial jumps) ----------- */
  --bm-space-3xs: 0.125rem;
  --bm-space-2xs: 0.25rem;
  --bm-space-xs: 0.5rem;
  --bm-space-sm: 0.75rem;
  --bm-space-md: 1rem;
  --bm-space-lg: 1.5rem;
  --bm-space-xl: 2.25rem;
  --bm-space-2xl: 3.5rem;
  --bm-space-section: clamp(2rem, 1.2rem + 3vw, 4.5rem);
  --bm-gutter: clamp(1rem, 0.6rem + 1.6vw, 2rem);
  --bm-measure: 66ch;

  /* ---- Shared controls, forms and rhythm (visual review §3, Sprint 6 quick wins) ---------- */
  /* One 20px checkbox and radio everywhere. */
  --bm-check-size: 1.25rem;
  /* One control height (buttons, fields, tabs: 44px); compact (36px) only in table rows and
     filter bars. */
  --bm-control-h: 2.75rem;
  --bm-control-h-compact: 2.25rem;
  /* A form column is at most 720px; page owners opt in with .bm-form-column (review 1.8). */
  --bm-form-max: 45rem;
  /* Field widths for short content (.bm-field--short / --date / --medium). A date fits
     "mm/dd/yyyy" and the picker button. */
  --bm-field-short: 8rem;
  --bm-field-date: 11rem;
  --bm-field-medium: 16rem;
  /* Three heading levels (page, section, group) and the space above each (review 1.11). */
  --bm-heading-page: var(--bm-text-xl);
  --bm-heading-section: var(--bm-text-lg);
  --bm-heading-group: var(--bm-text-base);
  --bm-space-before-page: 2.5rem;
  --bm-space-before-section: var(--bm-space-lg);
  --bm-space-before-group: var(--bm-space-md);
  /* Phone tables scroll sideways with an edge shadow where more columns hide (review 1.9). */
  --bm-table-fade: 2.5rem;
  --bm-table-edge: oklch(22.8% 0.07 265 / 0.14);
  --bm-page-max: 96rem;
  --bm-auth-max: 27rem;
  --bm-facts-narrow: 28rem; /* .bm-facts--narrow: a facts list in the main column */

  /* Phone layout (layouts/phone.html, Sprint 6 X1): text one step larger than the app, a larger
     step on request (Me > Text size) and the bottom bar's height. Targets use --bm-control-h. */
  --bm-phone-root-size: 106.25%;
  --bm-phone-root-size-large: 118.75%;
  --bm-phone-measure: 40rem;
  --bm-tabbar-h: 3.5rem;

  /* ---- Shape: radii, rules, shadows ------------------------------------------------------ */
  --bm-radius-none: 0;
  --bm-radius-sm: 2px;
  --bm-radius-md: 4px;
  --bm-radius-pill: 999px;
  --bm-rule-hair: 1px;
  --bm-rule-thick: 2px;
  --bm-rule-heavy: 3px;
  --bm-shadow-paper: 0 1px 0 oklch(62% 0.025 250 / 0.3), 0 10px 24px -14px oklch(25% 0.06 265 / 0.25);
  --bm-shadow-lift: 0 2px 0 oklch(62% 0.025 250 / 0.35), 0 18px 36px -18px oklch(23% 0.06 265 / 0.35);
  --bm-shadow-press: inset 0 2px 0 oklch(20% 0.06 265 / 0.25);
  /* Cast upwards: a bar pinned to the bottom of the view (sticky actions) over the content. */
  --bm-shadow-up: 0 -10px 20px -16px oklch(25% 0.06 265 / 0.3);

  /* ---- Focus ----------------------------------------------------------------------------- */
  --bm-focus-ring: oklch(50% 0.2 262);
  --bm-focus-ring-on-dark: oklch(74% 0.131 184); /* logo teal; amber stays for warnings */
  --bm-focus-ring-on-masthead: oklch(50% 0.2 262);
  --bm-focus-width: 3px;
  --bm-focus-offset: 2px;

  /* ---- Schedule grid (consumed by WP4) --------------------------------------------------- */
  --bm-grid-cell-min: 7.5rem;
  --bm-grid-period-col: 8.5rem;
  --bm-grid-header-h: 3.25rem;
  --bm-grid-today-rule: var(--bm-rule-heavy);

  /* ---- Motion (compositor-only; disabled under prefers-reduced-motion in base.css) ------- */
  --bm-duration-instant: 80ms;
  --bm-duration-fast: 120ms;
  --bm-duration-normal: 200ms;
  --bm-duration-popover-delay: 250ms;
  --bm-duration-undo: 15s; /* SC4: how long an Undo button stays after a reversible change */
  --bm-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bm-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --bm-lift-distance: -1px;
  --bm-popover-rise: 4px;

  /* ---- Stacking -------------------------------------------------------------------------- */
  --bm-z-sticky: 10;
  --bm-z-menu: 30;
  --bm-z-skip: 100;

  /* ---- Print (consumed by WP5 PDFs and @media print) ------------------------------------- */
  --bm-print-font-ui: var(--bm-font-dense);
  --bm-print-font-display: var(--bm-font-display);
  --bm-print-text: 10pt;
  --bm-print-min-text: 6pt;
  --bm-print-header-text: 14pt;
  --bm-print-title: var(--bm-print-header-text);
  --bm-print-subheader-text: 10pt;
  --bm-print-footer-text: 7pt;
  --bm-print-small: var(--bm-print-footer-text);
  --bm-print-label-micro: 6pt;
  --bm-print-margin: 10mm;
  --bm-print-period-col: 10%;
  --bm-print-rule: 0.5pt;
  --bm-print-rule-strong: 1pt;
  --bm-print-ink: oklch(0% 0 0);
  --bm-print-pencil: oklch(35% 0 0);
  --bm-print-paper: oklch(100% 0 0);
}
