/* Preview 18 — "The Khosravipour Record" (WSJ register).
   A sober broadsheet of record: black ink on warm white, hairline rules,
   a boxed "What's News" rail, justified serif columns, one ink-red accent.
   No stamps, no ticker — authority through restraint. Dark = ink reversed. */

:root {
    --paper: #fbfaf7;
    --ink: #14110d;
    --ink-soft: #45403a;
    --rule: rgba(20, 17, 13, 0.85);
    --hair: rgba(20, 17, 13, 0.18);
    --red: #9b1c1c;
    --serif: "Source Serif 4", Georgia, serif;
    --display: "Libre Caslon Text", Georgia, serif;
    --label: "Archivo Narrow", "Helvetica Neue", sans-serif;
    --maxw: 74rem;
    --ease: cubic-bezier(0.23, 1, 0.32, 1);
    color-scheme: light;
}
html.is-dark {
    --paper: #100f0d;
    --ink: #ece7dd;
    --ink-soft: #a59d92;
    --rule: rgba(236, 231, 221, 0.82);
    --hair: rgba(236, 231, 221, 0.18);
    --red: #e0736b;
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
body {
    background: var(--paper); color: var(--ink);
    font: 400 1.0625rem/1.6 var(--serif);
    -webkit-font-smoothing: antialiased;
    transition: background 0.4s ease, color 0.4s ease;
}
a { color: inherit; }
a, button { touch-action: manipulation; }
:where(a, button):focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
    position: absolute; left: 1rem; top: -3rem; z-index: 30;
    background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; text-decoration: none;
}
.skip-link:focus-visible { top: 1rem; }
.gallery-link {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 30;
    font-family: var(--label); font-size: 0.75rem; letter-spacing: 0.06em;
    color: var(--ink-soft); text-decoration: none;
    background: var(--paper); border: 1px solid var(--hair); padding: 0.35rem 0.7rem;
}
.gallery-link:hover, .gallery-link:focus-visible { color: var(--red); }

.paper { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem clamp(1.1rem, 4vw, 2.75rem) 4rem; }

/* ── Topline ──────────────────────────────────────────────────── */
.topline {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    font-family: var(--label); font-size: 0.72rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-soft);
    padding-bottom: 0.6rem;
}
.topline__mid { letter-spacing: 0.2em; }

/* ── Nameplate ────────────────────────────────────────────────── */
.nameplate { text-align: center; }
.nameplate__rule { border-top: 1px solid var(--rule); }
.nameplate__rule--double {
    border-top: 3px double var(--rule); margin-top: 0.55rem;
    transform: scaleX(0); transform-origin: center;
}
@media (prefers-reduced-motion: no-preference) {
    html.js .nameplate__rule--double { transition: transform 0.7s var(--ease) 0.15s; }
    html.js .nameplate.is-in .nameplate__rule--double { transform: scaleX(1); }
}
html:not(.js) .nameplate__rule--double, .nameplate.is-in .nameplate__rule--double { transform: scaleX(1); }
.nameplate h1 {
    font-family: var(--display); font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1; letter-spacing: -0.01em;
    margin: 0.9rem 0 0.5rem;
}
.nameplate__motto {
    font-family: var(--label); font-size: 0.8rem; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.55rem;
}

/* ── Masthead nav ─────────────────────────────────────────────── */
.masthead-nav {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
    margin: 1.4rem 0 2.5rem; padding: 0.4rem 0;
}
.masthead-nav__links { display: flex; flex-wrap: wrap; gap: clamp(0.8rem, 2.5vw, 1.9rem); }
.masthead-nav a {
    font-family: var(--label); font-size: 0.82rem; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--ink); text-decoration: none;
    padding: 0.45rem 0;
}
.masthead-nav a:hover { color: var(--red); }
.theme-toggle {
    flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem;
    background: transparent; color: var(--ink-soft); border: 1px solid var(--hair);
    cursor: pointer; transition: color 0.18s ease, border-color 0.18s ease;
}
.theme-toggle:hover { color: var(--red); border-color: var(--red); }
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }
html.is-dark .theme-toggle__sun { display: block; }
html.is-dark .theme-toggle__moon { display: none; }

/* ── Broadsheet: What's News rail + lead ──────────────────────── */
.broadsheet { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 3rem); }

.whatsnews { border: 1px solid var(--rule); padding: 1rem 1.1rem 1.2rem; align-self: start; }
.whatsnews__head {
    font-family: var(--display); font-weight: 700; font-size: 1.15rem;
    color: var(--red); text-align: center;
    border-bottom: 2px solid var(--rule); padding-bottom: 0.5rem; margin-bottom: 0.9rem;
}
.whatsnews__list { list-style: none; padding: 0; }
.whatsnews__list li {
    position: relative; padding: 0.55rem 0 0.55rem 1rem;
    font-size: 0.86rem; line-height: 1.45; color: var(--ink-soft);
    border-top: 1px solid var(--hair);
}
.whatsnews__list li:first-child { border-top: 0; }
.whatsnews__list li::before { content: "▪"; position: absolute; left: 0; top: 0.5rem; color: var(--red); font-size: 0.7rem; }
.whatsnews__list strong { color: var(--ink); font-weight: 600; }

