:root {
    --primary-color: #00376b;
    --secondary-color: #f9d180;
    --accent-color: #0274be;
    --gold-color: #c99a2e;
    --text-dark: #2d3436;
    --text-medium: #4f5b60;
    --text-light: #b2bec3;
    --bg-white: #ffffff;
    --bg-light: #f6f8fa;
    --border-color: #e3e8ec;
    --border-radius: 8px;
    --transition: all 0.25s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 15px rgba(0, 0, 0, 0.1);
    --header-height: 72px;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    background-color: var(--bg-white);
    line-height: 1.6;
}

img {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

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

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 2000;
    padding: 10px 16px;
    background: var(--primary-color);
    color: var(--bg-white);
    border-radius: var(--border-radius);
}

.skip-link:focus {
    top: 12px;
    color: var(--bg-white);
}

/* Keep section headings clear of the sticky header when jumping to them */
section[id] {
    scroll-margin-top: var(--header-height);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.btn-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--bg-white);
}

.btn-outline {
    background-color: var(--bg-white);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: #eef3f8;
    color: var(--primary-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Header */
.site-header {
    padding: 14px 0;
    background-color: var(--bg-white);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #f0f0f0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.logo img {
    width: 40px;
    height: 40px;
}

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

/* Language Switcher (hidden while the site is English-only) */
.language-selector {
    display: flex;
    gap: 10px;
}

.language-label {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-medium);
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.language-label:hover,
.language-label.active {
    color: var(--primary-color);
    background-color: #f0f4f8;
}

/* Hero */
.hero {
    padding: 120px 0 110px;
    text-align: center;
    background: linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.7)),
        url('media/cover/header-background.jpg');
    background-size: cover;
    background-position: center;
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: 3.2rem;
    max-width: 860px;
    margin: 0 auto 24px;
    color: var(--primary-color);
    line-height: 1.15;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-dark);
    max-width: 680px;
    margin: 0 auto 36px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Sections */
.section {
    padding: 80px 0;
}

.section-alt {
    background-color: var(--bg-light);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.2;
}

.section-title-spaced {
    margin-top: 70px;
}

.section-intro {
    max-width: 780px;
    margin: 0 auto;
    font-size: 1.1rem;
    text-align: center;
}

/* Programs */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 30px;
}

.project-card {
    background: var(--bg-white);
    padding: 26px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.project-title {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    line-height: 1.25;
}

.project-summary {
    font-weight: 500;
}

.project-details {
    margin-top: 10px;
    color: var(--text-medium);
    font-size: 0.95rem;
    flex-grow: 1;
}

.project-details p + p {
    margin-top: 8px;
}

.card-link {
    display: inline-block;
    margin-top: 16px;
    font-weight: 600;
}

/* Story & timeline (pure CSS heatmap built by build_index.py) */
.timeline {
    --cell: 13px;
    --gap: 3px;
    margin: 40px auto 0;
    text-align: center;
}

.timeline-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
}

.tl {
    display: inline-grid;
    gap: var(--gap);
    text-align: left;
}

.tl-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tl-year {
    width: 34px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-medium);
    text-align: right;
}

.tl-weeks {
    display: grid;
    grid-template-columns: repeat(53, var(--cell));
    gap: var(--gap);
}

.tl-cell {
    width: var(--cell);
    height: var(--cell-height, var(--cell));
    border-radius: 2px;
    background-color: #ebedf0;
}

.tl-cell.l1 { background-color: #ffee8e; }
.tl-cell.l2 { background-color: #ffe554; }
.tl-cell.l3 { background-color: #ffd700; }
.tl-cell.l4 { background-color: #ffa500; }
.tl-cell.l5 { background-color: #ff8c00; }

.tl-cell.out {
    visibility: hidden;
}

.timeline-legend {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-medium);
}

.timeline-legend .tl-cell {
    display: inline-block;
}

.timeline-legend span:first-child {
    margin-right: 6px;
}

.timeline-legend span:last-child {
    margin-left: 6px;
}

.timeline-caption {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-medium);
}

/* People */
.founders-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.founder-card {
    background: var(--bg-white);
    padding: 24px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.founder-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    background-color: var(--bg-light);
}

.founder-name {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.founder-role {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.founder-bio {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-medium);
}

/* Partners / Sponsors / Media */
.partners-subsection {
    margin-bottom: 60px;
}

.partners-subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 30px;
    text-align: center;
    font-family: var(--font-serif);
}

.logos-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px 40px;
    align-items: center;
    list-style: none;
}

.logo-item {
    display: block;
    transition: var(--transition);
}

.logo-item img {
    display: block;
    max-height: 60px;
    max-width: 170px;
    width: auto;
    height: auto;
}

.logo-item:hover {
    transform: translateY(-3px);
}

/* Support (donate & volunteer) */
.support {
    text-align: center;
}

.support-content {
    max-width: 760px;
    margin: 0 auto;
}

.support-description {
    font-size: 1.15rem;
    margin-bottom: 30px;
}

.support-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.support-actions form {
    display: contents;
}

.support-note {
    margin-top: 24px;
    font-size: 0.95rem;
    color: var(--text-medium);
}

/* Footer */
.site-footer {
    padding: 56px 0 32px;
    background-color: var(--primary-color);
    color: #dce6f0;
    text-align: center;
}

.footer-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--bg-white);
    margin-bottom: 12px;
}

