@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/fonts/JetBrainsMono-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --bg: #1a1b26;
    --bg-alt: #15161e;
    --bg-hover: #1e2030;
    --fg: #cdd6f4;
    --fg-dim: #6c7086;
    --red: #f7768e;
    --green: #9ece6a;
    --yellow: #e0af68;
    --blue: #7aa2f7;
    --magenta: #bb9af7;
    --cyan: #7dcfff;
    --border: #565f89;
    --selection: #2e3c5f;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.6;
}

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

a:hover {
    color: var(--blue);
    text-decoration: underline;
}

a:visited {
    color: var(--magenta);
}

.terminal {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 960px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-top: none;
}

.terminal-header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    user-select: none;
}

.terminal-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dot { font-size: 12px; }
.dot-red { color: var(--red); }
.dot-yellow { color: var(--yellow); }
.dot-green { color: var(--green); }

.terminal-title {
    flex: 1;
    text-align: center;
    color: var(--fg-dim);
    font-size: 13px;
}

.terminal-spacer {
    width: 42px;
}

.terminal-menu {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.menu-item {
    padding: 6px 16px;
    color: var(--fg-dim);
    font-size: 13px;
    border-right: 1px solid var(--border);
    transition: background 0.15s;
}

.menu-item:hover {
    background: var(--bg-hover);
    color: var(--fg);
    text-decoration: none;
}

.menu-item.active {
    color: var(--green);
    background: var(--bg-alt);
}

.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    line-height: 1.7;
}

.terminal-footer {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 13px;
}

.footer-prompt {
    color: var(--fg);
}

.prompt-user { color: var(--green); }
.prompt-at { color: var(--fg-dim); }
.prompt-host { color: var(--cyan); }
.prompt-colon { color: var(--fg-dim); }
.prompt-path { color: var(--yellow); }
.prompt-sign { color: var(--fg); margin-left: 4px; }

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--fg);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

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

.section-title {
    color: var(--green);
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section-title .prompt-sign {
    color: var(--green);
    margin-right: 8px;
}

.subsection-title {
    color: var(--yellow);
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 12px;
    margin-top: 24px;
}

.home-section {
    margin-bottom: 32px;
}

.welcome-block p {
    margin-bottom: 8px;
    color: var(--fg);
}

.prompt-line {
    margin-top: 16px;
}

.series-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.series-card {
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    border-radius: 4px;
}

.series-card h3 {
    font-size: 15px;
    margin-bottom: 8px;
    font-weight: 400;
}

.series-card h3 a {
    color: var(--cyan);
}

.series-meta {
    font-size: 12px;
    color: var(--fg-dim);
}

.progress-bar {
    display: inline-block;
    width: 120px;
    height: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    vertical-align: middle;
    margin: 0 8px;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.3s;
}

.series-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.series-table th {
    text-align: left;
    color: var(--yellow);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

.series-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chapter-item {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 4px 0;
    font-size: 14px;
}

.chapter-date {
    color: var(--fg-dim);
    font-size: 12px;
    flex-shrink: 0;
    min-width: 80px;
}

.chapter-series {
    color: var(--fg-dim);
    font-size: 12px;
}

.chapter-series a {
    color: var(--fg-dim);
}

.chapters-ordered {
    padding-left: 24px;
}

.chapter-entry {
    padding: 4px 0;
    font-size: 14px;
}

.chapter-entry a {
    color: var(--fg);
}

.chapter-entry a:hover {
    color: var(--blue);
}

.chapter-pending {
    color: var(--fg-dim);
    font-style: italic;
}

.series-single {
    margin-bottom: 32px;
}

.series-title {
    font-size: 20px;
    font-weight: 400;
    color: var(--fg);
    margin-bottom: 16px;
}

.series-description {
    margin-bottom: 16px;
    color: var(--fg);
}

.series-description p {
    margin-bottom: 8px;
}

.series-progress-block {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--fg-dim);
    margin-bottom: 16px;
}

.series-prerequisites {
    margin-bottom: 16px;
    font-size: 13px;
}

.series-prerequisites ul {
    list-style: none;
    padding-left: 16px;
}

.series-prerequisites li::before {
    content: '> ';
    color: var(--yellow);
}

.chapter-article {
    margin-bottom: 32px;
}

.chapter-title {
    font-size: 20px;
    font-weight: 400;
    color: var(--fg);
    margin-bottom: 12px;
}

.chapter-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--fg-dim);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.tag {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--magenta);
}

.chapter-content {
    font-size: 14px;
    line-height: 1.8;
}

.chapter-content p {
    margin-bottom: 12px;
}

.chapter-content h2 {
    font-size: 17px;
    font-weight: 400;
    color: var(--yellow);
    margin-top: 28px;
    margin-bottom: 12px;
}

.chapter-content h3 {
    font-size: 15px;
    font-weight: 400;
    color: var(--cyan);
    margin-top: 24px;
    margin-bottom: 8px;
}

.chapter-content ul, .chapter-content ol {
    margin-bottom: 12px;
    padding-left: 24px;
}

.chapter-content li {
    margin-bottom: 4px;
}

.chapter-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 13px;
}

.chapter-content th {
    text-align: left;
    color: var(--yellow);
    padding: 6px 10px;
    border: 1px solid var(--border);
    font-weight: 400;
}

.chapter-content td {
    padding: 6px 10px;
    border: 1px solid var(--border);
}

.chapter-content pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}

.chapter-content pre::before {
    display: block;
    content: '$ cat ' attr(data-filename);
    color: var(--fg-dim);
    font-size: 11px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.chapter-content code {
    font-family: var(--font-mono);
    font-size: 13px;
}

.chapter-content p > code {
    background: var(--bg-alt);
    padding: 1px 4px;
    border-radius: 2px;
    color: var(--red);
}

.chapter-content blockquote {
    border-left: 3px solid var(--border);
    padding-left: 12px;
    margin-bottom: 12px;
    color: var(--fg-dim);
    font-style: italic;
}

.chapter-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.chapter-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 13px;
}

.chapter-navigation.top {
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.chapter-navigation.bottom {
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.nav-link {
    color: var(--cyan);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: background 0.15s;
    font-size: 12px;
}

.nav-link:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.nav-link.up {
    margin: 0 auto;
    color: var(--green);
}

.nav-spacer {
    flex: 1;
}

.chapter-comments {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.comments-placeholder {
    color: var(--fg-dim);
    font-size: 13px;
}

.month-title {
    color: var(--yellow);
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 8px;
    margin-top: 20px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--fg-dim);
}

@media (max-width: 768px) {
    .terminal {
        border: none;
        max-width: 100%;
    }

    .terminal-body {
        padding: 16px;
        font-size: 14px;
    }

    .terminal-menu {
        flex-wrap: wrap;
    }

    .menu-item {
        flex: 1;
        text-align: center;
        font-size: 12px;
        padding: 6px 8px;
    }

    .chapter-date {
        min-width: 60px;
    }

    .chapter-navigation {
        flex-wrap: wrap;
    }

    .series-table th, .series-table td {
        padding: 6px 8px;
    }
}
