@import url('/css/design-tokens.css');

/**
 * Consolidated Base Styles
 * Foundation CSS for OK Rock Band Website
 *
 * Modern CSS Architecture (2026-2027):
 * - @layer cascade management
 * - oklch() color space utilities
 * - text-wrap: balance/pretty
 * - Container queries
 * - CSS nesting (native)
 */

/* Cascade Layer Declaration */
@layer reset, base, components, pages, utilities;

/* Container query contexts */
.container { container-type: inline-size; }
main { container-type: inline-size; container-name: main-content; }

/* ========================================
   CSS RESET & NORMALIZE
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Modern text rendering */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;

    /* Subtle top vignette (replaces aurora) */
    &::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 40vh;
        background: radial-gradient(ellipse at 50% 0%, rgba(220, 38, 38, 0.06), transparent 70%);
        pointer-events: none;
        z-index: -1;
    }

    /* Grain texture overlay for raw rock aesthetic */
    &::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: -1;
        opacity: 0.015;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ========================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ======================================== */

:root {
    /* Modern interaction hints */
    interpolate-size: allow-keywords;

    /* Smooth scroll with reduced-motion respect */
    scroll-behavior: smooth;

    /* Modern color scheme */
    color-scheme: dark light;

    /* Font Families */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-secondary: 'Inter', sans-serif;
    --font-display: 'Bebas Neue', 'Arial Black', sans-serif;
    --font-heading: 'Bebas Neue', 'Arial Black', sans-serif;

    /* Spacing System */
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */

    /* Section Spacing (Modern) */
    --space-section: clamp(4rem, 8vw, 8rem);
    --space-block: clamp(2rem, 4vw, 4rem);

    /* Typography Scale */
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */
    --font-size-5xl: 3rem;
    /* 48px */

    /* Heading Type Scale (Modern) */
    --font-size-hero: clamp(4rem, 12vw, 10rem);
    --font-size-h1: clamp(2.5rem, 6vw, 5rem);
    --font-size-h2: clamp(1.75rem, 4vw, 3rem);
    --font-size-h3: clamp(1.25rem, 2.5vw, 1.75rem);
    --font-size-body: clamp(1rem, 1.125vw, 1.125rem);
    --font-size-small: 0.875rem;

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Line Heights */
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.7;
    --line-height-loose: 2;

    /* Letter Spacing */
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-overlay: 800;
    --z-player: 900;
    --z-player-popup: 1000;
    --z-header: 1000;
    --z-bottom-nav: 1000;
    --z-reading-progress: 1050;
    --z-lightbox: 9999;
    --z-page-loader: 9999;
    --z-cookie-consent: 10000;
    --z-notification: 10000;
    --z-skip-link: 100001;

    /* Transition shorthand */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Color aliases for pages that reference these */
    --primary-color: var(--accent);
    --secondary-color: var(--accent-red);
    --neon-accent: oklch(0.75 0.2 160);
    --neon-secondary: oklch(0.7 0.2 280);
    --aurora-1: oklch(0.6 0.2 160);
    --aurora-3: oklch(0.6 0.15 280);

    /* Video Player defaults (scoped overrides in pages.css .video-page) */
    --vp-transition: all 0.3s ease;
    --vp-text-muted: oklch(0.65 0 0);
    --vp-border: oklch(0.3 0 0);
    --vp-gold: oklch(0.8 0.15 85);
    --vp-text: oklch(0.9 0 0);
    --vp-red: oklch(0.65 0.25 25);
    --vp-radius: 8px;
    --vp-bg-card: oklch(0.18 0 0);
    --vp-bg: oklch(0.12 0 0);

    /* Admin panel defaults (scoped overrides in pages.css) */
    --admin-primary: oklch(0.55 0.2 260);
    --admin-secondary: oklch(0.45 0.15 260);
    --admin-sidebar-width: 260px;
    --admin-light: oklch(0.95 0 0);
    --admin-text: oklch(0.2 0 0);
    --admin-text-light: oklch(0.55 0 0);
}

