/* ============================================================
   Signal Briefing — Editorial stylesheet
   Palette: warm off-white bg, deep navy masthead, dark-red accent
   Typography: Playfair Display (headings) + Inter (body/UI)
   ============================================================ */

/* -----------------------------------------------------------
   CSS custom properties
   ----------------------------------------------------------- */

:root {
    --bg:          #F9F7F4;
    --white:       #FFFFFF;
    --text:        #1A1A1A;
    --muted:       #6B6B6B;
    --navy:        #1C2B3A;
    --red:         #B5121B;
    --border:      #E0DAD2;
    --notice-bg:   #FFF8F0;

    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;

    --radius-card:  8px;
    --transition:   150ms ease;
}

/* -----------------------------------------------------------
   Reset & base
   ----------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--navy);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    text-decoration: underline;
}

/* -----------------------------------------------------------
   Masthead / header
   ----------------------------------------------------------- */

.masthead {
    background: var(--navy);
    border-bottom: 3px solid var(--red);
    position: sticky;
    top: 0;
    z-index: 100;
}

.masthead-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: 64px;
    gap: 1rem;
}

.masthead-left {
    flex: 1;
    min-width: 0;
}

.wordmark {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.masthead-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-email {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}

/* Ghost buttons in masthead */
.btn-ghost {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: var(--white);
    padding: 0.3rem 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    transition: background var(--transition), border-color var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.65);
}

/* -----------------------------------------------------------
   Masthead nav — wide only
   ----------------------------------------------------------- */

.desktop-nav {
    display: none; /* shown via JS when logged in; hidden on narrow via media query */
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.nav-link--active {
    color: var(--white);
    font-weight: 600;
}

.desktop-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* -----------------------------------------------------------
   Narrow controls — Daily/Weekly buttons + hamburger
   ----------------------------------------------------------- */

.narrow-controls {
    display: none; /* shown via JS when logged in; hidden on wide via media query */
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.narrow-tab-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition);
    text-decoration: none;
}

.narrow-tab-btn:hover {
    color: rgba(255, 255, 255, 0.85);
}

.narrow-tab-btn.active {
    color: var(--white);
    font-weight: 600;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background var(--transition);
    min-width: 36px;
    min-height: 36px;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* -----------------------------------------------------------
   Drawer — narrow only
   ----------------------------------------------------------- */

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 150;
}

.drawer {
    position: fixed;
    top: 67px; /* masthead height + border */
    right: 0;
    bottom: 0;
    width: 240px;
    background: var(--white);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.drawer-section-label {
    padding: 0.6rem 1.25rem 0.35rem;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.drawer-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    min-height: 44px;
    transition: background var(--transition);
    box-sizing: border-box;
}

.drawer-item--sub {
    padding-left: 2rem;
    color: var(--text);
}

.drawer-item:hover {
    background: var(--bg);
}

.drawer-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.4rem 0;
}

/* Wide: hide narrow-only elements */
@media (min-width: 768px) {
    .narrow-controls {
        display: none !important;
    }

    .drawer,
    .drawer-overlay {
        display: none !important;
    }

    .tab-bar {
        display: none !important;
    }

    .wordmark {
        font-size: 1.25rem;
    }
}

/* Narrow: hide desktop-only elements */
@media (max-width: 767px) {
    .desktop-nav {
        display: none !important;
    }

    .desktop-auth .btn-ghost:not(#loginBtn) {
        display: none !important;
    }
}

/* -----------------------------------------------------------
   Content area
   ----------------------------------------------------------- */

.content-area {
    max-width: 760px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 5rem;
}

/* -----------------------------------------------------------
   Section heading — Daily / Weekly label at top of content
   ----------------------------------------------------------- */

.section-heading {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
}

/* -----------------------------------------------------------
   Profile completion notice
   ----------------------------------------------------------- */

.profile-notice {
    background: var(--notice-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.5;
}

.profile-notice strong {
    font-weight: 600;
}

.profile-notice a {
    color: var(--red);
    margin-left: 0.35rem;
    text-decoration: none;
    font-weight: 500;
}

.profile-notice a:hover {
    text-decoration: underline;
}

/* -----------------------------------------------------------
   Welcome card (logged-out state)
   ----------------------------------------------------------- */

.welcome-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 2.5rem;
    margin-top: 1rem;
}

.welcome-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.welcome-card p {
    margin-bottom: 0.75rem;
}

