/* ===== TUTORIAL PAGE — shared styles ===== */

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

html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* ── Top bar ─────────────────────────────────────── */
.tut-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(10, 14, 30, 0.96);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 200;
}

.tut-back {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    transition: color 0.2s;
}
.tut-back:hover { color: var(--teal); }

.tut-topbar__sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
}

.tut-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-3);
}

.tut-breadcrumb a {
    color: var(--text-2);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}
.tut-breadcrumb a:hover { color: var(--gold-light); }

.tut-breadcrumb .sep { color: var(--text-3); }
.tut-breadcrumb .current { color: var(--text); }

/* ── Layout ──────────────────────────────────────── */
.tut-layout {
    display: flex;
    height: 100vh;
    padding-top: 52px;
}

/* ── Sidebar ─────────────────────────────────────── */
.tut-sidebar {
    width: 240px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tut-sidebar__header {
    padding: 18px 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-s);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--bg-alt);
    z-index: 1;
}

.tut-sidebar__icon { font-size: 1.25rem; }

.tut-sidebar__title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

/* Chapter accordion */
.tut-chapter { border-bottom: 1px solid var(--border-s); }

.tut-chapter-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 14px 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    text-align: left;
    gap: 8px;
    transition: color 0.2s, background 0.2s;
}

.tut-chapter-toggle:hover {
    color: var(--text);
    background: var(--bg-card);
}

.tut-chapter-toggle.open { color: var(--text); }

.tut-chapter-arrow {
    font-size: 0.75rem;
    color: var(--text-3);
    transition: transform 0.2s var(--ease);
    flex-shrink: 0;
}

.tut-chapter-toggle.open .tut-chapter-arrow { transform: rotate(90deg); }

/* Lesson list */
.tut-lessons {
    list-style: none;
    display: none;
    padding: 2px 0 6px;
}

.tut-chapter.open .tut-lessons { display: block; }

.tut-lesson-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 16px 7px 26px;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-2);
    cursor: pointer;
    text-align: left;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    line-height: 1.4;
}

.tut-lesson-btn:hover {
    color: var(--text);
    background: rgba(139, 124, 248, 0.05);
}

.tut-lesson-btn.active {
    color: var(--gold-light);
    border-left-color: var(--gold);
    background: var(--gold-dim);
    font-weight: 600;
}

/* ── Main content ────────────────────────────────── */
.tut-main {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Hero banner */
.tut-hero {
    background: linear-gradient(120deg, var(--bg-2) 0%, var(--bg-alt) 70%);
    border-bottom: 1px solid var(--border);
    padding: 52px 48px;
    display: flex;
    align-items: center;
    gap: 40px;
    position: relative;
    overflow: hidden;
    min-height: 210px;
}

.tut-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 80% 50%, var(--amber-dim) 0%, transparent 55%),
        radial-gradient(ellipse at 10% 80%, var(--gold-dim) 0%, transparent 50%);
}

.tut-hero__content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.tut-hero__title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.1;
}

.tut-hero__sub {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.7;
    max-width: 500px;
}

.tut-hero__emoji {
    position: absolute;
    right: 8%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 6rem;
    opacity: 0.18;
    z-index: 0;
    filter: blur(1px);
}

/* ── Lesson content ──────────────────────────────── */
.tut-content-wrap {
    padding: 44px 48px 72px;
    max-width: 860px;
}

.tut-lesson-page { display: none; }
.tut-lesson-page.active { display: block; }

.tut-lesson-page h2 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-s);
}

.tut-lesson-page h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 36px;
    margin-bottom: 10px;
}

.tut-lesson-page p {
    font-size: 0.93rem;
    color: var(--text-2);
    line-height: 1.88;
    margin-bottom: 14px;
}

.tut-lesson-page ul,
.tut-lesson-page ol {
    padding-left: 22px;
    margin-bottom: 16px;
}

.tut-lesson-page li {
    font-size: 0.93rem;
    color: var(--text-2);
    line-height: 1.88;
    margin-bottom: 6px;
}

.tut-lesson-page li strong { color: var(--text); }

.tut-lesson-page strong { color: var(--text); }

/* Inline code */
.tut-lesson-page code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: var(--bg-2);
    border: 1px solid var(--border-s);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--gold-light);
}

/* Code block */
.tut-code-block {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px 22px;
    margin: 18px 0;
    overflow-x: auto;
    position: relative;
}

.code-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-3);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-s);
}

.tut-code-block pre {
    font-family: var(--font-mono);
    font-size: 0.83rem;
    color: #c8cde8;
    line-height: 1.8;
    white-space: pre;
    tab-size: 2;
}

/* Syntax token colours — applied manually with span.t-* */
.t-kw { color: var(--gold-light); }       /* keyword: const, let, function */
.t-fn { color: var(--teal); }             /* function name */
.t-str { color: #86efac; }               /* strings */
.t-num { color: var(--amber); }          /* numbers */
.t-cm { color: var(--text-3); }          /* comments */
.t-op { color: var(--rose); }            /* operators/punctuation */
.t-out { color: var(--green); }          /* console output */

/* Callout box */
.tut-callout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--gold-dim);
    border: 1px solid rgba(139, 124, 248, 0.22);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin: 20px 0;
}

.tut-callout__icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.tut-callout p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-2);
}

/* Note / tip box */
.tut-note {
    background: rgba(56, 189, 248, 0.07);
    border-left: 3px solid var(--teal);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding: 12px 16px;
    margin: 16px 0;
}

.tut-note p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-2);
}

/* Prev / Next navigation */
.tut-lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-s);
    gap: 12px;
}

.tut-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--r-md);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-2);
    transition: all 0.2s var(--ease);
    text-decoration: none;
}

.tut-nav-btn:hover {
    border-color: var(--border-h);
    color: var(--text);
    background: var(--bg-card-h);
}

.tut-nav-btn--next {
    background: linear-gradient(135deg, var(--gold) 0%, #6d5dfc 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px var(--gold-glow);
}

.tut-nav-btn--next:hover {
    filter: brightness(1.1);
    transform: translateX(2px);
    box-shadow: 0 6px 22px var(--gold-glow);
}

/* Coming-soon lesson stub */
.lesson-stub {
    text-align: center;
    padding: 64px 20px;
}

.lesson-stub__icon { font-size: 3rem; display: block; margin-bottom: 18px; }

.lesson-stub h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    margin-top: 0;
}

.lesson-stub p {
    color: var(--text-2);
    font-size: 0.9rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .tut-sidebar { width: 200px; }
    .tut-content-wrap { padding: 32px 28px 60px; }
    .tut-hero { padding: 40px 28px; }
}

@media (max-width: 680px) {
    .tut-layout { flex-direction: column; }

    .tut-sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .tut-main { height: 50vh; }
    .tut-hero { min-height: auto; padding: 28px 20px; }
    .tut-hero__emoji { display: none; }
    .tut-content-wrap { padding: 24px 20px 48px; }
}
