/* ── /writing — shared styles for the listing + individual posts ──────
   Used by writing/index.html and writing/*.html.
   Repo fonts only (Inter + Lora italic + JetBrains Mono for code).
   ──────────────────────────────────────────────────────────────────── */

:root {
    --bg:            #FAF8F3;
    --bg-card:       #FFFFFF;
    --text:          #111;
    --text-muted:    #555;
    --text-dim:      #888;
    --border:        #E5E5E0;
    --rule:          #ECECE5;
    --accent:        #003566;     /* Oxford Navy — links + accents */
    --accent-soft:   #FFF5D4;     /* pale yellow wash for inline code */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ── INDEX page shell ──────────────────────────────────────────── */
.writing-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 7rem 32px 4rem;
}
@media (max-width: 600px) {
    .writing-wrap { padding: 6rem 20px 3rem; }
}

.writing-head {
    margin-bottom: 4rem;
    max-width: 720px;
}
.writing-head h1 {
    font-size: clamp(40px, 5.5vw, 64px);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 1.2rem;
}
.writing-head p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-muted);
    /* No max-width — let the intro line breathe single-line on desktop;
       it'll wrap naturally on narrower viewports. */
}

/* ── Trading-card grid (V1 + B2: date at top, single keyword center) ──
   3 columns for now — bump to 4 once enough posts accumulate to fill it. */
.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
@media (max-width: 820px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } }

.card {
    aspect-ratio: 5 / 7;
    border-radius: 14px;
    padding: 28px 24px 24px;
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
    transition: transform 220ms ease, box-shadow 220ms ease;
    overflow: hidden;
    position: relative;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -16px rgba(0,0,0,0.18);
}

.card-date {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
    opacity: 0.6;
}

.card-visual {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    margin: 18px 0 20px;
}
.card-keyword {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 900;
    font-size: 56px;
    letter-spacing: -0.04em;
    text-align: center;
    line-height: 1.05;
}
.card-keyword small {
    display: block;
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0;
    opacity: 0.5;
    margin-top: 10px;
}

.card-eyebrow {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    text-align: center; margin-bottom: 8px;
    opacity: 0.75;
}
.card-title {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.25;
    text-align: center;
}

