/* Due Processor — Ghost theme
   Layout: a court-docket list. Mono metadata rail (entry no., date) on the left,
   serif headline column in the middle, topic + reading time on the right.
   Accent is "redline" red, the color of a marked-up draft. */

:root {
    --paper: #f1f2f4;
    --surface: #ffffff;
    --ink: #141821;
    --muted: #586070;
    --rule: #d4d8df;
    --redline: #c42b1c;

    --font-display: var(--gh-font-heading, "Newsreader", Georgia, "Times New Roman", serif);
    --font-body: var(--gh-font-body, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --measure: 680px;
    --wrap: 1120px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0f1116;
        --surface: #171a21;
        --ink: #e7e9ee;
        --muted: #99a0ae;
        --rule: #2a2f3a;
        --redline: #ff6a5c;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #0f1116;
    --surface: #171a21;
    --ink: #e7e9ee;
    --muted: #99a0ae;
    --rule: #2a2f3a;
    --redline: #ff6a5c;
    color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--redline); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

.mono {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid var(--ink);
    border-radius: 2px;
    background: var(--ink);
    color: var(--paper);
    font: 500 0.92rem/1 var(--font-body);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--redline); border-color: var(--redline); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-small { padding: 7px 12px; font-size: 0.82rem; }
.link-quiet { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.link-quiet:hover { color: var(--ink); }

/* Masthead */
.masthead { border-bottom: 3px double var(--ink); }
.masthead-inner {
    display: flex;
    align-items: center;
    gap: 12px 28px;
    min-height: 68px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}
.brand img { max-height: 36px; width: auto; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 2px;
    background: var(--redline);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
}
.masthead-nav { flex: 1; min-width: 0; }
.nav { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
.nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover, .nav .is-current a { color: var(--ink); }
.nav .is-current a { box-shadow: inset 0 -2px 0 var(--redline); }
.masthead-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }

@media (max-width: 720px) {
    .masthead-inner { padding-top: 12px; padding-bottom: 0; }
    .masthead-nav { order: 3; flex-basis: 100%; overflow-x: auto; padding: 4px 0 12px; }
    .masthead-actions .link-quiet { display: none; }
    .masthead-actions .btn { padding: 8px 14px; }
}

/* Hero */
.hero { padding: clamp(44px, 9vw, 96px) 0 clamp(36px, 6vw, 64px); border-bottom: 1px solid var(--rule); }
.hero-kicker { color: var(--redline); margin: 0 0 18px; }
.hero-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3rem, 10vw, 6.5rem);
    line-height: 0.95;
    letter-spacing: -0.025em;
    text-wrap: balance;
}
.caret::after {
    content: "";
    display: inline-block;
    width: 0.42em;
    height: 0.78em;
    margin-left: 0.1em;
    background: var(--redline);
    vertical-align: -0.04em;
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret::after { animation: none; } }

.hero-desc {
    max-width: 38ch;
    margin: 22px 0 30px;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.3vw, 1.4rem);
    line-height: 1.45;
}

/* Subscribe form (Ghost members) */
.subscribe { display: flex; flex-wrap: wrap; gap: 8px; max-width: 480px; }
.subscribe input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
}
.subscribe input:focus { outline: none; border-color: var(--ink); }
.form-msg { display: none; flex-basis: 100%; margin: 4px 0 0; font-size: 0.88rem; }
.subscribe.success .msg-success { display: block; }
.subscribe.error .msg-error { display: block; color: var(--redline); }
.subscribe.loading button { opacity: 0.6; pointer-events: none; }

/* Docket list */
.docket { padding: 36px 0 56px; }
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink);
    color: var(--muted);
}
.entry { border-bottom: 1px solid var(--rule); }
.entry-link {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 170px;
    gap: 8px 36px;
    padding: 28px 0;
    text-decoration: none;
}
.entry-no, .entry-side { display: flex; flex-direction: column; gap: 6px; padding-top: 7px; color: var(--muted); }
.entry-side { align-items: flex-end; text-align: right; }
.tag-label { color: var(--redline); }
.flag { display: inline-block; margin-bottom: 8px; color: var(--redline); }
.entry-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    line-height: 1.14;
    letter-spacing: -0.01em;
    text-wrap: balance;
}
.entry-link:hover .entry-title {
    text-decoration: underline;
    text-decoration-color: var(--redline);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}
.entry-excerpt { max-width: 62ch; margin: 0; color: var(--muted); }
.entry.featured .entry-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }

@media (max-width: 760px) {
    .entry-link {
        grid-template-columns: auto auto;
        grid-template-areas: "no side" "main main";
        gap: 10px 16px;
        padding: 22px 0;
    }
    .entry-no { grid-area: no; flex-direction: row; gap: 12px; padding-top: 0; }
    .entry-side { grid-area: side; flex-direction: row; gap: 12px; padding-top: 0; justify-content: flex-end; }
    .entry-side span:last-child { display: none; }
    .entry-no time { display: none; }
    .entry-main { grid-area: main; }
}

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 28px;
    color: var(--muted);
}
.pager a { color: var(--ink); text-decoration: none; }
.pager a:hover { color: var(--redline); }

