/* =============================================
   Solfege PRO - Practice Guide Stylesheet
   ============================================= */

/* =============================================
   1. CSS Variables
   ============================================= */
:root {
    /* Studio Theme Colors - Dark Mode */
    --primary: #D4AF37;
    --secondary: #8B7355;
    --accent: #C9B896;
    --background: #1A1A1E;
    --surface: #2A2A30;
    --surface-light: #3A3A42;
    --text-primary: #F5F5F0;
    --text-secondary: #9A9A9A;
    --success: #4ADE80;
    --warning: #FBBF24;
    --error: #F87171;
    --info: #60A5FA;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

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

    /* Navigation Height */
    --nav-height: 56px;
}

/* =============================================
   2. Language Toggle System (ja / en / fr / de)
   ============================================= */
/* Default: Japanese visible, all others hidden */
/* Use :not(html) to prevent matching <html lang="X"> which would hide the entire page */
:not(html)[lang="en"],
:not(html)[lang="fr"],
:not(html)[lang="de"] { display: none; }
:not(html)[lang="ja"] { display: contents; }

/* When English is selected */
[data-lang="en"] :not(html)[lang="en"] { display: contents; }
[data-lang="en"] :not(html)[lang="ja"],
[data-lang="en"] :not(html)[lang="fr"],
[data-lang="en"] :not(html)[lang="de"] { display: none; }

/* When French is selected */
[data-lang="fr"] :not(html)[lang="fr"] { display: contents; }
[data-lang="fr"] :not(html)[lang="ja"],
[data-lang="fr"] :not(html)[lang="en"],
[data-lang="fr"] :not(html)[lang="de"] { display: none; }

/* When German is selected */
[data-lang="de"] :not(html)[lang="de"] { display: contents; }
[data-lang="de"] :not(html)[lang="ja"],
[data-lang="de"] :not(html)[lang="en"],
[data-lang="de"] :not(html)[lang="fr"] { display: none; }

/* =============================================
   3. Base Styles
   ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
    /* Reserve scrollbar space so viewport width is constant across pages
       (prevents nav width drift between short/long pages). */
    scrollbar-gutter: stable both-edges;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 16px;
}

/* =============================================
   4. Navigation
   ============================================= */
.nav {
    background: rgba(42, 42, 48, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--space-md) var(--space-lg);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--surface-light);
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav__container {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    max-width: 1200px;
    width: 100%;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    white-space: nowrap;
    text-decoration: none;
}

.nav__logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.nav__logo-text {
    /* Wrapper for logo text - keeps both languages together */
}

.nav__settings {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    position: relative;
}

.settings-btn {
    background: var(--surface-light);
    border: 1px solid var(--surface-light);
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.settings-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.settings-btn.active {
    background: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.settings-btn__chevron {
    display: inline-block;
    font-size: 9px;
    margin-left: 2px;
    opacity: 0.7;
    transition: transform 0.15s ease;
}

.settings-btn[aria-expanded="true"] .settings-btn__chevron {
    transform: rotate(180deg);
}

/* Language dropdown */
.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    list-style: none;
    margin: 0;
    padding: 4px;
    min-width: 144px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}
.lang-menu.open { display: block; }
.lang-menu__item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-family: inherit;
}
.lang-menu__item:hover,
.lang-menu__item:focus {
    background: var(--surface-light);
    color: var(--primary);
    outline: none;
}
.lang-menu__item.is-active {
    color: var(--primary);
    font-weight: 700;
}

.nav__list {
    display: flex;
    gap: var(--space-sm);
    list-style: none;
    flex-wrap: wrap;
    margin-left: auto;
}

.nav__link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav__link:hover,
.nav__link.active {
    color: var(--primary);
    background: var(--surface-light);
}

/* =============================================
   5. Header
   ============================================= */
