/* =======================================
   Palette: the one place where the colours live.
   20 colours only (Anton's pick, Oct 24: deep teal for the whole farm, sky
   blue for broilers, berry for layers; mint, blush and mist added the same
   day as soft accent backgrounds). Every stylesheet, page and chart
   uses these names (var(--cb-...)), never a colour code of its own, and the
   app has the same list (mobile/src/theme.ts). Words are always action,
   ink-soft, brand, broilers-dark, layers-dark, warm-ink or critical (4.5:1
   or more); broilers and warm are for fills, bars and marks.
   Loaded first, so everything after it can use the names.
======================================= */
:root {
    /* The only colours on the site (and in the app, mobile/src/theme.ts).
       Every stylesheet and page uses these names, never its own colour code.
       A new colour is added here only after Anton says yes. */
    --cb-action: #231f20;         /* near-black: the main button and all main words */
    --cb-brand: #08565c;          /* deep teal: links, "where you are" (blue on broiler pages, purple on layer pages) */
    --cb-brand-soft: #e9f4f1;     /* light teal: selected rows, plain notes */
    --cb-broilers: #1f96db;       /* sky blue: broiler card tops, bars, dots (never small words) */
    --cb-broilers-soft: #e7f2ff;  /* light sky behind broiler things */
    --cb-broilers-dark: #0053c0;  /* deep blue: links and "where you are" on broiler pages, 7:1 */
    --cb-layers-dark: #714787;    /* berry: links and "where you are" on layer pages, 7.1:1 */
    --cb-warm: #ffc65c;           /* honey: layer card tops, bars, highlights (dark words on it, never white) */
    --cb-warm-soft: #fff1d6;      /* light honey behind layer and warm things */
    --cb-warm-ink: #9a5b00;       /* words on warm-soft, 4.9:1 */
    --cb-critical: #9b1561;       /* a real problem only, 7.9:1 */
    --cb-critical-soft: #fcecec;
    --cb-good: #1e7b3a;           /* green: an arrow that's good news (Anton, 25 Oct 2026), never words, 5.6:1 */
    --cb-ink-soft: #585858;       /* second line words, 7.1:1 */
    --cb-line-strong: #dcdbdb;    /* input borders, dividers that must show */
    --cb-pill: #f0eae1;           /* grey pill buttons, card and table lines */
    --cb-page: #fbf6f0;           /* cream page */
    --cb-card: #ffffff;           /* cards, tables, inputs */
    /* Soft accent backgrounds (Anton, Oct 24): card tops, tags, highlights,
       empty pages and the start questions. Dark words on them, never white. */
    --cb-mint: #d2f8d5;           /* soft green: done, ready, good news */
    --cb-blush: #ffe6f4;          /* soft pink: friendly highlights */
    --cb-mist: #e2e9ed;           /* soft blue-grey: calm panels and tags */

    /* Type: one ramp for the whole site (and the app, mobile/src/theme.ts).
       12 tiny labels · 14 small text, tables · 16 body · 18 card titles ·
       20 section titles · 24 page titles on phones · 32 page titles.
       Every font-size uses one of these; see them at /demo/. */
    --cb-fs-12: .75rem;
    --cb-fs-14: .875rem;
    --cb-fs-16: 1rem;
    --cb-fs-18: 1.125rem;
    --cb-fs-20: 1.25rem;
    --cb-fs-24: 1.5rem;
    --cb-fs-32: 2rem;
    --cb-lh-tight: 1.2;     /* titles and big numbers */
    --cb-lh: 1.5;           /* everything you read */

    /* Cards: one radius, one padding, a hair of depth */
    --cb-card-pad: 24px;
    --cb-card-gap: 16px;
    --cb-card-shadow: 0 0 0 1px color-mix(in srgb, var(--cb-action) 4%, transparent), 0 1px 2px color-mix(in srgb, var(--cb-action) 5%, transparent);
    --cb-card-shadow-up: 0 0 0 1px color-mix(in srgb, var(--cb-action) 6%, transparent), 0 8px 24px color-mix(in srgb, var(--cb-action) 8%, transparent);

    /* Calendar sign drawn inside date boxes (ink-soft) */
    --cb-icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23585858' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E");

    /* Bootstrap follows the palette too (links, text-* and bg-* helpers) */
    --bs-body-color: var(--cb-action);
    --bs-body-color-rgb: 35, 31, 32;
    --bs-secondary-color: var(--cb-ink-soft);
    --bs-border-color: var(--cb-pill);
    --bs-primary: var(--cb-brand);
    --bs-primary-rgb: 8, 86, 92;
    --bs-success: var(--cb-brand);
    --bs-success-rgb: 8, 86, 92;
    --bs-warning: var(--cb-brand);
    --bs-warning-rgb: 8, 86, 92;
    --bs-danger: var(--cb-critical);
    --bs-danger-rgb: 155, 21, 97;
    --bs-info: var(--cb-brand);
    --bs-info-rgb: 8, 86, 92;
    --bs-link-color: var(--cb-brand);
    --bs-link-color-rgb: 8, 86, 92;
    --bs-link-hover-color: var(--cb-brand);
    --bs-link-hover-color-rgb: 8, 86, 92;
}

