/* ==========================================================================
   Fonts
   ========================================================================== */

@font-face {
    font-family: "IBM Plex Mono";
    src: url("/fonts/ibm-plex-mono.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
}

/* ==========================================================================
   Theme
   ========================================================================== */

:root {
    --bg-color: #f7f7f7;
    --heading-color: #1a1a1a;
    --text-color: #1a1a1a;
    --link-color: #1a1a1a;
    --link-border: rgba(26, 26, 26, 0.3);

    --text-body: #333;
    --text-muted: #555;
    --text-subtle: #666;
    --text-secondary: #777;
    --text-dim: #888;
    --text-faint: #999;
    --text-ghost: #bbb;
    --text-whisper: #ccc;

    --border-color: #ececec;
    --border-medium: #e0e0e0;
    --border-light: #e5e5e5;
    --border-faint: #e8e8e8;

    --surface-color: #efefef;
    --surface-border: #e2e2e2;
    --surface-code: #e6e4e1;
    --surface-code-border: #dbd8d4;
    --surface-code-text: #2a2a2a;
    --surface-code-block-text: #6b6870;
    --surface-inline: #eee;
    --surface-callout: color-mix(in oklch, var(--bg-color), black 5%);
    --surface-scrollbar: #d0d0d0;

    --accent-callout: #c9ada7;
    --highlight-bg: rgba(232, 210, 160, 0.4);

    --hljs-comment: #b5adb0;
    --hljs-keyword: #22223b;
    --hljs-string: #a67f77;
    --hljs-title: #4a4e69;
    --hljs-type: #7b5e82;
    --hljs-number: #c9ada7;
    --hljs-params: #6b6870;
    --hljs-punctuation: #9a8c98;
    --hljs-operator: #22223b;
    --hljs-meta: #7b5e82;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: oklch(19% 0.012 269);
        --heading-color: #ffffff;
        --text-color: #666666;
        --link-color: oklch(84% 0.012 269);
        --link-border: rgba(200, 200, 210, 0.3);

        --text-body: #aaa;
        --text-muted: #999;
        --text-subtle: #888;
        --text-secondary: #777;
        --text-dim: #666;
        --text-faint: #555;
        --text-ghost: #444;
        --text-whisper: #383838;

        --border-color: #2a2a2a;
        --border-medium: #333;
        --border-light: #2e2e2e;
        --border-faint: #2a2a2a;

        --surface-color: #1e1e22;
        --surface-border: #2a2a2e;
        --surface-code: #252528;
        --surface-code-border: #333336;
        --surface-code-text: rgba(120, 120, 200, 0.7);
        --surface-code-block-text: #a0a0a5;
        --surface-inline: #2a2a2e;
        --surface-callout: color-mix(in oklch, var(--bg-color), white 5%);
        --surface-scrollbar: #444;

        --accent-callout: rgba(120, 120, 200, 0.7);
        --highlight-bg: rgba(120, 120, 200, 0.4);

        --hljs-comment: #6b6870;
        --hljs-keyword: #c0c0d0;
        --hljs-string: #c9a7a0;
        --hljs-title: #9a9ab8;
        --hljs-type: #b08eb8;
        --hljs-number: #c9ada7;
        --hljs-params: #a0a0a5;
        --hljs-punctuation: #9a8c98;
        --hljs-operator: #c0c0d0;
        --hljs-meta: #b08eb8;
    }
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

body {
    margin: 0;
    background: var(--bg-color);
    color: var(--text-color);
    font-family:
        "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        monospace;
    font-size: 1rem;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

code {
    font-family:
        "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        monospace;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 3.5rem 5rem;
}

.page--wide {
    max-width: 1100px;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6rem;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.2s forwards;
}

.page--wide .top-bar {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 4rem;
    gap: 0.3rem;
}

.nav-home {
    font-size: 0.85rem;
    color: var(--text-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.nav-home:hover {
    color: var(--heading-color);
}

/* ==========================================================================
   Listing pages: headings, intro, section headings
   ========================================================================== */

h1 {
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin: 0 0 4rem 0;
    color: var(--heading-color);
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.3s forwards;
}

h2 {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 4rem 0 1.8rem 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-medium);
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.4s forwards;
}

h2:first-of-type {
    margin-top: 0;
}

.thoughts h2 {
    margin-top: 5rem;
}

.thoughts h2:first-of-type {
    margin-top: 0;
}

.intro {
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--text-subtle);
    margin: 0 0 4rem 0;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.35s forwards;
}

/* ==========================================================================
   Listing: shared item patterns
   ========================================================================== */

.post-list,
.project-list,
.tweet-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-item,
.project-item {
    margin-bottom: 0;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.5s forwards;
}

.post-item:last-child,
.project-item:last-child {
    border-bottom: none;
}

.post-link,
.project-link {
    display: block;
    transition: transform 0.2s ease;
}

.post-link:hover,
.project-link:hover {
    transform: translateX(4px);
}

/* Blog listing */

.post-title {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--heading-color);
    margin: 0;
}

.post-link:hover .post-title {
    color: var(--text-muted);
}

.post-summary {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin: 0.3rem 0 0 0;
}

/* Projects listing */

.project-name {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--heading-color);
    margin: 0;
}

