/* ═══════════════════════════════════════════════════
   Basics Tutorial — Chapter Page Styles
   Used by all chapter HTML files.
   ═══════════════════════════════════════════════════ */

/* ── Top Bar ─────────────────────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar .back {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.topbar .back:hover {
    color: var(--accent-hover);
}

.topbar .chapter-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

/* ── Content Area ────────────────── */
.content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
    flex: 1;
    width: 100%;
}

.content h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2.2rem 0 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.content p {
    margin-bottom: 1rem;
}

.content ul,
.content ol {
    margin: 0 0 1.2rem 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}

/* ── Summary Box ──────────────────── */
.summary {
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.25rem 1.5rem;
    margin: 2.5rem 0 0;
}

.summary h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.summary p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.summary ul {
    margin-bottom: 0;
}

/* ── Bottom Navigation ───────────── */
.bottom-nav {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.bottom-nav a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.bottom-nav a:hover {
    color: var(--accent-hover);
}

.bottom-nav .disabled {
    color: var(--border);
    pointer-events: none;
}

.bottom-nav .center {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ── Inline Code ─────────────────── */
.content code {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── Code Blocks ─────────────────── */
.content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.5rem;
    overflow-x: auto;
    line-height: 1.6;
}

.content pre code {
    background: none;
    color: var(--text);
    padding: 0;
    border-radius: 0;
    font-size: 0.85rem;
}

/* ── Tables ──────────────────────── */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

.content th,
.content td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.content th {
    font-weight: 700;
    color: var(--text);
    background: var(--accent-light);
}

.content tr:hover td {
    background: var(--accent-light);
}

/* ── Tip Box ─────────────────────── */
.content .tip {
    background: #ecfdf5;
    border-left: 4px solid #10b981;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    color: #065f46;
}

.content .tip strong {
    color: #059669;
}

[data-theme="dark"] .content .tip {
    background: #064e3b;
    border-left-color: #34d399;
    color: #d1fae5;
}

[data-theme="dark"] .content .tip strong {
    color: #6ee7b7;
}

[data-theme="sepia"] .content .tip {
    background: #e8dcc8;
    border-left-color: #5a8a3c;
    color: #3a5a2a;
}

[data-theme="sepia"] .content .tip strong {
    color: #4a7a30;
}

[data-theme="forest"] .content .tip {
    background: #1a3a2a;
    border-left-color: #5cb85c;
    color: #c8e6c9;
}

[data-theme="forest"] .content .tip strong {
    color: #81c784;
}

[data-theme="ocean"] .content .tip {
    background: #0a2a3a;
    border-left-color: #5bc0de;
    color: #b3e5fc;
}

[data-theme="ocean"] .content .tip strong {
    color: #81d4fa;
}

[data-theme="sunset"] .content .tip {
    background: #3a1a2a;
    border-left-color: #f0ad4e;
    color: #fce4d6;
}

[data-theme="sunset"] .content .tip strong {
    color: #ffab91;
}

/* ── Warning Box ─────────────────── */
.content .warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    color: #92400e;
}

.content .warning strong {
    color: #d97706;
}

[data-theme="dark"] .content .warning {
    background: #451a03;
    border-left-color: #fbbf24;
    color: #fef3c7;
}

[data-theme="dark"] .content .warning strong {
    color: #fcd34d;
}

[data-theme="sepia"] .content .warning {
    background: #f0dcc0;
    border-left-color: #b08030;
    color: #6b4020;
}

[data-theme="sepia"] .content .warning strong {
    color: #8a5a2a;
}

[data-theme="forest"] .content .warning {
    background: #2a2a1a;
    border-left-color: #d4a017;
    color: #f0e0a0;
}

[data-theme="forest"] .content .warning strong {
    color: #e6c860;
}

[data-theme="ocean"] .content .warning {
    background: #1a2a2a;
    border-left-color: #f0ad4e;
    color: #fde0b0;
}

[data-theme="ocean"] .content .warning strong {
    color: #ffcc80;
}

[data-theme="sunset"] .content .warning {
    background: #3a2a1a;
    border-left-color: #ff8a65;
    color: #ffe0d0;
}

[data-theme="sunset"] .content .warning strong {
    color: #ffab91;
}

/* ── Mark / Highlight ────────────── */
.content mark {
    background: #fef08a;
    color: #1a1a2e;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

[data-theme="dark"] .content mark {
    background: #854d0e;
    color: #fef3c7;
}

/* ── Responsive ──────────────────── */
@media (max-width: 640px) {
    .content {
        padding: 1.5rem 1rem 2rem;
    }

    .content h1 {
        font-size: 1.6rem;
    }
}

/* Reading surface aligned with the TypeScript-100 documentation pages. */
.content { max-width: 920px; padding: 3.25rem clamp(1.25rem, 5vw, 4.5rem) 4rem; line-height: 1.85; }
.content h1 { color: #172554; font-size: clamp(1.8rem, 4vw, 2.35rem); letter-spacing: -.04em; padding-bottom: 1rem; border-bottom: 1px solid #e2e8f0; }
.content h2 { color: #172554; border-left: 4px solid #3451b2; border-bottom: 0; background: linear-gradient(90deg, #e8edff, transparent); border-radius: 5px; padding: .55rem .8rem; margin-top: 2.4rem; }
.content h3 { color: #334155; border-left: 3px solid #7c8edb; background: #f8fafc; border-radius: 4px; padding: .45rem .7rem; }
.content p, .content li { color: #465569; }
.content strong { color: #9a3412; }
.content code:not(pre code) { color: #a23b2a; background: #fff1ed; border: 1px solid #fed7cc; }
.content pre { background: #172033; border-color: #273451; border-radius: 9px; box-shadow: 0 10px 25px rgba(15, 23, 42, .12); }
.content table { background: #fff; border: 1px solid #e2e8f0; }
.content th { background: #f8fafc; color: #334155; }
.content th, .content td { border-color: #e2e8f0; }
.content .tip, .content .warning { border-radius: 8px; box-shadow: none; }
.bottom-nav { max-width: 920px; padding-bottom: 3.5rem; }
