/* ==========================================================================
   Bootstrap -> Waldup tokens. Step 1 of docs/specs/bootstrap-token-mapping.md.

   Points Bootstrap's :root variables at the --wd-* tokens (DEF-BRAND-001), so a plain
   Bootstrap class renders Waldup's identity. Loaded after bootstrap.min.css and
   tokens.css, on both the Flask and React shells. Does NOT restyle anything by hand.

   Role mapping (decided 2026-11-15): primary = Summit navy, secondary = Valley,
   success = Pine, info = Sky, warning = Aid station, danger = Alert, light = Mist,
   dark = Summit.

   Reaches only what resolves through :root: alert, badge, progress, links, body,
   borders, form validation. Components that compile literal colours (all .btn-*,
   table, dropdown-menu, navbar, modal, card, spinner-border) are step 2; form-control,
   nav-link and dropdown-item have no --bs-* variables and are step 3.

   Derived colours (tints, shades, alpha) are color-mix() over the token, so they follow
   it (RUL-UI-002): tint = mix with white, shade = mix with black, as in Bootstrap's own
   Sass (decision 0008). The rgb triplets cannot be derived in CSS and stay literal. Every derived value
   carries an annotation, and tests/test_bootstrap_tokens.py checks the expression or
   the triplet against it and tokens.css.
   ========================================================================== */

:root,
[data-bs-theme="light"] {
  /* primary */
  --bs-primary: var(--wd-navy);
  --bs-primary-rgb: 1, 33, 56; /* --wd-navy rgb */
  --bs-primary-text-emphasis: color-mix(in srgb, var(--wd-navy), black 60%); /* --wd-navy shade 60 */
  --bs-primary-bg-subtle: color-mix(in srgb, var(--wd-navy), white 80%); /* --wd-navy tint 80 */
  --bs-primary-border-subtle: color-mix(in srgb, var(--wd-navy), white 60%); /* --wd-navy tint 60 */

  /* secondary */
  --bs-secondary: var(--wd-navy-m);
  --bs-secondary-rgb: 2, 77, 114; /* --wd-navy-m rgb */
  --bs-secondary-text-emphasis: color-mix(in srgb, var(--wd-navy-m), black 60%); /* --wd-navy-m shade 60 */
  --bs-secondary-bg-subtle: color-mix(in srgb, var(--wd-navy-m), white 80%); /* --wd-navy-m tint 80 */
  --bs-secondary-border-subtle: color-mix(in srgb, var(--wd-navy-m), white 60%); /* --wd-navy-m tint 60 */

  /* success */
  --bs-success: var(--wd-green);
  --bs-success-rgb: 14, 110, 64; /* --wd-green rgb */
  --bs-success-text-emphasis: color-mix(in srgb, var(--wd-green), black 60%); /* --wd-green shade 60 */
  --bs-success-bg-subtle: color-mix(in srgb, var(--wd-green), white 80%); /* --wd-green tint 80 */
  --bs-success-border-subtle: color-mix(in srgb, var(--wd-green), white 60%); /* --wd-green tint 60 */

  /* info */
  --bs-info: var(--wd-blue);
  --bs-info-rgb: 0, 158, 219; /* --wd-blue rgb */
  --bs-info-text-emphasis: color-mix(in srgb, var(--wd-blue), black 60%); /* --wd-blue shade 60 */
  --bs-info-bg-subtle: color-mix(in srgb, var(--wd-blue), white 80%); /* --wd-blue tint 80 */
  --bs-info-border-subtle: color-mix(in srgb, var(--wd-blue), white 60%); /* --wd-blue tint 60 */

  /* warning */
  --bs-warning: var(--wd-amber);
  --bs-warning-rgb: 245, 166, 35; /* --wd-amber rgb */
  --bs-warning-text-emphasis: color-mix(in srgb, var(--wd-amber), black 60%); /* --wd-amber shade 60 */
  --bs-warning-bg-subtle: color-mix(in srgb, var(--wd-amber), white 80%); /* --wd-amber tint 80 */
  --bs-warning-border-subtle: color-mix(in srgb, var(--wd-amber), white 60%); /* --wd-amber tint 60 */

  /* danger */
  --bs-danger: var(--wd-red);
  --bs-danger-rgb: 200, 35, 51; /* --wd-red rgb */
  --bs-danger-text-emphasis: color-mix(in srgb, var(--wd-red), black 60%); /* --wd-red shade 60 */
  --bs-danger-bg-subtle: color-mix(in srgb, var(--wd-red), white 80%); /* --wd-red tint 80 */
  --bs-danger-border-subtle: color-mix(in srgb, var(--wd-red), white 60%); /* --wd-red tint 60 */

  /* light */
  --bs-light: var(--wd-grey-bg);
  --bs-light-rgb: 239, 248, 255; /* --wd-grey-bg rgb */

  /* dark */
  --bs-dark: var(--wd-navy);
  --bs-dark-rgb: 1, 33, 56; /* --wd-navy rgb */

  /* text, surfaces, borders */
  --bs-body-color: var(--wd-navy);
  --bs-body-color-rgb: 1, 33, 56; /* --wd-navy rgb */
  --bs-body-bg: var(--wd-white);
  --bs-body-bg-rgb: 255, 255, 255; /* --wd-white rgb */
  --bs-emphasis-color: var(--wd-navy);
  --bs-emphasis-color-rgb: 1, 33, 56; /* --wd-navy rgb */
  --bs-secondary-color: var(--wd-mid);
  --bs-tertiary-color: var(--wd-muted);
  --bs-secondary-bg: var(--wd-grey-bg);
  --bs-secondary-bg-rgb: 239, 248, 255; /* --wd-grey-bg rgb */
  --bs-tertiary-bg: var(--wd-grey-bg);
  --bs-tertiary-bg-rgb: 239, 248, 255; /* --wd-grey-bg rgb */
  --bs-border-color: var(--wd-border);

  /* links: Sky ink, never Sky (DEF-BRAND-001) */
  --bs-link-color: var(--wd-blue-ink);
  --bs-link-color-rgb: 0, 120, 166; /* --wd-blue-ink rgb */
  --bs-link-hover-color: color-mix(in srgb, var(--wd-blue-ink), black 20%); /* --wd-blue-ink shade 20 */
  --bs-link-hover-color-rgb: 0, 96, 133; /* --wd-blue-ink shade 20 rgb */

  /* focus ring: Sky (DEF-BRAND-001) */
  --bs-focus-ring-color: color-mix(in srgb, var(--wd-blue) 25%, transparent); /* --wd-blue alpha 0.25 */

  /* form validation */
  --bs-form-valid-color: var(--wd-green);
  --bs-form-valid-border-color: var(--wd-green);
  --bs-form-invalid-color: var(--wd-red);
  --bs-form-invalid-border-color: var(--wd-red);
}

