/* bashtutorial.domainreviews.org */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-dim: #166534;
    --bg: #09090b;
    --surface: #18181b;
    --surface-hover: #27272a;
    --border: #27272a;
    --border-light: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --beginner: #22c55e;
    --intermediate: #f59e0b;
    --advanced: #ef4444;
    --code-bg: #1e1e2e;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
.site-header {
    border-bottom: 1px solid var(--border);
    height: 3.5rem;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: var(--accent);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #000;
    font-family: var(--font-mono);
    font-weight: 900;
}

.logo span { color: var(--accent); }

.header-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.progress-bar-mini {
    width: 120px;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-mini-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.hero h1 span { color: var(--accent); }

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-terminal {
    display: inline-block;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent);
    text-align: left;
}

.hero-terminal .prompt { color: var(--text-muted); }
.hero-terminal .cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ── Stats ── */
.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 0 2rem 3rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Section headers ── */
.section-title {
    padding: 2rem 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
}

.section-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title h2 .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-beginner { background: rgba(34, 197, 94, 0.15); color: var(--beginner); }
.badge-intermediate { background: rgba(245, 158, 11, 0.15); color: var(--intermediate); }
.badge-advanced { background: rgba(239, 68, 68, 0.15); color: var(--advanced); }

/* ── Collapsible sections ── */
.section-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-toggle::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 7px solid var(--text-muted);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.section-toggle.open::before {
    transform: rotate(90deg);
}

/* ── Lesson Grid ── */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    padding: 0 2rem 0;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding-bottom 0.4s ease;
}

.lesson-grid.expanded {
    max-height: 3000px;
    opacity: 1;
    padding-bottom: 2rem;
}

.lesson-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s, transform 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.lesson-card:hover {
    border-color: var(--accent-dim);
    transform: translateY(-2px);
}

.lesson-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lesson-number {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.lesson-status {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.lesson-status.completed {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.lesson-status.in-progress {
    border-color: var(--intermediate);
    color: var(--intermediate);
}

.lesson-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.lesson-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.lesson-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.lesson-topics {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.topic-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    color: var(--text-muted);
}

/* ── Lesson Page Layout ── */
html:has(.lesson-page) {
    height: 100dvh;
    overflow: hidden;
}

html:has(.lesson-page) body {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lesson-page {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.lesson-content {
    overflow-y: auto;
    padding: 2rem;
    border-right: 1px solid var(--border);
}

.lesson-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.lesson-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.lesson-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.lesson-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.lesson-nav a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Command info boxes */
.cmd-box {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.cmd-box-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cmd-box code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.cmd-box pre {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
}

/* Inline code */
code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
    color: var(--accent);
}

pre code {
    background: none;
    padding: 0;
}

/* Exercise blocks */
.exercise {
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid var(--accent-dim);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.exercise-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.exercise-cmd {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: var(--code-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.35rem;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.exercise-cmd:hover {
    border-color: var(--accent-dim);
}

.exercise-cmd .copy-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--font-sans);
}

.exercise p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.hint-toggle {
    font-size: 0.8rem;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
    margin-top: 0.5rem;
}

.hint-toggle:hover { color: var(--text-muted); }

.hint-text {
    display: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-radius: 0.35rem;
}

.hint-text.visible { display: block; }

/* Terminal panel */
.terminal-panel {
    display: flex;
    flex-direction: column;
    background: #000;
    min-height: 0;
}

.terminal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.terminal-toolbar-title {
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.terminal-toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-terminal {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 0.35rem;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-terminal:hover {
    border-color: var(--accent-dim);
    color: var(--text);
}

#terminal-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#terminal-container .xterm {
    height: 100%;
    padding: 4px;
}

.terminal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Quiz */
.quiz-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--accent-dim);
}

.quiz-section h2 {
    border: none;
    padding-top: 0;
    margin-top: 0;
}

.quiz-question {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin: 1rem 0;
}

.quiz-question p {
    color: var(--text);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.quiz-option:hover {
    border-color: var(--accent-dim);
    background: rgba(34, 197, 94, 0.05);
}

.quiz-option.correct {
    border-color: var(--beginner);
    background: rgba(34, 197, 94, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--advanced);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.quiz-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.quiz-option.correct .quiz-radio {
    border-color: var(--beginner);
    background: var(--beginner);
}

.quiz-option.incorrect .quiz-radio {
    border-color: var(--advanced);
    background: var(--advanced);
}

.quiz-explanation {
    display: none;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.quiz-explanation.visible { display: block; }

.quiz-score {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-top: 1.5rem;
    display: none;
}

.quiz-score.visible { display: block; }

.quiz-score-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
}

/* ── Lesson badge & bottom nav (avoid inline styles) ── */
.lesson-badge-line {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.badge-sm {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

.lesson-nav-bottom {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.loading-subtext {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.quiz-score-text {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .stats { gap: 1.5rem; }
    .lesson-grid { grid-template-columns: 1fr; padding-left: 1rem; padding-right: 1rem; }
    .lesson-grid.expanded { padding-bottom: 1.5rem; }
    .section-title { padding: 1.5rem 1rem 0.75rem; }

    .lesson-page {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .lesson-content { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 1rem; }
    .site-header { padding: 0 1rem; }
    .stats { flex-direction: column; gap: 1rem; }
}