/* Modern OKLCH color palette - 2026 */
:root {
    --accent-oklch: oklch(0.78 0.15 85);
    --accent-hover-oklch: oklch(0.72 0.17 85);
    --surface-glass: oklch(0.15 0.01 260 / 0.6);
    --text-glow: oklch(0.95 0.03 85 / 0.8);
    --gradient-hero: linear-gradient(
        135deg,
        oklch(0.15 0.02 260) 0%,
        oklch(0.12 0.03 280) 50%,
        oklch(0.10 0.02 300) 100%
    );
    --gradient-accent: linear-gradient(
        135deg,
        oklch(0.75 0.15 40) 0%,
        oklch(0.78 0.15 85) 100%
    );
}

/* ========================================
   THEME TRANSITION
   ======================================== */

:root.theme-transitioning,
:root.theme-transitioning *,
:root.theme-transitioning *::before,
:root.theme-transitioning *::after {
    transition: background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease !important;
}

/* Disable theme transition animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    :root.theme-transitioning,
    :root.theme-transitioning *,
    :root.theme-transitioning *::before,
    :root.theme-transitioning *::after {
        transition: none !important;
    }
}

/* ========================================
   DARK THEME (Default for Rock Band)
   ======================================== */

:root,
:root[data-theme="dark"],
:root.theme-dark,
:root.theme-auto[data-theme="dark"] {
    /* Background Colors - dark but readable */
    --bg-primary: #0e0e11;
    --bg-secondary: #161619;
    --bg-tertiary: #1e1e22;
    --bg-elevated: #2a2a30;
    --bg-glass: rgba(14, 14, 17, 0.85);
    --bg-overlay: rgba(0, 0, 0, 0.75);

    /* SINGLE accent - rock red */
    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --accent-glow: rgba(220, 38, 38, 0.3);

    /* Backward-compatible aliases */
    --accent-red: var(--accent);
    --accent-red-dark: var(--accent-hover);
    --accent-red-light: #ef4444;
    --accent-orange: var(--accent);
    --accent-yellow: var(--accent);
    --accent-purple: var(--accent);

    /* Surface tokens */
    --surface-primary: var(--bg-secondary);

    /* Modern color-mix() utilities (2026) */
    --surface-hover: color-mix(in oklch, var(--surface-primary) 85%, white);
    --surface-active: color-mix(in oklch, var(--surface-primary) 70%, white);
    --accent-subtle: color-mix(in oklch, var(--accent) 15%, transparent);
    --accent-muted: color-mix(in oklch, var(--accent) 40%, var(--bg-primary));

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #d4d4d8;
    --text-muted: #a1a1aa;
    --text-disabled: #71717a;
    --text-inverse: #111827;

    /* Border Colors */
    --border-primary: rgba(220, 38, 38, 0.25);
    --border-secondary: rgba(255, 255, 255, 0.12);
    --border-tertiary: rgba(255, 255, 255, 0.06);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    --gradient-secondary: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --gradient-glass: linear-gradient(145deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    --gradient-radial: radial-gradient(circle at 50% 0%, rgba(220, 38, 38, 0.15), transparent 70%);

    /* Shadows (Simplified 2-level system) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
    --shadow-xl: var(--shadow-lg);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --shadow-glow-hover: 0 0 50px rgba(220, 38, 38, 0.5);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.1);

    /* Backdrop Blur */
    --blur-glass: blur(20px);
    --blur-heavy: blur(40px);

    /* Border color (semantic alias for components) */
    --border-color: var(--border-secondary);

    /* Card interactive states */
    --card-lift: translateY(-6px);
    --card-lift-sm: translateY(-4px);
    --card-shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(220, 38, 38, 0.08);
    --card-border-hover: rgba(220, 38, 38, 0.25);
    --card-transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                        box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                        border-color 0.35s ease;

    /* Content max widths */
    --content-width: 1200px;
    --content-narrow: 900px;
    --content-wide: 1400px;

    color-scheme: dark;
}

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

:root[data-theme="light"],
:root.theme-light,
:root.theme-auto[data-theme="light"] {
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-overlay: rgba(0, 0, 0, 0.5);

    /* SINGLE accent - rock red (light mode) */
    --accent: #dc2626;
    --accent-hover: #991b1b;
    --accent-glow: rgba(220, 38, 38, 0.2);

    /* Backward-compatible aliases */
    --accent-red: var(--accent);
    --accent-red-dark: var(--accent-hover);
    --accent-red-light: #f87171;
    --accent-orange: var(--accent);
    --accent-yellow: var(--accent);
    --accent-purple: var(--accent);

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-disabled: #9ca3af;
    --text-inverse: #ffffff;

    /* Border Colors */
    --border-primary: rgba(220, 38, 38, 0.3);
    --border-secondary: rgba(0, 0, 0, 0.1);
    --border-tertiary: rgba(0, 0, 0, 0.05);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    --gradient-secondary: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    --gradient-glass: linear-gradient(145deg, rgba(220, 38, 38, 0.08) 0%, rgba(220, 38, 38, 0.04) 100%);
    --gradient-radial: radial-gradient(circle at 50% 0%, rgba(220, 38, 38, 0.1), transparent 70%);

    /* Shadows (Simplified 2-level system) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.18);
    --shadow-xl: var(--shadow-lg);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --shadow-glow-hover: 0 0 50px rgba(220, 38, 38, 0.3);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);

    /* Border color (semantic alias) */
    --border-color: var(--border-secondary);

    /* Card interactive states (light mode) */
    --card-shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.15), 0 0 20px rgba(220, 38, 38, 0.06);

    color-scheme: light;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-weight: 400; /* Bebas Neue only has 400 */
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    text-wrap: balance;
}