.project-link:hover .project-name {
    color: var(--text-muted);
}

.project-meta {
    font-size: 0.75rem;
    color: var(--text-ghost);
    letter-spacing: 0.06em;
    margin: 0.2rem 0 0 0;
}

.project-summary {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin: 0.3rem 0 0 0;
}

/* Thoughts/tweets listing */

.tweet-item {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.5s forwards;
}

.tweet-item:first-child {
    padding-top: 0;
}

.tweet-item:last-child {
    border-bottom: none;
}

.tweet-text {
    margin: 0;
    padding: 0;
    border: none;
}

.tweet-text p {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0;
}

.tweet-text p code {
    font-size: 0.9em;
    background: var(--surface-inline);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.tweet-date {
    font-size: 0.7rem;
    color: var(--text-whisper);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: block;
}

/* ==========================================================================
   Outro & Page footer (listing pages)
   ========================================================================== */

.outro {
    color: var(--text-faint);
    font-size: 0.9rem;
    line-height: 1.75;
    letter-spacing: 0;
    margin: 5rem 0 0 0;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-light);
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.6s forwards;
}

.outro a {
    color: var(--text-faint);
    text-decoration: underline;
    text-decoration-color: var(--text-whisper);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.4s ease;
}

.outro a:hover {
    text-decoration-color: var(--text-faint);
}

.page-footer {
    margin-top: 5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.6s forwards;
}

.page-footer a {
    color: var(--text-faint);
    transition: color 0.2s ease;
}

.page-footer a:hover {
    color: var(--heading-color);
}

/* ==========================================================================
   Blog post: article layout
   ========================================================================== */

.post-body a {
    text-decoration: underline;
    text-decoration-color: var(--text-whisper);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.4s ease;
}

.post-body a:hover {
    text-decoration-color: var(--heading-color);
}

mark {
    background: none;
    color: inherit;
}

.highlight-stroke {
    position: absolute;
    background: var(--highlight-bg);
    filter: url(#highlighter);
    pointer-events: none;
}

/* Article grid */

article {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    column-gap: 2.5rem;
    align-items: start;
    margin-top: 8rem;
}

.author-col {
    grid-column: 1;
    grid-row: 1;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.4s forwards;
}

.title-col {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 4rem;
    gap: 0.3rem;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.4s forwards;
}

.date-col {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
    padding-top: 0.45rem;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.4s forwards;
}

.date-col time {
    font-size: 1rem;
    color: var(--text-faint);
}

/* Author column */

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.author-name {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--heading-color);
}

.author-role {
    font-size: 0.72rem;
    color: var(--text-faint);
    line-height: 1.5;
}

.post-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-ghost);
    margin-top: 2rem;
}

/* Title column */

.title-col h1 {
    font-size: 2.5rem;
    font-weight: 400;
    line-height: 1.25;
    margin: 0 0 1.25rem 0;
    color: var(--heading-color);
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Post body */

.post-body {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    grid-column: 2;
    max-width: 720px;
    min-width: 0;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.6s forwards;
}

.post-body p {
    font-size: 1.15rem;
    line-height: 1.85;
    margin: 0 0 1.75rem 0;
    color: var(--text-body);
}

.post-body p.lead {
    font-size: 1.3rem;
    line-height: 1.7;
    color: var(--heading-color);
}

.post-body h2 {
    font-family:
        "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        monospace; /* override post-body serif */
    font-weight: 400;
    font-size: 1.7rem;
    margin: 4rem 0 1.5rem 0;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-faint);
    color: var(--heading-color);
    letter-spacing: -0.01em;
    text-transform: none;
}

.post-body h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.post-body h2.conclusion {
    font-size: 1.85rem;
    border-top: 2px solid var(--border-medium);
}

/* Takeaway callout */

.post-body ul.takeaway {
    background: var(--surface-callout);
    border-left: 3px solid var(--accent-callout);
    padding: 1.5rem 1.5rem 1.5rem 2.5rem;
    border-radius: 2px;
    margin: 2rem 0;
}

.post-body ul.takeaway li {
    color: var(--heading-color);
    font-weight: 400;
}

.post-body ul.takeaway li::before {
    color: var(--accent-callout);
}

/* Footnotes */

.post-body sup a {
    background: var(--highlight-bg);
    padding: 0.1em 0.35em;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75em;
}

.post-body ol.footnotes {
    list-style: decimal;
    padding-left: 1.75rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.92rem;
    color: var(--text-muted);
}

.post-body ol.footnotes li {
    padding-left: 0.5rem;
    margin-bottom: 1rem;
}