/* ==========================================================================
   Step 2 — buttons. Sets the variables Bootstrap's own .btn-* rules read; no component
   rules. Derived the way Bootstrap's Sass derives them (hover/active = shade 15/20/20/25
   when the text is light, tint 15/10/20/10 when it is dark; focus shadow = 15% of the
   text colour mixed into the fill), so the states move like a stock button's.
   Text on a fill follows DEF-BRAND-003: white at 4.5:1, otherwise Summit navy.
   Outline info and warning use the ink tokens: Sky and Aid station are not text colours.
   Each derived value is annotated and checked by tests/test_bootstrap_tokens.py.
   ========================================================================== */

.btn-primary {
  --bs-btn-color: var(--wd-white);
  --bs-btn-bg: var(--wd-navy);
  --bs-btn-border-color: var(--wd-navy);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-navy), black 15%); /* --wd-navy shade 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-navy), black 20%); /* --wd-navy shade 20 */
  --bs-btn-focus-shadow-rgb: 39, 66, 86; /* --wd-navy mix --wd-white 15 rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-navy), black 20%); /* --wd-navy shade 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-navy), black 25%); /* --wd-navy shade 25 */
  --bs-btn-disabled-color: var(--wd-white);
  --bs-btn-disabled-bg: var(--wd-navy);
  --bs-btn-disabled-border-color: var(--wd-navy);
}

.btn-secondary {
  --bs-btn-color: var(--wd-white);
  --bs-btn-bg: var(--wd-navy-m);
  --bs-btn-border-color: var(--wd-navy-m);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-navy-m), black 15%); /* --wd-navy-m shade 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-navy-m), black 20%); /* --wd-navy-m shade 20 */
  --bs-btn-focus-shadow-rgb: 40, 104, 135; /* --wd-navy-m mix --wd-white 15 rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-navy-m), black 20%); /* --wd-navy-m shade 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-navy-m), black 25%); /* --wd-navy-m shade 25 */
  --bs-btn-disabled-color: var(--wd-white);
  --bs-btn-disabled-bg: var(--wd-navy-m);
  --bs-btn-disabled-border-color: var(--wd-navy-m);
}

.btn-success {
  --bs-btn-color: var(--wd-white);
  --bs-btn-bg: var(--wd-green);
  --bs-btn-border-color: var(--wd-green);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-green), black 15%); /* --wd-green shade 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-green), black 20%); /* --wd-green shade 20 */
  --bs-btn-focus-shadow-rgb: 50, 132, 93; /* --wd-green mix --wd-white 15 rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-green), black 20%); /* --wd-green shade 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-green), black 25%); /* --wd-green shade 25 */
  --bs-btn-disabled-color: var(--wd-white);
  --bs-btn-disabled-bg: var(--wd-green);
  --bs-btn-disabled-border-color: var(--wd-green);
}

