/* Colour themes ("looks"). Each theme only re-points the design tokens declared in :root
   (site.css), so every page, button and card repaints without per-page CSS.
   The active theme is the data-theme attribute on <html>: set from Site:Theme in
   configuration, or - on a local Development run only - from the "Look" picker. */

/* 1. Spin Brand Blue - deep navy with the logo's sky blue, red and L-plate yellow. */
:root[data-theme="brand"] {
    --color-background: #f3f7fa;
    --color-surface: #ffffff;
    --color-surface-alt: #e8f0f6;
    --color-surface-tint: #e6f3fa;

    --color-primary: #0b1f33;
    --color-primary-foreground: #ffffff;

    --color-accent: #0087c2;
    --color-accent-hover: #006c9c;
    --color-accent-light: #2bb0e3;
    --color-accent-foreground: #ffffff;

    --color-secondary: #e3262e;
    --color-secondary-foreground: #ffffff;

    --color-tertiary: #ffd400;
    --color-tertiary-hover: #f0c400;
    --color-tertiary-deep: #e6b800;
    --color-tertiary-foreground: #0b1f33;

    --color-topbar-bg: #071524;
    --color-topbar-text: #a9bdd0;
    --color-on-dark-muted: #a9bdd0;
    --color-band-dark: #05111d;

    --color-border: #dbe5ee;
    --color-ring: #0087c2;
    --color-info: #0087c2;
    --color-info-foreground: #006c9c;
    --color-info-soft: #e1f2fa;

    --shadow-sm: 0 1px 2px rgba(11, 31, 51, 0.06);
    --shadow-md: 0 10px 24px rgba(11, 31, 51, 0.12), 0 2px 6px rgba(11, 31, 51, 0.08);
    --shadow-lg: 0 20px 36px rgba(11, 31, 51, 0.18), 0 4px 10px rgba(11, 31, 51, 0.1);
    --shadow-xl: 0 25px 50px rgba(11, 31, 51, 0.24);
}

/* 2. Midnight & Gold - midnight navy, warm gold highlights, ivory pages. */
:root[data-theme="gold"] {
    --color-background: #f7f4ee;
    --color-surface: #ffffff;
    --color-surface-alt: #efe9de;
    --color-surface-tint: #f6efe1;

    --color-primary: #0f1b2d;
    --color-primary-foreground: #ffffff;

    --color-accent: #c19a3e;
    --color-accent-hover: #a8832c;
    --color-accent-light: #dcbd6e;
    --color-accent-foreground: #0f1b2d;

    --color-secondary: #8c1c2b;
    --color-secondary-foreground: #ffffff;

    --color-tertiary: #e9c46a;
    --color-tertiary-hover: #ddb24f;
    --color-tertiary-deep: #c9a24a;
    --color-tertiary-foreground: #0f1b2d;

    --color-topbar-bg: #0a1322;
    --color-topbar-text: #c9b98f;
    --color-on-dark-muted: #c2c8d2;
    --color-band-dark: #070e19;

    --color-border: #e6dfd1;
    --color-ring: #c19a3e;
    --color-info: #1f3a5f;
    --color-info-foreground: #1f3a5f;
    --color-info-soft: #e7ecf3;

    --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
    --shadow-md: 0 10px 24px rgba(15, 27, 45, 0.12), 0 2px 6px rgba(15, 27, 45, 0.08);
    --shadow-lg: 0 20px 36px rgba(15, 27, 45, 0.18), 0 4px 10px rgba(15, 27, 45, 0.1);
    --shadow-xl: 0 25px 50px rgba(15, 27, 45, 0.24);
}

/* 3. Carbon & Red - sporty graphite with the logo's red, sky-blue second accent. */
:root[data-theme="carbon"] {
    --color-background: #f2f2f3;
    --color-surface: #ffffff;
    --color-surface-alt: #e9e9eb;
    --color-surface-tint: #f4f4f5;

    --color-primary: #16181d;
    --color-primary-foreground: #ffffff;

    --color-accent: #d41f2b;
    --color-accent-hover: #b01822;
    --color-accent-light: #ef4651;
    --color-accent-foreground: #ffffff;

    --color-secondary: #0a9bd1;
    --color-secondary-foreground: #ffffff;

    --color-tertiary: #facc15;
    --color-tertiary-hover: #eab308;
    --color-tertiary-deep: #e0a716;
    --color-tertiary-foreground: #16181d;

    --color-topbar-bg: #0c0d10;
    --color-topbar-text: #a1a5ad;
    --color-on-dark-muted: #b4b8bf;
    --color-band-dark: #0c0d10;

    --color-border: #e1e2e5;
    --color-ring: #d41f2b;
    --color-info: #0a9bd1;
    --color-info-foreground: #087fab;
    --color-info-soft: #e0f3fa;
}