.footer-description {
    max-width: 640px;
    margin: 0 auto;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 16px 30px;
    flex-wrap: wrap;
    margin: 24px 0 36px;
    list-style: none;
}

.contact-links a {
    color: var(--secondary-color);
    font-size: 1.05rem;
    font-weight: 500;
}

.contact-links a:hover {
    color: var(--bg-white);
}

.footer-legal {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 24px;
    font-size: 0.875rem;
}

.footer-legal p + p {
    margin-top: 6px;
}

/* Schedule Section (hidden for now; kept for when real classes are listed) */
.schedule-section {
    padding: 80px 0;
    background-color: var(--bg-white);
}

.timezone-selector-container {
    text-align: center;
    margin-bottom: 2rem;
}

.timezone-selector-container label {
    margin-right: 10px;
    font-weight: 600;
}

#timezone-selector {
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-family: inherit;
    min-width: 200px;
    max-width: 100%;
}

#timezone-error {
    color: #c0392b;
    font-size: 0.9em;
    margin-top: 5px;
}

#ec {
    margin-top: 2rem;
}

.schedule-container {
    overflow-x: auto;
    margin-top: 40px;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    color: var(--text-dark);
    min-width: 600px;
}

.schedule-table th,
.schedule-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.schedule-table th {
    background-color: var(--primary-color);
    color: var(--bg-white);
    font-weight: 600;
    font-family: var(--font-serif);
    letter-spacing: 0.5px;
}

.schedule-table tr:nth-child(even) {
    background-color: #fcfcfc;
}

.schedule-table tr:hover {
    background-color: #f0f4f8;
}

.schedule-table tr.schedule-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.schedule-table tr.schedule-row:hover {
    background-color: #f1f7fc;
}

.schedule-table tr.expanded {
    background-color: #eaf4fb;
    border-left: 4px solid var(--accent-color);
}

.description-row {
    background-color: #f8f9fa;
    display: none;
}

.description-row.show {
    display: table-row;
    animation: fadeIn 0.3s ease;
}

.description-content {
    padding: 20px;
    color: var(--text-medium);
    font-size: 0.95rem;
    line-height: 1.6;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 55, 107, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text,
.error-text {
    text-align: center;
    color: var(--text-medium);
    font-size: 1rem;
}

.error-text {
    color: #c0392b;
}

.view-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    background-color: rgba(0, 55, 107, 0.05);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .founders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .section {
        padding: 56px 0;
    }

    .hero {
        padding: 72px 0 64px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-description {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 28px;
    }

    .section-title-spaced {
        margin-top: 50px;
    }

    .logo span {
        font-size: 1.2rem;
    }

    .logos-grid {
        gap: 24px 28px;
    }

    /* Shrink the timeline squares so all 53 weeks fit the screen */
    .timeline {
        --gap: 1px;
        --cell: max(3px, calc((100vw - 90px) / 53 - var(--gap)));
        --cell-height: 16px;
    }

    .tl-row {
        gap: 6px;
    }

    .timeline-legend .tl-cell {
        width: 10px;
        height: 10px;
    }

    .tl-weeks .tl-cell {
        border-radius: 1px;
    }

    .logo-item img {
        max-height: 48px;
        max-width: 130px;
    }
}

@media (max-width: 560px) {
    .founders-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions .btn,
    .support-actions .btn {
        width: 100%;
    }

    /* Compact header: logo mark only, keep both actions visible */
    .logo span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .header-actions {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
