/* ===== SELF-HOSTED FONTS (variable) ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Metric-matched fallbacks (fontTools, weighted a-z advance) so the swap to the web font causes no layout shift */
@font-face {
    font-family: 'Inter Fallback';
    src: local('Arial'), local('Liberation Sans');
    size-adjust: 107.5%;
    ascent-override: 90.12%;
    descent-override: 22.44%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Playfair Display Fallback';
    src: local('Times New Roman'), local('Liberation Serif');
    size-adjust: 112.33%;
    ascent-override: 96.32%;
    descent-override: 22.34%;
    line-gap-override: 0%;
}

/* ===== CSS RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Enhanced from original */
    --primary-color: #4ab0c1;
    --primary-light: #61d8d9;
    --primary-dark: #1f7a8b;
    --secondary-color: #ff6b6b;
    --accent-color: #4ecdc4;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --text-muted: #646c74;
    --background-light: #f8f9fa;
    --background-dark: #1a1a1a;
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    --gradient-hero: linear-gradient(135deg, rgba(74, 176, 193, 0.9) 0%, rgba(97, 216, 217, 0.9) 100%);
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 5px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 10px 40px rgba(0, 0, 0, 0.2);

    /* Typography */
    --font-primary: 'Inter', 'Inter Fallback', sans-serif;
    --font-heading: 'Playfair Display', 'Playfair Display Fallback', serif;

    /* Spacing */
    --section-padding: 100px 0;
    --container-padding: 0 20px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border Radius */
    --radius-small: 8px;
    --radius-medium: 16px;
    --radius-large: 24px;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 100px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --text-dark: #e8f1f2;
    --text-muted: #c3d0d2;
    --background-light: #18343b;
    --background-dark: #102a32;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .instruments,
:root[data-theme="dark"] .projects,
:root[data-theme="dark"] .navbar,
:root[data-theme="dark"] .navbar.scrolled,
:root[data-theme="dark"] .nav-menu {
    background-color: var(--background-dark);
}

:root[data-theme="dark"] .feature,
:root[data-theme="dark"] .school-card,
:root[data-theme="dark"] .contact-card {
    background: #21444d;
}

/* --text-dark flips to light in dark mode, so anything using it as a background needs its own dark value */
:root[data-theme="dark"] .footer {
    background: #0b1d23;
}

/* --primary-dark (#1f7a8b) only reaches ~2:1 on the dark surfaces; use the light accent for text and borders */
:root[data-theme="dark"] .nav-logo p,
:root[data-theme="dark"] .nav-link:hover,
:root[data-theme="dark"] .text-link,
:root[data-theme="dark"] .text-link:hover,
:root[data-theme="dark"] .btn-outline,
:root[data-theme="dark"] .email-reverse:hover,
:root[data-theme="dark"] .email-reverse:focus {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

:root[data-theme="dark"] .btn-outline:hover {
    background: var(--primary-light);
    color: var(--background-dark);
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-dark);
    overflow-x: hidden;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    background: var(--primary-dark);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-small);
    text-decoration: none;
    z-index: 10000;
    transition: top var(--transition-medium);
}

.skip-link:focus {
    top: 8px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.section-subtitle {
    padding-top: 10px;
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: var(--radius-medium);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-medium);
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-light);
    box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border-color: var(--text-light);
}

.btn-secondary:hover {
    background: var(--text-light);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline:hover {
    background: var(--primary-dark);
    color: var(--text-light);
    transform: translateY(-2px);
}

/* ===== INLINE SVG ICONS ===== */
.icon {
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
}

.feature-icon .icon,
.instrument-icon .icon {
    width: 1.5em;
    height: 1.5em;
}

.contact-icon .icon {
    width: 2.5rem;
    height: 2.5rem;
}

.contact-item .icon {
    width: 1.3rem;
    height: 1.3rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.scroll-indicator .icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    transition: all var(--transition-medium);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-light);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.nav-logo p {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--primary-dark);
    margin: 0;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    gap: 40px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    padding: 8px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-medium);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary-dark);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* 44px hit area (WCAG 2.5.8) around the 25px bars; reset UA button chrome */
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    gap: 4px;
}