.welcome-card p:last-child {
    margin-bottom: 0;
}

/* -----------------------------------------------------------
   Tab bar — Daily / Weekly
   ----------------------------------------------------------- */

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
    transition: color var(--transition), border-color var(--transition);
    min-height: 44px;
}

.tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--red);
}

.tab-btn:hover:not(.active) {
    color: var(--text);
}

/* tab-link: <a> that looks and behaves like a tab button */
.tab-btn.tab-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

/* -----------------------------------------------------------
   Date navigation — scrollable pill strip
   ----------------------------------------------------------- */

#dateNav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 2rem;
    display: flex;
    gap: 0.4rem;
    padding-bottom: 2px;
}

#dateNav::-webkit-scrollbar {
    display: none;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.25rem 0.85rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
    min-height: 36px;
    transition: all var(--transition);
}

.date-chip:hover {
    color: var(--text);
    border-color: var(--navy);
}

.date-chip.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* -----------------------------------------------------------
   Narrow-screen lens nav link — shown when TOC sidebar is hidden
   ----------------------------------------------------------- */

#lensNavMobile {
    margin-bottom: 1rem;
}

.lens-nav-mobile {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--lens-dot-color, var(--navy));
    text-decoration: none;
    transition: opacity var(--transition);
}

.lens-nav-mobile:hover {
    opacity: 0.75;
    text-decoration: none;
}

/* Hide when the TOC sidebar grid is active — the TOC entry handles it there */
@media (min-width: 1100px) {
    .content-area.has-toc #lensNavMobile {
        display: none !important;
    }
}

/* -----------------------------------------------------------
   TOC lens entry — party lens link at bottom of sidebar nav
   ----------------------------------------------------------- */

.toc-lens-item {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.toc-lens-item a {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--lens-dot-color, var(--navy));
    text-decoration: none;
    display: block;
    line-height: 1.5;
    transition: opacity var(--transition);
}

.toc-lens-item a:hover {
    opacity: 0.75;
    text-decoration: none;
}

/* -----------------------------------------------------------
   Party lens section — always-expanded at page bottom
   Uses --lens-accent and --lens-tint CSS custom properties
   set inline by JS based on user's party
   ----------------------------------------------------------- */

#partyLensContent {
    margin-bottom: 2rem;
    border-top: 4px solid var(--lens-accent, var(--navy));
    background: var(--lens-tint, var(--bg));
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    padding: 1.5rem 1.5rem 2rem;
}

.lens-heading {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

#partyLensContent p {
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.7;
}

#partyLensContent p:last-child {
    margin-bottom: 0;
}

#partyLensContent ul {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

#partyLensContent li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

/* -----------------------------------------------------------
   Loading / error states
   ----------------------------------------------------------- */

.loading-text {
    color: var(--muted);
    font-style: italic;
}

.text-error {
    color: var(--red);
}

/* -----------------------------------------------------------
   Briefing content — metadata (timestamp, date)
   ----------------------------------------------------------- */

#briefingContent .briefing-timestamp {
    font-family: var(--font-body);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

#briefingContent .briefing-date {
    font-family: var(--font-body);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

#briefingContent .briefing-notice {
    font-style: italic;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* -----------------------------------------------------------
   Briefing content — main heading (h1)
   ----------------------------------------------------------- */

#briefingContent h1 {
    font-family: var(--font-display);
    font-size: 2.15rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    border-left: 4px solid var(--red);
    padding-left: 1rem;
    margin-bottom: 2.25rem;
}

/* -----------------------------------------------------------
   Briefing content — issue cards (h2 sections)
   ----------------------------------------------------------- */

.issue-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.issue-card h2 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    margin-bottom: 1.25rem;
}

/* -----------------------------------------------------------
   Intelligence Summary card (first h2 section)
   ----------------------------------------------------------- */

.issue-summary {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 2rem;
}

.issue-summary h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Summary labels: "Active issues:" "Newly emergent:" */
.issue-summary strong {
    display: block;
    font-family: var(--font-body);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Issue links in summary list — numbered with slide-in underline hover */
.issue-summary ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
    counter-reset: issue-counter;
}

.issue-summary ul li {
    counter-increment: issue-counter;
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    padding: 0.35rem 0;
    margin-bottom: 0;
    font-size: 0.95rem;
}

