/* logs — minimal monospace theme
   ------------------------------------------------------------------ */

:root {
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code",
        "JetBrains Mono", Menlo, Monaco, Consolas, "Liberation Mono",
        "Courier New", monospace;
    --measure: 46rem;
    --radius: 6px;
    --speed: 120ms;
}

/* dark is the default (set on <html data-theme="dark">) */
:root,
[data-theme="dark"] {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --fg: #c9d1d9;
    --muted: #768390;
    --border: #21262d;
    --accent: #3fb950;     /* terminal green */
    --accent-2: #58a6ff;   /* link blue */
    --selection: #264f78;
}

[data-theme="light"] {
    --bg: #fbfbf9;
    --bg-soft: #f3f3ee;
    --fg: #24292f;
    --muted: #6e7781;
    --border: #d8d8d0;
    --accent: #1a7f37;
    --accent-2: #0969da;
    --selection: #b6dcff;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.7;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background var(--speed) ease, color var(--speed) ease;
}

::selection { background: var(--selection); }

a {
    color: var(--accent-2);
    text-decoration: none;
    transition: color var(--speed) ease;
}
a:hover { color: var(--accent); }

.muted { color: var(--muted); }

.viewport {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 1.25rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.site-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.75rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.site-prompt {
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--fg);
    letter-spacing: -0.02em;
}
.site-prompt:hover { color: var(--fg); }

.cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    font-size: 0.9rem;
}
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--accent); }

.theme-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--muted);
    transition: color var(--speed) ease;
}
.theme-toggle:hover { color: var(--accent); }

/* ---- main ------------------------------------------------------------ */

.site-main {
    flex: 1 0 auto;
    padding: 2.5rem 0;
}

.intro { margin-bottom: 2.25rem; }
.intro-desc {
    margin: 0 0 1.5rem;
    color: var(--fg);
}
.index-label {
    font-size: 0.82rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    margin: 0;
}
.index-label::before { content: "> "; color: var(--accent); }

/* ---- post feed (the dated rows) -------------------------------------- */

.post-feed {
    display: flex;
    flex-direction: column;
}

.post-row {
    padding: 0.65rem 0;
    border-bottom: 1px dashed var(--border);
}
.post-row-link {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    color: var(--fg);
}
.post-row-link:hover .post-row-title {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.post-row-date {
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.post-row-title {
    font-weight: 500;
    transition: color var(--speed) ease;
}
.post-row-tags {
    display: block;
    margin: 0.25rem 0 0 6.1rem;
}
@media (max-width: 540px) {
    .post-row-link { flex-direction: column; gap: 0.1rem; }
    .post-row-tags { margin-left: 0; }
}

.tag {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 0.5rem;
}
.tag:hover { color: var(--accent); }

/* ---- single post ----------------------------------------------------- */

.post { margin-bottom: 2rem; }
.post-head { margin-bottom: 1.75rem; }
.post-meta {
    font-size: 0.85rem;
    margin: 0 0 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.post-meta .sep { color: var(--border); }
.post-title {
    font-size: 1.9rem;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin: 0;
}
.post-excerpt { margin: 0.75rem 0 0; font-size: 0.95rem; }

.post-image { margin: 0 0 2rem; }
.post-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.post-image figcaption {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* ---- post content typography ----------------------------------------- */

.gh-content { font-size: 1rem; }
.gh-content > * + * { margin-top: 1.4rem; }
.gh-content h2,
.gh-content h3,
.gh-content h4 {
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-top: 2.4rem;
}
.gh-content h2 { font-size: 1.35rem; }
.gh-content h2::before { content: "## "; color: var(--accent); }
.gh-content h3 { font-size: 1.12rem; }
.gh-content h3::before { content: "### "; color: var(--muted); }
.gh-content a { text-decoration: underline; text-underline-offset: 2px; }
.gh-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li + li { margin-top: 0.35rem; }
.gh-content blockquote {
    margin: 1.4rem 0;
    padding: 0.4rem 0 0.4rem 1.1rem;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}
.gh-content hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 2.4rem 0;
}

/* inline + block code */
.gh-content :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}
.gh-content pre {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    line-height: 1.6;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    overflow-x: auto;
}
.gh-content pre code { background: none; border: none; padding: 0; }

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.gh-content th, .gh-content td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.65rem;
    text-align: left;
}
.gh-content thead { background: var(--bg-soft); }

/* Ghost card helpers */
.kg-width-wide { max-width: calc(var(--measure) + 6rem); margin-left: auto; margin-right: auto; }
.kg-width-full { max-width: 100%; }
.kg-bookmark-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ---- post footer + nav ----------------------------------------------- */

.post-foot { margin-top: 2.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.9rem;
}
.post-nav a { display: flex; flex-direction: column; gap: 0.15rem; max-width: 48%; }
.post-nav-next { text-align: right; margin-left: auto; }

.archive-title { font-size: 1.6rem; letter-spacing: -0.03em; margin: 0.3rem 0 0.6rem; }

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

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    font-size: 0.9rem;
}
.pagination a { color: var(--muted); }
.pagination a:hover { color: var(--accent); }
.pagination .page-number { color: var(--muted); }

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

.site-foot {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }

.error-page { padding-top: 2rem; }

/* ---- listen-to-this-article player ----------------------------------- */

.tts-player {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 1.4rem 0 2rem;
}

.tts-btn {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    line-height: 1;
    color: var(--fg);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: border-color var(--speed) ease, color var(--speed) ease;
}
.tts-btn:hover,
.tts-btn:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

.tts-play {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    border-color: var(--accent);
    color: var(--accent);
    padding: 0.8rem 1.2rem;
}
.tts-play[aria-pressed="true"] {
    background: var(--accent);
    color: var(--bg);
}

.tts-play-icon { font-size: 0.9em; }

/* block currently being read aloud */
.tts-reading {
    background: var(--bg-soft);
    box-shadow: -0.75rem 0 0 var(--bg-soft), 0.75rem 0 0 var(--bg-soft),
        inset 3px 0 0 var(--accent);
    padding-left: 0.4rem;
    margin-left: -0.4rem;
}