.theme-toggle {
    min-width: 44px;
    min-height: 44px;
    margin-left: 16px;
    border: 2px solid var(--primary-dark);
    border-radius: 50%;
    background: transparent;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 1.25rem;
}

:root[data-theme="dark"] .theme-toggle {
    color: var(--text-dark);
    border-color: var(--text-dark);
}

.bar {
    width: 25px;
    height: 3px;
    /* Meaningful glyph: needs 3:1 against the white bar (1.4.11); --primary-color only reaches 2.5:1 */
    background: var(--primary-dark);
    transition: all var(--transition-medium);
    border-radius: 2px;
}

:root[data-theme="dark"] .bar {
    background: var(--text-dark);
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-hero);
    z-index: -2;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/carmen-1920w.jpg') center/cover no-repeat;
    background: -webkit-image-set(url('../images/carmen-1920w.avif') type('image/avif'), url('../images/carmen-1920w.webp') type('image/webp'), url('../images/carmen-1920w.jpg') type('image/jpeg')) center/cover no-repeat;
    background: image-set(url('../images/carmen-1920w.avif') type('image/avif'), url('../images/carmen-1920w.webp') type('image/webp'), url('../images/carmen-1920w.jpg') type('image/jpeg')) center/cover no-repeat;
    opacity: 0.3;
    z-index: -1;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    width: 100%;
}

.hero-text {
    color: var(--text-light);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 1s ease 0.2s forwards;
}

.title-line {
    display: block;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 1s ease 0.4s forwards;
}

.hero-description {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeInUp 1s ease 0.6s forwards;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeInUp 1s ease 0.8s forwards;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeInRight 1s ease 0.6s forwards;
}

.image-frame {
    position: relative;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    padding: 8px;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-heavy);
}

.portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--text-light);
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-light);
    font-size: 1.5rem;
    animation: bounce 2s infinite;
    will-change: transform;
}

/* ===== ABOUT SECTION ===== */
.about {
    padding: var(--section-padding);
    background: var(--background-light);
    contain: layout style;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 80px;
    align-items: start;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

.text-block {
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.text-block:nth-child(1) {
    animation-delay: 0.1s;
}

.text-block:nth-child(2) {
    animation-delay: 0.2s;
}

.text-block:nth-child(3) {
    animation-delay: 0.3s;
}

.text-block:nth-child(4) {
    animation-delay: 0.4s;
}

.text-block:nth-child(5) {
    animation-delay: 0.5s;
}

.about-features {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.feature {
    background: white;
    padding: 30px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: all var(--transition-medium);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.feature:nth-child(1) {
    animation-delay: 0.2s;
}

.feature:nth-child(2) {
    animation-delay: 0.4s;
}

.feature:nth-child(3) {
    animation-delay: 0.6s;
}

.feature:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-medium);
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.5rem;
}

.feature h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.feature p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== INSTRUMENTS SECTION ===== */
.instruments {
    padding: var(--section-padding);
    background: white;
    contain: layout style;
}

.instruments-content {
    display: grid;
    gap: 60px;
}

.video-container {
    display: flex;
    justify-content: center;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    padding-bottom: 45%;
    /* 16:9 aspect ratio */
    height: 0;
    border-radius: var(--radius-large);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-wrapper picture {
    display: contents;
}

.instruments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.instrument-card {
    background: var(--background-light);
    padding: 40px 30px;
    border-radius: var(--radius-large);
    text-align: center;
    transition: all var(--transition-medium);
    border: 2px solid transparent;
}

.instrument-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-medium);
}

.instrument-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 2rem;
}

.instrument-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.instrument-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== LESSONS SECTION ===== */
.lessons {
    padding: var(--section-padding);
    background: var(--background-light);
    contain: layout style;
}

.lessons-content {
    text-align: center;
}

.lessons-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 60px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.text-link {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.text-link:hover {
    border-bottom-color: var(--primary-dark);
    text-decoration: none;
}

.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.school-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-light);
    transition: all var(--transition-medium);
    border: 2px solid transparent;
}