.issue-summary ul li::before {
    content: counter(issue-counter);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--navy);
    min-width: 1.1em;
    flex-shrink: 0;
}

.issue-summary ul li a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color var(--transition);
}

.issue-summary ul li a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--navy);
    transition: width 0.2s ease;
}

.issue-summary ul li a:hover {
    text-decoration: none;
}

.issue-summary ul li a:hover::after {
    width: 100%;
}

/* Assessment paragraph */
.issue-summary > p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

/* Fix 2 — Editorial overview: last <p> in summary is the synthesis paragraph */
.issue-summary > p:last-of-type {
    font-size: 18px;
    line-height: 1.75;
    color: #1A1A1A;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Fix 3 — Newly emergent label + NEW badge */
.newly-emergent-label {
    color: var(--red) !important;
}

.new-badge {
    display: inline-block;
    background: var(--red);
    color: white;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 6px;
    font-family: var(--font-body);
    line-height: 1;
}

/* -----------------------------------------------------------
   Issue card labels: "Why it matters:" "Tensions:"
   Strong as first-child in a paragraph that has following text
   ----------------------------------------------------------- */

.issue-card:not(.issue-summary) p > strong:first-child {
    display: block;
    font-family: var(--font-body);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--red);
    font-weight: 700;
    margin-bottom: 0.2rem;
}

/* -----------------------------------------------------------
   H3 inside issue cards — editorial section divider
   (Progressive-leaning / Conservative-leaning / Other voices)
   ----------------------------------------------------------- */

.issue-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-body);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 600;
    margin: 1.75rem 0 1rem;
}

.issue-card h3::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* -----------------------------------------------------------
   Quote blocks
   ----------------------------------------------------------- */

.quote-block {
    border-left: 4px solid var(--border);
    padding: 0.6rem 0 0.6rem 1rem;
    margin: 0.85rem 0;
}

/* Attribution line: "Speaker (Party)" */
.quote-block .quote-attribution {
    font-family: var(--font-body);
    font-weight: 600;
    font-style: normal;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

/* Quote text: italic */
.quote-block .quote-text {
    font-style: italic;
    color: #2A2A2A;
    font-size: 0.97rem;
    line-height: 1.6;
    margin: 0;
}

/* Context em: small muted */
.quote-block .quote-text em {
    font-style: italic;
    color: var(--muted);
    font-size: 0.85rem;
}

/* "Article" link: small uppercase red */
.quote-block .quote-text a {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--red);
    text-decoration: none;
    font-style: normal;
    font-weight: 600;
    margin-left: 0.35rem;
    transition: opacity var(--transition);
}

.quote-block .quote-text a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* -----------------------------------------------------------
   General prose within issue cards
   ----------------------------------------------------------- */

.issue-card p {
    margin-bottom: 0.85rem;
    line-height: 1.7;
    font-size: 0.97rem;
}

.issue-card p:last-child {
    margin-bottom: 0;
}

/* Horizontal rules used as frame separators — hidden (cards replace them) */
#briefingContent hr {
    display: none;
}

/* -----------------------------------------------------------
   Profile form page
   ----------------------------------------------------------- */

.profile-form-wrap {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 2rem 2.25rem 2.25rem;
    margin-top: 1.5rem;
}

.profile-form-wrap h2 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.profile-form-wrap .form-hint {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 1.75rem;
}

.profile-form-wrap label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
    margin-top: 1.25rem;
}

.profile-form-wrap label:first-of-type {
    margin-top: 0;
}

.profile-form-wrap input[type="text"],
.profile-form-wrap select,
.profile-form-wrap textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.6rem 0.85rem;
    outline: none;
    transition: border-color var(--transition);
    appearance: auto;
}

.profile-form-wrap input[type="text"]:focus,
.profile-form-wrap select:focus,
.profile-form-wrap textarea:focus {
    border-color: var(--navy);
}

.profile-form-wrap textarea {
    resize: vertical;
    line-height: 1.6;
}

.profile-form-wrap .field-hint {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.2rem;
    margin-bottom: 0;
    line-height: 1.5;
}

.profile-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
    border: 1px solid var(--navy);
    padding: 0.55rem 1.35rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: opacity var(--transition);
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: none;
    color: var(--navy);
    border: 1px solid var(--border);
    padding: 0.55rem 1.35rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: border-color var(--transition), color var(--transition);
}

