/*
 * Truth Bytes: terminal window theme.
 * A private, single-site modification of Braun, Copyright (c) 2024 Themex Studio. See LICENSE.
 *
 * Colors are tokens on :root; html[data-theme="light"] swaps them.
 */

/* ---------- Theme switch ---------- */
/* The color tokens are typed properties, so they can transition on :root. One transition then
   fades every color, gradient and border together as the theme changes. Browsers without
   @property just switch instantly. Shadows, blur and the logo swap are not part of it. */
@property --bg { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --fg { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --fg2 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --fg3 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --dim { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --accent-ink { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --accent-soft { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --accent-line { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --blue { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --blue-soft { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --err { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --line { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --line2 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --hover { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --pane { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --pane-line { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --bar { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --status { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --well { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glass { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glass-line { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glass-solid { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --dots { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glow1 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glow2 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glow3 { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --c-str { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --c-flag { syntax: "<color>"; inherits: true; initial-value: #000; }
@property --glow1-o { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --glow2-o { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --glow3-o { syntax: "<number>"; inherits: true; initial-value: 0; }

:root { transition-property: --bg, --fg, --fg2, --fg3, --muted, --dim, --accent, --accent-ink, --accent-soft, --accent-line, --blue, --blue-soft, --err, --line, --line2, --hover, --pane, --pane-line, --bar, --status, --well, --glass, --glass-line, --glass-solid, --dots, --glow1, --glow2, --glow3, --c-str, --c-flag, --glow1-o, --glow2-o, --glow3-o; transition-duration: .5s; transition-timing-function: cubic-bezier(.45, 0, .2, 1); }
/* While the tokens fade, hover transitions on elements would lag behind them, so pause those. */
html[data-tw-switching] *:not(:root):not(.tw-glass), html[data-tw-switching] *::before, html[data-tw-switching] *::after { transition: none !important; }
.tw-glass { transition: box-shadow .5s cubic-bezier(.45, 0, .2, 1); }

/* ---------- Tokens ---------- */
/* Warm black, amber and light blue. --accent is the neutral chrome accent (amber);
   Tech stays neutral (chips and hovers fall back to muted / --accent); faith and church history
   get the amber category colour through --cat below. */
:root {
    --bg: #100f0d;
    --fg: #f1ece2;
    --fg2: #e2dccf;
    --fg3: #d6d0c4;
    --muted: #b9b2a5;
    --dim: #a09a8e;
    --accent: #e3b23c;
    --accent-ink: #151412;
    --accent-soft: rgba(227, 178, 60, .16);
    --accent-line: rgba(227, 178, 60, .38);
    --blue: #9cc2d8;
    --blue-soft: rgba(156, 194, 216, .12);
    --err: #e07a63;
    --faith: var(--accent);
    --faith-soft: var(--accent-soft);
    --faith-line: var(--accent-line);
    --line: rgba(241, 236, 226, .08);
    --line2: rgba(241, 236, 226, .14);
    --hover: rgba(241, 236, 226, .05);
    --pane: rgba(241, 236, 226, .035);
    --pane-line: rgba(241, 236, 226, .1);
    --bar: rgba(241, 236, 226, .03);
    --status: rgba(0, 0, 0, .25);
    --well: rgba(0, 0, 0, .32);
    --glass: rgba(22, 21, 19, .62);
    --glass-line: rgba(241, 236, 226, .12);
    --glass-solid: #1b1a17;
    --shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
    --blur: 28px;
    --sat: 140%;
    --dots: rgba(241, 236, 226, .07);
    --glow1: #a67c1a;
    --glow1-o: .5;
    --glow2: #3f6a85;
    --glow2-o: .45;
    --glow3: #6b4a12;
    --glow3-o: .4;
    --c-str: #a8c98f;
    --c-flag: #d8b98a;
    --cover-shadow: 0 24px 60px rgba(0, 0, 0, .5);

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

    --win-max: 1120px;
    --gutter: clamp(18px, 5vw, 64px);
    --measure: 700px;
    --space-section: 56px;

    /* Radii: chips and labels, controls, cards and blocks, the window */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 16px;

    color-scheme: dark;
}

html[data-theme="light"] {
    --bg: #efe9dd;
    --fg: #1c1a17;
    --fg2: #2c2925;
    --fg3: #3a3732;
    --muted: #5c574e;
    --dim: #58534b;
    --accent: #6c4e0d; /* darker than the #8a6410 brand amber so small text clears 4.5:1 on the glows */
    --accent-ink: #fffaf0;
    --accent-soft: rgba(166, 124, 26, .14);
    --accent-line: rgba(166, 124, 26, .38);
    --blue: #2f5f7d;
    --blue-soft: rgba(47, 95, 125, .1);
    --err: #a8432f;
    --faith: var(--accent);
    --faith-soft: var(--accent-soft);
    --faith-line: var(--accent-line);
    --line: rgba(28, 26, 23, .08);
    --line2: rgba(28, 26, 23, .14);
    --hover: rgba(255, 255, 255, .6);
    --pane: rgba(255, 255, 255, .45);
    --pane-line: rgba(255, 255, 255, .8);
    --bar: rgba(255, 255, 255, .35);
    --status: rgba(255, 255, 255, .35);
    --well: rgba(255, 255, 255, .55);
    --glass: rgba(255, 255, 255, .4);
    --glass-line: rgba(255, 255, 255, .75);
    --glass-solid: #f7f3ea;
    --shadow: 0 30px 80px rgba(70, 50, 20, .18), 0 0 0 1px rgba(28, 26, 23, .06), inset 0 1px 0 rgba(255, 255, 255, .95);
    --blur: 44px;
    --sat: 170%;
    --dots: rgba(28, 26, 23, .07);
    --glow1: #e3b23c;
    --glow1-o: .65;
    --glow2: #8fb3c9;
    --glow2-o: .8;
    --glow3: #d9a72a;
    --glow3-o: .45;
    --c-str: #4f7a32;
    --c-flag: #8a5a2e;
    --cover-shadow: 0 24px 50px rgba(70, 50, 20, .25);

    color-scheme: light;
}

/* Category accent: posts and rows carry data-tag / tag-<slug>. Only faith and history set --cat; everything else falls back. */
[data-tag="faith"], [data-tag="church-history"], .tag-faith, .tag-church-history {
    --cat: var(--faith); --cat-soft: var(--faith-soft); --cat-line: var(--faith-line);
}

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

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.65;
    overflow-x: clip;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--r-sm);
}
::selection { background: var(--accent); color: var(--accent-ink); }
img { max-width: 100%; height: auto; }

.tw-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.tw-lc { text-transform: lowercase; }
.tw-acc { color: var(--accent); }
.tw-dim { color: var(--dim); }
.tw-small { font-size: 12px; }

.tw-skip {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    padding: 10px 16px; border-radius: var(--r-md);
    background: var(--accent); color: var(--accent-ink);
}
.tw-skip:focus { top: 16px; color: var(--accent-ink); }

/* ---------- Background (fixed, so the frost holds while scrolling) ---------- */
/* Own compositor layer, painted once, so scrolling never repaints it. */
.tw-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; transform: translateZ(0); contain: strict; }
/* Glows are radial gradients scaled past their box, which looks like the old
   filter: blur(140px) discs but costs next to nothing to paint (big blurs are slow on iOS). */
.tw-glow { position: absolute; background: radial-gradient(closest-side, var(--g) 0%, var(--g) 20%, transparent 100%); transform: scale(1.7); }
.tw-glow-1 { top: -10%; left: -8%; width: 50vw; height: 50vw; max-width: 680px; max-height: 680px; --g: var(--glow1); opacity: var(--glow1-o); }
.tw-glow-2 { top: 35%; right: -12%; width: 45vw; height: 45vw; max-width: 600px; max-height: 600px; --g: var(--glow2); opacity: var(--glow2-o); }
.tw-glow-3 { bottom: -12%; left: 22%; width: 40vw; height: 32vw; max-width: 540px; max-height: 440px; --g: var(--glow3); opacity: var(--glow3-o); }
.tw-grid-dots { position: absolute; inset: 0; background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 22px 22px; }

/* ---------- Reading progress (posts only; no transition, so it is motion-safe) ---------- */
.tw-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 60; pointer-events: none; background: var(--line2); }
.tw-progress-bar { display: block; height: 100%; background: var(--progress-color, var(--accent)); transform: scaleX(0); transform-origin: 0 50%; }

/* ---------- Window ---------- */
.tw-page {
    position: relative; z-index: 1;
    padding: clamp(12px, 4vw, 56px) clamp(10px, 3vw, 40px);
}
.tw-window {
    max-width: var(--win-max);
    margin: 0 auto;
    border-radius: var(--r-xl);
    overflow: hidden;
}
.tw-glass {
    background: var(--glass);
    border: 1px solid var(--glass-line);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
    backdrop-filter: blur(var(--blur)) saturate(var(--sat));
}

.tw-titlebar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bar);
}
.tw-controls { display: flex; align-items: center; gap: 8px; }
.tw-ctl { position: relative; width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.tw-ctl-r { background: #c9654f; }
.tw-ctl-y { background: #e3b23c; }
.tw-ctl-g { background: #7fa36b; color: #1d3315; }
button.tw-ctl { cursor: pointer; }
button.tw-ctl::after { content: ""; position: absolute; inset: -16px; }
.tw-ctl svg { opacity: 0; transition: opacity .15s ease; }
button.tw-ctl:hover svg, button.tw-ctl:focus-visible svg { opacity: 1; }
.tw-titlebar-text {
    flex: 1; min-width: 0; text-align: center;
    font-size: 13px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tw-bar-cmd:empty::before { content: "~ — zsh"; }
.tw-titlebar-spacer { width: 52px; }

/* ---------- Header ---------- */
.tw-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 20px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}
.tw-logo { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 0; color: var(--fg); }
.tw-logo:hover { color: var(--fg); }
.tw-logo-img { flex: none; width: 40px; height: 40px; border-radius: 10px; }
.tw-logo-for-dark { display: none; }
html[data-theme="dark"] .tw-logo-for-light { display: none; }
html[data-theme="dark"] .tw-logo-for-dark { display: block; }
.tw-brand { font-family: var(--font-head); font-size: 22px; font-weight: 700; white-space: nowrap; }

.tw-nav { display: flex; align-items: center; gap: 4px; justify-self: end; min-width: 0; }
.tw-nav-sep { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--line2); }

.tw-tab {
    flex: none;
    display: inline-flex; align-items: center;
    min-height: 44px; padding: 0 14px;
    border-radius: var(--r-md);
    color: var(--fg3);
    font-size: 14px;
    transition: background-color .15s ease, color .15s ease;
}
.tw-tab:hover { background: var(--hover); color: var(--fg); }
.tw-nav .tw-tab:not(.tw-tab-plain), .tw-suggest .tw-tab { text-transform: lowercase; }
.tw-nav .tw-tab:not(.tw-tab-plain)::before, .tw-suggest .tw-tab::before { content: "~/"; content: "~/" / ""; }
.tw-tab[aria-current] { background: var(--accent-soft); color: var(--accent); }
.tw-tab-plain { color: var(--muted); }

.tw-actions { display: flex; align-items: center; gap: 8px; }

.tw-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 16px;
    border: 1px solid var(--accent); border-radius: var(--r-md);
    background: transparent; color: var(--accent);
    font: inherit; font-size: 14px; line-height: 1.2;
    cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.tw-btn:hover { background: var(--accent); color: var(--accent-ink); }
.tw-btn-sm { padding: 0 18px; }
.tw-btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; margin-top: 36px; }

.tw-icon-btn {
    width: 44px; height: 44px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-md); border: 1px solid var(--line2);
    background: var(--pane); color: var(--fg3);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.tw-icon-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.tw-i-moon { display: none; }
html[data-theme="light"] .tw-i-sun { display: none; }
html[data-theme="light"] .tw-i-moon { display: block; }

/* ---------- Content shell ---------- */
.tw-main { display: block; }
.tw-content { padding: clamp(24px, 5vw, 64px) var(--gutter) 32px; }

.tw-prompt { margin: 0 0 28px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.tw-p-user { color: var(--accent); }
.tw-p-dir { color: var(--blue); }
.tw-prompt-end { margin: var(--space-section) 0 0; }

@keyframes tw-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.tw-cursor {
    display: inline-block; width: 9px; height: 17px;
    border-radius: 2px; background: var(--accent);
    vertical-align: text-bottom;
    animation: tw-blink 1.1s steps(1) infinite;
}
.tw-cursor-block { width: .42em; height: .09em; margin-left: .08em; vertical-align: baseline; }

/* ---------- Hero ---------- */
.tw-hero { padding: 32px 0 var(--space-section); }
.tw-hero-title {
    margin: 0; max-width: 11.5em;
    font-family: var(--font-head); font-weight: 400;
    font-size: clamp(44px, 7vw, 84px); line-height: 1.04; letter-spacing: -.01em;
    text-wrap: balance;
}
.tw-hero-text {
    margin-top: 24px; max-width: 600px;
    font-family: var(--font-body); color: var(--fg2);
    font-size: 19px; line-height: 1.7;
}
.tw-hero-text > :first-child { margin-top: 0; }
.tw-hero-text p { margin: 0 0 16px; }
.tw-hero-text h1, .tw-hero-text h2, .tw-hero-text h3, .tw-hero-text h4, .tw-hero-text h5, .tw-hero-text h6 {
    margin: 24px 0 8px; font-family: var(--font-body); font-size: 19px; font-weight: 400; color: var(--fg2);
}
.tw-hero-text ol, .tw-hero-text ul { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tw-hero-text li a {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
    border-radius: var(--r-md); border: 1px solid var(--line2); background: var(--pane);
    font-family: var(--font-mono); font-size: 14px; color: var(--fg);
}
.tw-hero-text li a::after { content: " >"; content: " >" / ""; color: var(--accent); margin-left: 8px; }
.tw-hero-text li a:hover { border-color: var(--accent-line); color: var(--accent); }
.tw-hero-text li a strong { font-weight: 400; }
.tw-hero-text a { color: var(--accent); }

/* ---------- Subscribe form (Ghost members) ---------- */
.tw-subscribe { margin-top: 36px; max-width: 640px; }
.tw-subscribe-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 8px 8px 8px 18px;
    border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--well);
}
.tw-subscribe-label { color: var(--muted); font-size: 14px; }
.tw-input {
    flex: 1 1 200px; min-width: 0; min-height: 44px;
    padding: 0 8px; border: 0; border-radius: var(--r-md);
    background: transparent; color: var(--fg); font: inherit;
}
.tw-input::placeholder { color: var(--dim); }
.tw-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.tw-sub-loading, .tw-sub-msg { display: none; }
.tw-subscribe.loading .tw-sub-default { display: none; }
.tw-subscribe.loading .tw-sub-loading { display: inline; }
.tw-sub-msg { margin: 12px 0 0 4px; font-size: 14px; }
.tw-subscribe.success .tw-sub-success { display: block; color: var(--accent); }
.tw-subscribe.error .tw-sub-error { display: block; color: var(--err); }

/* ---------- Sections, rows, cards ---------- */
.tw-section { padding: 8px 0 var(--space-section); }
.tw-section-head {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px;
    padding-bottom: 16px;
}
.tw-section-title { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); }
.tw-view-all { font-size: 14px; color: var(--muted); }

.tw-list { display: flex; flex-direction: column; gap: 10px; }
.tw-grid { display: grid; gap: 14px; }
.tw-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.tw-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
/* Homepage reading list: one row of three, or a stacked list, never 2 + 1 */
.tw-grid-compact { grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) { .tw-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }

.tw-row {
    border-radius: var(--r-lg); border: 1px solid var(--pane-line); background: var(--pane);
    color: var(--fg);
    transition: background-color .15s ease, border-color .15s ease;
}
.tw-row:hover, .tw-row:focus-visible { background: var(--hover); border-color: var(--cat-line, var(--accent-line)); color: var(--fg); }
.tw-title { transition: color .15s ease; }
.tw-row:hover .tw-title, .tw-row:focus-visible .tw-title { color: var(--cat, var(--accent)); }
.tw-arrow { font-size: 30px; font-weight: 500; line-height: 1; color: var(--dim); transition: transform .15s ease, color .15s ease; }
.tw-row:hover .tw-arrow, .tw-row:focus-visible .tw-arrow { transform: translateX(4px); color: var(--cat, var(--accent)); }

.tw-chip {
    display: inline-block;
    padding: 2px 10px; border-radius: var(--r-sm);
    background: var(--cat-soft, var(--hover)); color: var(--cat, var(--muted));
    border: 1px solid var(--cat-line, var(--line2));
    font-size: 12px; line-height: 1.5; letter-spacing: .04em; text-transform: uppercase;
}
a.tw-chip:hover { color: var(--cat, var(--fg)); background: var(--hover); }
.tw-badge {
    align-self: flex-start; display: inline-block;
    padding: 2px 10px; border-radius: var(--r-sm);
    background: var(--accent); color: var(--accent-ink);
    font-size: 12px; font-weight: 500;
}

.tw-badge-done { background: transparent; color: var(--muted); border: 1px solid var(--line2); }
.tw-book-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }

.tw-post-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 24px 22px; }
.tw-meta { flex: 0 0 120px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.tw-meta time { font-size: 14px; }
.tw-meta .tw-chip { align-self: flex-start; }
.tw-row-body { flex: 1 1 380px; min-width: 0; }
.tw-row-title { display: block; font-family: var(--font-head); font-size: 32px; line-height: 1.15; }
.tw-row-excerpt { display: block; margin-top: 10px; max-width: 620px; font-family: var(--font-body); font-size: 17px; line-height: 1.65; color: var(--fg3); }
.tw-post-row-featured { padding-top: 32px; padding-bottom: 32px; border-color: var(--accent-line); background: var(--accent-soft); }
.tw-post-row-featured .tw-row-title { font-size: clamp(32px, 4vw, 42px); }
.tw-post-row-featured .tw-row-excerpt { font-size: 18px; }

.tw-book-card { display: flex; align-items: flex-start; gap: 18px; padding: 20px; }
.tw-book-card-arrow { align-items: center; }
.tw-cover-sm { flex: none; width: 76px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line2); box-shadow: 0 8px 20px rgba(0, 0, 0, .25); }
.tw-book-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tw-book-title {
    font-family: var(--font-head); font-size: 25px; line-height: 1.15;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tw-book-excerpt { font-family: var(--font-body); font-size: 15px; line-height: 1.55; color: var(--fg3); }
/* Homepage reading list: smaller, so it doesn't compete with the posts */
.tw-book-card-compact { align-items: center; gap: 16px; padding: 14px 16px; }
.tw-book-card-compact .tw-cover-sm { width: 52px; }
.tw-book-card-compact .tw-book-body { gap: 6px; }
.tw-book-card-compact .tw-book-title { font-size: 20px; -webkit-line-clamp: 2; }

/* ---------- Listing pages ---------- */
.tw-listing-head { margin-bottom: 40px; }
.tw-listing-title { margin: 0; font-family: var(--font-head); font-weight: 400; font-size: clamp(40px, 6vw, 68px); line-height: 1.05; }
.tw-listing-intro { margin-bottom: 32px; }
.tw-author-head { display: flex; align-items: center; gap: 24px; }
.tw-avatar { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line2); }

.tw-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; font-size: 14px; color: var(--muted); }
.tw-page-btn { border: 1px solid var(--line2); border-radius: var(--r-md); }
a.tw-page-btn:hover { border-color: var(--accent-line); }
.tw-page-off { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--dim); opacity: .6; }

/* ---------- Article ---------- */
.tw-article { max-width: var(--measure); margin: 0 auto; }
.tw-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 14px; color: var(--muted); }
.tw-sep { color: var(--dim); }
.tw-author { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.tw-article-title {
    margin: 20px 0 0; font-family: var(--font-head); font-weight: 400;
    font-size: clamp(38px, 5.5vw, 60px); line-height: 1.08; letter-spacing: -.01em; text-wrap: balance;
}
.tag-faith .tw-lead, .tag-church-history .tw-lead { font-family: var(--font-head); font-style: italic; font-size: 24px; line-height: 1.55; color: var(--fg); }
.tag-faith .tw-prose, .tag-church-history .tw-prose { line-height: 1.9; }
.tag-faith .tw-article-title, .tag-church-history .tw-article-title { font-weight: 400; letter-spacing: -.015em; }
.tw-lead { margin: 24px 0 0; font-family: var(--font-body); font-size: 21px; line-height: 1.6; color: var(--fg2); }
.tw-feature { margin: 36px 0 0; }
.tw-feature img { display: block; width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line2); }
.tw-feature figcaption, .tw-prose figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.tw-divider { margin: 40px 0; height: 1px; background: var(--line2); }

/* Post body */
.tw-prose { font-family: var(--font-body); font-size: 19px; line-height: 1.8; color: var(--fg2); overflow-wrap: break-word; }
.tw-prose-lg { font-size: 20px; }
.tw-prose > * { margin-top: 0; margin-bottom: 24px; }
.tw-prose > *:last-child { margin-bottom: 0; }
.tw-prose a { color: var(--cat, var(--accent)); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--cat-line, var(--accent-line)); }
.tw-prose a:hover { text-decoration-color: var(--accent); }
.tw-prose strong { color: var(--fg); font-weight: 600; }
.tw-prose h2 { margin: 64px 0 20px; font-family: var(--font-head); font-weight: 700; font-size: 34px; line-height: 1.2; color: var(--fg); }
/* A small markdown-style marker keeps the terminal feel without competing with the serif heading */
.tw-prose h2::before { content: "## "; content: "## " / ""; font-family: var(--font-mono); font-weight: 400; font-size: .5em; letter-spacing: 0; color: var(--cat, var(--accent)); opacity: .75; vertical-align: .18em; }
.tw-prose h3 { margin: 40px 0 14px; font-family: var(--font-head); font-weight: 700; font-size: 25px; line-height: 1.3; color: var(--fg); }
.tw-prose h4, .tw-prose h5, .tw-prose h6 { margin: 32px 0 12px; font-family: var(--font-body); font-weight: 600; font-size: 18px; letter-spacing: .01em; color: var(--fg); }
.tw-prose ul, .tw-prose ol { padding-left: 24px; }
.tw-prose li { margin: 6px 0; padding-left: 4px; }
.tw-prose li::marker { color: var(--cat, var(--accent)); }
.tw-prose blockquote {
    margin-left: 0; margin-right: 0; padding: 18px 24px;
    border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--pane);
    font-family: var(--font-head); font-size: 20px; font-style: italic; line-height: 1.55; color: var(--fg);
}
.tw-prose blockquote p { margin: 0; }
.tw-prose blockquote.kg-blockquote-alt {
    padding: 8px 0; border: 0; background: none;
    text-align: center; font-size: 26px; line-height: 1.45; color: var(--fg2);
}
.tw-prose blockquote.kg-blockquote-alt::before { content: none; }
.tw-prose blockquote::before { content: "> "; content: "> " / ""; font-family: var(--font-mono); font-style: normal; font-size: 16px; color: var(--accent); }
.tw-prose hr { margin: 40px 0; border: 0; height: 1px; background: var(--line2); }
.tw-prose img { border-radius: var(--r-lg); }
.tw-prose figure { margin-left: 0; margin-right: 0; }
.tw-prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.tw-prose th, .tw-prose td { padding: 10px 12px; border-bottom: 1px solid var(--line2); text-align: left; }
.tw-prose th { font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--accent); }
.tw-prose :not(pre) > code {
    padding: 2px 6px; border-radius: var(--r-sm);
    background: var(--hover); border: 1px solid var(--line);
    font-family: var(--font-mono); font-size: .86em; color: var(--fg);
}

/* Code blocks: tw.js wraps each <pre> in .tw-code and adds the header */
.tw-code {
    margin: 0 0 22px; border-radius: var(--r-lg);
    border: 1px solid var(--line2); background: var(--well);
    overflow: hidden;
}
.tw-code-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 6px 0 16px; border-bottom: 1px solid var(--line);
    font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.tw-copy {
    min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
    background: transparent; color: var(--muted);
    font: inherit; font-size: 12px; cursor: pointer;
}
.tw-copy:hover { background: var(--hover); color: var(--fg); }
.tw-prose pre, .tw-error-log {
    margin: 0; padding: 18px 20px; overflow-x: auto;
    background: transparent;
    font-family: var(--font-mono); font-size: 14px; line-height: 1.7; color: var(--fg);
    tab-size: 4;
}
.tw-prose pre code { font-family: inherit; font-size: inherit; background: none; border: 0; padding: 0; }
.tw-prose > pre { border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--well); }
.tw-code pre { border: 0; border-radius: 0; background: transparent; }
.kg-code-card { margin-left: 0; margin-right: 0; }
.kg-code-card figcaption { margin-top: 0; padding: 0 16px 12px; text-align: left; }

/* Prism tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--dim); font-style: italic; }
.token.string, .token.char, .token.attr-value, .token.inserted { color: var(--c-str); }
.token.keyword, .token.builtin, .token.function, .token.selector, .token.tag { color: var(--blue); }
.token.parameter, .token.number, .token.boolean, .token.constant, .token.attr-name, .token.property { color: var(--c-flag); }
.token.variable, .token.important, .token.regex { color: var(--accent); }
.token.operator, .token.punctuation, .token.entity { color: var(--muted); }
.token.deleted { color: var(--err); }

/* Ghost cards */
.tw-prose .kg-width-wide {
    position: relative; left: 50%; transform: translateX(-50%);
    width: min(960px, calc(100vw - 60px)); max-width: none;
}
.tw-prose .kg-width-full {
    position: relative; left: 50%; transform: translateX(-50%);
    width: min(calc(var(--win-max) - 2px), calc(100vw - 2 * clamp(10px, 3vw, 40px) - 2px)); max-width: none;
}
.tw-prose .kg-width-full img { border-radius: 0; }
.tw-prose .kg-callout-card {
    border-radius: var(--r-lg); border: 1px solid var(--accent-line);
    background: var(--accent-soft); color: var(--fg2);
}
.tw-prose .kg-callout-card-blue, .tw-prose .kg-callout-card-grey, .tw-prose .kg-callout-card-white {
    border-color: var(--line2); background: var(--blue-soft);
}
.tw-prose .kg-button-card a.kg-btn, .tw-prose .kg-btn {
    border-radius: var(--r-md); font-family: var(--font-mono); text-decoration: none;
}
.tw-prose .kg-btn-accent { background: var(--accent); color: var(--accent-ink); }
.tw-prose .kg-bookmark-container {
    border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--pane);
    color: var(--fg); text-decoration: none;
}
.tw-prose .kg-bookmark-title { color: var(--fg); }
.tw-prose .kg-bookmark-description, .tw-prose .kg-bookmark-metadata { color: var(--muted); }
.tw-prose .kg-toggle-card { border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--pane); }
.tw-prose .kg-signup-card { border-radius: var(--r-xl); overflow: hidden; }
.tw-prose .kg-signup-card a { text-decoration: none; }
.tw-prose .kg-header-card { border-radius: var(--r-xl); }
.tw-prose .kg-product-card-container { border-radius: var(--r-lg); background: var(--pane); border: 1px solid var(--line2); }
.tw-prose .kg-image-card img, .tw-prose .kg-gallery-image img { border-radius: var(--r-lg); }
.tw-prose .kg-gallery-image img { border-radius: var(--r-md); }

/* Signup box, post navigation */
.tw-signup {
    margin-top: 48px; padding: 28px;
    border-radius: var(--r-xl); border: 1px solid var(--pane-line); background: var(--pane);
}
.tw-signup-title { margin: 0; font-family: var(--font-head); font-weight: 400; font-size: 28px; line-height: 1.2; }
.tw-signup-text { margin: 10px 0 0; font-family: var(--font-body); font-size: 17px; color: var(--fg3); }
.tw-signup .tw-subscribe { margin-top: 18px; max-width: none; }

.tw-postnav { margin-top: 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.tw-postnav-item { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 22px; border-radius: var(--r-lg); }
.tw-postnav-next { text-align: right; }
.tw-postnav-cmd { font-size: 13px; color: var(--muted); }
.tw-postnav-title { font-family: var(--font-head); font-size: 24px; line-height: 1.2; }
.tw-postnav-empty { border: 1px dashed var(--line2); color: var(--muted); font-size: 14px; }

/* Comments (Ghost iframe) */
.tw-article > [data-ghost-comments], .tw-article #ghost-comments-root { margin-top: 48px; }

/* ---------- Book post ---------- */
.tw-book { display: flex; flex-wrap: wrap; align-items: flex-start; gap: clamp(32px, 5vw, 64px); }
.tw-book-cover { flex: 0 1 300px; min-width: 220px; margin: 0 auto; }
.tw-book-cover img {
    display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
    border-radius: var(--r-lg); border: 1px solid var(--line2); box-shadow: var(--cover-shadow);
}
.tw-book-main { flex: 999 1 460px; min-width: 0; }
.tw-book-heading {
    margin: 18px 0 0; font-family: var(--font-head); font-weight: 400;
    font-size: clamp(36px, 4.6vw, 60px); line-height: 1.06; letter-spacing: -.01em; text-wrap: balance;
}
.tw-prose-book { margin-top: 36px; max-width: 640px; font-size: 19px; }
.tw-section-more { margin-top: var(--space-section); }

/* Panels (stat / profile) */
.tw-panel { margin-top: 32px; border-radius: var(--r-lg); border: 1px solid var(--line2); background: var(--well); overflow: hidden; }
.tw-panel-head { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.tw-dl { margin: 0; padding: 18px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 24px; font-size: 14px; }
.tw-dl dt { color: var(--accent); }
.tw-dl dd { margin: 0; color: var(--fg); overflow-wrap: anywhere; }
.tw-dl dd a { text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.tw-blue-link { color: var(--blue); }
.tw-taglist .tw-blue-link { text-transform: lowercase; text-decoration: none; }
.tw-taglist { display: flex; flex-wrap: wrap; }
.tw-taglist .tw-blue-link + .tw-blue-link::before { content: ",\00a0"; color: var(--fg); }

/* ---------- About ---------- */
.tw-about { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 48px; }
.tw-about-main { flex: 999 1 480px; min-width: 0; }
.tw-about-title { margin: 0 0 32px; font-family: var(--font-head); font-weight: 400; font-size: clamp(40px, 6vw, 68px); line-height: 1.05; }
.tw-about-main .tw-prose { max-width: 640px; }
.tw-about-panel { flex: 1 1 300px; min-width: 0; margin-top: 8px; }

/* ---------- Errors ---------- */
.tw-err-line { margin: -22px 0 0; color: var(--err); font-size: 14px; overflow-wrap: anywhere; }
.tw-error-title { margin-top: 48px; }
.tw-error-text { max-width: 560px; }
.tw-error-ls { margin: 44px 0 14px; }
.tw-suggest { display: flex; flex-wrap: wrap; gap: 10px; }
.tw-suggest .tw-tab { border: 1px solid var(--line2); border-radius: var(--r-md); }
.tw-suggest .tw-tab:hover { border-color: var(--accent-line); }
.tw-suggest .tw-tab:first-child { border-color: var(--accent); color: var(--accent); }
.tw-error-recent { margin-top: 56px; }

/* ---------- Status bar ---------- */
.tw-status {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 16px;
    padding: 0 12px 0 18px;
    border-top: 1px solid var(--line); background: var(--status);
    font-size: 13px; color: var(--muted);
}
.tw-status-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 44px; min-width: 0; }
.tw-mode {
    padding: 2px 10px; border-radius: var(--r-sm);
    background: var(--accent); color: var(--accent-ink);
    font-weight: 500; letter-spacing: .04em;
}
.tw-mode:empty::before { content: "NORMAL"; }
.tw-mode[data-mode="READ"] { background: var(--blue); }
.tw-mode[data-mode^="E"] { background: var(--err); }
.tw-status-path { max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-status-read:empty { display: none; }
.tw-status-links { display: flex; flex-wrap: wrap; gap: 2px; }
.tw-status-links a {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
    border-radius: var(--r-sm); color: var(--muted); text-transform: lowercase;
}
.tw-status-links a:hover { background: var(--hover); color: var(--fg); }

/* ---------- Phone ---------- */
/* Header: logo, nav and actions need about 960px in one row; below that the nav gets its own swipeable row */
@media (max-width: 960px) {
    .tw-head { grid-template-columns: minmax(0, 1fr) auto; }
    .tw-logo { grid-row: 1; grid-column: 1; }
    .tw-actions { grid-row: 1; grid-column: 2; }
    .tw-nav {
        grid-row: 2; grid-column: 1 / -1; justify-self: stretch;
        overflow-x: auto; scrollbar-width: none;
        margin: 0 -18px; padding: 2px 18px;
    }
    .tw-nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 860px) {
    /* The window fills the screen here, so the dots only show through it. */
    .tw-grid-dots { display: none; }
    .tw-meta { flex-direction: row; flex-wrap: wrap; align-items: center; flex-basis: 100%; }
    .tw-row .tw-arrow { display: none; }
    .tw-row-title { font-size: 27px; }
    .tw-prose .kg-width-wide, .tw-prose .kg-width-full { left: auto; transform: none; width: 100%; }
    .tw-titlebar-spacer { display: none; }
}
@media (max-width: 480px) {
    .tw-brand { display: none; }
    .tw-actions { gap: 6px; }
    .tw-subscribe-row { padding: 10px; }
    .tw-subscribe-label { width: 100%; padding-left: 8px; }
    .tw-subscribe-row .tw-btn { flex: 1 1 100%; }
    .tw-prose { font-size: 17.5px; line-height: 1.75; }
    .tw-prose h2 { font-size: 28px; margin-top: 52px; }
    .tw-prose h3 { font-size: 22px; }
    .tw-lead { font-size: 19px; }
    .tw-status { padding: 6px 12px; }
}

/* ---------- Phones and tablets: no live frost ----------
   backdrop-filter on a page-tall window makes iOS Safari re-blur on every scroll frame.
   The backdrop is only soft glows, so the tinted glass alone looks nearly the same. */
@media (max-width: 860px), (hover: none) and (pointer: coarse) {
    .tw-glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Preferences ---------- */
@media (prefers-reduced-transparency: reduce) {
    .tw-glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
}
@media (prefers-reduced-motion: reduce) {
    .tw-cursor { animation: none; }
    *, *::before, *::after { transition: none !important; }
}
@media print {
    .tw-bg, .tw-progress, .tw-titlebar, .tw-head, .tw-status, .tw-signup, .tw-postnav, .tw-prompt { display: none !important; }
    .tw-glass { background: none; box-shadow: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