h1 {
    font-size: var(--font-size-h1);
}

h2 {
    font-size: var(--font-size-h2);
}

h3 {
    font-size: var(--font-size-h3);
}

h4 {
    font-size: var(--font-size-2xl);
}

h5 {
    font-size: var(--font-size-xl);
}

h6 {
    font-size: var(--font-size-lg);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    text-wrap: pretty;
}

a {
    color: var(--accent-red);
    text-decoration: none;
    transition: var(--transition-fast);

    &:hover {
        color: var(--accent-orange);
    }

    /* Focus-visible handled by comprehensive rule in ACCESSIBILITY section */
}

strong,
b {
    font-weight: var(--font-weight-bold);
}

em,
i {
    font-style: italic;
}

small {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--accent-red);
}

pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow-x: auto;
    margin-bottom: var(--space-4);

    & code {
        background: none;
        padding: 0;
        border-radius: 0;
        color: var(--text-primary);
    }
}

blockquote {
    border-left: 4px solid var(--accent-red);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    font-style: italic;
    color: var(--text-muted);
}

/* ========================================
   SCROLLBAR STYLES
   ======================================== */

/* Webkit Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-red);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-red-light);
}

::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-red) var(--bg-secondary);
}

/* ========================================
   SELECTION STYLES
   ======================================== */

::selection {
    background-color: var(--accent-red);
    color: white;
}

/* ::-moz-selection removed — deprecated since Firefox 62 (2018), ::selection is sufficient */

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

/* --- Focus Ring Custom Property --- */
:root {
    --focus-ring-color: oklch(0.75 0.15 85);
    --focus-ring-fallback: #d4a020;
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
}

@supports not (color: oklch(0 0 0)) {
    :root {
        --focus-ring-color: var(--focus-ring-fallback);
    }
}

/* --- Remove outline on mouse click, keep for keyboard (WCAG 2.2) --- */
:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* --- Comprehensive :focus-visible for ALL interactive elements --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
details:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="option"]:focus-visible,
[contenteditable]:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
    box-shadow: 0 0 0 calc(var(--focus-ring-width) + 2px) oklch(0.75 0.15 85 / 0.25);
}

@supports not (color: oklch(0 0 0)) {
    a:focus-visible,
    button:focus-visible,
    input:focus-visible,
    textarea:focus-visible,
    select:focus-visible,
    summary:focus-visible,
    details:focus-visible,
    [tabindex]:focus-visible,
    [role="button"]:focus-visible,
    [role="link"]:focus-visible,
    [role="tab"]:focus-visible,
    [role="menuitem"]:focus-visible,
    [role="option"]:focus-visible,
    [contenteditable]:focus-visible {
        box-shadow: 0 0 0 4px rgba(212, 160, 32, 0.25);
    }
}

