/*
 * Site standards
 * --------------
 * Fixed design and CMS shell constants shared by every generated site.
 * Developers should use Bootstrap utilities in markup and should not edit this
 * file as part of routine site branding.
 */

:root {
    --site-color-success: #198754;
    --site-color-success-background: #d1e7dd;
    --site-color-success-border: #a3cfbb;
    --site-color-success-text: #0a3622;
    --site-color-warning: #997404;
    --site-color-warning-background: #fff3cd;
    --site-color-warning-border: #ffe69c;
    --site-color-warning-text: #664d03;
    --site-color-danger: #dc3545;
    --site-color-danger-background: #f8d7da;
    --site-color-danger-border: #f1aeb5;
    --site-color-danger-text: #58151c;
    --site-color-info: #0dcaf0;
    --site-color-info-background: #cff4fc;
    --site-color-info-border: #9eeaf9;
    --site-color-info-text: #055160;

    --site-font-weight-medium: 500;
    --site-font-weight-semibold: 600;
    --site-font-weight-bold: 700;
    --site-font-size-small: 0.875rem;
    --site-font-size-lead: clamp(1.125rem, 1.5vw, 1.25rem);
    --site-font-size-h3: clamp(1.5rem, 2.5vw, 2.125rem);
    --site-font-size-h4: clamp(1.25rem, 1.75vw, 1.5rem);

    --site-space-1: 0.25rem;
    --site-space-2: 0.5rem;
    --site-space-3: 0.75rem;
    --site-space-4: 1rem;
    --site-space-5: 1.5rem;
    --site-space-6: 2rem;
    --site-space-7: 3rem;
    --site-space-8: 4rem;
    --site-section-spacing: clamp(3rem, 7vw, 6rem);

    /* 87.5rem = 1400px. Needs 1464px of viewport before it is reached, because --site-page-gutter
       takes 2rem off each side - below that the container is simply the window less its gutters. */
    --site-content-width: 87.5rem;
    --site-content-width-narrow: 48rem;
    --site-page-gutter: clamp(1rem, 4vw, 2rem);
    --site-cms-canvas-gutter: var(--site-space-5);
    --site-toast-width: 26rem;
    --site-header-min-height: 4.5rem;
    --site-brand-logo-height: 2.5rem;
    --site-brand-logo-height-small: 2rem;

    /* The footer mark, sized independently of the header's. A header logo is boxed in by the bar
       it sits in; a footer logo is not, and most brands run it larger there. Defaults to the
       header height, so a site that wants one size sets --site-brand-logo-height alone and this
       follows. */
    --site-brand-logo-height-footer: var(--site-brand-logo-height);

    --site-radius-small: 0.25rem;
    --site-radius-medium: 0.5rem;
    --site-radius-large: 1rem;
    --site-radius-pill: 999rem;
    --site-shadow-small: 0 1px 3px rgba(15, 23, 42, 0.1);
    --site-shadow-medium: 0 8px 24px rgba(15, 23, 42, 0.12);
    --site-shadow-large: 0 20px 48px rgba(15, 23, 42, 0.16);
    --site-focus-ring: 0 0 0 0.2rem color-mix(in srgb, var(--site-color-secondary) 28%, transparent);
    --site-transition-fast: 150ms ease;
    --site-transition-standard: 250ms ease;

    /* The admin background wash. Derived from the brand rather than fixed, so admin keeps one
       layout on every site while taking that site's colour. Percentages are deliberately tiny:
       this is a wash behind working screens, not a branded surface. */
    --site-admin-canvas-start: color-mix(in srgb, var(--site-color-primary) 4%, #ffffff);
    --site-admin-canvas-middle: color-mix(in srgb, var(--site-color-secondary) 5%, #ffffff);
    --site-admin-canvas-end: color-mix(in srgb, var(--site-color-surface) 92%, #ffffff);
    --site-admin-canvas-fallback: var(--site-admin-canvas-middle);
    --site-admin-overlay-primary-strong: color-mix(in srgb, var(--site-color-primary) 58%, transparent);
    --site-admin-overlay-primary-soft: color-mix(in srgb, var(--site-color-primary) 30%, transparent);
    --site-admin-overlay-secondary-strong: color-mix(in srgb, var(--site-color-secondary) 48%, transparent);
    --site-admin-overlay-secondary-soft: color-mix(in srgb, var(--site-color-secondary) 24%, transparent);

    /* The account chip in the sidebar footer. The per-link icon tokens that used to sit beside
       these were read only by .admin-sidebar__icon--* rules that nothing ever carried - a link's
       colour comes from its own --primary/--secondary/--accent class, through
       --admin-sidebar-item-color. Both are gone. */
    --site-sidebar-icon-account-background: var(--site-color-primary);
    --site-sidebar-icon-account-foreground: var(--site-color-primary-contrast);
}

/* Shared CMS modal presentation used by both administration and editor layouts. */
.cms-modal .modal-content {
    overflow: hidden;
    border: 1px solid var(--site-color-border);
    border-radius: var(--site-radius-large);
    background: var(--site-color-background);
    box-shadow: 0 16px 40px rgba(17, 24, 39, .18);
}

.cms-modal .modal-header,
.cms-modal .modal-footer {
    border-color: var(--site-color-border);
}

.cms-modal .modal-header {
    align-items: flex-start;
    background: var(--site-color-surface);
}

.cms-modal .modal-body > p {
    margin-bottom: 0;
    color: var(--site-color-text);
}

.cms-modal-layer {
    z-index: 2000;
}

.cms-modal-submitting .modal-content {
    cursor: progress;
}

.cms-page-transition-overlay {
    position: fixed;
    z-index: 3000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--site-space-4);
    color: var(--site-color-text);
    background: color-mix(in srgb, var(--site-color-background) 82%, transparent);
    cursor: progress;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.cms-page-transition-overlay__status {
    display: inline-flex;
    align-items: center;
    gap: var(--site-space-3);
    padding: var(--site-space-4) var(--site-space-5);
    border: 1px solid var(--site-color-border);
    border-radius: var(--site-radius-medium);
    background: var(--site-color-background);
    box-shadow: var(--site-shadow-large);
    font-weight: var(--site-font-weight-semibold);
}

body.cms-page-transitioning {
    overflow: hidden;
    cursor: progress;
}

/* Several CMS modals wrap header, body and footer in a single <form> so one submit posts the lot.
   That form lands in the middle of the flex column modal-dialog-scrollable depends on, which only
   works while every element between .modal-content and .modal-body is part of that column - a
   plain block-level form in between leaves the body unbounded, so it grows to fit and the footer
   ends up outside the dialog. Making the form the column restores the intended behaviour. */
.cms-modal .modal-content > form,
.cms-editor-modal .modal-content > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
}

/* Flex items refuse to shrink below their content unless told otherwise. .modal-body carries
   overflow-y: auto in the scrollable variant, which already implies this, but stating it means a
   modal that scrolls its body without that class behaves the same way. */
.cms-modal .modal-content > form > .modal-body,
.cms-editor-modal .modal-content > form > .modal-body {
    min-height: 0;
}