.school-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-medium);
}

.school-info h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.school-info p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ===== PROJECTS SECTION ===== */
.projects {
    padding: var(--section-padding);
    background: white;
    contain: layout style;
}

.projects-content {
    display: flex;
    justify-content: center;
}

.project-card {
    background: var(--background-light);
    padding: 40px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-light);
    text-align: center;
    max-width: 700px;
    transition: all var(--transition-medium);
    border: 2px solid transparent;
}

.project-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-medium);
}

.project-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.project-card p {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 24px;
}

/* ===== CONTACT SECTION ===== */
.contact {
    padding: var(--section-padding);
    background: var(--background-light);
    contain: layout style;
}

.contact-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.contact-info {
    width: 100%;
    max-width: 600px;
}

.contact-card {
    background: white;
    padding: 60px 40px;
    border-radius: var(--radius-large);
    text-align: center;
    box-shadow: var(--shadow-light);
}

.contact-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 2.5rem;
}

.contact-card h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Reversed no-JS fallback (spam obfuscation); script.js swaps it for a real mailto link */
.email-reverse {
    unicode-bidi: bidi-override;
    direction: rtl;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-medium);
}

.email-reverse:hover,
.email-reverse:focus {
    color: var(--primary-dark);
}

.email-link {
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--primary-color);
    text-underline-offset: 4px;
    transition: color var(--transition-medium);
}

.email-link:hover {
    color: var(--primary-dark);
}

:root[data-theme="dark"] .email-link:hover {
    color: var(--primary-light);
}

/* ===== YOUTUBE LAZY LOAD ===== */
.yt-play-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yt-play-icon {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
    transition: transform var(--transition-medium);
}

.yt-play-btn:hover .yt-play-icon,
.yt-play-btn:focus-visible .yt-play-icon {
    transform: scale(1.1);
}

/* ===== SCROLL TO TOP BUTTON ===== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    /* Solid dark teal: the white glyph needs 3:1 (1.4.11); the light gradient only gave 2.5:1 */
    background: var(--primary-dark);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
    z-index: 999;
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover,
.scroll-to-top:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.scroll-to-top .icon {
    width: 1.2rem;
    height: 1.2rem;
}

/* ===== UTILITY CLASSES ===== */
.lessons-schools-note {
    margin-top: 2em;
}

.contact-cta {
    margin-top: 2em;
}

/* 1px markers observed by IntersectionObserver in script.js (replaces scroll listeners) */
.scroll-sentinel {
    position: absolute;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--text-dark);
    color: var(--text-light);
    padding: 40px 0;
}

