/* ============================================
   Aviation Weather — PilotMoves
   Friendly, visual, accessible design
   ============================================ */

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

:root {
    --bg-primary: #0b1526;
    --bg-secondary: #111d33;
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-hover: rgba(255,255,255,0.09);
    --border-subtle: rgba(255,255,255,0.08);
    --border-hover: rgba(136,187,255,0.3);
    --text-primary: #e8edf5;
    --text-body: #b0c4de;
    --text-muted: #6a8ab0;
    --accent: #88bbff;
    --accent-dim: rgba(136,187,255,0.12);
    --accent-border: rgba(136,187,255,0.25);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --purple: #a78bfa;
    --orange: #fb923c;
    --pink: #f472b6;
    --cyan: #22d3ee;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --max-width: 860px;
    --max-width-wide: 1200px;
    --radius: 16px;
    --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 18px;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: all 0.2s; }
a:hover { color: #aad4ff; }
img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* ============================================
   Top Navigation
   ============================================ */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11,21,38,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topnav-brand {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
}
.topnav-brand span { color: var(--text-muted); font-weight: 400; }

.topnav-links { display: flex; gap: 1.25rem; font-size: 0.9rem; }
.topnav-links a { color: var(--text-muted); }
.topnav-links a:hover { color: var(--accent); }

/* ============================================
   Landing Page
   ============================================ */
.landing-hero {
    text-align: center;
    padding: 5rem 1.5rem 3.5rem;
    background: linear-gradient(160deg, #0b1526 0%, #162644 40%, #1e3a5f 70%, #2a4a7a 100%);
    position: relative;
    overflow: hidden;
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 60% 40%, rgba(136,187,255,0.06) 0%, transparent 60%);
    pointer-events: none;
}

.landing-hero .hero-icon { font-size: 4rem; margin-bottom: 1rem; }

.landing-hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero .subtitle {
    font-size: 1.3rem;
    color: var(--text-body);
    font-weight: 300;
    margin-bottom: 0.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.landing-hero .source {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Parts container */
.parts-container {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.part-section { margin-bottom: 3rem; }

.part-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.part-number {
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    padding: 0.35rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.part-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Chapter cards */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.85rem;
}

.chapter-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all 0.25s;
    text-decoration: none;
}

.chapter-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.chapter-card .ch-num {
    flex-shrink: 0;
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent);
}

.chapter-card .ch-info { flex: 1; }
.chapter-card .ch-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}
.chapter-card .ch-status { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.chapter-card .ch-status.available { color: var(--success); font-weight: 600; }

/* ============================================
   Chapter Page — Hero
   ============================================ */
.chapter-hero {
    text-align: center;
    padding: 4rem 1.5rem 3rem;
    background: linear-gradient(160deg, var(--bg-primary) 0%, #162644 100%);
    border-bottom: 1px solid var(--border-subtle);
}

.chapter-hero .part-label {
    display: inline-block;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    padding: 0.35rem 1.1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.chapter-hero .chapter-num {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.chapter-hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chapter-hero .hero-summary {
    max-width: 650px;
    margin: 1rem auto 0;
    font-size: 1.15rem;
    color: var(--text-body);
    line-height: 1.7;
}

/* ============================================
   Chapter — Single Column (friendly, no sidebar)
   ============================================ */
.chapter-body {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* Section blocks — each topic is a visual "section" */
.section-block {
    margin-bottom: 3.5rem;
}

.section-block > h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-block > h2 .section-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.section-block p {
    color: var(--text-body);
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
    line-height: 1.85;
}

.section-block h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 2rem 0 0.8rem;
    color: var(--text-primary);
}

/* ============================================
   Visual Info Cards — the key learning component
   ============================================ */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin: 1.5rem 0;
    transition: border-color 0.3s;
}

.info-card:hover { border-color: rgba(255,255,255,0.12); }

.info-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card p {
    color: var(--text-body);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.info-card p:last-child { margin-bottom: 0; }

/* ============================================
   Stat Boxes — key numbers at a glance
   ============================================ */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin: 1.5rem 0;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
}

.stat-box .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}

.stat-box .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.3;
}

/* Colored stat variants */
.stat-box.green .stat-value { color: var(--success); }
.stat-box.orange .stat-value { color: var(--orange); }
.stat-box.purple .stat-value { color: var(--purple); }
.stat-box.pink .stat-value { color: var(--pink); }
.stat-box.cyan .stat-value { color: var(--cyan); }

/* ============================================
   Visual Layer Diagram (CSS-based)
   ============================================ */
.layer-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.layer {
    padding: 1.5rem 1.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: default;
    transition: all 0.3s;
}

.layer:last-child { border-bottom: none; }
.layer:hover { filter: brightness(1.15); }

.layer-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #fff;
}

.layer-info p {
    font-size: 0.92rem;
    color: rgba(255,255,255,0.75);
    margin: 0;
    line-height: 1.5;
}

.layer-alt {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    text-align: right;
    white-space: nowrap;
    background: rgba(0,0,0,0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
}

.layer-exo { background: linear-gradient(135deg, #1a1040, #2a1860); }
.layer-thermo { background: linear-gradient(135deg, #2d1b4e, #4a2080); }
.layer-meso { background: linear-gradient(135deg, #1e3a5f, #2a4a7a); }
.layer-strato { background: linear-gradient(135deg, #1a4a6a, #2980b9); }
.layer-tropo { background: linear-gradient(135deg, #2a7ab5, #3498db); }

.layer-tropo .layer-info h4::after {
    content: ' \2190 You are here!';
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
}

/* ============================================
   Callout Boxes — friendly, bigger
   ============================================ */
.callout {
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin: 1.75rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.callout-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 0.1rem;
}

.callout-body h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.callout-body p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0;
    color: var(--text-body);
}

.callout-pilot {
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.2);
}
.callout-pilot h4 { color: var(--success); }

.callout-info {
    background: rgba(136,187,255,0.08);
    border: 1px solid rgba(136,187,255,0.2);
}
.callout-info h4 { color: var(--accent); }

.callout-warning {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
}
.callout-warning h4 { color: var(--warning); }

.callout-think {
    background: rgba(167,139,250,0.08);
    border: 1px solid rgba(167,139,250,0.2);
}
.callout-think h4 { color: var(--purple); }

/* ============================================
   Pie / Bar Charts (CSS only)
   ============================================ */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.5rem 0;
}

.bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 60px;
    align-items: center;
    gap: 0.75rem;
}

.bar-label {
    font-size: 0.9rem;
    color: var(--text-body);
    text-align: right;
}

.bar-track {
    height: 28px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease-out;
    min-width: 4px;
}

.bar-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   Tables — friendlier
   ============================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

th {
    text-align: left;
    padding: 0.85rem 1.1rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
}

td {
    padding: 0.75rem 1.1rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-body);
    font-size: 0.95rem;
}

tr:hover td { background: rgba(255,255,255,0.03); }

/* ============================================
   Expandable Sections (details/summary)
   ============================================ */
details {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    overflow: hidden;
}

summary {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    transition: background 0.2s;
}

summary:hover { background: rgba(255,255,255,0.03); }

summary::before {
    content: '+';
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}

details[open] summary::before {
    content: '\2212';
}

.details-content {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-body);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ============================================
   Quiz / Check Your Knowledge
   ============================================ */
.quiz-section {
    background: rgba(167,139,250,0.06);
    border: 1px solid rgba(167,139,250,0.15);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2.5rem 0;
}

.quiz-section h3 {
    color: var(--purple);
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quiz-q {
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 0.85rem;
}

.quiz-q p {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.quiz-q .quiz-answer {
    display: none;
    padding: 0.85rem 1rem;
    background: rgba(74,222,128,0.08);
    border-radius: 8px;
    color: var(--text-body);
    font-size: 0.92rem;
    line-height: 1.6;
    border: 1px solid rgba(74,222,128,0.15);
}

.quiz-q .quiz-answer.show { display: block; }

.reveal-btn {
    background: rgba(167,139,250,0.15);
    border: 1px solid rgba(167,139,250,0.3);
    color: var(--purple);
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.reveal-btn:hover {
    background: rgba(167,139,250,0.25);
}

/* ============================================
   Code / METAR
   ============================================ */
code {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.88em;
    color: var(--accent);
}

/* ============================================
   Chapter Nav (prev/next)
   ============================================ */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

.chapter-nav a {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    flex: 1;
    max-width: 48%;
    transition: all 0.25s;
}

.chapter-nav a:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.chapter-nav a .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.chapter-nav a .title {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.chapter-nav .next { text-align: right; margin-left: auto; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.site-footer a { color: var(--text-body); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    body { font-size: 16px; }
    .landing-hero h1 { font-size: 2.2rem; }
    .landing-hero .subtitle { font-size: 1.05rem; }
    .chapter-hero h1 { font-size: 2rem; }
    .chapters-grid { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .bar-row { grid-template-columns: 80px 1fr 50px; }
    .layer { grid-template-columns: 1fr; gap: 0.5rem; }
    .layer-alt { text-align: left; width: fit-content; }
    .chapter-nav { flex-direction: column; }
    .chapter-nav a { max-width: 100%; }
    .chapter-body { padding: 1.5rem 1rem 3rem; }
}

@media (max-width: 480px) {
    .topnav-links { gap: 0.75rem; font-size: 0.82rem; }
    .stat-row { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 70px 1fr 45px; }
    .bar-label { font-size: 0.8rem; }
}