.btn-danger {
  --bs-btn-color: var(--wd-white);
  --bs-btn-bg: var(--wd-red);
  --bs-btn-border-color: var(--wd-red);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-red), black 15%); /* --wd-red shade 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-red), black 20%); /* --wd-red shade 20 */
  --bs-btn-focus-shadow-rgb: 208, 68, 82; /* --wd-red mix --wd-white 15 rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-red), black 20%); /* --wd-red shade 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-red), black 25%); /* --wd-red shade 25 */
  --bs-btn-disabled-color: var(--wd-white);
  --bs-btn-disabled-bg: var(--wd-red);
  --bs-btn-disabled-border-color: var(--wd-red);
}

.btn-warning {
  --bs-btn-color: var(--wd-navy);
  --bs-btn-bg: var(--wd-amber);
  --bs-btn-border-color: var(--wd-amber);
  --bs-btn-hover-color: var(--wd-navy);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-amber), white 15%); /* --wd-amber tint 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-amber), white 10%); /* --wd-amber tint 10 */
  --bs-btn-focus-shadow-rgb: 208, 146, 38; /* --wd-amber mix --wd-navy 15 rgb */
  --bs-btn-active-color: var(--wd-navy);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-amber), white 20%); /* --wd-amber tint 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-amber), white 10%); /* --wd-amber tint 10 */
  --bs-btn-disabled-color: var(--wd-navy);
  --bs-btn-disabled-bg: var(--wd-amber);
  --bs-btn-disabled-border-color: var(--wd-amber);
}

.btn-info {
  --bs-btn-color: var(--wd-navy);
  --bs-btn-bg: var(--wd-blue);
  --bs-btn-border-color: var(--wd-blue);
  --bs-btn-hover-color: var(--wd-navy);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-blue), white 15%); /* --wd-blue tint 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-blue), white 10%); /* --wd-blue tint 10 */
  --bs-btn-focus-shadow-rgb: 0, 139, 195; /* --wd-blue mix --wd-navy 15 rgb */
  --bs-btn-active-color: var(--wd-navy);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-blue), white 20%); /* --wd-blue tint 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-blue), white 10%); /* --wd-blue tint 10 */
  --bs-btn-disabled-color: var(--wd-navy);
  --bs-btn-disabled-bg: var(--wd-blue);
  --bs-btn-disabled-border-color: var(--wd-blue);
}

.btn-light {
  --bs-btn-color: var(--wd-navy);
  --bs-btn-bg: var(--wd-grey-bg);
  --bs-btn-border-color: var(--wd-grey-bg);
  --bs-btn-hover-color: var(--wd-navy);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-grey-bg), black 15%); /* --wd-grey-bg shade 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-grey-bg), black 20%); /* --wd-grey-bg shade 20 */
  --bs-btn-focus-shadow-rgb: 203, 216, 225; /* --wd-grey-bg mix --wd-navy 15 rgb */
  --bs-btn-active-color: var(--wd-navy);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-grey-bg), black 20%); /* --wd-grey-bg shade 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-grey-bg), black 25%); /* --wd-grey-bg shade 25 */
  --bs-btn-disabled-color: var(--wd-navy);
  --bs-btn-disabled-bg: var(--wd-grey-bg);
  --bs-btn-disabled-border-color: var(--wd-grey-bg);
}

.btn-dark {
  --bs-btn-color: var(--wd-white);
  --bs-btn-bg: var(--wd-navy);
  --bs-btn-border-color: var(--wd-navy);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: color-mix(in srgb, var(--wd-navy), white 15%); /* --wd-navy tint 15 */
  --bs-btn-hover-border-color: color-mix(in srgb, var(--wd-navy), white 10%); /* --wd-navy tint 10 */
  --bs-btn-focus-shadow-rgb: 39, 66, 86; /* --wd-navy mix --wd-white 15 rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: color-mix(in srgb, var(--wd-navy), white 20%); /* --wd-navy tint 20 */
  --bs-btn-active-border-color: color-mix(in srgb, var(--wd-navy), white 10%); /* --wd-navy tint 10 */
  --bs-btn-disabled-color: var(--wd-white);
  --bs-btn-disabled-bg: var(--wd-navy);
  --bs-btn-disabled-border-color: var(--wd-navy);
}