.btn-secondary:hover {
    border-color: var(--navy);
    text-decoration: none;
    color: var(--text);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--text);
    text-decoration: none;
}

/* -----------------------------------------------------------
   Mobile responsive adjustments
   ----------------------------------------------------------- */

@media (max-width: 767px) {
    .content-area {
        padding: 1.5rem 1rem 4rem;
    }

    #briefingContent h1 {
        font-size: 1.65rem;
    }

    .issue-card {
        padding: 1.25rem;
    }

    .issue-card h2 {
        font-size: 1.3rem;
    }

    .profile-form-wrap {
        padding: 1.25rem;
    }

    .profile-form-actions {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .tab-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* -----------------------------------------------------------
   Content layout — single column by default, grid with sticky
   TOC sidebar on viewports ≥ 1100px
   ----------------------------------------------------------- */

.content-layout {
    /* single-column at all widths until .has-toc is added */
}

#toc-sidebar {
    display: none;
}

.toc-title {
    font-family: var(--font-body);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

#toc-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#toc-sidebar ul li {
    margin-bottom: 0.4rem;
}

#toc-sidebar ul li a {
    font-family: var(--font-body);
    font-size: 13px;
    color: #6B6B6B;
    text-decoration: none;
    line-height: 1.5;
    display: block;
    transition: color var(--transition);
}

#toc-sidebar ul li a:hover,
#toc-sidebar ul li a.active {
    color: var(--red);
    font-weight: 500;
}

@media (min-width: 1100px) {
    /* Widen content-area to accommodate grid */
    .content-area.has-toc {
        max-width: 1100px;
    }

    .content-layout.has-toc {
        display: grid;
        grid-template-columns: 220px 1fr;
        gap: 48px;
        align-items: start;
    }

    .content-layout.has-toc #toc-sidebar {
        display: block;
        position: sticky;
        top: 80px;
        align-self: start;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        scrollbar-width: none;
    }

    .content-layout.has-toc #toc-sidebar::-webkit-scrollbar {
        display: none;
    }

    /* TOC sidebar already lists all issues — hide the duplicate "Active issues" list
       from the Intelligence Summary card. Newly emergent and assessment remain visible. */
    .content-layout.has-toc .issue-summary > p:first-of-type,
    .content-layout.has-toc .issue-summary > ul:first-of-type {
        display: none;
    }
}

/* -----------------------------------------------------------
   Back-to-top button
   ----------------------------------------------------------- */

#backToTop {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.45rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, background var(--transition);
    z-index: 50;
}

#backToTop.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#backToTop:hover {
    background: #0f1c27;
}



/* -----------------------------------------------------------
   Article links — own line below quote, source name + external icon
   ----------------------------------------------------------- */

.article-link {
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
}

.article-link a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: none;
    font-style: normal;
    font-weight: 400;
    transition: color var(--transition);
}

.article-link a:hover {
    color: var(--navy);
    text-decoration: none;
}

/* -----------------------------------------------------------
   Issue card count badge — "Issue X of Y" top-right
   ----------------------------------------------------------- */

.issue-card:not(.issue-summary) {
    position: relative;
}

.card-count {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    font-family: var(--font-body);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 400;
}

@media (max-width: 767px) {
    .card-count {
        display: none;
    }
}

/* -----------------------------------------------------------
   Suggested response block (party lens active)
   ----------------------------------------------------------- */

.suggested-response {
    margin-top: 1.5rem;
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
    padding: 1rem 1.25rem 1rem 1rem;
}