.header {
    background: linear-gradient(180deg, var(--surface) 0%, var(--background) 100%);
    padding: var(--space-3xl) var(--space-lg);
    padding-top: calc(var(--nav-height) + var(--space-3xl));
    text-align: center;
    border-bottom: 1px solid var(--surface-light);
}

.header__title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* =============================================
   6. Main Content
   ============================================= */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

/* =============================================
   7. Section
   ============================================= */
.section {
    margin-bottom: var(--space-3xl);
    scroll-margin-top: calc(var(--nav-height) + var(--space-lg));
}

.section__header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--primary);
}

.section__icon {
    font-size: 32px;
}

.section__title {
    font-size: 24px;
    font-weight: 700;
}

.section__header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-left: auto;
}

/* =============================================
   8. Section TOC
   ============================================= */
.section-toc {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--surface-light);
}

.section-toc__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-toc__list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.section-toc__item {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.section-toc__item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* =============================================
   9. Question Card (Accordion)
   ============================================= */
.question-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-md);
    border: 1px solid var(--surface-light);
    scroll-margin-top: calc(var(--nav-height) + var(--space-lg));
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.question-card:hover {
    border-color: var(--primary);
}

.question-card.expanded {
    border-color: var(--primary);
}

.question-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.question-card__header:hover {
    background: var(--surface-light);
}

.question-card__q {
    background: var(--primary);
    color: var(--background);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.question-card__title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    flex: 1;
}

.question-card__toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.question-card.expanded .question-card__toggle {
    transform: rotate(180deg);
}

/* Content area - FIXED: No padding shift on expand */
.question-card__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.question-card.expanded .question-card__content {
    max-height: none; /* Allow natural height */
    padding: 0 var(--space-xl) var(--space-xl) var(--space-xl);
}

/* =============================================
   10. Content Block
   ============================================= */
.content-block {
    margin-bottom: var(--space-xl);
}

.content-block__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.content-block__title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.content-block p {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.content-block p:last-child {
    margin-bottom: 0;
}

/* Highlight Text */
.highlight {
    color: var(--primary);
    font-weight: 500;
}

/* =============================================
   11. Lists
   ============================================= */
.content-list {
    list-style: none;
    margin-bottom: var(--space-md);
}

.content-list li {
    padding-left: var(--space-lg);
    position: relative;
    margin-bottom: var(--space-sm);
}

.content-list li::before {
    content: "•";
    color: var(--primary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.content-list--numbered {
    counter-reset: item;
}

.content-list--numbered li::before {
    content: counter(item) ".";
    counter-increment: item;
}

/* =============================================
   12. Level Cards
   ============================================= */
.level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.level-card {
    background: var(--surface-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border-left: 4px solid var(--primary);
}

.level-card--beginner { border-left-color: var(--success); }
.level-card--intermediate { border-left-color: var(--warning); }
.level-card--advanced { border-left-color: var(--error); }

.level-card__title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.level-card--beginner .level-card__title { color: var(--success); }
.level-card--intermediate .level-card__title { color: var(--warning); }
.level-card--advanced .level-card__title { color: var(--error); }

.level-card__content {
    font-size: 14px;
    color: var(--text-secondary);
}

/* =============================================
   13. Training Table
   ============================================= */
.table-wrapper {
    overflow-x: auto; /* lint-skip: data tables intrinsically need many columns; grid-ification N/A */
    -webkit-overflow-scrolling: touch;
}

.training-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-md);
    font-size: 14px;
}

.training-table th,
.training-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--surface-light);
}

