/* ============================================================
 * newspaper-edition.css — The Needle homepage
 * Newspaper-on-screen design system
 *
 * COLOUR PHILOSOPHY
 * All colours use CSS custom properties from layout.css :root /
 * html[data-theme] so dark ↔ light toggle works everywhere.
 * No hardcoded hex / rgb literals appear in this file.
 *
 * WCAG AAA contrast targets (7:1 minimum):
 *   --text-color on --bg          ≥ 16:1  (AAA ✓)
 *   --text-color-80 on --bg       ≥ 11:1  (AAA ✓)
 *   --text-color-55 on --bg       ≥  7:1  (AAA ✓)
 *   --brand-g1 on --bg (dark)    ≈  4.5:1 (AA — accent only, no body text)
 *
 * Three breakpoints:
 *   Desktop  ≥ 992px  : left-rail | center-hero | right-list
 *   Tablet   768–991px: full-width hero → 2×2 grid → newsletter
 *   Mobile   < 768px  : 2 heroes → tag sections (≤3/tag)
 * ============================================================ */

/* ── VISIBILITY HELPERS ─────────────────────────────────── */
.np-hide-mobile  { display: block; }
.np-show-mobile  { display: none; }

/* ── EDITION DATELINE BAR ───────────────────────────────── */
.edition-dateline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 42px;
    border-bottom: 3px double var(--text-color);
    font-family: var(--font3, 'Old Standard TT'), serif;
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg in both modes */
    color: var(--text-color);
    margin-bottom: 0;
    background: var(--bg);
}
.edition-dateline-rule {
    flex: 1;
    height: 1px;
    background: var(--border);
    max-width: 80px;
}
.edition-dateline-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .22em;
    color: var(--text-color);
}
.edition-dateline-date,
.edition-dateline-edition {
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--text-color);
}

/* ── SECTION FLAG (newspaper section label) ─────────────── */
.np-section-flag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    margin-bottom: 18px;
    border-top: 3px solid var(--text-color);
    border-bottom: 1px solid var(--border);
    font-family: var(--font3, 'Old Standard TT'), serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg in both modes */
    color: var(--text-color-55);
    background: transparent;
}
.np-section-flag--lead {
    border-top-color: var(--brand-g1);
    border-top-width: 4px;
    color: var(--text-color);
    font-size: 11px;
}
.np-section-flag--stories {
    border-top-color: var(--brand-g3);
}
.np-section-flag-link {
    font-size: 10px;
    letter-spacing: .1em;
    color: var(--text-color-55);
    transition: color .2s ease;
}
.np-section-flag-link:hover { color: var(--text-color); }

/* ── TAG LABEL (inline kicker) ──────────────────────────── */
.np-tag-label {
    font-family: var(--font3, 'Old Standard TT'), serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    /* brand-g1 is an accent — used only on non-body-text kickers */
    color: var(--brand-g1);
}
.np-tag-label:hover { text-decoration: underline; }