/* Per-card palette — rotates through 4 moods */
.card-navy   { background: #4F5C72; color: #E8E1CF; }
.card-sage   { background: #B7D4D2; color: #1E2532; }
.card-brown  { background: #4A3B2E; color: #F5C75F; }
.card-plum   { background: #D2B8DB; color: #2A1F33; }

/* ── POST page shell ───────────────────────────────────────────── */
.post-wrap {
    max-width: 960px;     /* wider so TL;DR breathes */
    margin: 0 auto;
    padding: 6rem 24px 3rem;
}
@media (min-width: 768px) {
    .post-wrap { padding: 7rem 32px 4rem; }
}

.post-back {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 3rem;
}
.post-back:hover { text-decoration: underline; }

.post-header { margin-bottom: 2rem; }
.post-header .post-meta {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 14px;
}
.post-header h1 {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.06;
}

/* ── TL;DR Variant A (annotated, wider, bigger) ───────────────── */
.tldr {
    margin: 2.5rem 0 3.5rem;
    background: var(--bg);
    padding: 44px 40px;
    border: 1px dashed #D4CFC2;
    border-radius: 10px;
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 30px;
    line-height: 1.5;
    color: #2a2a2a;
}
@media (max-width: 680px) {
    .tldr { padding: 28px 22px; font-size: 22px; }
}

.tldr .hl-green  { background: #C8E6C8; padding: 0 8px; border-radius: 3px; }
.tldr .hl-yellow { background: #FBE7A0; padding: 0 8px; border-radius: 3px; }
.tldr .hl-pink   { background: #F5C6D0; padding: 0 8px; border-radius: 3px; }
.tldr .hl-blue   { background: #BCDCEA; padding: 0 8px; border-radius: 3px; }

.tldr .annotation {
    display: flex; flex-wrap: wrap; gap: 24px;
    font-family: 'Inter', system-ui, sans-serif;
    font-style: normal;
    font-size: 14px;
    line-height: 1.45;
    color: #555;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px dashed #D4CFC2;
}
.tldr .annotation span {
    display: inline-flex; gap: 8px; align-items: center;
}
.tldr .annotation .key {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 13px;
}

/* ── Body content — matches TL;DR width (fills .post-wrap container) ─
   Medium-style 20px body for comfortable longer-form reading.
   TL;DR keeps its own larger sizing — not affected here. */
.post-body {
    max-width: 100%;
    font-size: 20px;
    line-height: 1.7;
    color: var(--text);
}
.post-body > * + * { margin-top: 1.4rem; }

.post-body h2 {
    font-size: clamp(22px, 2.8vw, 28px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-top: 3rem;
    margin-bottom: 1rem;
}
.post-body h3 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 2.2rem;
    margin-bottom: 0.7rem;
}

.post-body p { line-height: 1.75; }
.post-body strong { font-weight: 700; color: var(--text); }
.post-body em { font-style: italic; }

.post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color 200ms ease;
}
.post-body a:hover { text-decoration-thickness: 2px; }

.post-body ul, .post-body ol {
    padding-left: 1.5rem;
}
.post-body li + li { margin-top: 0.5rem; }
.post-body li { line-height: 1.65; }

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.2rem 0 0.2rem 1.4rem;
    margin: 2rem 0;
    font-size: 19px;
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.6;
}

.post-body code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.9em;
    background: var(--accent-soft);
    padding: 0.1em 0.4em;
    border-radius: 4px;
}

/* Horizontal rule as a soft section break */
.post-body hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 3rem 0;
}

/* ── Visual moves — break up the body's monotony ──────────────── */

/* Drop cap on the first paragraph after a header */
.post-body .drop-cap::first-letter {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 5.2em;
    float: left;
    line-height: 0.82;
    margin: 0.08em 0.12em 0 0;
    color: var(--accent);
}

/* Inline body highlights — use sparingly. Same palette as TL;DR but
   slimmer padding so they read like marker pen, not labels. */
.post-body .hl-y { background: #FBE7A0; padding: 0 5px; border-radius: 2px; }
.post-body .hl-g { background: #C8E6C8; padding: 0 5px; border-radius: 2px; }
.post-body .hl-p { background: #F5C6D0; padding: 0 5px; border-radius: 2px; }
.post-body .hl-b { background: #BCDCEA; padding: 0 5px; border-radius: 2px; }

/* Pull-quote — centered, large, italic, with thin rules above/below */
.post-body .pull-quote {
    margin: 3rem auto;
    max-width: 88%;
    padding: 1.8rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(24px, 3.2vw, 34px);
    line-height: 1.35;
    text-align: center;
    color: var(--accent);
}

/* Numbered editorial list (V3 — used for pros/cons in posts) */
.post-body .list-card {
    margin: 1.8rem 0 2rem;
}
.post-body .list-card-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding-bottom: 0.8rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--rule);
}
.post-body .list-card-head .sym {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 1;
}
.post-body .list-card-head .lbl {
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--text-dim);
}
.post-body .list-pros .sym { color: #4A6B3A; }
.post-body .list-cons .sym { color: #8B3A2A; }

.post-body .list-card ol {
    list-style: none;
    padding: 0; margin: 0;
    counter-reset: item;
}
.post-body .list-card li {
    position: relative;
    padding: 1rem 0 1rem 60px;
    counter-increment: item;
    border-bottom: 1px solid var(--rule);
    line-height: 1.65;
    margin-top: 0 !important;     /* override .post-body > * + * spacing */
}
.post-body .list-card li:last-child { border-bottom: none; }
.post-body .list-card li::before {
    content: counter(item, decimal-leading-zero);
    position: absolute;
    left: 0; top: 1rem;
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 30px;
    line-height: 1;
    color: var(--text-dim);
}

/* Decision box — Yes/No side-by-side columns for "when to use" */
.post-body .decision-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 2rem 0;
}
.post-body .decision-box > div {
    padding: 1.3rem 1.5rem;
    border-radius: 10px;
}
.post-body .decision-box .yes {
    background: #EAF4EA;
}
.post-body .decision-box .no {
    background: #FBEEEE;
}
.post-body .decision-box .db-label {
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.18em; text-transform: uppercase;
    margin-bottom: 10px;
}
.post-body .decision-box .yes .db-label { color: #16A34A; }
.post-body .decision-box .no  .db-label { color: #DC2626; }
.post-body .decision-box p { line-height: 1.55; font-size: 16px; margin: 0; }
@media (max-width: 600px) {
    .post-body .decision-box { grid-template-columns: 1fr; }
}

/* Ornament divider — replaces plain hr at the closing transition */
.post-body .ornament {
    text-align: center;
    margin: 3rem 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 22px;
    letter-spacing: 0.6em;
    color: var(--text-dim);
    border: none;
    line-height: 1;
}
.post-body .ornament::before { content: '·  ·  ·'; }

/* Final closer line — the article's punchline.
   Treated as a deliberate "moment" with an ornament marker above,
   oversized italic Lora in accent. No background tile — relies on
   the ornament + typography + spacing to land. */
.post-body .closer {
    position: relative;
    padding: 2rem 0 1rem;
    margin: 3rem auto 1rem;
    max-width: 720px;

    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(26px, 3.4vw, 36px);
    line-height: 1.4;
    letter-spacing: -0.015em;
    text-align: center;
    color: var(--accent);
}

/* Decorative ornament above the text — pseudo-element, no markup change */
.post-body .closer::before {
    content: '❖';
    display: block;
    font-family: 'Inter', system-ui, sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 22px;
    color: var(--accent);
    opacity: 0.5;
    margin-bottom: 1.4rem;
    letter-spacing: 0;
}

@media (max-width: 600px) {
    .post-body .closer {
        font-size: 22px;
        margin: 2.5rem auto 0.5rem;
    }
    .post-body .closer::before {
        font-size: 18px;
        margin-bottom: 1rem;
    }
}

/* ── Settings page mockup (visual replacement for code blocks) ── */
.settings-mockup {
    max-width: 100%;
    margin: 2rem 0 2.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 40px -20px rgba(0,0,0,0.12);
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
}

.sm-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: #FAFAF8;
    font-size: 13px; font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.sm-header .sm-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #c2c2c2;
    margin-right: 4px;
}
.sm-header .sm-dot:nth-child(2) { background: #c2c2c2; margin-right: 4px; }
.sm-header .sm-dot:nth-child(3) { background: #c2c2c2; margin-right: 14px; }

.sm-body { padding: 22px 24px 24px; }

.sm-section + .sm-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
}
.sm-section-label {
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
}
.sm-section-label .sm-status {
    margin-left: auto;
    font-size: 11px; font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: none;
    display: inline-flex; align-items: center; gap: 6px;
}
.sm-section-label .sm-status .ok-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #16A34A;
}
.sm-section-label .sm-status .off-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #c2c2c2;
}

.sm-field {
    margin-top: 8px;
}
.sm-field-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.sm-field-row {
    display: flex; gap: 10px;
    align-items: stretch;
}
.sm-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    background: #fff;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sm-input.url-input {
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
}
.sm-save {
    padding: 9px 16px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: none;
    cursor: default;
    pointer-events: none;
}
.sm-connect {
    padding: 9px 16px;
    border-radius: 6px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.04em;
    cursor: default;
    pointer-events: none;
}
.sm-help {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Settings mockup — tighten on narrow screens */
@media (max-width: 520px) {
    .sm-body { padding: 18px 16px 20px; }
    .sm-section-label {
        flex-wrap: wrap;
        gap: 6px 8px;
    }
    .sm-section-label .sm-status {
        margin-left: 0;
        flex-basis: 100%;
    }
    .sm-input { font-size: 12px; padding: 8px 10px; }
    .sm-save, .sm-connect { padding: 8px 12px; font-size: 11px; }
}

/* ── Post footer: prev/next — also matches body width ──────────── */
.post-nav {
    max-width: 100%;
    margin: 4rem 0 0;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    font-size: 14px;
}
.post-nav a {
    display: block;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 200ms ease;
}
.post-nav a:hover { color: var(--accent); }
.post-nav .nav-label {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
    display: block;
}
.post-nav .nav-title {
    font-size: 15px; font-weight: 700;
    color: var(--text); line-height: 1.4;
}
.post-nav .nav-next { text-align: right; }

@media (max-width: 600px) {
    .post-nav { grid-template-columns: 1fr; gap: 28px; }
    .post-nav .nav-next { text-align: left; }
}
