/* self-hosted from @fontsource-variable/geist and geist-mono 5.3.0 (OFL, see /fonts/OFL.txt) */
@font-face {
    font-family: "Geist";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/fonts/geist-latin-ext-wght-normal.woff2) format("woff2-variations");
    unicode-range:
        U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
        U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Geist";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/fonts/geist-latin-wght-normal.woff2) format("woff2-variations");
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
        U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/fonts/geist-mono-latin-ext-wght-normal.woff2) format("woff2-variations");
    unicode-range:
        U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
        U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/fonts/geist-mono-latin-wght-normal.woff2) format("woff2-variations");
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
        U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.97 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --border: oklch(0.922 0 0);
    --primary: oklch(0.205 0 0);
    --primary-foreground: oklch(0.985 0 0);
    --code-bg: oklch(0.18 0 0);
    --code-fg: oklch(0.96 0 0);
    --radius: 0.625rem;
    --container: 56rem;

    --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    /* follows the chosen theme once the css has loaded, not the os */
    color-scheme: light;
}

.dark {
    color-scheme: dark;
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --border: oklch(1 0 0 / 12%);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --code-bg: oklch(0.205 0 0);
    --code-fg: oklch(0.96 0 0);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    border-color: var(--border);
}

html {
    font-family: var(--font-sans);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- nav ---- */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
    background: color-mix(in oklab, var(--background) 80%, transparent);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}

.site-nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    height: 3.5rem;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-nav-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-nav-group:first-child {
    gap: 1.5rem;
}

.site-brand {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--foreground);
    transition: color 0.15s ease;
}

.site-brand:hover {
    color: color-mix(in oklab, var(--foreground) 80%, transparent);
}

.site-nav-items--desktop {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

@media (min-width: 768px) {
    .site-nav-items--desktop {
        display: inline-flex;
    }
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    border-radius: calc(var(--radius) * 0.6);
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.nav-link:hover {
    color: var(--foreground);
}

.nav-link[aria-current="page"] {
    color: var(--foreground);
    font-weight: 500;
}

.nav-link--mobile {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) * 0.6);
}

.nav-link--mobile:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.icon-btn {
    height: 2rem;
    width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    border-radius: calc(var(--radius) * 0.6);
    cursor: pointer;
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.icon-btn:hover {
    color: var(--foreground);
    background: var(--accent);
}

.icon {
    width: 1rem;
    height: 1rem;
    display: inline-block;
    vertical-align: middle;
}

.icon-ext {
    width: 0.75rem;
    height: 0.75rem;
}

.icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-slot--sun {
    display: none;
}

.dark .icon-slot--sun {
    display: inline-flex;
}

.dark .icon-slot--moon {
    display: none;
}

.site-mobile-toggle {
    display: inline-flex;
}

@media (min-width: 768px) {
    .site-mobile-toggle {
        display: none;
    }
}

/* ---- mobile drawer ---- */

.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.mobile-drawer[hidden] {
    display: none;
}

.mobile-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mobile-drawer.is-open .mobile-drawer-overlay {
    opacity: 1;
}

.mobile-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 16rem;
    max-width: 80vw;
    background: var(--background);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.mobile-drawer.is-open .mobile-drawer-panel {
    transform: translateX(0);
}

.mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.mobile-drawer-title {
    font-size: 1rem;
    font-weight: 600;
}

.mobile-drawer-items {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.75rem 1rem;
    overflow-y: auto;
}

/* ---- main + page ---- */

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 3rem 1.5rem;
    opacity: 0;
    transform: translateY(4px);
    animation: fade-in 0.3s ease forwards;
}

@keyframes fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-sections {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.page-section {
    opacity: 0;
    transform: translateY(8px);
    animation: section-in 0.5s ease forwards;
}

.page-section:nth-child(1) {
    animation-delay: 0ms;
}
.page-section:nth-child(2) {
    animation-delay: 100ms;
}
.page-section:nth-child(3) {
    animation-delay: 200ms;
}
.page-section:nth-child(4) {
    animation-delay: 300ms;
}
.page-section:nth-child(5) {
    animation-delay: 400ms;
}
.page-section:nth-child(n + 6) {
    animation-delay: 500ms;
}

@keyframes section-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- markdown prose ---- */

.markdown {
    color: var(--foreground);
    font-size: 1rem;
    line-height: 1.7;
}

.markdown > * {
    margin: 0;
}

.markdown > * + * {
    margin-top: 1.25em;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin-top: 2em;
    scroll-margin-top: 5rem;
}

.markdown > h1:first-child,
.markdown > h2:first-child,
.markdown > h3:first-child {
    margin-top: 0;
}

.markdown h1 {
    font-size: 2.25rem;
}
.markdown h2 {
    font-size: 1.5rem;
}
.markdown h3 {
    font-size: 1.25rem;
}
.markdown h4 {
    font-size: 1.05rem;
}

.markdown p {
    color: var(--foreground);
}

.markdown a {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: color-mix(in oklab, var(--foreground) 30%, transparent);
    transition: text-decoration-color 0.15s ease;
}

.markdown a:hover {
    text-decoration-color: var(--foreground);
}

.markdown strong {
    font-weight: 600;
    color: var(--foreground);
}

.markdown ul,
.markdown ol {
    padding-left: 1.5rem;
}

.markdown ul {
    list-style: disc;
}

.markdown ol {
    list-style: decimal;
}

.markdown li + li {
    margin-top: 0.5em;
}

.markdown li > p {
    margin: 0;
}

.markdown blockquote {
    border-left: 3px solid var(--border);
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--muted-foreground);
    font-style: italic;
}

