/* =========================================================
   THEME + ACCESSIBILITY
   Load AFTER style.css, developer.css and staff.css.
   Driven by attributes that js/prefs.js sets on <html>:
   data-theme, data-text, data-font, data-contrast,
   data-motion, data-links, data-focus, data-spacing
   ========================================================= */

/* ---------- Preferences UI ---------- */

.scz-skip-link {
    position: fixed;
    top: -60px;
    left: 12px;
    z-index: 5000;
    padding: 10px 16px;
    border-radius: 10px;
    background: #0878dc;
    color: #fff;
    font-weight: 700;
    transition: top 0.15s ease;
}

.scz-skip-link:focus {
    top: 12px;
    color: #fff;
}

.scz-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--glass);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    transition: 0.2s ease;
}

.scz-theme-btn:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.scz-theme-btn-floating {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 2900;
}

.scz-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scz-a11y-fab {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 2900;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-hover);
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text);
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: 0.2s ease;
}

.scz-a11y-fab:hover {
    transform: translateY(-2px);
}

.scz-panel {
    position: fixed;
    left: 18px;
    bottom: 76px;
    z-index: 2950;
    width: min(360px, calc(100vw - 36px));
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid var(--border-hover);
    border-radius: 18px;
    background: var(--bg-secondary);
    color: var(--text);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

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

.scz-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.scz-panel-head h2 {
    font-size: 16px;
    color: var(--text);
}

.scz-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 20px;
    line-height: 1;
}