/* Broiler pages wear sky blue, layer pages berry (base.html sets data-place).
   Everything else, and everything for both, stays deep teal. */
body[data-place="broilers"] { --cb-brand: var(--cb-broilers-dark); --cb-brand-soft: var(--cb-broilers-soft); }
body[data-place="layers"] { --cb-brand: var(--cb-layers-dark); }

.btn-primary {
    --bs-btn-color: var(--cb-card);
    --bs-btn-bg: var(--cb-action);
    --bs-btn-border-color: var(--cb-action);
    --bs-btn-hover-color: var(--cb-card);
    --bs-btn-hover-bg: var(--cb-action);
    --bs-btn-hover-border-color: var(--cb-action);
    --bs-btn-active-color: var(--cb-card);
    --bs-btn-active-bg: var(--cb-action);
    --bs-btn-active-border-color: var(--cb-action);
    --bs-btn-disabled-color: var(--cb-card);
    --bs-btn-disabled-bg: var(--cb-action);
    --bs-btn-disabled-border-color: var(--cb-action);
}
/* Stock alert boxes in the farm's colours too (a real problem stays red). */
.alert-success, .alert-info, .alert-warning, .alert-primary, .alert-secondary, .alert-light {
    --bs-alert-color: var(--cb-brand);
    --bs-alert-bg: var(--cb-brand-soft);
    --bs-alert-border-color: var(--cb-line-strong);
    --bs-alert-link-color: var(--cb-brand);
}
.alert-danger {
    --bs-alert-color: var(--cb-critical);
    --bs-alert-bg: var(--cb-critical-soft);
    --bs-alert-border-color: var(--cb-critical-soft);
}
.btn-outline-primary {
    --bs-btn-color: var(--cb-brand);
    --bs-btn-border-color: var(--cb-brand);
    --bs-btn-hover-bg: var(--cb-brand);
    --bs-btn-hover-border-color: var(--cb-brand);
    --bs-btn-active-bg: var(--cb-brand);
    --bs-btn-active-border-color: var(--cb-brand);
}
.form-check-input:checked { background-color: var(--cb-brand); border-color: var(--cb-brand); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--cb-brand);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--cb-brand) 15.0%, transparent);
}

/* No stock blue anywhere: every Bootstrap piece that ships with its own blue
   (ticks, switches, sliders, menus, tabs, page numbers, focus rings) uses the
   farm green instead. */
:focus-visible { outline-color: var(--cb-brand); }
.form-check-input:checked, .form-check-input[type=checkbox]:indeterminate {
    background-color: var(--cb-brand); border-color: var(--cb-brand);
}
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2313544e'/%3e%3c/svg%3e");
}
.form-range::-webkit-slider-thumb { background-color: var(--cb-brand); }
.form-range::-moz-range-thumb { background-color: var(--cb-brand); }
.form-range:focus::-webkit-slider-thumb, .form-range:focus::-moz-range-thumb {
    box-shadow: 0 0 0 1px var(--cb-card), 0 0 0 .2rem color-mix(in srgb, var(--cb-brand) 25.0%, transparent);
}
.nav-link:focus-visible, .btn-close:focus, .page-link:focus, .accordion-button:focus {
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--cb-brand) 20.0%, transparent);
}
.accordion-button:not(.collapsed) { color: var(--cb-brand); background-color: var(--cb-brand-soft); }
.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--cb-brand-soft);
    --bs-dropdown-link-active-color: var(--cb-brand);
    --bs-dropdown-link-hover-bg: var(--cb-brand-soft);
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--cb-brand); }
.nav { --bs-nav-link-color: var(--cb-brand); --bs-nav-link-hover-color: var(--cb-brand); }
.pagination {
    --bs-pagination-active-bg: var(--cb-brand);
    --bs-pagination-active-border-color: var(--cb-brand);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--cb-brand) 20.0%, transparent);
}
.progress, .progress-stacked { --bs-progress-bar-bg: var(--cb-brand); }
.list-group {
    --bs-list-group-active-bg: var(--cb-brand);
    --bs-list-group-active-border-color: var(--cb-brand);
}
.text-primary { color: var(--cb-brand) !important; }
.bg-primary { background-color: var(--cb-brand) !important; }
.border-primary { border-color: var(--cb-brand) !important; }