/* ── FRONT PAGE GRID ────────────────────────────────────── */
.np-front-section {
    padding-top: 0;
    padding-bottom: 0;
    /* Broadsheet fold line */
    border-top: 4px double var(--text-color);
    margin-top: 0;
    background: var(--bg);
}
.np-front-grid {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 260px;
    grid-template-areas: "left center right";
    gap: 0;
    /* All three columns stretch to the same height */
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

/* ── LEFT RAIL ──────────────────────────────────────────── */
.np-left-rail {
    grid-area: left;
    border-right: 1px solid var(--border);
    padding: 24px 20px 24px 0;
    min-width: 0;
    background: var(--bg);
}

/* Newsletter inside left rail */
.np-newsletter-rail {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.np-newsletter-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.np-newsletter-tagline {
    font-family: var(--font1, 'Noto Serif'), serif;
    font-size: 13px;
    line-height: 1.6;
    font-style: italic;
    /* --text-color-80: AAA on --bg */
    color: var(--text-color-80);
    margin: 0;
}
.np-subscribe-form {
    margin-top: 14px;
    background: transparent;
    color: var(--text-color);
}
.np-subscribe-wrapper {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}
.np-subscribe-input {
    font-size: 12px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-color);
}
.np-subscribe-input::placeholder {
    color: var(--text-color-55);
}
.np-subscribe-btn {
    width: 100%;
    font-size: 11px;
    padding: 8px 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    /* Inherits base button: bg = --text-color, color = --background-color */
    background: var(--text-color);
    color: var(--background-color);
    border: none;
}
.np-subscribe-btn:hover {
    opacity: .88;
}

/* Left rail brief items */
.np-left-stories {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.np-brief-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.np-brief-item:last-child { border-bottom: none; }
.np-brief-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-family: var(--font3), serif;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg */
    color: var(--text-color-55);
}
.np-brief-date {
    color: var(--text-color-55);
}
.np-brief-heading {
    font-family: var(--font2, 'Old Standard TT'), serif;
    font-size: clamp(13px, 1vw, 15px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.01em;
    color: var(--text-color);
}

/* ── CENTER COLUMN ──────────────────────────────────────── */
.np-center-column {
    grid-area: center;
    padding: 24px 28px;
    min-width: 0;
    border-right: 1px solid var(--border);
    background: var(--bg);
}

/* Hero card — fills full center column height */
.np-hero-card {
    /* No bottom border: support row removed on desktop */
    padding-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.np-hero-image-link {
    display: block;
    margin-bottom: 18px;
}
.np-hero-image-wrapper {
    width: 100%;
    height: 0;
    padding-bottom: 54%;   /* ~16:9 */
    position: relative;
    overflow: hidden;
}
.np-hero-image-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.np-hero-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-family: var(--font3), serif;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg */
    color: var(--text-color-55);
}
.np-hero-date { color: var(--text-color-55); }
.np-hero-heading {
    font-family: var(--font2, 'Old Standard TT'), serif;
    font-size: clamp(26px, 2.6vw, 42px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.025em;
    margin-bottom: 14px;
    color: var(--text-color);
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}
/* Drop cap on hero excerpt — newspaper tradition */
.np-hero-excerpt {
    font-family: var(--font1, 'Noto Serif'), serif;
    font-size: 15px;
    line-height: 1.7;
    /* --text-color-80: AAA on --bg */
    color: var(--text-color-80);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.np-drop-cap::first-letter {
    float: left;
    font-family: var(--font4, 'Chomsky'), serif;
    font-size: 4.2em;
    line-height: .82;
    margin-right: 6px;
    margin-top: 4px;
    color: var(--text-color);
}
.np-read-more {
    display: inline-block;
    font-family: var(--font3), serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand-g1);
    transition: opacity .2s ease;
    margin-top: auto;
}
.np-read-more:hover { opacity: .7; }

/* Support row (articles 2 & 3) — HIDDEN on desktop, visible on tablet/mobile */
.np-support-row {
    display: none;
}

/* Tablet-extra row — HIDDEN on desktop, shown on tablet */
.np-tablet-extra {
    display: none;
}

/* ── RIGHT RAIL ─────────────────────────────────────────── */
.np-right-rail {
    grid-area: right;
    padding: 24px 0 24px 20px;
    min-width: 0;
    background: var(--bg);
}
.np-right-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.np-right-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.np-right-item:first-child { padding-top: 0; }
.np-right-item:last-child  { border-bottom: none; }
.np-right-item--has-image {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    align-items: start;
}
/* Alternating tint for scannability — uses surface variable */
.np-right-item:nth-child(even) {
    background: var(--surface);
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}
.np-right-image-link { display: block; }
.np-right-image-wrapper {
    width: 72px;
    height: 54px;
    overflow: hidden;
    flex-shrink: 0;
}
.np-right-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.np-right-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    font-family: var(--font3), serif;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg */
    color: var(--text-color-55);
}
.np-right-heading {
    font-family: var(--font2, 'Old Standard TT'), serif;
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -.01em;
    color: var(--text-color);
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* ── TABLET NEWSLETTER (hidden on desktop and mobile) ───── */
.np-tablet-newsletter {
    display: none;
    background: var(--bg);
}
.np-tablet-newsletter-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 22px 28px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--text-color);
    margin-bottom: 32px;
    background: var(--surface);
}
.np-tablet-newsletter-copy {
    flex: 1;
}
.np-tablet-subscribe-form {
    flex: 1;
    background: transparent;
    color: var(--text-color);
    margin-top: 0;
}

/* ── MOBILE TAG SECTIONS (hidden on desktop/tablet) ─────── */
.np-mobile-tags {
    display: none;
    background: var(--bg);
}
.np-mobile-tag-section {
    padding-top: 24px;
    padding-bottom: 8px;
    background: var(--bg);
}
.np-mobile-tag-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.np-mobile-tag-card {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.np-mobile-tag-card:first-child { border-top: 1px solid var(--border); }
.np-mobile-tag-image-link { display: block; }
.np-mobile-tag-image-wrapper {
    width: 90px;
    height: 68px;
    overflow: hidden;
}
.np-mobile-tag-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.np-mobile-tag-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-family: var(--font3), serif;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    /* --text-color-55: AAA on --bg */
    color: var(--text-color-55);
}
.np-mobile-tag-heading {
    font-family: var(--font2, 'Old Standard TT'), serif;
    font-size: clamp(15px, 4vw, 18px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
    color: var(--text-color);
}

/* ── SECTION FLAG GRADIENT ACCENT ON LEAD ───────────────── */
/* Uses brand-gradient-text for the "Latest Edition" label */
.np-section-flag--lead span {
    background: var(--brand-gradient-text, var(--brand-gradient));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── DATELINE DOUBLE-RULE ───────────────────────────────── */
.edition-dateline {
    border-bottom: 3px double var(--text-color);
    margin-bottom: 0;
}

/* ── NEWSPAPER TEXTURE (SVG noise via CSS variables) ─────── */
/* Light mode: warm paper grain */
html[data-theme="light"] .np-front-grid {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='4' fill='%23f4f2ee'/%3E%3Crect x='0' y='0' width='1' height='1' fill='%23e8e6e2' opacity='0.4'/%3E%3C/svg%3E");
}
/* Dark mode: subtle noise */
html[data-theme="dark"] .np-front-grid {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='4' fill='%23111111'/%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ffffff' opacity='0.015'/%3E%3C/svg%3E");
}

/* ══════════════════════════════════════════════════════════
   TABLET  768px – 991px
   Layout: full-width hero → 2×2 support grid → newsletter
   ══════════════════════════════════════════════════════════ */
@media (max-width: 991px) {

    /* Dateline: compact on tablet */
    .edition-dateline {
        padding: 8px 5%;
        gap: 10px;
    }
    .edition-dateline-rule { max-width: 40px; }

    /* Front grid: single column, left/right rails hidden */
    .np-front-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "center"
            "right";
        border-bottom: none;
        align-items: start;
    }
    .np-left-rail {
        display: none;   /* newsletter moves to np-tablet-newsletter below */
    }
    .np-center-column {
        border-right: none;
        padding: 20px 5%;
    }
    .np-right-rail {
        padding: 0 5% 20px;
        border-top: 1px solid var(--border);
    }

    /* Hero: slightly shorter image on tablet */
    .np-hero-card {
        height: auto;
        display: block;
    }
    .np-hero-image-wrapper { padding-bottom: 48%; }
    .np-hero-heading { font-size: clamp(22px, 4vw, 34px); }
    .np-hero-excerpt { -webkit-line-clamp: 3; }

    /* Support row: show on tablet as 2-column grid */
    .np-support-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 1px;
        margin-top: 24px;
        padding-top: 20px;
        border-top: 1px solid var(--border);
    }
    .np-support-card {
        padding: 0 20px 0 0;
        border-right: 1px solid var(--border);
        background: transparent;
    }
    .np-support-card:last-child {
        padding: 0 0 0 20px;
        border-right: none;
    }
    .np-support-image-link {
        display: block;
        margin-bottom: 12px;
    }
    .np-support-image-wrapper {
        width: 100%;
        height: 0;
        padding-bottom: 60%;
        position: relative;
        overflow: hidden;
    }
    .np-support-image-wrapper img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .np-support-meta {
        display: flex;
        align-items: center;
        gap: 5px;
        margin-bottom: 7px;
        font-family: var(--font3), serif;
        font-size: 10px;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--text-color-55);
    }
    .np-support-heading {
        font-family: var(--font2, 'Old Standard TT'), serif;
        font-size: clamp(14px, 1.3vw, 20px);
        font-weight: 700;
        line-height: 1.2;
        letter-spacing: -.015em;
        margin-bottom: 8px;
        color: var(--text-color);
    }
    .np-support-excerpt {
        font-family: var(--font1, 'Noto Serif'), serif;
        font-size: 13px;
        line-height: 1.6;
        color: var(--text-color-80);
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Tablet extra: show articles 4–5 */
    .np-tablet-extra {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 1px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid var(--border);
    }

    /* Right rail: horizontal scroll list on tablet */
    .np-right-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0 20px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .np-right-list::-webkit-scrollbar { display: none; }
    .np-right-item {
        min-width: 180px;
        max-width: 200px;
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding: 0 16px 0 0;
        background: transparent;
    }
    .np-right-item:last-child { border-right: none; }
    .np-right-item:nth-child(even) {
        background: transparent;
        margin: 0;
        padding-left: 0;
        padding-right: 16px;
    }
    .np-right-item--has-image {
        grid-template-columns: 1fr;
    }
    .np-right-image-wrapper {
        width: 100%;
        height: 100px;
    }

    /* Tablet newsletter: show the wide/shallow block */
    .np-tablet-newsletter {
        display: block;
    }
    .np-tablet-newsletter-inner {
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }

    /* Mobile tag sections: still hidden on tablet */
    .np-mobile-tags  { display: none; }
    .np-hide-mobile  { display: block; }
    .np-show-mobile  { display: none; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE  < 768px
   Layout: 2 hero cards → tag sections (≤3/tag) → newsletter
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    /* Dateline: single line, no rules */
    .edition-dateline {
        padding: 8px 4%;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .edition-dateline-rule { display: none; }

    /* Front grid: single column, only center visible */
    .np-front-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "center";
        align-items: start;
    }
    .np-left-rail  { display: none; }
    .np-right-rail { display: none; }

    .np-center-column {
        padding: 16px 4%;
        border-right: none;
    }

    /* Hero: full-width */
    .np-hero-card {
        height: auto;
        display: block;
    }
    .np-hero-image-wrapper { padding-bottom: 56%; }
    .np-hero-heading { font-size: clamp(22px, 7vw, 32px); }
    .np-hero-excerpt { -webkit-line-clamp: 3; font-size: 14px; }
    .np-drop-cap::first-letter { font-size: 3.4em; }

    /* Support row: show as 2 stacked cards on mobile */
    .np-support-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 0;
        border-top: 1px solid var(--border);
    }
    .np-support-card {
        padding: 16px 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: transparent;
    }
    .np-support-card:last-child {
        padding: 16px 0 0;
        border-bottom: none;
    }
    .np-support-image-link {
        display: block;
        margin-bottom: 12px;
    }
    .np-support-image-wrapper {
        width: 100%;
        height: 0;
        padding-bottom: 52%;
        position: relative;
        overflow: hidden;
    }
    .np-support-image-wrapper img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .np-support-meta {
        display: flex;
        align-items: center;
        gap: 5px;
        margin-bottom: 7px;
        font-family: var(--font3), serif;
        font-size: 10px;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--text-color-55);
    }
    .np-support-heading {
        font-family: var(--font2, 'Old Standard TT'), serif;
        font-size: clamp(16px, 5vw, 20px);
        font-weight: 700;
        line-height: 1.2;
        letter-spacing: -.015em;
        margin-bottom: 8px;
        color: var(--text-color);
    }
    .np-support-excerpt {
        font-family: var(--font1, 'Noto Serif'), serif;
        font-size: 13px;
        line-height: 1.6;
        color: var(--text-color-80);
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Tablet-extra: hidden on mobile */
    .np-tablet-extra { display: none; }

    /* Tablet newsletter: hidden on mobile */
    .np-tablet-newsletter { display: none; }

    /* Mobile tag sections: show */
    .np-mobile-tags  { display: block; }
    .np-hide-mobile  { display: none; }
    .np-show-mobile  { display: block; }

    /* Mobile tag section */
    .np-mobile-tag-section {
        padding-top: 20px;
        padding-bottom: 4px;
    }
    .np-mobile-tag-card {
        grid-template-columns: 80px 1fr;
        gap: 10px;
        padding: 12px 0;
    }
    .np-mobile-tag-image-wrapper {
        width: 80px;
        height: 60px;
    }
    .np-mobile-tag-heading {
        font-size: clamp(14px, 4.5vw, 17px);
    }

    /* Section flag on mobile */
    .np-section-flag {
        margin-bottom: 12px;
    }
}

/* ══════════════════════════════════════════════════════════
   SMALL MOBILE  < 480px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 479px) {
    .np-hero-heading { font-size: clamp(20px, 6.5vw, 28px); }
    .np-hero-excerpt { font-size: 13px; }
    .np-support-heading { font-size: clamp(15px, 5vw, 18px); }
    .np-mobile-tag-card {
        grid-template-columns: 72px 1fr;
        gap: 8px;
    }
    .np-mobile-tag-image-wrapper {
        width: 72px;
        height: 54px;
    }
    .np-mobile-tag-heading { font-size: clamp(13px, 4.2vw, 16px); }
    .edition-dateline-date,
    .edition-dateline-edition { display: none; }
}

/* ══════════════════════════════════════════════════════════
   LARGE DESKTOP  ≥ 1440px — fluid scaling
   ══════════════════════════════════════════════════════════ */
@media (min-width: 1440px) {
    .np-front-grid {
        grid-template-columns: 220px minmax(0, 1fr) 300px;
    }
    .np-hero-heading { font-size: clamp(32px, 2.8vw, 52px); }
    .np-right-heading { font-size: clamp(14px, 1.05vw, 17px); }
    .np-brief-heading { font-size: clamp(13px, 1.05vw, 16px); }
}