/* Archive headers (tag, author, error) */
.archive-head { padding: clamp(40px, 7vw, 80px) 0 8px; }
.archive-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.4rem, 7vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.author-head { display: flex; gap: 24px; align-items: center; }
.author-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.error-page { padding-bottom: 80px; }

/* Article: Ghost canvas grid so wide and full-width cards work */
.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(clamp(16px, 4vw, 40px), auto)
        [wide-start] minmax(auto, 200px)
        [main-start] min(var(--measure), calc(100% - 2 * clamp(16px, 4vw, 40px)))
        [main-end] minmax(auto, 200px)
        [wide-end] minmax(clamp(16px, 4vw, 40px), auto)
        [full-end];
}
.gh-canvas > * { grid-column: main-start / main-end; }
.gh-content.gh-canvas { grid-column: full-start / full-end; }
.kg-width-wide { grid-column: wide-start / wide-end; }
.kg-width-full { grid-column: full-start / full-end; }
.kg-width-full img { width: 100%; }

.article { padding: clamp(36px, 7vw, 80px) 0 40px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); }
.article-meta a { color: var(--redline); text-decoration: none; }
.article-title {
    margin: 18px 0 16px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.3rem, 6.5vw, 3.9rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.article-dek {
    margin: 0 0 24px;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.4vw, 1.4rem);
    line-height: 1.4;
}
.article-byline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.9rem;
}
.article-byline a { color: var(--ink); text-decoration: none; }
.article-image { margin: 36px 0 0; }
.article-image img { width: 100%; }
figcaption { margin-top: 10px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Post body */
.gh-content {
    margin-top: 36px;
    font-family: var(--font-display);
    font-size: 1.22rem;
    line-height: 1.66;
}
.gh-content > * { margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 1.1em; }
.post-template .gh-content > p:first-child::first-letter {
    float: left;
    margin: 0.06em 0.08em 0 0;
    font-size: 3.4em;
    line-height: 0.85;
    font-weight: 600;
    color: var(--redline);
}
.gh-content h2, .gh-content h3 { font-weight: 600; line-height: 1.2; text-wrap: balance; }
.gh-content h2 { margin-top: 1.9em; font-size: 1.7rem; letter-spacing: -0.01em; }
.gh-content h3 {
    margin-top: 1.8em;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.gh-content a { text-decoration-color: var(--redline); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content a:hover { color: var(--redline); }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content blockquote:not([class]) {
    margin-left: 0;
    padding-left: 22px;
    border-left: 3px solid var(--redline);
    font-style: italic;
}
.gh-content blockquote.kg-blockquote-alt {
    padding: 0.5em 0;
    border: 0;
    font-size: 1.5em;
    line-height: 1.3;
    text-align: center;
    color: var(--ink);
}
.gh-content code {
    padding: 0.1em 0.35em;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.8em;
}
.gh-content pre {
    overflow-x: auto;
    padding: 18px 20px;
    border: 1px solid var(--rule);
    background: var(--surface);
    font-size: 0.9rem;
    line-height: 1.5;
}
.gh-content pre code { padding: 0; border: 0; background: none; }
.gh-content hr { height: auto; margin: 2.2em 0; border: 0; text-align: center; }
.gh-content hr::after { content: "§ § §"; color: var(--muted); letter-spacing: 0.6em; font-size: 0.9rem; }
.gh-content figure { margin-left: 0; margin-right: 0; }
.gh-content table { display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--font-body); font-size: 0.92rem; }
.gh-content th, .gh-content td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; }

/* Article footer: citation block */
.article-foot { margin-top: 48px; display: flex; flex-direction: column; gap: 20px; }
.cite {
    padding: 18px 20px;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--redline);
    background: var(--surface);
}
.cite-label { margin: 0 0 6px; color: var(--redline); }
.cite-text { margin: 0 0 14px; font-size: 0.95rem; line-height: 1.55; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 6px 10px;
    border: 1px solid var(--rule);
    border-radius: 2px;
    color: var(--ink);
    text-decoration: none;
}
.chip:hover { border-color: var(--redline); color: var(--redline); }
.article-comments { margin-top: 48px; }
.related { padding-top: 12px; }

/* Footer */
.site-footer { margin-top: 32px; padding: 32px 0 44px; border-top: 3px double var(--ink); color: var(--muted); font-size: 0.88rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-title { margin: 0 0 6px; color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.disclaimer { max-width: 54ch; margin: 0; }
.footer-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.footer-side .nav { gap: 16px; font-size: 0.86rem; }
.footer-side p { margin: 0; }
@media (max-width: 600px) { .footer-side { align-items: flex-start; } }

/* Ghost editor card styles that themes must provide */
.kg-image { margin: 0 auto; }
.kg-gallery-container { display: flex; flex-direction: column; }
.kg-gallery-row { display: flex; justify-content: center; gap: 0.75em; }
.kg-gallery-row + .kg-gallery-row { margin-top: 0.75em; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