.btn-outline-primary {
  --bs-btn-color: var(--wd-navy);
  --bs-btn-border-color: var(--wd-navy);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-navy);
  --bs-btn-hover-border-color: var(--wd-navy);
  --bs-btn-focus-shadow-rgb: 1, 33, 56; /* --wd-navy rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-navy);
  --bs-btn-active-border-color: var(--wd-navy);
  --bs-btn-disabled-color: var(--wd-navy);
  --bs-btn-disabled-border-color: var(--wd-navy);
}

.btn-outline-secondary {
  --bs-btn-color: var(--wd-navy-m);
  --bs-btn-border-color: var(--wd-navy-m);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-navy-m);
  --bs-btn-hover-border-color: var(--wd-navy-m);
  --bs-btn-focus-shadow-rgb: 2, 77, 114; /* --wd-navy-m rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-navy-m);
  --bs-btn-active-border-color: var(--wd-navy-m);
  --bs-btn-disabled-color: var(--wd-navy-m);
  --bs-btn-disabled-border-color: var(--wd-navy-m);
}

.btn-outline-success {
  --bs-btn-color: var(--wd-green);
  --bs-btn-border-color: var(--wd-green);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-green);
  --bs-btn-hover-border-color: var(--wd-green);
  --bs-btn-focus-shadow-rgb: 14, 110, 64; /* --wd-green rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-green);
  --bs-btn-active-border-color: var(--wd-green);
  --bs-btn-disabled-color: var(--wd-green);
  --bs-btn-disabled-border-color: var(--wd-green);
}

.btn-outline-danger {
  --bs-btn-color: var(--wd-red);
  --bs-btn-border-color: var(--wd-red);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-red);
  --bs-btn-hover-border-color: var(--wd-red);
  --bs-btn-focus-shadow-rgb: 200, 35, 51; /* --wd-red rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-red);
  --bs-btn-active-border-color: var(--wd-red);
  --bs-btn-disabled-color: var(--wd-red);
  --bs-btn-disabled-border-color: var(--wd-red);
}

.btn-outline-warning {
  --bs-btn-color: var(--wd-orange-ink);
  --bs-btn-border-color: var(--wd-orange-ink);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-orange-ink);
  --bs-btn-hover-border-color: var(--wd-orange-ink);
  --bs-btn-focus-shadow-rgb: 175, 87, 24; /* --wd-orange-ink rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-orange-ink);
  --bs-btn-active-border-color: var(--wd-orange-ink);
  --bs-btn-disabled-color: var(--wd-orange-ink);
  --bs-btn-disabled-border-color: var(--wd-orange-ink);
}

.btn-outline-info {
  --bs-btn-color: var(--wd-blue-ink);
  --bs-btn-border-color: var(--wd-blue-ink);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-blue-ink);
  --bs-btn-hover-border-color: var(--wd-blue-ink);
  --bs-btn-focus-shadow-rgb: 0, 120, 166; /* --wd-blue-ink rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-blue-ink);
  --bs-btn-active-border-color: var(--wd-blue-ink);
  --bs-btn-disabled-color: var(--wd-blue-ink);
  --bs-btn-disabled-border-color: var(--wd-blue-ink);
}

.btn-outline-light {
  --bs-btn-color: var(--wd-grey-bg);
  --bs-btn-border-color: var(--wd-grey-bg);
  --bs-btn-hover-color: var(--wd-navy);
  --bs-btn-hover-bg: var(--wd-grey-bg);
  --bs-btn-hover-border-color: var(--wd-grey-bg);
  --bs-btn-focus-shadow-rgb: 239, 248, 255; /* --wd-grey-bg rgb */
  --bs-btn-active-color: var(--wd-navy);
  --bs-btn-active-bg: var(--wd-grey-bg);
  --bs-btn-active-border-color: var(--wd-grey-bg);
  --bs-btn-disabled-color: var(--wd-grey-bg);
  --bs-btn-disabled-border-color: var(--wd-grey-bg);
}

.btn-outline-dark {
  --bs-btn-color: var(--wd-navy);
  --bs-btn-border-color: var(--wd-navy);
  --bs-btn-hover-color: var(--wd-white);
  --bs-btn-hover-bg: var(--wd-navy);
  --bs-btn-hover-border-color: var(--wd-navy);
  --bs-btn-focus-shadow-rgb: 1, 33, 56; /* --wd-navy rgb */
  --bs-btn-active-color: var(--wd-white);
  --bs-btn-active-bg: var(--wd-navy);
  --bs-btn-active-border-color: var(--wd-navy);
  --bs-btn-disabled-color: var(--wd-navy);
  --bs-btn-disabled-border-color: var(--wd-navy);
}

.btn-link {
  --bs-btn-disabled-color: var(--wd-haze);
}
