/*
 * domainmod-tokens.css
 * The shared family look for domainmod.org and the User Guide: colours, fonts, the type scale, radii, focus rings,
 * and the colour-mode palettes, as CSS custom properties and Bootstrap 5.3 variable overrides. No layout.
 * Source: DomainMOD's css/base.css (the link colours and the Nord dark block), checked against DomainMOD 4.26.0's dev
 * tree on 2026-11-17. This is the canonical copy. The User Guide keeps a copy at theme/css/domainmod-tokens.css.
 */

/* Light mode: Bootstrap 5.3's light palette on a #f8f9fa page with white cards */
:root,
[data-bs-theme="light"] {
    --bs-font-sans-serif: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: 1rem;
    --bs-border-radius: 0.375rem;

    --bs-primary: #dc3545;
    --bs-primary-rgb: 220, 53, 69;
    --bs-primary-text-emphasis: #b02a37;
    --bs-primary-bg-subtle: #f8d7da;
    --bs-primary-border-subtle: #f1aeb5;

    --bs-link-color: #0b5ed7;
    --bs-link-color-rgb: 11, 94, 215;
    --bs-link-hover-color: #0a58ca;
    --bs-link-hover-color-rgb: 10, 88, 202;

    --bs-focus-ring-color: rgba(11, 94, 215, 0.5);

    /* Family tokens the site's own CSS reads */
    --dm-page-bg: #f8f9fa;
    --dm-surface: #ffffff;
    --dm-surface-alt: #f1f3f5;
    --dm-chrome-bg: #ffffff;
    --dm-red: #dc3545;
    --dm-red-hover: #b02a37;
    --dm-red-active: #8f2430;
    --dm-red-text: #b02a37;
    --dm-on-red: #ffffff;
    --dm-logo-tile: #f1f1f1;
    --dm-shadow: 0 0.5rem 1.5rem rgba(33, 37, 41, 0.12);
    --dm-shadow-lg: 0 1.25rem 3rem rgba(33, 37, 41, 0.16);
    --dm-focus-outline: #0b5ed7;
}

/* Dark mode: the app's Nord block, value for value */
[data-bs-theme="dark"] {
    --bs-body-bg: #3b4252;
    --bs-body-bg-rgb: 59, 66, 82;
    --bs-tertiary-bg: #2e3440;
    --bs-tertiary-bg-rgb: 46, 52, 64;
    --bs-secondary-bg: #434c5e;
    --bs-secondary-bg-rgb: 67, 76, 94;
    --bs-body-color: #d8dee9;
    --bs-body-color-rgb: 216, 222, 233;
    --bs-emphasis-color: #eceff4;
    --bs-emphasis-color-rgb: 236, 239, 244;
    --bs-secondary-color: rgba(216, 222, 233, 0.75);
    --bs-secondary-color-rgb: 216, 222, 233;
    --bs-tertiary-color: rgba(216, 222, 233, 0.5);
    --bs-tertiary-color-rgb: 216, 222, 233;
    --bs-heading-color: #eceff4;
    --bs-border-color: #4c566a;
    --bs-border-color-translucent: rgba(216, 222, 233, 0.15);
    --bs-primary: #b8434e;
    --bs-primary-rgb: 184, 67, 78;
    --bs-danger: #d98e95;
    --bs-danger-rgb: 217, 142, 149;
    --bs-warning: #ebcb8b;
    --bs-warning-rgb: 235, 203, 139;
    --bs-success: #a3be8c;
    --bs-success-rgb: 163, 190, 140;
    --bs-info: #88c0d0;
    --bs-info-rgb: 136, 192, 208;
    --bs-secondary: #b5bdcd;
    --bs-secondary-rgb: 181, 189, 205;
    --bs-primary-text-emphasis: #e6adb2;
    --bs-danger-text-emphasis: #e6adb2;
    --bs-warning-text-emphasis: #ebcb8b;
    --bs-success-text-emphasis: #adc79a;
    --bs-info-text-emphasis: #93c7d5;
    --bs-secondary-text-emphasis: #d8dee9;
    --bs-primary-bg-subtle: #4a3a42;
    --bs-danger-bg-subtle: #4a3a42;
    --bs-warning-bg-subtle: #4a4638;
    --bs-success-bg-subtle: #3d4a3e;
    --bs-info-bg-subtle: #374a52;
    --bs-secondary-bg-subtle: #434c5e;
    --bs-primary-border-subtle: #8f4950;
    --bs-danger-border-subtle: #8f4950;
    --bs-warning-border-subtle: #a89160;
    --bs-success-border-subtle: #768a65;
    --bs-info-border-subtle: #5f8a96;
    --bs-secondary-border-subtle: #616e88;
    --bs-focus-ring-color: rgba(136, 192, 208, 0.75);
    --bs-form-valid-color: #adc79a;
    --bs-form-valid-border-color: #a3be8c;
    --bs-form-invalid-color: #e6adb2;
    --bs-form-invalid-border-color: #d98e95;

    --bs-link-color: #93c7d5;
    --bs-link-color-rgb: 147, 199, 213;
    --bs-link-hover-color: #b5d9e3;
    --bs-link-hover-color-rgb: 181, 217, 227;

    --dm-page-bg: #3b4252;
    --dm-surface: #434c5e;
    --dm-surface-alt: #2e3440;
    --dm-chrome-bg: #2e3440;
    --dm-red: #b8434e;
    --dm-red-hover: #a23b45;
    --dm-red-active: #8f343d;
    --dm-red-text: #e6adb2;
    --dm-on-red: #ffffff;
    --dm-logo-tile: #f1f1f1;
    --dm-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3);
    --dm-shadow-lg: 0 1.25rem 3rem rgba(0, 0, 0, 0.4);
    --dm-focus-outline: #88c0d0;
}