.training-table th {
    background: var(--surface-light);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =============================================
   14. Info Boxes
   ============================================= */
/* Tips Box */
.tips-box {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.tips-box__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.tips-box__content {
    font-size: 14px;
}

/* Warning Box */
.warning-box {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.warning-box__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--error);
    margin-bottom: var(--space-sm);
}

.warning-box__content {
    font-size: 14px;
}

/* Science Box */
.science-box {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.science-box__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--info);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.science-box__title::before {
    content: "🧠";
}

.science-box__content {
    font-size: 14px;
}

/* Curriculum Box */
.curriculum-box {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.curriculum-box__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: var(--space-md);
}

.curriculum-week {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

.curriculum-week:last-child {
    margin-bottom: 0;
}

.curriculum-week__header {
    font-weight: 700;
    color: var(--success);
    margin-bottom: var(--space-xs);
    font-size: 14px;
}

.curriculum-week__content {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =============================================
   15. CTA Section
   ============================================= */
.cta {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    border: 1px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    margin-top: var(--space-3xl);
}

.cta__title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.cta__text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.cta__button {
    display: inline-block;
    background: var(--primary);
    color: var(--background);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
}

.cta__button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

/* =============================================
   16. Footer
   ============================================= */
.footer {
    background: var(--surface);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    border-top: 1px solid var(--surface-light);
}

.footer__text {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer__link {
    color: var(--primary);
    text-decoration: none;
}

/* =============================================
   17. Expand All Button
   ============================================= */
.expand-all-btn {
    background: var(--surface-light);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.expand-all-btn:hover {
    background: var(--primary);
    color: var(--background);
}

/* =============================================
   17b. Guide Links Grid
   ============================================= */
.guide-links {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    margin-top: var(--space-xl);
}

.guide-links__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    text-align: center;
}

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

.guide-link-card {
    display: block;
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-decoration: none;
    transition: all 0.2s ease;
}

.guide-link-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.guide-link-card__icon {
    font-size: 24px;
    margin-bottom: var(--space-sm);
}

.guide-link-card__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.guide-link-card__desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* =============================================
   18. Hamburger Button (Hidden on Desktop)
   ============================================= */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    padding: 4px;
    background: var(--surface-light);
    border: 1px solid var(--surface-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 4px;
}

.hamburger-btn:hover {
    border-color: var(--primary);
}

.hamburger-btn__line {
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover .hamburger-btn__line {
    background: var(--primary);
}

/* Hamburger animation when open */
.hamburger-btn.active .hamburger-btn__line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.hamburger-btn.active .hamburger-btn__line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-btn__line:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* =============================================
   19. Side Drawer (Hidden on Desktop)
   ============================================= */
.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    display: block;
    opacity: 1;
}

.drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.drawer.active {
    right: 0;
}

.drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--surface-light);
}

.drawer__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.drawer__close {
    width: 32px;
    height: 32px;
    background: var(--surface-light);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drawer__close:hover {
    background: var(--primary);
    color: var(--background);
}

.drawer__list {
    list-style: none;
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
}

.drawer__link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    margin-bottom: var(--space-xs);
}

.drawer__link:hover,
.drawer__link.active {
    background: var(--surface-light);
    color: var(--primary);
}

/* =============================================
   20. Responsive - Tablet (768px and below)
   ============================================= */
@media (max-width: 768px) {
    .nav {
        height: var(--nav-height);
        padding: var(--space-sm) var(--space-md);
    }

    .nav__container {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: var(--space-sm);
    }

    .nav__logo {
        order: 1;
        flex: 1;
    }

    /* Logo text always visible on mobile */
    .nav__logo-text {
        font-size: 12px;
    }

    .nav__logo-icon {
        width: 28px;
        height: 28px;
    }

    .nav__settings {
        order: 2;
        display: flex;
        gap: var(--space-sm);
    }

    /* Hide desktop nav list on mobile; hamburger drawer takes over */
    .nav__list {
        display: none;
    }

    /* Show hamburger button on mobile */
    .hamburger-btn {
        display: flex;
    }

    .header {
        padding-top: calc(var(--nav-height) + var(--space-xl));
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    .header__title {
        font-size: 24px;
    }

    .header__subtitle {
        font-size: 14px;
    }

    .main {
        padding: var(--space-lg) var(--space-md);
    }

    .section__header {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .section__title {
        font-size: 20px;
    }

    .section__header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .question-card {
        margin-bottom: var(--space-md);
    }

    .question-card__header {
        padding: var(--space-md);
    }

    .question-card.expanded .question-card__content {
        padding: var(--space-md);
    }

    .question-card__title {
        font-size: 15px;
    }

    .question-card__q {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .content-block__title {
        font-size: 14px;
    }

    .section-toc {
        padding: var(--space-md);
    }

    .section-toc__list {
        flex-direction: column;
        gap: var(--space-xs);
    }

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

    .level-cards {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .level-card {
        padding: var(--space-md);
    }

    .curriculum-box {
        padding: var(--space-md);
    }

    .curriculum-week {
        padding: var(--space-sm);
    }

    .tips-box,
    .warning-box,
    .science-box {
        padding: var(--space-md);
    }

    .table-wrapper {
        margin: 0 calc(-1 * var(--space-md));
        padding: 0 var(--space-md);
    }

    .training-table {
        font-size: 12px;
        min-width: 400px; /* lint-skip: data table; .table-wrapper provides overflow-x scroll */
    }

    .training-table th,
    .training-table td {
        padding: var(--space-sm);
    }

    .cta {
        padding: var(--space-xl);
        margin: var(--space-xl) 0;
    }

    .cta__title {
        font-size: 20px;
    }

    .cta__button {
        padding: var(--space-md) var(--space-lg);
        font-size: 14px;
        display: block;
        text-align: center;
    }
}

/* =============================================
   19. Responsive - Mobile (480px and below)
   ============================================= */
@media (max-width: 480px) {
    :root {
        --space-lg: 20px;
        --space-xl: 24px;
        --space-2xl: 32px;
        --space-3xl: 48px;
    }

    .nav__link {
        font-size: 11px;
        padding: 4px 8px;
    }

    .header {
        padding-top: calc(95px + var(--space-lg));
    }

    .header__title {
        font-size: 20px;
    }

    .header__subtitle {
        font-size: 13px;
    }

    .section__icon {
        font-size: 24px;
    }

    .section__title {
        font-size: 18px;
    }

    .question-card__title {
        font-size: 14px;
        line-height: 1.3;
    }

    .question-card__q {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .question-card__toggle {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .content-block {
        margin-bottom: var(--space-lg);
    }

    .content-block__title {
        font-size: 13px;
    }

    .content-block p,
    .content-list li {
        font-size: 14px;
        line-height: 1.7;
    }

    .level-card__title {
        font-size: 13px;
    }

    .level-card__content {
        font-size: 13px;
    }

    .curriculum-week__header {
        font-size: 13px;
    }

    .curriculum-week__content {
        font-size: 12px;
    }

    .science-box__title,
    .tips-box__title,
    .warning-box__title {
        font-size: 13px;
    }

    .science-box__content,
    .tips-box__content,
    .warning-box__content {
        font-size: 13px;
    }

    .section-toc__title {
        font-size: 12px;
    }

    .section-toc__item {
        font-size: 12px;
    }

    .expand-all-btn {
        font-size: 11px;
        padding: var(--space-xs) var(--space-sm);
    }

    .footer {
        padding: var(--space-lg) var(--space-md);
    }

    .footer__text {
        font-size: 12px;
    }
}

/* =============================================
   Shared Conversion Components (W3)
   ============================================= */

/* Sticky bottom CTA bar (mobile-only) */
.sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(42, 42, 48, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--surface-light);
    padding: 10px 14px;
    z-index: 999;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}
.sticky-cta__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}
.sticky-cta__text {
    flex: 1;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text-secondary);
    min-width: 0;
}
.sticky-cta__text strong {
    color: var(--text-primary);
    font-size: 13px;
    display: block;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sticky-cta__button {
    background: var(--primary);
    color: var(--background);
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.sticky-cta__button:active {
    transform: scale(0.96);
}
@media (max-width: 768px) {
    .sticky-cta { display: flex; }
    body { padding-bottom: 70px; }
}

/* Hero CTA group (above-the-fold buttons) */
.hero-cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    justify-content: center;
    align-items: center;
    margin-top: var(--space-xl);
}

/* App Store badge */
.app-store-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--primary);
    color: var(--background);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s ease;
    line-height: 1.2;
}
.app-store-badge:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}
.app-store-badge__icon {
    font-size: 20px;
}
.app-store-badge--secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.app-store-badge--secondary:hover {
    background: var(--surface-light);
    box-shadow: none;
}


/* Social proof section */
.social-proof {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    margin: var(--space-xl) 0;
    text-align: center;
}
.social-proof__title {
    font-size: 13px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-md);
}
.social-proof__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md) var(--space-xl);
    list-style: none;
}
.social-proof__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.social-proof__item strong {
    color: var(--text-primary);
    font-size: 14px;
}
.social-proof__icon {
    color: var(--primary);
    font-size: 16px;
}