/* 4. Racing Green & Brass - deep British green, brass highlights, cream pages. */
:root[data-theme="green"] {
    --color-background: #f5f3ec;
    --color-surface: #ffffff;
    --color-surface-alt: #ece8dc;
    --color-surface-tint: #eef2ea;

    --color-primary: #0f2e24;
    --color-primary-foreground: #ffffff;

    --color-accent: #17694f;
    --color-accent-hover: #10523d;
    --color-accent-light: #2f8a6b;
    --color-accent-foreground: #ffffff;

    --color-secondary: #b3863c;
    --color-secondary-foreground: #ffffff;

    --color-tertiary: #d9b25f;
    --color-tertiary-hover: #c9a04a;
    --color-tertiary-deep: #b8893b;
    --color-tertiary-foreground: #0f2e24;

    --color-topbar-bg: #0a2019;
    --color-topbar-text: #c8b78f;
    --color-on-dark-muted: #bfcbc4;
    --color-band-dark: #071812;

    --color-border: #e2ddcf;
    --color-ring: #17694f;
    --color-info: #17694f;
    --color-info-foreground: #10523d;
    --color-info-soft: #e3f0ea;

    --shadow-sm: 0 1px 2px rgba(15, 46, 36, 0.06);
    --shadow-md: 0 10px 24px rgba(15, 46, 36, 0.12), 0 2px 6px rgba(15, 46, 36, 0.08);
    --shadow-lg: 0 20px 36px rgba(15, 46, 36, 0.18), 0 4px 10px rgba(15, 46, 36, 0.1);
    --shadow-xl: 0 25px 50px rgba(15, 46, 36, 0.24);
}

/* 5. Spin Brand Gold - the brand navy and logo sky blue, with warm gold buttons and highlights. */
:root[data-theme="brandgold"] {
    --color-background: #f3f6f9;
    --color-surface: #ffffff;
    --color-surface-alt: #eef1f5;
    --color-surface-tint: #f7f1e3;

    --color-primary: #0b1f33;
    --color-primary-foreground: #ffffff;

    --color-accent: #c8a043;
    --color-accent-hover: #b08a30;
    --color-accent-light: #e2c27a;
    --color-accent-foreground: #0b1f33;

    --color-secondary: #0a9bd1;
    --color-secondary-foreground: #ffffff;

    --color-tertiary: #ffd400;
    --color-tertiary-hover: #f0c400;
    --color-tertiary-deep: #e6b800;
    --color-tertiary-foreground: #0b1f33;

    --color-topbar-bg: #071524;
    --color-topbar-text: #d2bd86;
    --color-on-dark-muted: #b9c6d3;
    --color-band-dark: #05111d;

    --color-border: #e2e3df;
    --color-ring: #c8a043;
    --color-info: #0a9bd1;
    --color-info-foreground: #087fab;
    --color-info-soft: #e0f3fa;

    --shadow-sm: 0 1px 2px rgba(11, 31, 51, 0.06);
    --shadow-md: 0 10px 24px rgba(11, 31, 51, 0.12), 0 2px 6px rgba(11, 31, 51, 0.08);
    --shadow-lg: 0 20px 36px rgba(11, 31, 51, 0.18), 0 4px 10px rgba(11, 31, 51, 0.1);
    --shadow-xl: 0 25px 50px rgba(11, 31, 51, 0.24);
}

/* ---------- Layers: a fixed background layer with the page content sliding over it as
   frosted, semi-transparent panels. data-layers on <html> picks the background
   ("city" photo or "glow"); public pages only (the admin layout sets data-admin). ---------- */
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) {
    background: var(--color-primary);
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) body {
    background: transparent;
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

:root[data-layers="city"]:not([data-admin]) body::before {
    /* Melbourne CBD at dusk (Joshua Navratil, Pexels - free licence). A light tint only, so the city stays clear. */
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--color-band-dark) 35%, transparent) 0%,
            color-mix(in srgb, var(--color-band-dark) 8%, transparent) 45%,
            color-mix(in srgb, var(--color-band-dark) 30%, transparent) 100%),
        url('/images/melbourne-dusk.jpg') center 30% / cover no-repeat,
        var(--color-primary);
}