/* Buttons: Bootstrap's blue primary becomes the brand red through its own variables (no Sass build) */
.btn-primary {
    --bs-btn-color: var(--dm-on-red);
    --bs-btn-bg: var(--dm-red);
    --bs-btn-border-color: var(--dm-red);
    --bs-btn-hover-color: var(--dm-on-red);
    --bs-btn-hover-bg: var(--dm-red-hover);
    --bs-btn-hover-border-color: var(--dm-red-hover);
    --bs-btn-active-color: var(--dm-on-red);
    --bs-btn-active-bg: var(--dm-red-active);
    --bs-btn-active-border-color: var(--dm-red-active);
    --bs-btn-disabled-color: var(--dm-on-red);
    --bs-btn-disabled-bg: var(--dm-red);
    --bs-btn-disabled-border-color: var(--dm-red);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--dm-red-text);
    --bs-btn-border-color: var(--dm-red-text);
    --bs-btn-hover-color: var(--dm-on-red);
    --bs-btn-hover-bg: var(--dm-red-hover);
    --bs-btn-hover-border-color: var(--dm-red-hover);
    --bs-btn-active-color: var(--dm-on-red);
    --bs-btn-active-bg: var(--dm-red-active);
    --bs-btn-active-border-color: var(--dm-red-active);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.text-primary {
    color: var(--dm-red-text) !important;
}

/* Links: no underline until hover, except links inside running text */
a {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
a.btn:hover,
a.nav-link:hover,
a.navbar-brand:hover {
    text-decoration: none;
}
.dm-prose a {
    text-decoration: underline;
}

/* A visible focus ring on every control, in Frost in dark mode. The site's and the guide's own stylesheets leave text
   fields out, by the owner's choice, since the text cursor shows where you're typing. */
:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.navbar-toggler:focus-visible {
    outline: 3px solid var(--dm-focus-outline);
    outline-offset: 2px;
}

/* Forms take the brand focus colour */
.form-control:focus,
.form-select:focus {
    border-color: var(--dm-focus-outline);
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

/* The logo: on its light tile, or with the app's dark-mode treatment (lettering off-white, red icon kept) */
.dm-logo {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.dm-logo-icon {
    display: none;
}
.dm-logo--tile {
    background-color: var(--dm-logo-tile);
    border-radius: var(--bs-border-radius);
    padding: 0.375rem 0.625rem;
}
[data-bs-theme="dark"] .dm-logo--filter .dm-logo-image {
    filter: brightness(0) invert(0.88);
    clip-path: inset(0 0 0 14%);
}
[data-bs-theme="dark"] .dm-logo--filter .dm-logo-icon {
    display: block;
    position: absolute;
    top: 0;
    /* Physical, like the app: the logo image isn't mirrored in right-to-left languages */
    left: 0;
    clip-path: inset(0 86% 0 0);
}

/* Light and dark screenshot pairs: only the one matching the page's mode shows (and, being lazy, loads) */
.dm-shot {
    display: block;
}
[data-bs-theme="dark"] .dm-shot-light,
[data-bs-theme="light"] .dm-shot-dark {
    display: none;
}

/* The skip link */
.dm-skip {
    position: absolute;
    /* top and left first, for older Safari, which doesn't know the logical inset properties */
    top: -10rem;
    left: 1rem;
    inset-inline-start: 1rem;
    /* In right-to-left pages, this clears the left fallback, so the link doesn't stretch across */
    inset-inline-end: auto;
    inset-block-start: -10rem;
    z-index: 2000;
    padding: 0.5rem 1rem;
    background: var(--dm-surface);
    color: var(--bs-link-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--dm-shadow);
}
.dm-skip:focus {
    top: 1rem;
    inset-block-start: 1rem;
}

/* The colour-mode menu's check mark */
.dm-mode-check {
    visibility: hidden;
}
[aria-pressed="true"] > .dm-mode-check {
    visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