.post-body ol.footnotes li::before {
    content: none;
}

/* Inline code */

.post-body :not(pre) > code {
    background: var(--surface-code);
    padding: 0.12em 0.4em;
    border-radius: 3px;
    font-size: 0.82em;
    color: var(--surface-code-text);
    border: 1px solid var(--surface-code-border);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Code blocks */

.post-body pre {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    padding: 1.5rem 1.75rem;
    margin: 2rem 0;
    overflow-x: auto;
    font-size: 0.95rem;
    line-height: 1.65;
    -webkit-overflow-scrolling: touch;
}

.post-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: var(--surface-code-block-text);
}

.post-body pre::-webkit-scrollbar {
    height: 5px;
}

.post-body pre::-webkit-scrollbar-track {
    background: var(--surface-color);
}

.post-body pre::-webkit-scrollbar-thumb {
    background: var(--surface-scrollbar);
    border-radius: 3px;
}

/* Lists */

.post-body ul {
    list-style: none;
    padding-left: 0;
    font-size: 1.15rem;
    margin: 0 0 1.75rem 0;
}

.post-body li {
    margin-bottom: 0.6rem;
    line-height: 1.85;
    padding-left: 1.75rem;
    position: relative;
    color: var(--text-body);
}

.post-body li::before {
    content: "\2014";
    position: absolute;
    left: 0;
    color: var(--text-ghost);
}

.post-body em {
    font-style: italic;
}

/* Sidebar label */

.sidebar-label {
    position: fixed;
    right: 2.5rem;
    top: 50%;
    writing-mode: vertical-rl;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-whisper);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.sidebar-arrow {
    font-size: 0.85rem;
    letter-spacing: 0;
}

/* Post footer (blog articles) */

.post-footer {
    grid-column: 2;
    max-width: 720px;
    margin: 5rem 0 0;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.8s forwards;
}

.post-footer p {
    color: var(--text-faint);
    line-height: 1.75;
    margin: 0 0 2.5rem 0;
    letter-spacing: 0;
    font-size: 0.9rem;
}

.post-footer p a {
    color: var(--text-faint);
    text-decoration: underline;
    text-decoration-color: var(--text-whisper);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.4s ease;
}

.post-footer p a:hover {
    text-decoration-color: var(--text-faint);
}

.post-footer > a {
    color: var(--text-faint);
    transition: color 0.2s ease;
}

.post-footer > a:hover {
    color: var(--heading-color);
}

/* ==========================================================================
   Syntax highlighting — warm editorial palette
   ========================================================================== */

pre code.hljs {
    background: transparent;
    padding: 0;
}

.hljs-comment {
    color: var(--hljs-comment);
    font-style: italic;
}

.hljs-keyword {
    color: var(--hljs-keyword);
}

.hljs-string {
    color: var(--hljs-string);
}

.hljs-title,
.hljs-title.function_ {
    color: var(--hljs-title);
}

.hljs-type,
.hljs-built_in {
    color: var(--hljs-type);
}

.hljs-number,
.hljs-literal {
    color: var(--hljs-number);
}

.hljs-params {
    color: var(--hljs-params);
}

.hljs-attr,
.hljs-variable {
    color: var(--hljs-title);
}

.hljs-punctuation {
    color: var(--hljs-punctuation);
}

.hljs-operator {
    color: var(--hljs-operator);
}

.hljs-meta {
    color: var(--hljs-meta);
}

.hljs-property {
    color: var(--hljs-title);
}

/* ==========================================================================
   Animation
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-20px, 20px);
    }
    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

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

/* Blog post: tablet */
@media (max-width: 920px) {
    .page--wide {
        padding: 2rem 2rem 3rem;
    }

    article {
        grid-template-columns: 1fr;
        margin-top: 3rem;
        column-gap: 0;
    }

    .author-col,
    .title-col,
    .date-col,
    .post-body,
    .post-footer {
        grid-column: 1;
        grid-row: auto;
        min-width: 0;
        max-width: 100%;
    }

    .author-col {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .avatar {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .author-meta {
        display: flex;
        flex-direction: column;
    }

    .post-label {
        margin-top: 0;
    }

    .date-col {
        text-align: left;
        order: -1;
        margin-bottom: 1rem;
    }

    .title-col {
        margin-bottom: 2.5rem;
    }

    .title-col h1 {
        font-size: 2rem;
    }

    .sidebar-label {
        display: none;
    }
}

/* All pages: mobile */
@media (max-width: 540px) {
    .page {
        padding: 1.5rem 1.25rem 2.5rem;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 2.5rem;
    }

    .top-bar {
        margin-bottom: 3rem;
    }

    .title-col h1 {
        font-size: 1.65rem;
    }

    .post-body p,
    .post-body li {
        font-size: 1.05rem;
    }

    .post-body pre {
        padding: 1.25rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        font-size: 0.85rem;
    }
}