/* Phones and other tall screens: a portrait crop around the towers, so the photo isn't blown up and blurry. */
@media (orientation: portrait) {
    :root[data-layers="city"]:not([data-admin]) body::before {
        background:
            linear-gradient(180deg,
                color-mix(in srgb, var(--color-band-dark) 35%, transparent) 0%,
                color-mix(in srgb, var(--color-band-dark) 8%, transparent) 45%,
                color-mix(in srgb, var(--color-band-dark) 30%, transparent) 100%),
            url('/images/melbourne-dusk-portrait.jpg') center 25% / cover no-repeat,
            var(--color-primary);
    }
}

:root[data-layers="glow"]:not([data-admin]) body::before {
    background:
        radial-gradient(900px circle at 8% 12%, color-mix(in srgb, var(--color-secondary) 55%, transparent), transparent 60%),
        radial-gradient(820px circle at 92% 28%, color-mix(in srgb, var(--color-accent) 55%, transparent), transparent 60%),
        radial-gradient(1000px circle at 40% 105%, color-mix(in srgb, var(--color-secondary) 40%, transparent), transparent 62%),
        var(--color-primary);
}

/* Content layer: every top-level block of the page becomes a rounded glass panel. */
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > section,
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > div:not(.sds-flash) {
    background: color-mix(in srgb, var(--color-surface) 84%, transparent) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    width: calc(100% - 40px);
    max-width: 1400px;
    margin: 0 auto 20px;
    overflow: hidden;
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > div:not(.sds-flash) {
    padding: var(--spacing-6) var(--spacing-5);
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > section.bg-light-blue {
    background: color-mix(in srgb, var(--color-surface-alt) 80%, transparent) !important;
}

/* The hero lets more of the background through, so the layering is obvious at the top. */
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > section.sds-hero {
    background: color-mix(in srgb, var(--color-surface) 74%, transparent) !important;
    margin-top: 16px;
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) .find-instructor-card {
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
}

/* Dark bands become smoked glass over the background instead of a solid block. */
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > section.sds-cta-band {
    background: color-mix(in srgb, var(--color-band-dark) 70%, transparent) !important;
    border-color: rgba(255, 255, 255, 0.18);
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) footer.sds-footer {
    background: color-mix(in srgb, var(--color-primary) 80%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) .sds-footer-bottom {
    background: transparent;
}

:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) .sds-topbar {
    background: color-mix(in srgb, var(--color-topbar-bg) 78%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

@media (max-width: 767.98px) {
    :root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > section,
    :root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) main > div:not(.sds-flash) {
        width: calc(100% - 16px);
        border-radius: var(--radius-xl);
        margin-bottom: 12px;
    }
}

/* ---------- Look picker (local Development runs only) ---------- */
.sds-look-picker {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2000;
    font-family: var(--font-sans);
}

.sds-look-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius-full);
    padding: 10px 16px;
    background: var(--color-accent);
    color: var(--color-accent-foreground);
    font-weight: 600;
    outline: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-lg);
}

.sds-look-panel {
    position: absolute;
    left: 0;
    bottom: 54px;
    width: 280px;
    max-width: calc(100vw - 32px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 12px;
}

.sds-look-panel[hidden] {
    display: none;
}

.sds-look-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin: 2px 4px 8px;
}

.sds-look-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    padding: 8px;
    text-align: left;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.92rem;
}

.sds-look-option:hover {
    background: var(--color-surface-alt);
}

.sds-look-option[aria-pressed="true"] {
    border-color: var(--color-accent);
}

.sds-look-swatches {
    display: inline-flex;
    flex-shrink: 0;
}

.sds-look-swatches span {
    width: 18px;
    height: 28px;
    display: block;
}

.sds-look-swatches span:first-child {
    border-radius: 6px 0 0 6px;
}

.sds-look-swatches span:last-child {
    border-radius: 0 6px 6px 0;
}

.sds-layer-row {
    display: flex;
    gap: 6px;
    padding: 0 4px;
}

.sds-layer-option {
    flex: 1;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 4px;
}

.sds-layer-option[aria-pressed="true"] {
    border-color: var(--color-accent);
    background: var(--color-surface-alt);
}

.sds-look-panel {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sds-look-note {
    font-size: 0.75rem;
    color: var(--color-muted);
    margin: 8px 4px 2px;
}

/* Body text on the glass panels: a little darker than on plain white, so it stays easy to read
   when the background shows through. */
:root:is([data-layers="city"], [data-layers="glow"]):not([data-admin]) {
    --color-muted: #475060;
    --color-muted-foreground: #5b6371;
}
