/* =============================================================
    Global style configuration (single source of truth)
    -------------------------------------------------------------
    1. Base      - scale, font, colors, border, radius, shadow
    2. Spacing   - shared spacing scale + shared paddings
    3. Sizes     - control, icon and font sizes
    4. Breakpoint
    5. Components - only values that are genuinely component specific

    Padding = space INSIDE an element's border (between border and content).
    Margin  = space OUTSIDE an element's border (distance to neighbours).
    ============================================================= */

:root {
    /* ---------- 1. Base ---------- */
    --satcam-ui-scale: 1; /* Global UI scaling factor for all size tokens (1 = default) */
    --satcam-font-family-ui: Arial, Helvetica, sans-serif; /* Main font family */

    --satcam-color-text: rgb(0, 101, 189); /* SatCam blue: text, icons */
    --satcam-color-text-hover: rgb(0, 65, 140); /* Darker blue for hovered text */
    --satcam-color-accent: rgb(90, 170, 40); /* SatCam green: borders, active states */
    --satcam-color-accent-soft: rgba(90, 170, 40, 0.45); /* Faint green for separators */
    --satcam-color-highlight: rgb(255, 192, 0); /* SatCam yellow: hover / highlight */
    --satcam-color-highlight-soft: rgba(255, 192, 0, 0.08); /* Faint yellow background for notes */
    --satcam-color-warn: rgb(227, 114, 34); /* Orange: secondary / decline actions */
    --satcam-color-support: var(--satcam-color-highlight); /* Symbols in highlighted links (info panel, top bar, footer) */
    --satcam-color-support-hover: var(--satcam-color-text); /* Heart on the yellow hover background */
    --satcam-color-on-accent: rgb(255, 255, 255); /* Text on green/blue backgrounds */
    --satcam-color-surface: rgba(255, 255, 255, 0.96); /* Background of controls and panels */
    --satcam-color-surface-solid: rgb(255, 255, 255); /* Opaque background (buttons inside panels, pages) */
    --satcam-color-surface-soft: rgba(255, 255, 255, 0.9); /* Translucent background (legend, overlays) */
    --satcam-color-disabled: #cccccc; /* Disabled text */
    --satcam-color-body: rgb(40, 40, 40); /* Running text on content pages */

    --satcam-border-width: 1px; /* Border width of all controls */
    --satcam-border: var(--satcam-border-width) solid var(--satcam-color-accent); /* Standard control border */
    --satcam-radius: calc(4px * var(--satcam-ui-scale)); /* Corner radius of all controls, panels and buttons */
    --satcam-radius-round: 50%; /* Perfect circles (info button) */
    --satcam-radius-pill: 999px; /* Pill shaped labels (support pill) */
    --satcam-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); /* Drop shadow of floating controls */

    /* ---------- 2. Spacing ---------- */
    --satcam-space-xs: calc(2px * var(--satcam-ui-scale)); /* Hairline gaps */
    --satcam-space-sm: calc(4px * var(--satcam-ui-scale)); /* Gaps inside compact controls */
    --satcam-space-md: calc(6px * var(--satcam-ui-scale)); /* Default gap: between stacked controls, inline content */
    --satcam-space-lg: calc(8px * var(--satcam-ui-scale)); /* Gap between larger blocks */
    --satcam-space-xl: calc(16px * var(--satcam-ui-scale)); /* Section spacing on content pages */

    --satcam-control-padding-x: var(--satcam-space-lg); /* Horizontal padding of ALL text buttons in map controls */
    --satcam-panel-padding: var(--satcam-space-md); /* Inner padding of ALL expandable panels (planning, legend, info) */
    --satcam-map-edge-margin: var(--satcam-space-md); /* Screen-edge margin; also around the info panel */

    /* ---------- 3. Sizes ---------- */
    --satcam-control-btn-size: calc(44px * var(--satcam-ui-scale)); /* Outer square/circle size of map controls, including borders */
    --satcam-control-icon-size: calc(24px * var(--satcam-ui-scale)); /* Standard icon size in controls */
    --satcam-control-icon-size-small: calc(22px * var(--satcam-ui-scale)); /* Small icon size for compact buttons */
    --satcam-info-btn-size: calc(var(--satcam-control-btn-size) + 2 * var(--satcam-space-sm) + 2 * var(--satcam-border-width)); /* Diameter of the round info button, including borders; matches the date control height */
    --satcam-info-logo-size: calc(var(--satcam-info-btn-size) - 7px * var(--satcam-ui-scale)); /* SatCam logo in the round info button */
    --satcam-zen-fade-duration: 400ms; /* Fade map controls in/out for zen mode */

    --satcam-btn-font-size: calc(18px * var(--satcam-ui-scale)); /* Base font size; other font sizes derive from it */
    --satcam-control-font-size: calc(var(--satcam-btn-font-size) - 2px); /* Text inside map controls */
    --satcam-small-font-size: calc(var(--satcam-btn-font-size) - 5px); /* Small print (legal links, stats) */

    /* ---------- 4. Breakpoint ----------
       CSS variables cannot be used inside @media queries.
       The narrow-screen breakpoint is configured ONCE in scripts/siteConfig.js
       (narrowBreakpointPx). scripts/viewport.js then sets the class
       "is-narrow" on <html>; use "html.is-narrow ..." selectors for mobile rules. */

    /* ---------- 5. Components ---------- */
    /* Large dialog buttons (ACCEPT / DECLINE) */
    --satcam-btn-padding-y: calc(15px * var(--satcam-ui-scale)); /* Vertical padding of large dialog buttons */
    --satcam-btn-padding-x: calc(32px * var(--satcam-ui-scale)); /* Horizontal padding of large dialog buttons */
    --satcam-btn-height: auto; /* Height of large dialog buttons */

    /* Planning panel */
    --satcam-planning-panel-width: min(74vw, calc(328px * var(--satcam-ui-scale))); /* Expanded width (wide screens) */
    --satcam-planning-panel-width-mobile: min(92vw, calc(328px * var(--satcam-ui-scale))); /* Expanded width (narrow screens) */
    --satcam-planning-toggle-font-size: calc(var(--satcam-btn-font-size) - 1px); /* Collapse toggle */
    --satcam-planning-tool-font-size: calc(var(--satcam-btn-font-size) - 3px); /* Tool row buttons */
    --satcam-planning-stats-font-size: var(--satcam-small-font-size); /* Stats summary */
    --satcam-planning-pace-font-size: calc(var(--satcam-btn-font-size) - 6px); /* Pace line container */
    --satcam-planning-pace-sub-font-size: calc(var(--satcam-btn-font-size) - 7px); /* Pace labels and units */
    --satcam-planning-pace-value-font-size: calc(var(--satcam-btn-font-size) - 4px); /* Pace value buttons */
    --satcam-planning-pace-value-width: calc(50px * var(--satcam-ui-scale)); /* Pace value button width */
    --satcam-planning-pace-value-height: calc(26px * var(--satcam-ui-scale)); /* Pace value button height */

    /* Layer switcher */
    --satcam-layer-title-font-size: var(--satcam-control-font-size); /* Selector and overlay labels */
    --satcam-layer-hamburger-font-size: calc(var(--satcam-btn-font-size) + 4px); /* Collapsed hamburger symbol */
    --satcam-layer-panel-width: min(86vw, calc(300px * var(--satcam-ui-scale))); /* Expanded width (wide screens) */
    --satcam-layer-panel-width-mobile: min(92vw, calc(320px * var(--satcam-ui-scale))); /* Expanded width (narrow screens) */
    --satcam-layer-panel-max-height: calc(360px * var(--satcam-ui-scale)); /* Expanded max height */

    /* Date control and temporal pins */
    --satcam-date-display-min-width: calc(86px * var(--satcam-ui-scale)); /* Min width of the date text */
    --satcam-temporal-pin-date-font-size: calc(10px * var(--satcam-ui-scale)); /* Date label in pin widget */
    --satcam-temporal-pin-icon-size: calc(20px * var(--satcam-ui-scale)); /* Pin symbol size */

    /* Legend */
    --satcam-legend-max-width: calc(220px * var(--satcam-ui-scale)); /* Max width (wide screens) */
    --satcam-legend-max-width-mobile: 70vw; /* Max width (narrow screens) */
    --satcam-legend-swatch-size: calc(9px * var(--satcam-ui-scale)); /* Colour squares on the collapsed legend button (3 per row, max 9) */

    /* Info panel (bottom-right; content-fit height within viewport and configured limits) */
    --satcam-info-panel-max-width: calc(960px * var(--satcam-ui-scale)); /* Cap on wide screens */
    --satcam-info-panel-max-height: calc(720px * var(--satcam-ui-scale)); /* Cap on tall screens */
    --satcam-info-nav-font-size: calc(var(--satcam-btn-font-size) * 1.15); /* Main page links */
    --satcam-info-legal-font-size: var(--satcam-small-font-size); /* Legal links */
    --satcam-info-attrib-column-width: calc(260px * var(--satcam-ui-scale)); /* Attribution list flows into columns of this width */

    /* Scale bar */
    --satcam-scale-font-size: calc(13px * var(--satcam-ui-scale)); /* Label font size */
    --satcam-scale-line-height: calc(16px * var(--satcam-ui-scale)); /* Label line height */
    --satcam-scale-padding-y: calc(1px * var(--satcam-ui-scale)); /* Label vertical padding */
    --satcam-scale-border-width: calc(2px * var(--satcam-ui-scale)); /* Label border width */

    /* Subpages (top bar, footer, content) */
    --satcam-topbar-height: calc(56px * var(--satcam-ui-scale)); /* Height of the top bar */
    --satcam-topbar-logo-height: calc(40px * var(--satcam-ui-scale)); /* Logo height inside the top bar */
    --satcam-page-max-width: calc(860px * var(--satcam-ui-scale)); /* Readable content width */
    --satcam-maintenance-logo-size: min(60vmin, calc(360px * var(--satcam-ui-scale))); /* Logo on "Coming soon" page */
    --satcam-supporter-logo-width: clamp(calc(110px * var(--satcam-ui-scale)), 25%, calc(220px * var(--satcam-ui-scale))); /* Supporter logo box on the Support page: 25% of the entry width, within min/max (wide screens) */
    --satcam-supporter-logo-aspect: 2 / 1; /* Box width:height; logos are scaled to fit inside the box */
    --satcam-supporter-logo-width-mobile: min(70%, calc(260px * var(--satcam-ui-scale))); /* Logo box width (narrow screens; logo sits above the text) */
    --satcam-supporter-logo-aspect-mobile: 3 / 1; /* Flatter box on narrow screens so wide logos stay large */

    /* jQuery UI datepicker */
    --satcam-jq-padding: calc(0.3em * var(--satcam-ui-scale)); /* Container padding */
    --satcam-jq-header-padding: calc(0.5em * var(--satcam-ui-scale)) 0; /* Header padding */
    --satcam-jq-title-font-size: calc(1.1em * var(--satcam-ui-scale)); /* Month-year title size */
    --satcam-jq-nav-size: calc(1.8em * var(--satcam-ui-scale)); /* Prev/next button size */
    --satcam-jq-nav-offset: calc(0.5em * var(--satcam-ui-scale)); /* Prev/next horizontal offset */
    --satcam-jq-table-gap: calc(0.4em * var(--satcam-ui-scale)); /* Gap between header and table */
    --satcam-jq-header-cell-padding: calc(0.4em * var(--satcam-ui-scale)); /* Weekday header cell padding */
    --satcam-jq-day-cell-padding: calc(0.3em * var(--satcam-ui-scale)); /* Day cell padding */
}