.footer-content {
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-nav a {
    color: var(--text-light);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-nav a:hover {
    color: var(--primary-light);
}

/* ===== LEGAL PAGES ===== */
.legal-page {
    min-height: 100vh;
    background: var(--background-light);
}

.legal-page .nav-logo {
    color: var(--primary-dark);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
}

.legal-home-link {
    color: var(--primary-dark);
    font-weight: 600;
}

.legal-content {
    max-width: 840px;
    margin: 0 auto;
    padding: 140px 20px 80px;
}

.legal-content h1 {
    margin-bottom: 32px;
    color: var(--text-dark);
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 5vw, 3.5rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.legal-content section {
    margin-top: 36px;
}

.legal-content h2 {
    margin-bottom: 12px;
    color: var(--text-dark);
    font-family: var(--font-heading);
    font-size: 1.6rem;
}

.legal-content p,
.legal-content address {
    color: var(--text-muted);
    line-height: 1.8;
}

.legal-content address {
    font-style: normal;
}

.legal-content a {
    color: var(--primary-dark);
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-note {
    margin-top: 48px;
    font-size: 0.9rem;
}

:root[data-theme="dark"] .legal-page .nav-logo,
:root[data-theme="dark"] .legal-home-link,
:root[data-theme="dark"] .legal-content a {
    color: var(--primary-light);
}

@media (max-width: 480px) {
    .legal-content {
        padding-top: 120px;
    }
}

.footer-text p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Offset for fixed navbar when navigating to anchors */
section[id] {
    scroll-margin-top: 100px;
}

/* Focus-visible for keyboard accessibility: dark outline + white inner ring stays >= 3:1 on every surface (1.4.11) */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #1f2933;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px #fff;
}

@media (forced-colors: active) {
    .btn,
    .theme-toggle,
    .nav-toggle,
    .scroll-to-top {
        border: 2px solid ButtonText;
        forced-color-adjust: none;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 769px) and (max-width: 1280px) {
    .hero-background::before {
        background: url('../images/carmen-1280w.jpg') center/cover no-repeat;
        background: -webkit-image-set(url('../images/carmen-1280w.avif') type('image/avif'), url('../images/carmen-1280w.webp') type('image/webp'), url('../images/carmen-1280w.jpg') type('image/jpeg')) center/cover no-repeat;
        background: image-set(url('../images/carmen-1280w.avif') type('image/avif'), url('../images/carmen-1280w.webp') type('image/webp'), url('../images/carmen-1280w.jpg') type('image/jpeg')) center/cover no-repeat;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 60px 0;
        --container-padding: 0 16px;
    }

    .hero-background::before {
        background: url('../images/carmen-640w.jpg') center/cover no-repeat;
        background: -webkit-image-set(url('../images/carmen-640w.avif') type('image/avif'), url('../images/carmen-640w.webp') type('image/webp'), url('../images/carmen-640w.jpg') type('image/jpeg')) center/cover no-repeat;
        background: image-set(url('../images/carmen-640w.avif') type('image/avif'), url('../images/carmen-640w.webp') type('image/webp'), url('../images/carmen-640w.jpg') type('image/jpeg')) center/cover no-repeat;
    }

    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: start;
        align-items: center;
        padding-top: 50px;
        gap: 30px;
        transition: left var(--transition-medium);
    }

    .theme-toggle {
        margin-left: auto;
        margin-right: 12px;
    }

    /* Keep the wordmark on one line next to the two toggles */
    .nav-logo p {
        font-size: clamp(1.15rem, 5vw, 1.8rem);
    }

    :root[data-theme="dark"] .nav-menu {
        background: rgba(16, 42, 50, 0.98);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
        padding-top: 100px;
    }

    .hero-image {
        order: -1;
    }

    .image-frame {
        width: 280px;
        height: 280px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .schools-grid {
        grid-template-columns: 1fr;
    }

    .school-card {
        margin: 0 auto;
        max-width: 400px;
    }

    .instruments-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .video-wrapper {
        padding-bottom: 56.25%;
        /* 16:9 aspect ratio for mobile */
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .contact-card {
        padding: 40px 20px;
    }

    .school-card,
    .instrument-card,
    .project-card {
        padding: 30px 20px;
    }

    .about-features {
        gap: 30px;
    }

    .feature {
        padding: 24px;
    }

    .btn {
        margin-bottom: 1rem;
    }
}

/* ===== SMOOTH SCROLLING & SCROLL BEHAVIOR ===== */
@media (prefers-reduced-motion: no-preference) {
    .hero-content>* {
        opacity: 0;
        transform: translateY(30px);
        animation: fadeInUp 0.8s ease forwards;
    }

    .section-header {
        opacity: 0;
        transform: translateY(30px);
        animation: fadeInUp 0.8s ease forwards;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Anchor navigation must jump, not glide */
    html {
        scroll-behavior: auto;
    }

    .scroll-indicator {
        animation: none;
    }

    .hero-content > *,
    .section-header,
    .text-block,
    .feature,
    .hero-image {
        opacity: 1;
        transform: none;
    }
}

/* ===== ERROR PAGES (404 / 50x) ===== */
/* Styles live here (not inline) so the strict CSP style-src 'self' holds on error responses too. */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-hero);
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
}

.error-page .error-container {
    max-width: 500px;
}

.error-page h1 {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.error-page p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-page a {
    display: inline-block;
    padding: 14px 32px;
    background: var(--text-light);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: var(--radius-medium);
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.error-page a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}