/* Prominent mid-article CTA (more visible than .article-cta-subtle) */
.article-cta-mid {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: linear-gradient(90deg, var(--surface) 0%, var(--surface-light) 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-2xl) 0;
}
.article-cta-mid__icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
}
.article-cta-mid__body {
    flex: 1;
    min-width: 0;
}
.article-cta-mid__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.article-cta-mid__text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.article-cta-mid__button {
    background: var(--primary);
    color: var(--background);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
    transition: transform 0.15s ease;
}
.article-cta-mid__button:hover {
    transform: scale(1.04);
}
@media (max-width: 600px) {
    .article-cta-mid {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
}

/* Recommended reading order indicator (guide index) */
.guide-card__order {
    display: inline-block;
    background: var(--primary);
    color: var(--background);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: 700;
    margin-right: var(--space-sm);
}

/* =============================================
   Apple App Store Official Badge (W3 Task A)
   Uses Apple-hosted badge images for marketing-guideline compliance.
   ============================================= */
.app-store-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    line-height: 0;
}
.app-store-link:hover { transform: scale(1.04); }
.app-store-link:active { opacity: 0.85; }
.app-store-link__img {
    height: 50px;
    width: auto;
    display: block;
}
@media (max-width: 600px) {
    .app-store-link__img { height: 44px; }
}



