/* Developers Coffee — newspaper post theme.
   CSS variables, masthead, and typography rules transplanted verbatim
   from tdd.cat (The Daily Diff, MIT — github.com/arpitbbhayani/the-daily-diff,
   src/styles/main.scss) to match its exact "classic newspaper" look.
   Deviation: .story-body font-size raised from tdd.cat's 0.8rem (sized for
   short digest blurbs) to 1.05rem — our posts are full-length articles, not
   two-sentence story summaries, so their literal size reads too small here. */

@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
    --bg-page: #e7e1d1;
    --bg-sheet: #f8f4e8;
    --bg-sheet-alt: #efe8d4;
    --bg-well: #ffffff;

    --ink: #1b1a17;
    --ink-soft: #45423a;
    --ink-faint: #7c7563;
    --ink-invert: #f8f4e8;

    --rule: #201e19;
    --rule-soft: rgba(32, 30, 25, 0.28);
    --rule-hair: rgba(32, 30, 25, 0.16);

    --accent: #8a1f11;
    --accent-soft: rgba(138, 31, 17, 0.08);
    --accent-ink: #8a1f11;

    --shadow-sheet: 0 1px 2px rgba(27, 26, 23, 0.06), 0 18px 40px -20px rgba(27, 26, 23, 0.35);

    --font-display: "Lora", Georgia, "Times New Roman", serif;
    --font-body: "PT Serif", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", "Courier New", monospace;

    --sheet-max: 1180px;
    --sheet-pad: clamp(1rem, 2.5vw, 2.25rem);

    --bg-selection: rgba(138, 31, 17, 0.16);
}

[data-theme="dark"] {
    --bg-page: #17150f;
    --bg-sheet: #221f19;
    --bg-sheet-alt: #2a2520;
    --bg-well: #1c1913;

    --ink: #d9d0bd;
    --ink-soft: #b0a790;
    --ink-faint: #7f7663;
    --ink-invert: #221f19;

    --rule: #b0a790;
    --rule-soft: rgba(217, 208, 189, 0.22);
    --rule-hair: rgba(217, 208, 189, 0.12);

    --accent: #cc9a56;
    --accent-soft: rgba(204, 154, 86, 0.12);
    --accent-ink: #dcae6d;

    --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -22px rgba(0, 0, 0, 0.55);

    --bg-selection: rgba(204, 154, 86, 0.25);
}

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

::selection { background-color: var(--bg-selection); color: inherit; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100vw;
}

.np-body {
    margin: 0;
    background-color: var(--bg-page);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
    max-width: 100%;
}

.np-body a { color: inherit; text-decoration: none; }

.page-container {
    max-width: var(--sheet-max);
    margin: 0 auto;
    padding: 0 var(--sheet-pad) 4rem;
}

/* Newspaper sheet */
.newspaper-sheet {
    background: var(--bg-sheet);
    box-shadow: var(--shadow-sheet);
    padding: var(--sheet-pad);
}

/* Masthead */
.masthead { position: relative; text-align: center; padding-bottom: 0.45rem; }

.masthead-eyebrow {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.66rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding-bottom: 0.35rem;
}
.masthead-eyebrow span:first-child { text-align: left; }

.masthead-eyebrow-left { display: inline-flex; align-items: center; justify-content: flex-start; }
.masthead-eyebrow-right { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.75rem; text-align: right; }

.masthead-archive-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ink-faint); vertical-align: -0.05em; }
.masthead-archive-link:hover { color: var(--accent-ink); }

.masthead-eyebrow-sep { color: var(--ink-faint); }
.masthead-eyebrow-link { color: var(--ink-soft); text-transform: lowercase; font-style: italic; font-weight: 500; transition: color 0.15s ease; }
.masthead-eyebrow-link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

.rail-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    color: var(--ink);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.masthead-eyebrow-right #theme-toggle.rail-btn {
    width: auto; height: auto; padding: 0.2rem;
    color: var(--ink-faint); background: transparent; border: none;
    transition: color 0.15s ease;
}
.masthead-eyebrow-right #theme-toggle.rail-btn:hover { color: var(--accent-ink); background: transparent; }

.theme-toggle-icon .sun { display: none; }
.theme-toggle-icon .moon { display: inline-block; }
[data-theme="dark"] .theme-toggle-icon .sun { display: inline-block; }
[data-theme="dark"] .theme-toggle-icon .moon { display: none; }

.masthead-name {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 5vw, 3.85rem);
    margin: 0;
    -webkit-text-stroke: 1.2px currentColor;
    text-shadow: 0.5px 0 0 currentColor;
}

.masthead-tagline {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    color: var(--ink-faint);
    margin: 0.15rem 0 0;
}

.masthead-rule-thick { border: none; border-top: 4px double var(--rule); margin: 1.1rem 0 0.32rem; }

@media (max-width: 480px) {
    .masthead-eyebrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0; }
    .masthead-eyebrow-left { flex: 1 0 auto; }
    .masthead-eyebrow-right { flex: 1 0 auto; justify-content: flex-end; }
}

/* Story (single post = lead story, full width) */
.story.is-lead {
    padding: 1.1rem 0 1rem;
}

.story-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.4vw, 2.35rem);
    line-height: 1.15;
    margin: 0 0 0.6rem;
}

.story-byline {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 1.4rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--rule-soft);
}
.story-source-sep { margin: 0 0.5em; }

.story-body { font-size: 1.05rem; line-height: 1.68; max-width: 68ch; }

.story-body p { margin: 0 0 1.05em; }

.story-body h1, .story-body h2, .story-body h3, .story-body h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    margin: 1.6em 0 0.55em;
}
.story-body h2 { font-size: 1.4rem; }

.story-body ul, .story-body ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.story-body li { margin: 0 0 0.45em; }

.story-body blockquote {
    margin: 0 0 1.05em;
    padding: 0.7rem 0 0.7rem 1rem;
    border-left: 2px solid var(--rule-soft);
    color: var(--ink-soft);
    font-style: italic;
    background: var(--accent-soft);
}
.story-body blockquote p:last-child { margin-bottom: 0; }

.story-body code {
    font-family: var(--font-mono);
    background: var(--bg-sheet-alt);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.86em;
}

.story-body pre { background: var(--bg-sheet-alt); padding: 1rem 1.2rem; overflow-x: auto; margin: 0 0 1.05em; border-radius: 4px; }
.story-body pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.55; }

.story-body strong { font-weight: 700; }

.story-body a { text-decoration: underline; text-decoration-color: var(--rule-soft); text-underline-offset: 0.15em; }
.story-body a:hover { color: var(--accent-ink); }

.story-body hr { border: none; border-top: 1px solid var(--rule-hair); margin: 1em 0; }

.story-callout {
    background: var(--bg-sheet-alt);
    border: 1px solid var(--rule-hair);
    padding: 1.1rem 1.3rem;
    margin: 0 0 1.4em;
}
.story-callout p:last-child { margin-bottom: 0; }

/* Colophon (footer) */
.edition-colophon {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 4px double var(--rule);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.edition-colophon a { color: var(--ink-faint); text-decoration: underline; text-decoration-color: var(--rule-soft); text-underline-offset: 0.15em; }
.edition-colophon a:hover { color: var(--accent-ink); }