/* Form inputs: tighter offset, border highlight */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-offset: 0;
    border-color: var(--focus-ring-color);
}

/* Ensure focus ring is visible on both dark and light backgrounds */
:root[data-theme="light"] {
    --focus-ring-color: oklch(0.55 0.18 85);
}

@supports not (color: oklch(0 0 0)) {
    :root[data-theme="light"] {
        --focus-ring-color: #b08a1a;
    }
}

:root[data-theme="light"] a:focus-visible,
:root[data-theme="light"] button:focus-visible,
:root[data-theme="light"] [tabindex]:focus-visible,
:root[data-theme="light"] [role="button"]:focus-visible {
    box-shadow: 0 0 0 4px rgba(176, 138, 26, 0.3);
}

/* --- Skip Links (WCAG 2.4.1) --- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-skip-link, 100001);
    padding: 0.75rem 1.5rem;
    background: var(--color-primary, #dc2626);
    color: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
    transition: top 0.2s ease;

    &:focus,
    &:focus-visible {
        top: 0;
        outline: 3px solid #fff;
        outline-offset: -3px;
    }
}

.skip-link-player {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-skip-link, 100001);
    padding: 0.75rem 1.5rem;
    background: oklch(0.18 0.005 260);
    color: #fff;
    border: 2px solid var(--focus-ring-color);
    border-radius: 0 0 0.5rem 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
    transition: top 0.2s ease;

    &:focus,
    &:focus-visible {
        top: 0;
        outline: 3px solid #fff;
        outline-offset: -3px;
    }
}

/* --- High Contrast Preferences --- */
@media (prefers-contrast: high) {
    :root {
        --border-secondary: rgba(255, 255, 255, 0.3);
        --text-secondary: #e5e7eb;
        --text-muted: #d1d5db;
        --focus-ring-width: 3px;
    }

    :root[data-theme="light"] {
        --border-secondary: rgba(0, 0, 0, 0.3);
        --text-secondary: #1f2937;
        --text-muted: #374151;
    }

    *:focus-visible {
        outline-width: 4px;
        outline-style: solid;
    }

    a { text-decoration: underline; }
}

/* --- Color Contrast Fixes (WCAG AA: 4.5:1 normal, 3:1 large) --- */

/* Dark theme: boost muted text from #9ca3af to #b0b5bd (contrast ~5.5:1 on #030303) */
:root,
:root[data-theme="dark"] {
    --text-muted: #b0b5bd;
    --text-disabled: #8b919a;
}

/* Light theme: darken muted text from #6b7280 to #595f69 (contrast ~5.8:1 on #fff) */
:root[data-theme="light"] {
    --text-muted: #595f69;
    --text-disabled: #7a8190;
}

/* Placeholder text contrast fix */
::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

/* Disabled states: ensure text remains readable */
:disabled,
[aria-disabled="true"] {
    color: var(--text-disabled);
    opacity: 0.7;
}

button:disabled,
.btn:disabled {
    color: var(--text-disabled);
}

/* --- Reduced Motion (comprehensive) --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Keep opacity changes (less disorienting) */
    [data-reveal],
    [data-stagger] > *,
    .scroll-animate,
    .scroll-animate-fade,
    .scroll-animate-scale,
    .scroll-reveal,
    .scroll-reveal-scale,
    .scroll-reveal-left,
    .scroll-parallax,
    .reading-progress,
    .text-reveal span {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        scale: 1 !important;
    }

    /* Disable scroll-driven animations */
    .reading-progress {
        animation: none !important;
    }

    /* Disable view transitions */
    ::view-transition-old(root),
    ::view-transition-new(root),
    ::view-transition-old(page-title),
    ::view-transition-new(page-title) {
        animation-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto !important;
    }
}