/* =============================================
   Icon system (Lucide stroke icons via SVG sprite)
   Use: <svg class="icon"><use href="/assets/icons.svg#icon-name"></use></svg>
   ============================================= */
.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: -0.15em;
    color: currentColor;
}
/* Size variants used in cards/headers */
.guide-card__icon .icon,
.instrument-card__icon .icon,
.diag-option__icon .icon { font-size: 32px; }
.page-header__icon .icon { font-size: 48px; }
.social-proof__icon .icon { font-size: 18px; }
.article-cta-mid__icon .icon { font-size: 32px; }
.question-card__q .icon { font-size: 18px; vertical-align: 0; }
@media (max-width: 768px) {
    .page-header__icon .icon { font-size: 36px; }
    .instrument-card__icon .icon { font-size: 28px; }
}
/* The icon containers inherit accent color */
.guide-card__icon,
.instrument-card__icon,
.page-header__icon,
.social-proof__icon,
.article-cta-mid__icon { color: var(--primary); }

/* =============================================
   Page Header (unified hero across all pages)
   Used by: TOP, start-here, guides index, practice/*, guides/* (articles)
   ============================================= */
.page-header {
    background: linear-gradient(180deg, var(--surface) 0%, var(--background) 100%);
    padding: var(--space-3xl) var(--space-lg);
    padding-top: calc(var(--nav-height) + var(--space-3xl));
    text-align: center;
    border-bottom: 1px solid var(--surface-light);
}
.page-header__icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
}
.page-header__title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    /* Distribute line breaks evenly across all lines (avoids the
       awkward fr-only 4-line H1 with a break after "intervalles ?"). */
    text-wrap: balance;
}
.page-header__subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.8;
}
.page-header__meta {
    margin-top: var(--space-md);
    font-size: 13px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}