.scz-panel-note {
    margin: 4px 0 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.scz-group {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.scz-group legend {
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.scz-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scz-options input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.scz-options label {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s ease;
}

.scz-options label:hover {
    border-color: var(--border-hover);
}

.scz-options input:checked + label {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    font-weight: 700;
}

.scz-options input:focus-visible + label {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

.scz-reset {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
}

.scz-reset:hover {
    border-color: var(--border-hover);
}

/* ---------- Content pages (About, FAQ) ---------- */

.scz-page {
    width: min(820px, calc(100% - 40px));
    margin: 0 auto;
    padding: 56px 0 80px;
}

.scz-page h1 {
    margin: 8px 0 16px;
    font-family: 'Orbitron', 'Inter', sans-serif;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.2;
}

.scz-page h2 {
    margin: 36px 0 10px;
    font-size: 22px;
}

.scz-page p,
.scz-page li {
    color: var(--text-secondary);
}

.scz-page p {
    margin-bottom: 14px;
}

.scz-page ul {
    margin: 0 0 14px 22px;
}

.scz-page .eyebrow {
    display: inline-block;
}

.scz-header-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
}

.scz-header-links a {
    font-weight: 600;
    font-size: 14px;
}

.scz-faq {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.scz-faq details {
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--glass);
    padding: 0 18px;
}

.scz-faq summary {
    padding: 16px 0;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.scz-faq details[open] summary {
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.scz-faq details p {
    padding-bottom: 6px;
}

.scz-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

/* =========================================================
   LIGHT THEME
   ========================================================= */

html[data-theme="light"] {
    --bg: #f3f7fc;
    --bg-secondary: #ffffff;
    --glass: rgba(255, 255, 255, 0.86);
    --glass-light: rgba(231, 240, 251, 0.95);
    --border: rgba(15, 90, 170, 0.2);
    --border-hover: rgba(15, 90, 170, 0.5);
    --blue: #0b74d1;
    --blue-light: #0a62b3;
    --blue-dark: #0a5fb0;
    --cyan: #0688a8;
    --text: #0d1b2e;
    --text-secondary: #33506f;
    --text-muted: #566c86;
    --green: #0d8559;
    --red: #c4224a;
    --purple: #6a47cc;
    --shadow: 0 6px 28px rgba(15, 70, 140, 0.1);
}

html[data-theme="light"] body {
    background:
        radial-gradient(circle at 10% 5%, rgba(0, 113, 255, 0.1), transparent 30%),
        radial-gradient(circle at 90% 35%, rgba(0, 190, 230, 0.08), transparent 25%),
        radial-gradient(circle at 50% 80%, rgba(80, 120, 220, 0.08), transparent 40%),
        var(--bg);
    color: var(--text);
}

html[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(15, 90, 170, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 90, 170, 0.05) 1px, transparent 1px);
}

html[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.88);
}

html[data-theme="light"] a:hover {
    color: #04264a;
}

/* text that the base stylesheet hard-codes to white */

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] h6,
html[data-theme="light"] strong,
html[data-theme="light"] label,
html[data-theme="light"] legend,
html[data-theme="light"] th,
html[data-theme="light"] summary,
html[data-theme="light"] [class*="title"],
html[data-theme="light"] [class*="name"],
html[data-theme="light"] [class*="number"],
html[data-theme="light"] [class*="label"] {
    color: var(--text);
}

html[data-theme="light"] .nav-links > a,
html[data-theme="light"] .logo,
html[data-theme="light"] .logo span {
    color: var(--text);
}

html[data-theme="light"] .nav-links > a:hover,
html[data-theme="light"] .nav-links > a.active {
    color: var(--blue-dark);
}

/* keep text on coloured buttons white */

html[data-theme="light"] .btn-primary,
html[data-theme="light"] .btn-primary *,
html[data-theme="light"] .scz-options input:checked + label,
html[data-theme="light"] .scz-skip-link {
    color: #fff;
}

/* form fields */

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .suggestion-toolbar input,
html[data-theme="light"] .suggestion-toolbar select,
html[data-theme="light"] .filter-select,
html[data-theme="light"] .dev-page textarea {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: var(--text-muted);
}

html[data-theme="light"] select option {
    background: #ffffff;
    color: var(--text);
}

/* surfaces */

html[data-theme="light"] .modal-content {
    background: linear-gradient(145deg, #ffffff, #eef4fb);
    box-shadow: 0 10px 50px rgba(15, 70, 140, 0.18);
}

html[data-theme="light"] .toast,
html[data-theme="light"] .notification {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 10px 35px rgba(15, 70, 140, 0.2);
}

html[data-theme="light"] .activity-toggle-slider {
    background: #c3d1e3;
}

html[data-theme="light"] ::-webkit-scrollbar-track {
    background: #e3ebf5;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #9db6d3;
}

html[data-theme="light"] .scz-panel,
html[data-theme="light"] .scz-a11y-fab {
    box-shadow: 0 12px 34px rgba(15, 70, 140, 0.22);
}

/* developer and staff pages */

html[data-theme="light"] .dev-subtab,
html[data-theme="light"] .dev-task-button,
html[data-theme="light"] .dev-message,
html[data-theme="light"] .dev-task-review,
html[data-theme="light"] .dev-editor-item,
html[data-theme="light"] .dev-save-bar {
    background: rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .staff-tab:hover,
html[data-theme="light"] .staff-tab.active {
    background: rgba(15, 90, 170, 0.09);
}

html[data-theme="light"] .dev-pill-warn {
    color: #8a5600;
}

html[data-theme="light"] .dev-pill-bad {
    color: #b3173d;
}

html[data-theme="light"] .dev-pill-good {
    color: #0b6b48;
}

/* the code editor stays dark in both themes */

html[data-theme="light"] .dev-editor,
html[data-theme="light"] .dev-page .dev-editor,
html[data-theme="light"] .dev-editor-bar,
html[data-theme="light"] .dev-gutter {
    --text: #edf6ff;
    --text-secondary: #a6bdd8;
    --text-muted: #7186a3;
    --border: rgba(85, 165, 255, 0.18);
    background: #070d1a;
    color: #edf6ff;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

/* text size (the site uses px sizes, so zoom is used) */

html[data-text="115"] body { zoom: 1.15; }
html[data-text="130"] body { zoom: 1.3; }
html[data-text="150"] body { zoom: 1.5; }

/* easy-to-read font */

html[data-font="easy"] body,
html[data-font="easy"] body *:not(pre):not(code):not(.dev-editor):not(.dev-gutter) {
    font-family: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif !important;
}

/* line spacing */

html[data-spacing="relaxed"] body {
    line-height: 1.9;
    letter-spacing: 0.02em;
    word-spacing: 0.08em;
}

html[data-spacing="relaxed"] p,
html[data-spacing="relaxed"] li {
    line-height: 1.9;
}

/* links */

html[data-links="underline"] a:not(.btn):not(.logo):not(.scz-skip-link) {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

/* keyboard focus */

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

html[data-focus="strong"] :focus-visible {
    outline: 4px solid #ffbf00 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 7px #000 !important;
}

/* reduced motion (also respected automatically via the device setting) */

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* high contrast */

html[data-theme="dark"][data-contrast="high"] {
    --bg: #000000;
    --bg-secondary: #000000;
    --glass: #000000;
    --glass-light: #0a0a0a;
    --border: #ffffff;
    --border-hover: #ffff00;
    --blue: #5cc8ff;
    --blue-light: #8fdcff;
    --text: #ffffff;
    --text-secondary: #ffffff;
    --text-muted: #e6e6e6;
    --green: #5dffb8;
    --red: #ff7d99;
}

html[data-theme="light"][data-contrast="high"] {
    --bg: #ffffff;
    --bg-secondary: #ffffff;
    --glass: #ffffff;
    --glass-light: #f2f2f2;
    --border: #000000;
    --border-hover: #0000cc;
    --blue: #0036b3;
    --blue-light: #0036b3;
    --blue-dark: #00297f;
    --text: #000000;
    --text-secondary: #000000;
    --text-muted: #1a1a1a;
    --green: #005c3a;
    --red: #a00027;
}

html[data-contrast="high"] body,
html[data-contrast="high"] body::before {
    background-image: none;
    background-color: var(--bg);
}

html[data-contrast="high"] .navbar,
html[data-contrast="high"] .modal-content {
    background: var(--bg);
}

/* phones */

@media (max-width: 480px) {
    .scz-a11y-fab {
        left: 12px;
        bottom: 12px;
    }

    .scz-panel {
        left: 12px;
        bottom: 68px;
    }
}
