/* ═══════════════════════════════════════════════════
   Basics Tutorial — Homepage Styles
   Sidebar + Main Content two-column layout
   ═══════════════════════════════════════════════════ */

/* ── Layout Shell ────────────────── */
.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────── */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 0 1rem 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header a {
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
}

.sidebar-header a:hover {
    color: var(--accent);
}

/* ── Volume Groups ───────────────── */
.vol-group {
    border-bottom: 1px solid var(--border);
}

.vol-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 0.7rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.vol-toggle:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.vol-toggle .arrow {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    flex-shrink: 0;
    border-radius: 8px;
    cursor: pointer;
}

.vol-toggle:hover .arrow {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .vol-toggle:hover .arrow {
    background: rgba(255, 255, 255, 0.08);
}

.vol-toggle.open .arrow {
    transform: rotate(90deg);
}

.vol-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 0.1rem;
}

.vol-name {
    flex: 1;
}

/* ── Chapter List ────────────────── */
.chapter-list {
    display: none;
    list-style: none;
    padding: 0 0 0.4rem 0;
    background: var(--bg);
}

.chapter-list.open {
    display: block;
}

.chapter-list li {
    margin: 0;
}

.chapter-list a {
    display: block;
    padding: 0.45rem 1rem 0.45rem 3rem;
    text-decoration: none;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: background 0.12s ease, color 0.12s ease;
    border-left: 2px solid transparent;
}

.chapter-list a:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-left-color: var(--accent);
}

.chapter-list a.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}

/* ── Main Content Area ───────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Hero (compact) ──────────────── */
.hero {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.hero-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
}

/* ── Volume Cards Grid ───────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    flex: 1;
    width: 100%;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.vol-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* ── Volume Card ─────────────────── */
.vol-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.vol-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.vol-card .vol-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.vol-card:hover .vol-badge {
    background: var(--accent);
    color: #fff;
}

.vol-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.vol-card .vol-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.vol-card .vol-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
}

/* ── Mobile Sidebar Toggle ───────── */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* ── Sidebar Overlay (mobile) ────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 50;
}

/* ── Responsive ──────────────────── */
@media (max-width: 1024px) {
    .vol-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -340px;
        top: 0;
        bottom: 0;
        z-index: 60;
        transition: left 0.25s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .vol-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        padding: 2rem 1rem 1rem;
        padding-left: 3.5rem;
    }

    .container {
        padding: 0 1rem 2rem;
    }
}

@media (max-width: 480px) {
    .vol-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 1.5rem 1rem 1rem;
        padding-left: 3rem;
    }

    .hero h1 {
        font-size: 1.4rem;
    }
}

/* Portal layout overrides. */
.sidebar {
    width: 288px;
    min-width: 288px;
    background: #f1f4f8;
    border-right: 1px solid #e2e8f0;
    padding: 1.25rem .75rem;
    scroll-behavior: auto;
}
.sidebar.is-initializing { visibility: hidden; }
.sidebar-header { padding: .35rem .75rem 1.2rem; margin-bottom: .8rem; border-bottom: 1px solid #e2e8f0; }
.sidebar-header::before { content: 'C++23  /  REFERENCE'; display: block; margin: 0 0 .65rem .15rem; color: #3451b2; font: 700 .68rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; }
.sidebar-header a { display: block; color: #172554; border-left: 3px solid #3451b2; padding-left: .8rem; font-size: 1.05rem; line-height: 1.45; letter-spacing: -.02em; }
.sidebar-header a:hover { color: #3451b2; }
.vol-group { border-bottom: 0; margin: .15rem 0; }
.vol-toggle { padding: .68rem .75rem; gap: .6rem; border-radius: 8px; color: #334155; }
.vol-toggle:hover { background: #e8edff; color: #3451b2; }
.vol-toggle .arrow { width: 20px; height: 20px; font-size: .62rem; }
.chapter-list { background: transparent; padding: .15rem 0 .55rem; }
.chapter-list a { color: #526174; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; margin: 1px 0; padding: .46rem .75rem .46rem 2.35rem; }
.chapter-list a:hover, .chapter-list a.active { background: #e8edff; color: #3451b2; border-left-color: #3451b2; }
.main-content { background: #fff; }
.hero { position: relative; text-align: left; padding: 4.5rem clamp(2rem, 7vw, 5rem) 3.2rem; background: #111827; color: #f8fafc; overflow: hidden; }
.hero::before { content: 'C++23  ·  PRACTICAL GUIDE'; display: block; margin-bottom: 1.1rem; color: #93c5fd; font: 700 .72rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.hero::after { content: '01'; position: absolute; right: clamp(2rem, 8vw, 7rem); bottom: -1.4rem; color: rgba(147, 197, 253, .12); font: 800 11rem/.8 Georgia, serif; letter-spacing: -.12em; }
.hero-icon { display: none; }
.hero h1 { color: #f8fafc; font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.06em; }
.hero .subtitle { margin: 1rem 0 0; max-width: 720px; color: #cbd5e1; line-height: 1.8; }
.container { max-width: 1120px; padding: 2.5rem 2rem 4rem; }
.section-title { color: #172554; margin-bottom: 1.2rem; }
.section-title::after { background: #e2e8f0; }
.vol-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.vol-card { border-color: #e2e8f0; border-radius: 10px; box-shadow: none; padding: 1.35rem 1.35rem; align-items: flex-start; text-align: left; }
.vol-card:hover { transform: none; background: #f8fbff; border-color: #93c5fd; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.vol-card .vol-badge { width: 38px; height: 38px; border-radius: 8px; font-size: .9rem; }
.vol-card h3 { font-size: 1rem; }
.footer { background: #fff; color: #64748b; border-top-color: #e2e8f0; }
@media (max-width: 768px) {
    .hero { padding: 2.5rem 1.25rem 2rem; padding-left: 3.5rem; }
    .container { padding: 2rem 1rem 3rem; }
    .vol-grid { grid-template-columns: 1fr; }
}
