/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
    --bg: #faf8f5;
    --surface: #ffffff;
    --text: #2c2416;
    --muted: #8a7d6d;
    --border: #ece4d8;
    --accent: #c45c26;
    --accent-soft: #f5ebe3;
    --sans: "Source Sans 3", -apple-system, system-ui, sans-serif;
    --mono: ui-monospace, "Cascadia Code", monospace;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(44, 36, 22, 0.04), 0 6px 16px rgba(44, 36, 22, 0.06);
    --shadow-hover: 0 2px 4px rgba(44, 36, 22, 0.05), 0 10px 28px rgba(44, 36, 22, 0.10);
    --sidebar-w: 15rem;
    --content-max: 42rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1612;
        --surface: #242019;
        --text: #ede8e0;
        --muted: #9a9088;
        --border: #3d3530;
        --accent: #e07a3a;
        --accent-soft: #2e241c;
        --shadow: none;
        --shadow-hover: none;
    }
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
    scrollbar-gutter: stable;
}

body {
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

h1, h2, h3 { letter-spacing: -0.015em; }

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: 4rem;
    max-width: 68rem;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 100vh;
}

main {
    max-width: var(--content-max);
    padding: 3.5rem 0 7rem;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 3.5rem 0 2rem;
    max-height: 100vh;
}

.sidebar-identity {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--text);
}

.sidebar-identity:hover { color: var(--accent); }

.avatar {
    flex-shrink: 0;
    border-radius: 22px;
    background: var(--accent-soft);
}

.site-name {
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-bio {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    margin-left: -0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--muted);
}

.sidebar-nav a:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.sidebar-nav .ext {
    font-size: 0.8em;
    opacity: 0.7;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--muted);
}

.sidebar-footer a { color: var(--muted); font-weight: 500; }
.sidebar-footer a:hover { color: var(--accent); }

/* ==========================================================================
   Hero (home)
   ========================================================================== */

.hero {
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.hero-bio {
    color: var(--muted);
    font-size: 1.0625rem;
    max-width: 36rem;
}

.hero-currently {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Stack / skills (home)
   ========================================================================== */

.stack {
    margin-bottom: 3rem;
}

.stack > h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pill {
    font-size: 0.8125rem;
    padding: 0.35em 0.85em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
}

/* ==========================================================================
   Bento grid (featured projects)
   ========================================================================== */

.bento {
    margin-bottom: 3rem;
}

.bento > h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
    gap: 1rem;
}

.bento-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
    color: var(--text);
}

.bento-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.bento-name {
    font-weight: 700;
    font-size: 1.0625rem;
}

.bento-stars {
    font-size: 0.8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bento-desc {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
    flex: 1;
}

.bento-tag {
    align-self: flex-start;
    font-size: 0.75rem;
    padding: 0.2em 0.6em;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-weight: 600;
}

/* ==========================================================================
   Post cards (dev log)
   ========================================================================== */

.posts > h1,
.posts > h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.posts-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.posts-head h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0;
}

.posts-head .all-posts {
    margin-top: 0;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.section-desc {
    color: var(--muted);
    margin: -0.75rem 0 1.5rem;
}

.card-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
    color: var(--text);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.card-meta time { font-variant-numeric: tabular-nums; }

.card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
}

.card:hover h3 { color: var(--accent); }

.card-desc {
    font-size: 0.9375rem;
    color: var(--muted);
    margin-top: 0.35rem;
}

.all-posts {
    display: inline-block;
    margin-top: 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Tags */

.tag {
    font-size: 0.75rem;
    padding: 0.2em 0.6em;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-weight: 600;
}

.term-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.term-list a {
    display: inline-block;
    padding: 0.35em 0.9em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.term-list a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ==========================================================================
   Article
   ========================================================================== */

.article h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.meta {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.back {
    margin-top: 3.5rem;
    font-size: 0.9375rem;
}

.back a { color: var(--muted); font-weight: 600; }
.back a:hover { color: var(--accent); }

/* ==========================================================================
   Prose
   ========================================================================== */

.prose {
    font-size: 1.0625rem;
    line-height: 1.75;
}

.prose h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 2.25rem 0 0.75rem;
}

.prose h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 1.75rem 0 0.5rem;
}

.prose p { margin-bottom: 1.25rem; }

.prose ul, .prose ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.prose li { margin-bottom: 0.4rem; }

.prose blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.25rem;
    color: var(--muted);
    margin: 1.5rem 0;
    font-style: italic;
}

.prose pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.prose code {
    font-family: var(--mono);
    font-size: 0.88em;
}

.prose p code, .prose li code {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose a:hover { color: var(--text); }

.prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.prose strong { font-weight: 700; }

.prose img { max-width: 100%; border-radius: var(--radius-sm); }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.pagination a { color: var(--muted); }
.pagination a:hover { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 820px) {
    .layout {
        display: block;
        padding: 0 1.25rem;
    }

    .sidebar {
        position: static;
        max-height: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem 1.25rem;
        padding: 1.25rem 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar .avatar { width: 40px; height: 40px; border-radius: 14px; }
    .site-name { font-size: 1.125rem; }

    .sidebar-bio,
    .sidebar-footer { display: none; }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sidebar-nav a { margin-left: 0; padding: 0.35rem 0.6rem; }

    main { padding: 2.5rem 0 7rem; }
}

@media (max-width: 480px) {
    .card { padding: 1rem 1.1rem; }
    .article h1 { font-size: 1.625rem; }
    .posts > h1, .posts > h2 { font-size: 1.3rem; }
}
