:root {
    --bg-primary: #313131;
    --bg-secondary: #313131;
    --text-primary: #e2e8f0;
    --text-secondary: #f8fafc;
    --code-inline-bg: #2d3748;
    --code-block-bg: #17191d;
    --border-color: #4a6860;
    --link-color: #60fa64;
    --keyword-color: #c678dd;
    --string-color: #98c379;
    --comment-color: #7f848e;
    --function-color: #61afef;
    --nav-bg: #1e1e1e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ── Navigation ───────────────────────────────────────────── */
nav {
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
}

.nav-brand {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--link-color);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nav-links li a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: var(--border-color);
    color: var(--text-secondary);
}

/* ── Page container ────────────────────────────────────────── */
.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 0 0 8px 8px;
}

/* ── Typography ────────────────────────────────────────────── */
h1 {
    font-size: 2.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-family: monospace;
}

h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

h3 {
    font-size: 1.15rem;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-family: monospace;
}

p, ul, ol { margin-bottom: 1rem; color: var(--text-primary); }
li { margin-bottom: 0.4rem; }

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

/* ── Code ──────────────────────────────────────────────────── */
code {
    font-family: Monaco, 'Courier New', monospace;
    font-size: 0.88em;
}

:not(pre) > code {
    background-color: var(--code-inline-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    color: var(--text-primary);
}

pre {
    background-color: var(--code-block-bg) !important;
    border-radius: 0.5rem;
    margin: 1rem 0;
    padding: 1rem 1.2rem;
    overflow-x: auto;
}

pre code { background: none; padding: 0; font-size: 0.85em; color: var(--string-color); }

/* ── Tables ────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.9rem;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

th {
    background-color: var(--code-block-bg);
    color: var(--text-secondary);
    font-family: monospace;
}

tr:nth-child(even) td { background-color: rgba(255,255,255,0.03); }

.blog-grid.blog-grid--2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.more-guides-section {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 0 0.3rem;
}

/* ── Article CTA ───────────────────────────────────────────── */
.article-cta {
    background: var(--code-block-bg);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--link-color);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    margin: 3rem 0 1rem;
}

.article-cta h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--link-color);
    border-bottom: none;
    padding-bottom: 0;
}

.article-cta p { margin-bottom: 0; }

.article-cta .preview-container {
    margin: 0;
}

/* ── Blog list (homepage) ──────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.blog-card {
    background: var(--code-block-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: border-color 0.2s;
    position: relative;
    cursor: pointer;
}

.blog-card:hover { border-color: var(--link-color); }

.blog-card h3 {
    margin-top: 0;
    font-size: 1rem;
}

.blog-card h3 a {
    color: var(--link-color);
    text-decoration: none;
}

/* stretch the title link to cover the entire card */
.blog-card h3 a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.blog-card p {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 0.5rem;
}

.blog-card .date {
    font-size: 0.75rem;
    color: #718096;
}

/* ── Article meta ──────────────────────────────────────────── */
.article-meta {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 1.5rem;
}

.article-site-header {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 0 0 1rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-family: monospace;
    line-height: 1.2;
}

/* ── Preview container (existing) ─────────────────────────── */
.preview-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.code-preview-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.preview-container .gumroad-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4CAF50 !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-weight: 500 !important;
    border: none !important;
    box-shadow: none !important;
    transition: background-color 0.2s !important;
}

.preview-container .gumroad-button:hover {
    background: #45a049 !important;
    color: white !important;
    text-decoration: none !important;
    opacity: 1 !important;
    transform: translate(-50%, -50%) !important;
}

/* ── Homepage menu demo (animated iframe) ─────────────────── */
.home-menu-demo {
    margin: 1.1rem 0 0.8rem;
    padding-top: 0.85rem;
}

.home-menu-demo__embed {
    display: block;
    width: 100%;
    height: 380px;
    border: 0;
    border-radius: 10px;
}

@media (max-width: 820px) {
    .more-guides-section .blog-grid--2col {
        grid-template-columns: 1fr;
    }
}

/* ── Feedback ──────────────────────────────────────────────── */
.feedback { display: block; margin-top: 200px; }
.feedback a {
    font-weight: bold;
    text-decoration: none;
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: var(--link-color) !important;
    border-top: 2px solid var(--border-color);
    padding-top: 0.5rem;
    font-family: monospace;
    opacity: 0.5;
}

.article-home-link-wrap {
    max-width: 900px;
    margin: 0.9rem auto 0;
    padding: 0 2rem;
}

.article-home-link {
    font-size: 0.9rem;
    font-family: monospace;
    color: var(--link-color);
    text-decoration: none;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--code-block-bg); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; border: 3px solid var(--code-block-bg); }
::-webkit-scrollbar-thumb:hover { background: #4a5568; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .container { padding: 1rem; }
    h1 { font-size: 1.6rem; }
    .nav-links { gap: 2px; }
    .nav-links li a { font-size: 0.75rem; padding: 3px 7px; }
    .article-home-link-wrap { padding: 0 1rem; }
    .blog-grid--2col { grid-template-columns: 1fr; }

    .home-menu-demo__embed {
        height: 320px;
    }
}
