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

:root {
    --primary: #191d2b;
    --accent: #27ae60;
    --accent-light: #5fd99a;
    --bg: #f8f8f8;
    --card-bg: #ffffff;
    --text: #191d2b;
    --text-muted: #6c6c6c;
    --border: #e0e0e0;
    --code-bg: #f1f1f1;
    --step-bg: #191d2b;
    --tag-bg: #e6f7ee;
    --tag-color: #1b7a43;
    --font: 'Poppins', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
}

/* NAV */
.learn-nav {
    background: var(--primary);
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.learn-nav .brand {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.learn-nav .back-link {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.learn-nav .back-link:hover { color: #fff; }
.learn-nav .back-link i { font-size: 0.8rem; }

/* HERO */
.learn-hero {
    background: var(--primary);
    color: #fff;
    padding: 3rem 2rem 2.5rem;
}
.learn-hero .meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.learn-hero .category {
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}
.learn-hero .read-time {
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
}
.learn-hero h1 {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}
.learn-hero .subtitle {
    color: rgba(255,255,255,0.65);
    font-size: 0.95rem;
    max-width: 680px;
}

/* SECTION ANCHORS */
.section-anchors {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    position: sticky;
    top: 50px;
    z-index: 90;
}
.section-anchors a {
    font-size: 0.8rem;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s;
    white-space: nowrap;
}
.section-anchors a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* MAIN CONTENT */
.learn-body {
    max-width: 820px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}

/* SECTION BLOCKS */
.learn-section {
    margin-bottom: 3rem;
    scroll-margin-top: 110px;
}
.learn-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

/* PREREQUISITES */
.prereq-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.prereq-chips span {
    background: var(--tag-bg);
    color: var(--tag-color);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 20px;
}

/* ARCHITECTURE */
.arch-diagram {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
}
.arch-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.node {
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    white-space: nowrap;
}
.node.secondary {
    background: var(--accent);
}
.node.tertiary {
    background: #2e8b57;
}
.arrow {
    color: var(--text-muted);
    font-size: 1rem;
}
.arch-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}
.arch-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.arch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.arch-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
    font-weight: 500;
}

/* TUTORIAL STEPS */
.steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.step {
    display: flex;
    gap: 1.25rem;
}
.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--step-bg);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.step-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--primary);
}
.step-content p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.step-content code {
    display: block;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-family: 'Courier New', monospace;
    margin-top: 0.6rem;
    white-space: pre;
    overflow-x: auto;
    color: #333;
    line-height: 1.5;
}

/* KEY LEARNINGS */
.learnings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.learning-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
}
.learning-item i {
    color: var(--accent);
    font-size: 0.9rem;
    margin-top: 2px;
    flex-shrink: 0;
}

/* RESOURCES */
.resources {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.resource-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
    transition: border-color 0.2s, color 0.2s;
}
.resource-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.resource-link i { color: var(--accent); font-size: 1rem; }

/* CTA FOOTER */
.learn-cta {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
}
.learn-cta p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}
.cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 11px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
    background: transparent;
    color: var(--primary);
    padding: 11px 28px;
    border-radius: 6px;
    border: 1.5px solid var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

/* OVERVIEW PROSE */
.overview-text p {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.75;
}
.overview-text p:last-child { margin-bottom: 0; }

/* RESPONSIVE */
@media (max-width: 600px) {
    .learn-hero { padding: 2rem 1.25rem 1.75rem; }
    .learn-body { padding: 1.75rem 1.25rem 3rem; }
    .section-anchors { padding: 0.6rem 1.25rem; top: 48px; }
    .learn-nav { padding: 0.75rem 1.25rem; }
    .cta-buttons { flex-direction: column; align-items: stretch; }
    .btn-primary, .btn-secondary { justify-content: center; }
}

/* THEME TOGGLE BUTTON */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    appearance: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.25); }

/* DARK MODE */
body.dark-mode {
    --bg: #10131c;
    --card-bg: #191d2b;
    --text: #e6e6e6;
    --text-muted: #9aa0ac;
    --border: #2a2e3a;
    --code-bg: #0e1118;
    --tag-bg: #14321f;
    --tag-color: #5fd99a;
}
body.dark-mode .learn-section h2 { color: var(--accent-light); }
body.dark-mode .step-content h3 { color: #ffffff; }
body.dark-mode .step-content code { color: #d6d6d6; }
body.dark-mode .btn-secondary { color: #ffffff; border-color: rgba(255, 255, 255, 0.45); }
body.dark-mode .btn-secondary:hover { background: var(--accent); border-color: var(--accent); }