.page-header__badge,
.page-header__tag {
    display: inline-block;
    background: rgba(212, 175, 55, 0.15);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .page-header {
        padding: var(--space-xl) var(--space-md);
        padding-top: calc(var(--nav-height) + var(--space-xl));
    }
    .page-header__icon { font-size: 36px; }
    .page-header__title { font-size: 24px; }
    .page-header__subtitle { font-size: 14px; }
}
@media (max-width: 480px) {
    .page-header__title { font-size: 20px; }
}

/* ========================================================================
   ANIMATIONS
   PdM-prioritized motion: funnel transitions (start-here.html),
   CTA micro-interactions (App Store badge, sticky CTA), and limited
   scroll-driven reveals. All respect prefers-reduced-motion.
   ======================================================================== */

/* --- Scroll-driven reveal (applied by animations.js to .reveal elements) --- */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 450ms cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- App Store badge micro-interaction (CTA polish) --- */
.app-store-link {
    display: inline-block;
    transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
                filter 180ms ease;
    will-change: transform;
}
.app-store-link:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.06);
}
.app-store-link:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 80ms;
    filter: brightness(0.96);
}

/* --- Sticky bottom CTA: hide above the fold, reveal after scroll --- */
.sticky-cta {
    transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 200ms ease;
}
.sticky-cta--hidden {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

/* --- Diagnostic funnel progress bar (start-here.html) --- */
.diag-progress {
    max-width: 720px;
    margin: 0 auto var(--space-xl);
    padding: 0 var(--space-lg);
}
.diag-progress__steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: var(--space-sm);
}
.diag-progress__step {
    height: 3px;
    background: var(--surface-light);
    border-radius: 2px;
    transition: background 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.diag-progress__step.is-active {
    background: var(--primary);
}
.diag-progress__labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}
.diag-progress__labels > span {
    text-align: center;
    transition: color 400ms ease, font-weight 400ms ease;
}
.diag-progress__labels > span.is-active {
    color: var(--primary);
    font-weight: 700;
}

/* --- Diagnostic step entry animation --- */
.diag-step.is-entering {
    animation: diag-step-enter 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes diag-step-enter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Selected option confirmation pulse --- */
.diag-option.is-confirming {
    animation: diag-option-confirm 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes diag-option-confirm {
    0%   { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.0); }
    40%  { box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.18); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.0); }
}

/* --- Result card reveal (diagnostic Step 4) --- */
.diag-result.is-entering {
    animation: diag-result-enter 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes diag-result-enter {
    from { opacity: 0; transform: scale(0.97) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Reading progress bar (E: auto-injected on .article-body pages) --- */
.reading-progress {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.04);
    z-index: 50;
    pointer-events: none;
}
.reading-progress__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 120ms linear;
    will-change: transform;
}

/* --- Respect user's motion preferences --- */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal.is-revealed,
    .app-store-link,
    .app-store-link:hover,
    .app-store-link:active,
    .sticky-cta,
    .sticky-cta--hidden,
    .diag-progress__step,
    .diag-progress__labels > span {
        transition: none !important;
        animation: none !important;
    }
    .reveal {
        opacity: 1;
        transform: none;
    }
    .app-store-link:hover,
    .app-store-link:active {
        transform: none;
        filter: none;
    }
    .sticky-cta--hidden {
        transform: translateY(120%);
    }
    .diag-step.is-entering,
    .diag-option.is-confirming,
    .diag-result.is-entering {
        animation: none;
    }
    .reading-progress__fill {
        transition: none;
    }
    [data-count-up] {
        /* skip the JS count-up; the static final number is left in place */
    }
}