/* ── Lead story ───────────────────────────────────────────────── */
.lead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10rem;
    column-gap: 1.8rem;
    grid-template-areas:
        "kicker   portrait"
        "headline portrait"
        "deck     portrait"
        "body     body"
        "actions  actions";
}
.lead > .kicker { grid-area: kicker; }
.lead__headline { grid-area: headline; }
.lead__deck { grid-area: deck; }
.lead .portrait { grid-area: portrait; }
.lead__body { grid-area: body; }
.lead__actions { grid-area: actions; }

.kicker {
    font-family: var(--label); font-size: 0.78rem; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--red); margin-bottom: 0.6rem;
}
.lead__headline {
    font-family: var(--display); font-weight: 700;
    font-size: clamp(1.7rem, 3.6vw, 2.7rem); line-height: 1.08; letter-spacing: -0.01em;
    margin-bottom: 0.8rem;
}
.lead__deck { font-family: var(--display); font-style: italic; font-size: 1.12rem; line-height: 1.4; color: var(--ink-soft); margin-bottom: 1.2rem; }

.portrait { align-self: start; }
.portrait__plate {
    aspect-ratio: 4 / 5; display: grid; place-items: center;
    border: 1px solid var(--rule);
    background:
        repeating-linear-gradient(90deg, transparent 0 2px, color-mix(in oklab, var(--ink) 7%, transparent) 2px 3px),
        var(--paper);
    font-family: var(--display); font-weight: 700; font-size: 2.6rem;
    color: color-mix(in oklab, var(--ink) 78%, var(--paper));
    filter: grayscale(1) contrast(1.05);
}
.portrait figcaption { font-family: var(--label); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); text-align: center; margin-top: 0.4rem; }

.lead__body { margin-top: 1.4rem; columns: 2; column-gap: 2rem; text-align: justify; hyphens: auto; }
.lead__body p { margin-bottom: 0.85rem; }
.lead__body p:first-child::first-letter {
    font-family: var(--display); font-weight: 700;
    font-size: 3.1em; line-height: 0.82; float: left; padding: 0.05em 0.1em 0 0;
}
.dateline { font-family: var(--label); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; font-size: 0.82em; }
.lead__cont { font-style: italic; color: var(--ink-soft); }
.lead__cont a { color: var(--red); text-decoration: none; }
.lead__cont a:hover { text-decoration: underline; }
.lead__actions { margin-top: 1.6rem; display: flex; gap: 0.7rem; flex-wrap: wrap; column-span: all; }

.btn {
    font-family: var(--label); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase;
    text-decoration: none; padding: 0.6rem 1.2rem;
    background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
    transition: background 0.18s ease, color 0.18s ease;
}
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: transparent; color: var(--red); border-color: var(--red); }

/* ── Section rule heads ───────────────────────────────────────── */
.section-rule {
    border-top: 2px solid var(--rule); margin: 3rem 0 1.5rem;
    font-family: var(--label); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.section-rule span { display: inline-block; background: var(--paper); padding: 0.5rem 0.8rem 0 0; transform: translateY(-0.1rem); }

/* ── Stories grid ─────────────────────────────────────────────── */
.stories__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.story { padding: 0 1.4rem; border-left: 1px solid var(--hair); }
.story:first-child { padding-left: 0; border-left: 0; }
.kicker--research { color: var(--red); }
.kicker--writing { color: #1f5566; }
html.is-dark .kicker--writing { color: #6fb6c8; }
.story h3 { font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.18; margin: 0.3rem 0 0.5rem; }
.story h3 a { color: inherit; text-decoration: none; }
.story h3 a:hover { color: var(--red); }
.story__deck { font-size: 0.92rem; color: var(--ink-soft); }
.story__tags { margin-top: 0.6rem; font-family: var(--label); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.stories__more { display: flex; gap: 1.5rem; margin-top: 1.5rem; font-family: var(--label); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; }
.stories__more a { color: var(--red); text-decoration: none; }
.stories__more a:hover { text-decoration: underline; }

/* ── Correspondence ───────────────────────────────────────────── */
.correspondence__pitch { max-width: 60ch; color: var(--ink-soft); margin-bottom: 1.3rem; }
.correspondence__row { display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* ── Colophon ─────────────────────────────────────────────────── */
.colophon { border-top: 1px solid var(--hair); margin-top: 3rem; padding-top: 1rem; font-family: var(--label); font-size: 0.76rem; letter-spacing: 0.03em; color: var(--ink-soft); }

/* ── Reveals ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    html.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.55s var(--ease), transform 0.55s var(--ease); }
    html.js .reveal.is-in { opacity: 1; transform: none; }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* links wrap within their column; toggle stays pinned top-right */
    .masthead-nav { align-items: flex-start; }
    .masthead-nav__links { gap: 0.5rem 1.1rem; }
}
@media (max-width: 800px) {
    .broadsheet { grid-template-columns: 1fr; }
    .whatsnews { order: 2; }
    .lead {
        grid-template-columns: 1fr;
        grid-template-areas: "kicker" "headline" "deck" "portrait" "body" "actions";
    }
    .lead .portrait { max-width: 9rem; margin-bottom: 1rem; }
}
@media (max-width: 640px) {
    .lead__body { columns: 1; text-align: left; hyphens: manual; }
    .stories__grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .story { padding: 1.2rem 0 0; border-left: 0; border-top: 1px solid var(--hair); }
    .story:first-child { padding-top: 0; border-top: 0; }
}