/* --- Forced Colors / Windows High Contrast Mode --- */
@media (forced-colors: active) {
    /* Ensure borders are visible when background colors are stripped */
    .btn,
    button,
    .nav-link,
    .album-card,
    .news-card,
    .vp-card,
    .gallery-category,
    .stat-card,
    .form-control,
    input,
    textarea,
    select {
        border: 1px solid ButtonText;
    }

    /* Active/current states use highlight */
    .nav-link.active,
    .sme-tab.active,
    .vp-tabs__tab.active {
        border-color: Highlight;
        outline: 2px solid Highlight;
    }

    /* Focus visible uses system highlight */
    :focus-visible {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }

    /* Ensure links are distinguishable */
    a {
        text-decoration: underline;
    }

    /* Cards and interactive surfaces get visible borders */
    .album-card,
    .news-card,
    .vp-card,
    .gallery-category,
    .stat-card,
    .memorial-section,
    .search-modal-enhanced {
        border: 1px solid CanvasText;
    }

    /* SVG icons need forced-color-adjust so they stay visible */
    .icon,
    svg {
        forced-color-adjust: auto;
    }

    /* Disabled state */
    :disabled,
    [aria-disabled="true"] {
        border-color: GrayText;
        color: GrayText;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    :root {
        --bg-primary: white;
        --bg-secondary: white;
        --text-primary: black;
        --text-secondary: #333;
        color-scheme: light;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to Main Content */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-red);
    color: white;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: var(--z-skip-link, 100001);

    &:focus {
        top: 0;
    }
}

/* ============================================
   SCROLL-DRIVEN ANIMATIONS
   ============================================ */

/* Text reveal - subtle slide up (content always visible) */
@keyframes reveal-up {
    from {
        opacity: 1;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes reveal-fade {
    from { opacity: 0.85; }
    to { opacity: 1; }
}

@keyframes reveal-scale {
    from {
        opacity: 1;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes reveal-left {
    from {
        opacity: 1;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scroll-triggered animation classes
   Content is ALWAYS VISIBLE by default. Animations are progressive enhancement only.
   JS adds .reveal-ready to <html> when IntersectionObserver is set up.
   Unrevealed elements get a subtle transform offset but remain fully visible. */
[data-reveal] {
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-ready [data-reveal]:not(.revealed) {
    opacity: 1;
    transform: translateY(15px);
}

.reveal-ready [data-reveal="up"]:not(.revealed) {
    transform: translateY(15px);
}

.reveal-ready [data-reveal="fade"]:not(.revealed) {
    transform: none;
}

.reveal-ready [data-reveal="scale"]:not(.revealed) {
    transform: scale(0.98);
}

.reveal-ready [data-reveal="left"]:not(.revealed) {
    transform: translateX(-15px);
}

/* When element is visible (JS adds this class) */
[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger children animations */
[data-stagger] > * {
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-ready [data-stagger]:not(.revealed) > * {
    opacity: 1;
    transform: translateY(10px);
}

[data-stagger].revealed > *:nth-child(1) { transition-delay: 0.05s; }
[data-stagger].revealed > *:nth-child(2) { transition-delay: 0.1s; }
[data-stagger].revealed > *:nth-child(3) { transition-delay: 0.15s; }
[data-stagger].revealed > *:nth-child(4) { transition-delay: 0.2s; }
[data-stagger].revealed > *:nth-child(5) { transition-delay: 0.25s; }
[data-stagger].revealed > *:nth-child(6) { transition-delay: 0.3s; }

[data-stagger].revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* .scroll-animate classes removed — unused in templates.
   Scroll animations use data-reveal JS observer system instead. */

/* Smooth text character reveal */
.text-reveal {
    overflow: hidden;
    display: inline-block;

    & span {
        display: inline-block;
        transform: translateY(100%);
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    &.revealed span {
        transform: translateY(0);
    }
}

/* .parallax-container / .parallax-slow removed — unused.
   Parallax uses data-parallax attribute + JS instead. */

/* Container query responsive patterns for new components */
/* NOTE: Prefer @container over @media max-width for new component-level layouts */
@container main-content (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
}

@container main-content (max-width: 480px) {
    .page-title { font-size: 2rem; }
}

/* Reduced motion for scroll-driven animations: see consolidated block in ACCESSIBILITY section */

/* ============================================
   2026 Modern CSS Features
   ============================================ */

/* Text wrapping - balanced headings, pretty paragraphs */
h1, h2, h3, h4 { text-wrap: balance; }
p, li, blockquote { text-wrap: pretty; }

/* Scroll-driven reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent, #f59e0b);
    transform-origin: left;
    scale: 0 1;
    z-index: var(--z-reading-progress, 1050);
    animation: grow-progress linear;
    animation-timeline: scroll(root);
}

@keyframes grow-progress {
    from { scale: 0 1; }
    to { scale: 1 1; }
}

/* Scroll-driven reveal classes
   DISABLED: CSS animation-timeline: view() with fill-mode causes opacity: 0
   on elements that haven't entered the viewport, making content invisible.
   The data-reveal JS observer system handles scroll animations instead. */
.scroll-reveal,
.scroll-reveal-scale,
.scroll-reveal-left {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    scale: 1 !important;
    filter: none !important;
    animation: none !important;
}

/* Scroll-driven parallax for hero sections */
.scroll-parallax {
    animation: parallax-shift linear;
    animation-timeline: scroll(root);
}

@keyframes parallax-shift {
    from { transform: translateY(0); }
    to { transform: translateY(-15%); }
}

/* View Transitions moved to transitions.css for centralized management */

/* :has() powered interactive states */
.form-group:has(input:focus),
.form-group:has(textarea:focus) {
    --field-border: var(--accent, #f59e0b);
}

.form-group:has(input:invalid:not(:placeholder-shown)) {
    --field-border: var(--error, #ef4444);
}

/* .card:has() rules removed — .card / .card-badge classes not used in templates */

/* Container query for album cards */
.albums-grid, .news-grid {
    container-type: inline-size;
    container-name: content-grid;
}

@container content-grid (max-width: 500px) {
    .album-card, .news-card {
        flex-direction: column;
    }
    .album-card .card-image,
    .news-card .card-image {
        aspect-ratio: 16 / 9;
        width: 100%;
    }
}

@container content-grid (min-width: 501px) and (max-width: 800px) {
    .album-card, .news-card {
        grid-template-columns: 1fr 1fr;
    }
}

/* Global scroll-margin for anchor targets (works with fixed header) */
[id] { scroll-margin-top: 5rem; }

/* Reduced motion for scroll-driven and view-transition animations: see consolidated block in ACCESSIBILITY section */

/* === Phase 73b: Accessibility Fixes === */

/* Focus indicators: ensure all interactive elements have visible focus */
:focus-visible {
    outline: 2px solid var(--accent-red, #dc2626);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove default outline for mouse clicks */
:focus:not(:focus-visible) {
    outline: none;
}

/* Stronger focus ring for form inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-red, #dc2626);
    outline-offset: 0;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

/* Ensure links within body text are distinguishable (underline) */
.typography-content a,
.article-body-modern a,
.article-lead a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}
.typography-content a:hover,
.article-body-modern a:hover,
.article-lead a:hover {
    text-decoration-thickness: 2px;
}

/* Minimum touch target size: 44x44px (WCAG 2.5.5 Enhanced, 2.5.8 Target Size) */
.track-play-btn,
.track-add-to-queue-btn,
.lyrics-btn,
.share-btn-modern,
.bottom-nav-item,
.theme-toggle-btn,
.search-btn,
.nav-toggle,
.lang-toggle,
.footer-keyboard-hint {
    min-width: 44px;
    min-height: 44px;
}

/* Track items: ensure keyboard-activated items show focus */
.track-item:focus-visible {
    outline: 2px solid var(--accent-red, #dc2626);
    outline-offset: -2px;
    border-radius: 8px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
}

/* Gallery scroll region: indicate scrollability for keyboard users */
.gallery-preview:focus-visible {
    outline: 2px solid var(--accent-red, #dc2626);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid Highlight;
    }
    .skip-link:focus {
        background: Highlight;
        color: HighlightText;
    }
    .btn-primary,
    .album-play-all-btn,
    .track-play-btn {
        border: 1px solid ButtonText;
    }
    .deceased-badge {
        color: LinkText;
    }
    .reading-progress {
        background: Highlight;
    }
}

/* Ensure disabled elements are not focusable visually */
[disabled],
[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Skip link for player: match skip-link style */
.skip-link-player {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001;
    padding: 0.75rem 1.5rem;
    background: var(--accent-red, #dc2626);
    color: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link-player:focus {
    top: 0;
}

/* ========================================
   CONTENT-VISIBILITY OPTIMIZATIONS
   Phase 78: Skip rendering of below-fold sections until they scroll near viewport.
   contain-intrinsic-size gives the browser a placeholder height to prevent layout shift.
   ======================================== */

/* Footer — Phase 97: disabled content-visibility:auto which caused CLS.
   The footer renders at a different height than contain-intrinsic-size,
   causing a layout shift when it becomes visible. */
.site-footer {
    content-visibility: visible;
}

/* Community and related content areas — Phase 97: removed content-visibility:auto.
   These sections are often near the top of their pages (community pages, members),
   and content-visibility:auto was causing CLS when they rendered at incorrect
   intrinsic size before snapping to real dimensions. */
.community-nav,
.community-section,
.fan-photos-section,
.fan-stories-section,
.guestbook-section {
    content-visibility: visible;
}

/* Related content sidebars and bottom sections — keep below-fold optimization
   but use accurate intrinsic sizes */
.related-articles,
.related-content,
.related-albums {
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;
}

/* Cookie consent banner — Phase 97: removed content-visibility:auto.
   The banner is position:fixed and uses [hidden] attribute, so
   content-visibility containment was unnecessarily reserving 60px. */
.cookie-consent {
    content-visibility: visible;
}

/* Timeline and events below initial viewport */
.events-timeline,
.decade-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}

/* Gallery grids (image-heavy, big render savings) */
.gallery-grid,
.fan-photos-grid {
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
}

/* === Phase 96: WCAG 2.2 AA Accessibility Fixes === */

/* --- prefers-contrast: more (WCAG 1.4.6 Enhanced Contrast) --- */
@media (prefers-contrast: more) {
    :root,
    :root[data-theme="dark"] {
        --text-secondary: #e5e7eb;
        --text-muted: #d1d5db;
        --text-disabled: #a1a1aa;
        --border-secondary: rgba(255, 255, 255, 0.35);
        --border-tertiary: rgba(255, 255, 255, 0.15);
        --accent-glow: rgba(220, 38, 38, 0.5);
    }

    :root[data-theme="light"] {
        --text-secondary: #111827;
        --text-muted: #1f2937;
        --text-disabled: #4b5563;
        --border-secondary: rgba(0, 0, 0, 0.3);
        --border-tertiary: rgba(0, 0, 0, 0.15);
    }

    /* Stronger focus rings */
    :focus-visible {
        outline-width: 3px;
    }

    /* Underline all links for better distinguishability */
    a:not(.btn-primary):not(.btn-secondary):not(.nav-link):not(.desktop-nav__link):not(.album-card):not(.album-card-modern):not(.site-brand):not(.member-card):not(.bottom-nav-item) {
        text-decoration: underline;
        text-underline-offset: 0.15em;
    }

    /* Increase border visibility on cards */
    .album-card,
    .album-card-modern,
    .news-card,
    .bento-card,
    .member-card,
    .vp-card,
    .stat-card,
    .contact-card,
    .disco-stat-card,
    .guestbook-form-section {
        border-width: 2px;
    }

    /* Boost badge/pill contrast */
    .album-year-badge,
    .filter-pill.active,
    .members-era-btn.active {
        font-weight: 700;
    }
}

/* --- ARIA busy state visual indicator --- */
[aria-busy="true"] {
    position: relative;
    opacity: 0.7;
}

[aria-busy="true"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.03) 8px,
        rgba(255, 255, 255, 0.03) 16px
    );
    pointer-events: none;
    border-radius: inherit;
}

/* --- Toast/notification accessibility --- */
.toast,
.toast-notification,
[role="status"] {
    /* Ensure toasts are announced but not disruptive */
}

/* --- Search input visible label helper --- */
.search-pill {
    position: relative;
}

/* Ensure form validation messages are visually prominent */
.form-message[role="alert"]:not([hidden]) {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 8px);
    font-weight: 500;
    margin-top: 0.5rem;
}

.form-message[role="alert"].error:not([hidden]) {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

:root[data-theme="light"] .form-message[role="alert"].error:not([hidden]) {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
}

.form-message[role="alert"].success:not([hidden]) {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

:root[data-theme="light"] .form-message[role="alert"].success:not([hidden]) {
    background: rgba(34, 197, 94, 0.08);
    color: #166534;
}

/* --- Footer headings: ensure proper visual distinction even if semantically upgraded --- */
.footer-heading {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* --- Mobile nav overlay: Escape-dismissible overlay darkening --- */
.nav-menu.active .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* --- Color contrast fixes for red-on-dark patterns --- */
/* Red accent links on dark bg: ensure 4.5:1.
   #dc2626 on #0e0e11 = 4.62:1 (passes AA).
   But on --bg-secondary (#161619) = 4.13:1 (fails).
   Lighten accent for body text links only: */
.article-body-modern a,
.article-lead a,
.typography-content a,
.guestbook-entry a,
.fan-story-card a {
    color: #ef4444; /* 5.25:1 on #161619 */
}

:root[data-theme="light"] .article-body-modern a,
:root[data-theme="light"] .article-lead a,
:root[data-theme="light"] .typography-content a,
:root[data-theme="light"] .guestbook-entry a,
:root[data-theme="light"] .fan-story-card a {
    color: #b91c1c; /* 5.67:1 on #ffffff */
}

/* Ensure disabled buttons have cursor + visual cue */
button:disabled,
.btn:disabled,
[aria-disabled="true"] {
    pointer-events: none;
}

/* --- Keyboard focus trap indicator for modals --- */
.search-modal-enhanced[role="dialog"],
.gallery-lightbox[role="dialog"],
dialog[open] {
    /* Ensure modals trap focus visually with a border */
    outline: none;
}

.search-modal-enhanced[role="dialog"]:focus-visible,
.gallery-lightbox[role="dialog"]:focus-visible,
dialog[open]:focus-visible {
    outline: 2px solid var(--focus-ring-color, #d4a020);
    outline-offset: -2px;
}

/* --- WCAG 2.5.8: Target Size minimum 24x24px (AA), preferred 44x44px --- */
/* Ensure all clickable inline elements have adequate touch targets */
.footer-links a,
.footer-nav a,
.breadcrumb-link,
.breadcrumb-current {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Small icon buttons: ensure minimum 44x44 touch target */
.contact-card__copy-btn,
.scroll-to-top-btn {
    min-width: 44px;
    min-height: 44px;
}

/* --- Print accessibility: ensure hidden content is visible --- */
@media print {
    .sr-only {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
}

/* === Phase 97: Mobile Touch Target + Font Size Fixes === */

/* --- 1. Touch targets below 44px (WCAG 2.5.8) --- */
.scroll-to-top-btn {
    min-width: 44px;
    min-height: 44px;
}

.ambient-sound-toggle {
    min-width: 44px;
    min-height: 44px;
}

.ribbon-nav-trigger {
    min-height: 44px;
}

.contact-social-btn {
    min-height: 44px;
}

.contact-card__email-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.newsletter-form__btn {
    min-height: 44px;
}

.lyrics-quickjump__btn {
    min-width: 44px;
    min-height: 44px;
}

.lyrics-search-clear {
    min-width: 44px;
    min-height: 44px;
}

.lyrics-action-btn {
    min-height: 44px;
}

/* --- 2. Font sizes below 12px — mobile readability --- */
@media (max-width: 480px) {
    /* Bottom nav labels: 10px -> 11px minimum */
    .bottom-nav-label {
        font-size: max(11px, 0.625rem);
    }

    /* Player time display: 10px -> 11px */
    .smp-time {
        font-size: max(11px, 0.625rem);
    }

    /* Volume label */
    .smp-volume-label {
        font-size: max(11px, 0.625rem);
    }

    /* Language switcher text */
    .lang-current-text {
        font-size: max(11px, 0.625rem);
    }
}

/* --- 3. Prevent nav-actions overflow at 375px --- */
@media (max-width: 375px) {
    .nav-actions {
        gap: 0.125rem;
    }

    .lang-toggle {
        padding-inline: 0.25rem;
    }
}

/* === End Phase 97: Mobile Touch Target + Font Size Fixes === */