/* =========================================================
   AmaTisMo — Professional Accessible Stylesheet
   WCAG 2.2 AA compliant · Dark theme · Mobile-first
   ========================================================= */

/* --- CUSTOM PROPERTIES --- */
:root {
    /* Backgrounds */
    --bg-primary: #0c0d14;
    --bg-secondary: #12141f;
    --bg-card: #1a1d2e;
    --bg-elevated: #222640;
    --bg-input: #0e1019;

    /* Text — all pass WCAG AA on dark backgrounds */
    --text-primary: #f0f2f8;
    --text-secondary: #b0b8cd;
    --text-muted: #8792ab;

    /* Accent — passes AA on dark bg */
    --accent: #818cf8;
    --accent-bright: #a5b4fc;
    --accent-dim: #6366f1;
    --accent-bg: rgba(99, 102, 241, 0.12);

    /* Secondary accent */
    --purple: #c084fc;
    --purple-dim: #a855f7;

    /* Feedback colors — pass AA on dark bg */
    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.12);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.12);
    --warning: #fbbf24;

    /* Borders */
    --border: #2a2f45;
    --border-hover: #3d4466;

    /* Focus ring — high contrast */
    --focus-ring: #fbbf24;
    --focus-ring-offset: var(--bg-primary);

    /* Layout */
    --container-max: 1100px;
    --container-narrow: 720px;
    --header-height: 72px;

    /* Typography — OpenDyslexic as exclusive font */
    --font-body: 'OpenDyslexic', system-ui, sans-serif;
    --font-dyslexic: 'OpenDyslexic', system-ui, sans-serif;

    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* --- FONT-DISPLAY OVERRIDE (prevent render-blocking) --- */
@font-face {
    font-family: 'OpenDyslexic';
    font-display: swap;
}

/* --- RESET & BASE --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 2rem);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- ACCESSIBILITY --- */
.skip-link {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--focus-ring);
    color: #000;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 10000;
    text-decoration: none;
    transition: top var(--transition-fast);
    box-shadow: var(--shadow-md);
}
.skip-link:focus {
    top: 0;
    outline: none;
}

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

/* Focus styles — high visibility yellow ring (WCAG 2.2 §2.4.11, §2.4.13) */
*:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Remove outline when using mouse */
*:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (forced-colors: active) {
    .btn, .tab-btn, .card {
        border: 2px solid ButtonText;
    }
    *:focus-visible {
        outline: 3px solid Highlight;
    }
}

/* --- LAYOUT UTILITIES --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

.container-narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-dim);
    color: #fff;
    border-color: var(--accent-dim);
}
.btn-primary:hover, .btn-primary:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--accent-bright);
    border-color: var(--accent);
}
.btn-outline:hover, .btn-outline:focus-visible {
    background: var(--accent-bg);
    text-decoration: none;
}

.btn-lg {
    padding: 1rem 2.25rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn:disabled, .btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* --- HEADER --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(12, 13, 20, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon {
    color: var(--accent);
    font-size: 1.3rem;
    line-height: 1;
}
.logo-text {
    color: var(--text-primary);
}

/* Navigation */
.main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a {
    display: block;
    padding: 0.5rem 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.main-nav a:hover,
.main-nav a:focus-visible {
    color: var(--text-primary);
    background: var(--accent-bg);
    text-decoration: none;
}

/* Language toggle */
#lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
}
#lang-toggle:hover,
#lang-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-bg);
}
.lang-icon { display: flex; align-items: center; }

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 200;
}
.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- SECTIONS --- */
.section {
    padding: var(--space-3xl) 0;
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
}
.section-alt {
    background: var(--bg-secondary);
}

