/*
 * nanoblog default theme.
 *
 * Designed for reading long-form text, which drives most of what follows: a measure
 * near 66 characters, generous line height, and a type scale that stays readable at
 * 320px without a separate mobile stylesheet.
 *
 * Colours are defined once as custom properties and inverted wholesale for dark
 * mode, so a new surface cannot be added that works in one mode and not the other.
 */

:root {
    --ink: #1a1a19;
    --ink-muted: #5f5f5a;
    --ink-faint: #86867f;
    --paper: #fdfdfc;
    --paper-raised: #f4f4f1;
    --rule: #e2e2dd;
    --accent: #1b5e9c;
    --accent-hover: #144775;

    --measure: 34rem;
    --gap: 1.5rem;
    --radius: 6px;

    --font-body: ui-serif, Georgia, Cambria, "Times New Roman", serif;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e6e6e3;
        --ink-muted: #a3a39d;
        --ink-faint: #77777199;
        --paper: #151514;
        --paper-raised: #1f1f1d;
        --rule: #33332f;
        --accent: #7db1e8;
        --accent-hover: #a3c9f0;
    }
}

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

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

body {
    margin: 0;
    padding: 0 1.25rem;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--measure); margin: 0 auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

/* Focus must be visible for keyboard users, and must not be suppressed by any
   later rule. Deliberately high contrast rather than subtle. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Skip link: the first thing a screen reader or keyboard user meets. */
.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--paper-raised);
    color: var(--ink);
    padding: .6rem 1rem;
    border-radius: 0 0 var(--radius) 0;
    font-family: var(--font-ui);
    z-index: 10;
}
.skip:focus { left: 0; }

.masthead {
    font-family: var(--font-ui);
    padding: 2.5rem 0 1.25rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 2.5rem;
}
.masthead__title { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.masthead__title a { color: var(--ink); text-decoration: none; }
.masthead__title a:hover { color: var(--accent); }
.masthead__tagline { margin: .4rem 0 0; color: var(--ink-muted); font-size: .9375rem; }
.masthead__nav { margin-top: .85rem; display: flex; flex-wrap: wrap; gap: 1rem; font-size: .9375rem; }

.entry + .entry { margin-top: 2.75rem; padding-top: 2.75rem; border-top: 1px solid var(--rule); }
.entry__title { font-size: 1.375rem; line-height: 1.3; margin: 0 0 .3rem; letter-spacing: -0.015em; }
.entry__title a { color: var(--ink); text-decoration: none; }
.entry__title a:hover { color: var(--accent); text-decoration: underline; }
.entry__meta { font-family: var(--font-ui); font-size: .8125rem; color: var(--ink-faint); }
.entry__summary { margin: .6rem 0 0; color: var(--ink-muted); }

/* Long unbroken strings — URLs, code identifiers — must wrap rather than force the
   page to scroll sideways. */
.prose { overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15rem; }
.prose h1, .prose h2, .prose h3, .prose h4 {
    font-family: var(--font-ui);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-top: 2rem;
}
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.0625rem; }
.prose h4 { font-size: 1rem; color: var(--ink-muted); }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); display: block; }
.prose figure { margin: 1.5rem 0; }
.prose blockquote {
    margin: 1.5rem 0;
    padding-left: 1.15rem;
    border-left: 3px solid var(--rule);
    color: var(--ink-muted);
    font-style: italic;
}
.prose code {
    font-family: var(--font-mono);
    font-size: .875em;
    background: var(--paper-raised);
    padding: .12em .35em;
    border-radius: 3px;
}
.prose pre {
    font-family: var(--font-mono);
    font-size: .8125rem;
    line-height: 1.5;
    background: var(--paper-raised);
    padding: .9rem 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); }
.prose th { font-family: var(--font-ui); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .35rem; }

.tags { font-family: var(--font-ui); font-size: .8125rem; margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.tags a {
    background: var(--paper-raised);
    color: var(--ink-muted);
    padding: .2rem .6rem;
    border-radius: 999px;
    text-decoration: none;
}
.tags a:hover { color: var(--accent); }

.empty { color: var(--ink-muted); font-style: italic; padding: 2rem 0; }

.footer {
    font-family: var(--font-ui);
    font-size: .8125rem;
    color: var(--ink-faint);
    border-top: 1px solid var(--rule);
    margin-top: 4rem;
    padding: 1.25rem 0 3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
}

@media (max-width: 30rem) {
    body { font-size: 1rem; padding: 0 1rem; }
    .entry__title { font-size: 1.1875rem; }
    .masthead { padding-top: 1.75rem; }
}

@media print {
    body { background: #fff; color: #000; }
    .masthead__nav, .footer, .skip { display: none; }
    a { text-decoration: none; color: #000; }
    .prose a::after { content: " (" attr(href) ")"; font-size: .8em; color: #444; }
}