.suggested-response__label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.suggested-response__slogan {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.suggested-response__interview {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.copy-btn {
    flex-shrink: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
    padding: 0.2rem;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.copy-btn:hover {
    opacity: 1;
}

/* -----------------------------------------------------------
   Site footer
   ----------------------------------------------------------- */

.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.25rem;
    text-align: center;
    margin-top: 1rem;
}

.site-footer .footer-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.site-footer .footer-credit {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.6rem;
}


/* ============================================================
   Weekly briefing layout
   ============================================================ */

.weekly-layout {
    /* no wrapper styling needed — inherits briefingContent spacing */
}

.weekly-range {
    font-family: var(--font-body);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* Overview */
.weekly-overview {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.5rem;
}

.weekly-overview ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.weekly-overview ul li {
    font-size: 0.95rem;
    line-height: 1.55;
    padding-left: 1.1rem;
    position: relative;
    color: var(--text);
}

.weekly-overview ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--navy);
    font-weight: 700;
}

/* Three-column grid */
.weekly-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.weekly-col {
    min-width: 0; /* allow grid children to shrink below content width */
}

.weekly-col-heading {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Sustained issues — prominent cards */
.weekly-sustained-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.65rem;
}

.weekly-sustained-card:last-child {
    margin-bottom: 0;
}

.weekly-sustained-card--emerging {
    background: #EAF6EC;
    border-color: #A5CFA9;
    border-left: 3px solid #2A7A3B;
}

.weekly-sustained-card--fading {
    background: #FAF0F0;
    border-color: #DDBDBD;
    border-left: 3px solid #C0392B;
}

.weekly-sustained-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.weekly-traj {
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
    line-height: 1;
}

.weekly-traj--up           { color: #C0392B; }
.weekly-traj--stable       { color: #2C6FAC; }
.weekly-traj--down         { color: #999; }
.weekly-traj--emerging     { color: #2A7A3B; font-size: 0.8rem; }
.weekly-traj--fading-issue { color: #aaa; font-size: 0.85rem; }

.weekly-sustained-card--fading .weekly-traj--fading-issue { color: #C0392B; }

.weekly-sustained-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
    line-height: 1.3;
    color: var(--text);
}

.weekly-card-meta {
    font-size: 0.7rem;
    color: var(--muted);
    font-family: var(--font-body);
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.weekly-tension {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
    font-style: italic;
}


.weekly-empty {
    font-size: 0.82rem;
    color: var(--muted);
    font-style: italic;
}

/* Watch Next Week footer */
.weekly-watch {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1.1rem 1.4rem;
}

.weekly-watch ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.weekly-watch ul li {
    font-size: 0.92rem;
    line-height: 1.55;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text);
}

.weekly-watch ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--navy);
    font-size: 0.78rem;
}

/* Responsive: stack columns on mobile */
@media (max-width: 767px) {
    .weekly-columns {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Local Briefing Generator page
   ============================================================ */

.local-briefing-wrap {
    max-width: 720px;
    margin: 0 auto 3rem;
}

.local-briefing-header {
    margin-bottom: 1.25rem;
}

.local-briefing-header h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.25rem;
}

/* Quota bar */
.quota-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.625rem 1rem;
    margin-bottom: 1.25rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.quota-text { color: var(--navy); font-weight: 600; }
.quota-text.quota-low { color: #B45309; }
.quota-text.quota-exhausted { color: var(--red); }
.quota-reset { color: var(--muted); font-size: 0.8rem; }
.quota-exhausted-msg { color: var(--red); font-size: 0.9rem; margin-bottom: 1rem; }

/* Form card */
.local-form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.local-form-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 1.25rem;
}

.local-form-card label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1rem;
    margin-bottom: 0.35rem;
}

.local-form-card label:first-of-type { margin-top: 0; }

.required-mark { color: var(--red); }
.optional-mark { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 0.8rem; }

.local-form-card input[type="text"],
.local-form-card textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    box-sizing: border-box;
    transition: border-color var(--transition);
    resize: vertical;
}

.local-form-card input[type="text"]:focus,
.local-form-card textarea:focus {
    outline: none;
    border-color: var(--navy);
}

.word-counter {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
    margin-top: 0.25rem;
}

.word-counter .over-limit { color: var(--red); font-weight: 600; }
.word-counter .near-limit { color: #B45309; }

.form-error {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--red);
    background: #FFF0F0;
    border: 1px solid #FECACA;
    border-radius: 4px;
    padding: 0.625rem 0.875rem;
    margin-top: 0.75rem;
}

.local-form-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
}

/* History */
.local-history h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 1rem;
}

.history-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.history-item.pending { border-left: 3px solid var(--muted); }
.history-item.completed { border-left: 3px solid var(--navy); }

.history-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin-bottom: 0.4rem;
    overflow: hidden;
}

.status-badge {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.status-badge.generating {
    background: #FEF3C7;
    color: #92400E;
}

.history-date {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    flex-shrink: 0;
}

.history-detail {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expand-btn {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--navy);
    border-color: var(--navy);
}

.expand-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--navy);
}

.history-preview {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0;
    font-style: italic;
}

.history-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
}

.history-content h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.history-content ul { padding-left: 1.25rem; }
.history-content li { margin-bottom: 0.35rem; }

.muted-text {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
}