.section-heading {
    font-family: var(--font-body);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: var(--space-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* --- CARDS --- */
.card {
    background: var(--bg-card);
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.card:hover {
    border-color: var(--border-hover);
}

/* --- HERO --- */
#hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 90vh;
    padding: 0;
    overflow: hidden;
    background: #08090f;
}

#hero picture {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(12, 13, 20, 0.95) 0%,
        rgba(12, 13, 20, 0.5) 50%,
        rgba(12, 13, 20, 0.3) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.hero-container {
    position: relative;
    z-index: 2;
    padding-bottom: var(--space-3xl);
    padding-top: var(--space-3xl);
}

.hero-content {
    max-width: 580px;
}

#hero h1 {
    font-family: var(--font-body);
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -2px;
    color: #fff;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    letter-spacing: 0.5px;
}

.hero-desc {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 480px;
    margin-bottom: var(--space-xl);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* --- PLATFORMS BAR --- */
.platforms-bar {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: var(--space-lg) 0;
}

.platforms-bar .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.platforms-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.platforms-list {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.platform-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.platform-item i {
    font-size: 1.15rem;
    opacity: 0.7;
}

/* --- ABOUT --- */
.about-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: start;
}

.about-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}
.about-text p + p {
    margin-top: var(--space-md);
}

.about-highlights {
    margin-top: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.highlight-item {
    padding-left: var(--space-lg);
    border-left: 2px solid var(--border-hover);
}

.highlight-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.highlight-item span {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.about-media {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.about-media img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- MEDIA (TRAILER + SCREENSHOTS) --- */
.trailer-container {
    max-width: 960px;
    margin: 0 auto var(--space-2xl);
}

.trailer-title,
.screenshots-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.trailer-placeholder {
    aspect-ratio: 16 / 9;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.trailer-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
}

.trailer-coming-soon svg {
    opacity: 0.3;
}

.trailer-coming-soon span {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- SCREENSHOTS / CAROUSEL --- */
.carousel {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
}

.carousel-viewport {
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #000;
    aspect-ratio: 16 / 9;
}

.carousel-track {
    display: flex;
    transition: transform 0.4s ease;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    z-index: 2;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.carousel-btn-prev {
    left: var(--space-md);
}

.carousel-btn-next {
    right: var(--space-md);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--space-md);
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    cursor: pointer;
    padding: 0;
    transition: background var(--transition-fast);
}

.carousel-dot[aria-selected="true"] {
    background: var(--accent);
}

/* --- NEWS --- */
.news-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    max-width: var(--container-narrow);
    margin: 0 auto;
}

.news-card {
    position: relative;
    overflow: hidden;
    padding: 0;
}
.news-card-body {
    padding: clamp(1.25rem, 3vw, 1.75rem);
}

.news-date {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.news-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.news-card p + p {
    margin-top: var(--space-sm);
}

/* Featured card — "NEW" badge */
.news-card-featured {
    border-color: var(--border-hover);
}
.news-card-featured .news-date::after {
    content: 'NEW';
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
    vertical-align: middle;
}

/* News update list inside featured card */
.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.news-list li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.news-list li::before {
    content: '\2013';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Dynamic news content (from DB) */
.news-content { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; }
.news-content p + p { margin-top: var(--space-sm); }
.news-content ul, .news-content ol { margin: var(--space-sm) 0; padding-left: 1.5rem; }
.news-content li { color: var(--text-secondary); line-height: 1.7; }
.news-loading, .news-empty { text-align: center; color: var(--text-muted); padding: var(--space-xl) 0; }

/* --- TEAM --- */
.team-grid {
    display: grid;
    gap: var(--space-xl);
}

.team-member {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
    transition: border-color var(--transition-base);
}
.team-member:hover {
    border-color: var(--border-hover);
}

.team-photo-wrapper {
    flex-shrink: 0;
}

.team-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background-color: var(--bg-primary);
}

.team-info {
    flex: 1;
    min-width: 0;
}

.team-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.team-link {
    color: var(--accent-bright);
    text-decoration: none;
}
.team-link:hover {
    text-decoration: underline;
}

.team-role {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.team-bio {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.btn-michael {
    margin-top: var(--space-md);
    font-size: 0.95rem;
    padding: 0.6rem 1.25rem;
}

/* --- GAME STORY --- */
.story-grid {
    display: grid;
    gap: var(--space-xl);
}

.story-main {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.story-main h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.story-details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.story-stat {
    text-align: center;
    padding: var(--space-sm) var(--space-md);
}

.story-stat-sep {
    display: block;
    width: 1px;
    height: 2.5rem;
    background: var(--border);
}

.story-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.story-stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.story-features {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.story-feature {
    transition: transform var(--transition-base), border-color var(--transition-base);
}
.story-feature:hover {
    border-color: var(--border-hover);
}
.story-feature h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.story-feature p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* --- TEAM ORIGIN --- */
.team-origin {
    margin-bottom: var(--space-xl);
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
}
.team-origin p + p {
    margin-top: var(--space-md);
}

/* --- JOIN US --- */
.join-roles {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-bottom: var(--space-xl);
}

.join-role {
    padding: var(--space-xl) var(--space-lg);
}

.join-role h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.join-role-icon {
    flex-shrink: 0;
    color: var(--accent);
}
.join-role p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.join-form-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    padding: var(--space-lg) var(--space-lg) 0;
    margin-bottom: 0;
}

#join-form {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.privacy-notice {
    padding: var(--space-md) clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2rem);
    border-top: 1px solid var(--border);
}
.privacy-notice p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
    opacity: 0.8;
}

/* --- FORMS --- */
.form-container {
    padding: 0;
    overflow: hidden;
}

/* Tab bar — ARIA tablist */
.form-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
}

.tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255, 0.03);
}
.tab-btn[aria-selected="true"],
.tab-btn.active {
    color: var(--accent-bright);
    border-bottom-color: var(--accent);
    background: var(--bg-card);
}
.tab-icon {
    display: flex;
    align-items: center;
}

/* Form panels */
form {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.form-panel {
    display: none;
    animation: panelFadeIn var(--transition-base) ease;
}
.form-panel.active {
    display: block;
}
.form-panel[hidden] {
    display: none;
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form groups */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-row {
    display: flex;
    gap: var(--space-lg);
}
.half { flex: 1; min-width: 0; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.label-optional {
    font-weight: 400;
    font-size: 0.85em;
    color: var(--text-muted);
}

.label-recommended {
    color: var(--accent);
}

.field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--error);
    padding: 0.35rem 0.65rem;
    background: var(--error-bg);
    border-radius: var(--radius-sm);
}
.field-error[hidden] {
    display: none;
}

/* Inputs */
input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}
input[type="text"]:hover,
input[type="email"]:hover,
select:hover,
textarea:hover {
    border-color: var(--border-hover);
}
input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
    outline: none;
}
input[type="text"]::placeholder,
input[type="email"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
/* Custom select arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238792ab' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Validation states */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: var(--error);
}
.form-group.has-error .field-hint {
    color: var(--error);
}

/* --- STAR RATING (accessible) --- */
.rating-fieldset {
    border: none;
    padding: 0;
}
.rating-fieldset legend {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.star-rating {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

/* Minimum target size for interactive elements (WCAG 2.2 §2.5.8) */
.star-label {
    position: relative;
    cursor: pointer;
    font-size: 0;
    padding: 0.25rem;
    min-width: 24px;
    min-height: 24px;
}

.star-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    margin: 0;
}

.star-visual {
    display: block;
    font-size: 2rem;
    line-height: 1;
    color: var(--border);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

/* Hover and checked states */
.star-label:hover .star-visual,
.star-label:has(input:checked) .star-visual {
    color: var(--warning);
    transform: scale(1.15);
}

/* Highlight all stars up to hovered/checked */
.star-rating:hover .star-label .star-visual {
    color: var(--border);
    transform: scale(1);
}
.star-rating:hover .star-label:hover .star-visual,
.star-rating:hover .star-label:hover ~ .star-label .star-visual {
    color: var(--border);
    transform: scale(1);
}
.star-rating:hover .star-label:hover .star-visual {
    color: var(--warning);
    transform: scale(1.15);
}

/* JS-driven active class (stars up to and including the selected one) */
.star-label.active .star-visual {
    color: var(--warning);
}

/* Focus on star radio */
.star-label:has(input:focus-visible) {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- FILE UPLOAD --- */
.file-upload-group { position: relative; }

.file-upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.file-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}
.file-upload-icon {
    color: var(--accent);
}

.file-name {
    display: block;
    margin-top: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-bright);
}

/* --- SUBMIT BUTTON --- */
.btn-submit {
    width: 100%;
    padding: 1rem;
    margin-top: var(--space-md);
    font-size: 1.1rem;
    position: relative;
}
.btn-text {
    transition: opacity var(--transition-fast);
}
.btn-spinner {
    position: absolute;
    display: flex;
    align-items: center;
    animation: spin 1s linear infinite;
}
.btn-spinner[hidden] {
    display: none;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Shared fields separator */
.shared-fields {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

/* Form status messages */
.form-status {
    margin-top: var(--space-md);
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}
.form-status:empty {
    display: none;
}
.status-success {
    color: var(--success);
    background: var(--success-bg);
}
.status-error {
    color: var(--error);
    background: var(--error-bg);
}

/* --- NEWSLETTER --- */
.newsletter-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--space-2xl) 0;
    text-align: center;
}

.newsletter-section h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.newsletter-section > .container > p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.newsletter-form {
    max-width: 460px;
    margin: 0 auto;
}

.newsletter-input-group {
    display: flex;
    gap: var(--space-sm);
}

.newsletter-input-group input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.newsletter-input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
    outline: none;
}

.newsletter-btn {
    flex-shrink: 0;
}

.newsletter-status {
    margin-top: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 1.4em;
}

.newsletter-privacy {
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* --- FOOTER --- */
footer {
    border-top: 1px solid var(--border);
    padding: var(--space-2xl) 0;
    margin-top: var(--space-2xl);
    text-align: center;
}
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}
.footer-brand .logo-icon {
    color: var(--accent);
}
footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.footer-a11y {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    opacity: 0.7;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    /* Remove backdrop-filter on mobile — it creates a containing block
       that traps position:fixed children (nav) inside the header's height */
    header {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--bg-primary);
    }

    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }

    /* Mobile navigation */
    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border);
        padding: var(--space-lg);
        transform: translateX(100%);
        transition: transform var(--transition-base);
        overflow-y: auto;
        z-index: 90;
    }
    .main-nav.open {
        transform: translateX(0);
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav a {
        display: block;
        padding: 1rem 1.25rem;
        font-size: 1.15rem;
        border-radius: var(--radius-md);
    }

    .nav-lang-item {
        margin-top: var(--space-md);
        padding-top: var(--space-md);
        border-top: 1px solid var(--border);
    }

    #lang-toggle {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }

    /* Adjustments */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .team-member {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .team-photo {
        width: 100px;
        height: 100px;
    }

    .about-layout {
        grid-template-columns: 1fr;
    }

    .about-media {
        order: -1;
    }

    .story-details {
        flex-direction: column;
        align-items: center;
        gap: var(--space-md);
    }
    .story-stat-sep {
        width: 3rem;
        height: 1px;
    }

    .story-features {
        grid-template-columns: 1fr;
    }

    .join-roles {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        flex-direction: column;
    }
    .hero-actions .btn {
        width: 100%;
        max-width: 320px;
    }

    .platforms-bar .container {
        flex-direction: column;
        gap: var(--space-md);
    }

    .platforms-list {
        justify-content: center;
    }

    .newsletter-input-group {
        flex-direction: column;
    }

    .hero-container {
        padding-bottom: var(--space-2xl);
    }

    .section {
        padding: var(--space-2xl) 0;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        font-size: 0.9rem;
        padding: 0.85rem 0.75rem;
    }
    .tab-icon {
        display: none;
    }
}

/* --- DYSLEXIC FONT TOGGLE --- */
body.dyslexic-font {
    font-family: var(--font-dyslexic);
}

/* --- PRINT STYLES --- */
@media print {
    header, footer, #community, #join, .hero-actions, .skip-link, #lang-toggle, .mobile-menu-btn {
        display: none !important;
    }
    body {
        background: #fff;
        color: #000;
    }
    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
    .section-heading {
        color: #000;
    }
}