/* ==========================================================================
   Steven Truong — Personal Site
   Single stylesheet. CSS custom properties for auto light/dark theming.
   ========================================================================== */

/* -- Theme ---------------------------------------------------------------- */

:root {
    --color-bg: #ffffff;
    --color-text: #222222;
    --color-text-secondary: #6b6b6b;
    --color-link: #222222;
    --color-link-hover: #555555;
    --color-border: #e5e5e5;
    --color-code-bg: #f5f5f5;
    --color-code-border: #e8e8e8;
    --color-blockquote-border: #d0d0d0;
    --color-blockquote-text: #4a4a4a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #111111;
        --color-text: #e0e0e0;
        --color-text-secondary: #999999;
        --color-link: #e0e0e0;
        --color-link-hover: #bbbbbb;
        --color-border: #2a2a2a;
        --color-code-bg: #1a1a1a;
        --color-code-border: #2a2a2a;
        --color-blockquote-border: #444444;
        --color-blockquote-text: #bbbbbb;
    }
}

/* -- Reset ---------------------------------------------------------------- */

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

/* -- Base ----------------------------------------------------------------- */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -- Layout --------------------------------------------------------------- */

body > header, main, footer {
    max-width: 640px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* -- Navigation ----------------------------------------------------------- */

body > header {
    padding-top: 32px;
    padding-bottom: 32px;
}

nav {
    display: flex;
    align-items: baseline;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.15s ease;
}

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

nav a.active {
    color: var(--color-text);
    font-weight: 600;
}

/* -- Blog post list (home page) ------------------------------------------- */

.post-list ul {
    list-style: none;
}

.post-list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    text-decoration: none;
    color: var(--color-text);
    gap: 16px;
}

.post-list a:hover .post-title {
    color: var(--color-link-hover);
}

.post-list .post-title {
    transition: color 0.15s ease;
}

.post-list time {
    color: var(--color-text-secondary);
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* -- Post header ---------------------------------------------------------- */

.post-header {
    margin-bottom: 28px;
}

.post-header h1 {
    font-size: 28px;
    line-height: 1.3;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.post-header time {
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* -- Page heading --------------------------------------------------------- */

.page h1 {
    font-size: 28px;
    line-height: 1.3;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

/* -- Content typography --------------------------------------------------- */

.post-content, .page-content {
    line-height: 1.6;
}

.post-content h2, .page-content h2 {
    font-size: 21px;
    margin-top: 36px;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.post-content h3, .page-content h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 16px;
}

.post-content h4, .page-content h4 {
    font-size: 16px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.post-content p, .page-content p {
    margin-bottom: 16px;
}

.post-content a, .page-content a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease;
}

.post-content a:hover, .page-content a:hover {
    color: var(--color-link-hover);
}

/* -- Lists ---------------------------------------------------------------- */

.post-content ul, .post-content ol,
.page-content ul, .page-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.post-content li, .page-content li {
    margin-bottom: 4px;
}

/* -- Blockquotes ---------------------------------------------------------- */

blockquote {
    border-left: 3px solid var(--color-blockquote-border);
    padding-left: 16px;
    color: var(--color-blockquote-text);
    margin-bottom: 16px;
    font-style: italic;
}

/* -- Code ----------------------------------------------------------------- */

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875em;
    background: var(--color-code-bg);
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid var(--color-code-border);
}

pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-code-border);
    padding: 16px 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
    line-height: 1.45;
}

pre code {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 14px;
}

/* -- Images --------------------------------------------------------------- */

.post-content img, .page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 16px;
}

/* -- Horizontal rule ------------------------------------------------------ */

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 32px 0;
}

/* -- Scheduled posts (hidden until publish date, revealed by JS) ---------- */

.scheduled { display: none; }

/* -- Footer --------------------------------------------------------------- */

footer {
    padding-top: 32px;
    padding-bottom: 32px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* -- Responsive ----------------------------------------------------------- */

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    body > header {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    nav {
        gap: 16px;
    }

    .nav-links {
        gap: 16px;
    }

    .post-header h1, .page h1 {
        font-size: 24px;
    }

    .post-list a {
        flex-direction: column;
        gap: 2px;
        padding: 8px 0;
    }

    .post-list time {
        font-size: 13px;
    }

    pre {
        padding: 14px;
        border-radius: 0;
        margin-left: -20px;
        margin-right: -20px;
        border-left: none;
        border-right: none;
    }
}