.markdown hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5em 0;
}

.markdown :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--muted);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
}

.markdown pre {
    position: relative;
    padding: 0;
    border-radius: var(--radius);
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.markdown pre code.hljs {
    border-radius: var(--radius);
}

.markdown table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    display: block;
    overflow-x: auto;
}

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

.markdown th {
    font-weight: 600;
    color: var(--foreground);
}

.markdown img {
    border-radius: var(--radius);
    display: block;
}

.markdown iframe {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    border-radius: var(--radius);
    display: block;
}

/* heading anchor link (injected by client.js) */

.markdown .heading-anchor {
    margin-left: 0.5rem;
    opacity: 0;
    color: var(--muted-foreground);
    transition: opacity 0.15s ease;
    text-decoration: none;
    font-weight: 400;
}

.markdown h1:hover .heading-anchor,
.markdown h2:hover .heading-anchor,
.markdown h3:hover .heading-anchor,
.markdown h4:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor svg {
    width: 0.9em;
    height: 0.9em;
    vertical-align: -0.1em;
}

/* copy button (injected by client.js) */

.code-wrap {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--code-fg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.375rem;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s ease,
        background-color 0.15s ease;
}

.code-wrap:hover .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.copy-btn.is-copied {
    color: oklch(0.85 0.15 145);
}

/* ---- footer ---- */

.site-footer {
    border-top: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
}

.site-footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-footer-copy {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.site-footer-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-link {
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.social-link:hover {
    color: var(--foreground);
}

.social-link svg {
    width: 1rem;
    height: 1rem;
}

/* ---- 404 ---- */

.not-found {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.not-found-title {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
}

.not-found-text {
    font-size: 1.125rem;
    color: var(--muted-foreground);
    margin: 0 0 2rem;
}

.not-found-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.not-found-link:hover {
    color: color-mix(in oklab, var(--foreground) 80%, transparent);
}

/* ---- blog list ---- */

.blog-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 2rem;
}

@media (min-width: 640px) {
    .blog-title {
        font-size: 2.25rem;
    }
}

.empty-state {
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    padding: 2rem 0;
}

.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: inherit;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.post-card:hover {
    border-color: color-mix(in oklab, var(--border) 60%, var(--foreground) 10%);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.06);
}

.post-card-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--muted);
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-card:hover .post-card-thumb img {
    transform: scale(1.05);
}

.post-card-body {
    padding: 1rem;
}

.post-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.25rem;
    transition: color 0.15s ease;
}

.post-card:hover .post-card-title {
    color: color-mix(in oklab, var(--foreground) 80%, transparent);
}

.post-card-author {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-transform: capitalize;
    margin: 0;
}

.post-card-date {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}

.blog-title-tag {
    color: var(--muted-foreground);
    font-weight: 500;
}

/* only needed where the tag bar (and its "All") is hidden */
.blog-title-clear {
    display: none;
    margin-left: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
    vertical-align: middle;
    color: var(--muted-foreground);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-title-clear:hover {
    color: var(--foreground);
}

@media (max-width: 639px) {
    .blog-title-clear {
        display: inline;
    }
}

.tag-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: -1rem 0 2rem;
}

/* too many rows on narrow screens; tags on the post page still link to the filtered list */
@media (max-width: 639px) {
    .tag-bar {
        display: none;
    }
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
}

.blog-post-header .tag-list {
    margin-top: 1rem;
}

.tag {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    padding: 0.1rem 0;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    border-bottom: 1px solid transparent;
    transition:
        color 0.15s ease,
        border-color 0.15s ease;
}

.tag-hash {
    opacity: 0.5;
}

a.tag:hover {
    color: var(--foreground);
}

.tag[aria-current="page"] {
    color: var(--foreground);
    border-bottom-color: var(--foreground);
}

.tag-count {
    align-self: flex-start;
    margin-left: 0.15rem;
    font-size: 0.625rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.65;
}

.post-card-topic {
    margin: 0 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

/* ---- pagination ---- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
}

.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 0.6);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.pager-btn:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.pager-btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.pager-info {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ---- blog post ---- */

.blog-post {
    max-width: 100%;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--foreground);
}

.blog-post-header {
    margin-bottom: 2.5rem;
}

.blog-post-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 1rem;
}

@media (min-width: 640px) {
    .blog-post-title {
        font-size: 2.25rem;
    }
}

@media (min-width: 1024px) {
    .blog-post-title {
        font-size: 3rem;
    }
}

.blog-post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.blog-post-author {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.blog-post-byline {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ---- author avatar ---- */

.author-avatar {
    border-radius: 9999px;
    object-fit: cover;
    object-position: top;
    background: var(--muted);
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    flex-shrink: 0;
}

.author-avatar--sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.author-avatar--md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.author-avatar--initials {
    text-transform: uppercase;
}
