/* =====================================================================
   The Modern Report - shared base styles
   Page-specific styles (per-section accent colors, hero layouts)
   remain inline in each .php file.
   ===================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    padding-bottom: 56px;
    transition: background .35s, color .35s;
    line-height: 1.5;
}

/* ---------- ACCESSIBILITY ---------- */

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
}
.skip-link:focus {
    position: fixed;
    left: 12px;
    top: 12px;
    width: auto;
    height: auto;
    padding: 10px 16px;
    background: var(--accent);
    color: var(--bg);
    text-decoration: none;
    font-family: 'DM Mono', monospace;
    font-size: .7rem;
    letter-spacing: .1em;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
}

/* Visible focus ring everywhere - replaces outline:none on inputs */
:focus-visible {
    outline: 2px solid var(--accent, #e8c96d);
    outline-offset: 2px;
    border-radius: 2px;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent, #e8c96d);
    outline-offset: 3px;
}

/* Screen-reader-only text utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion: kill blink, ticker, pulse, hover scales */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    .ticker-inner { animation: none !important; }
    .live-badge-dot, .market-status-dot { animation: none !important; }
    .badge-breaking, .story.is-breaking .story-title { animation: none !important; }
    .hero-lead:hover img,
    .hero-sub:hover img { transform: none !important; }
}

/* ---------- NAV ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-brand {
    font-family: 'DM Mono', monospace;
    font-size: .6rem;
    letter-spacing: .18em;
    color: var(--muted);
    margin-right: 16px;
    text-transform: uppercase;
}
.nav-links a {
    font-family: 'DM Mono', monospace;
    font-size: .62rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 11px;
    border-radius: 4px;
    transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--accent); background: var(--accent-dim); }
.nav-right { display: flex; align-items: center; gap: 12px; }

.live-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'DM Mono', monospace;
    font-size: .58rem;
    color: var(--green);
    letter-spacing: .08em;
}
.live-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .5; transform: scale(.9); }
}

/* Theme toggle */
.theme-toggle {
    width: 34px;
    height: 19px;
    border-radius: 10px;
    background: var(--surface2);
    border: 1px solid var(--border-hi);
    cursor: pointer;
    position: relative;
    transition: background .3s;
    padding: 0;
}
.theme-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform .3s, background .3s;
}
[data-theme="light"] .theme-toggle::after {
    transform: translateX(15px);
    background: var(--accent);
}

/* ---------- FOOTER ---------- */
.footer {
    text-align: center;
    padding: 28px 20px 72px;
    border-top: 1px solid var(--border);
    font-family: 'DM Mono', monospace;
    font-size: .62rem;
    color: var(--muted);
    letter-spacing: .07em;
}
.footer-links {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    text-transform: uppercase;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    transition: color .2s;
}
.footer-links a:hover,
.footer-links a:focus-visible { color: var(--accent); }
.footer-live { color: var(--green); }

/* ---------- TICKER (shared structure; colors set per page) ---------- */
.ticker-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    align-items: center;
    overflow: hidden;
    z-index: 300;
}
.ticker-tag {
    font-family: 'DM Mono', monospace;
    font-size: .62rem;
    letter-spacing: .15em;
    padding: 0 14px;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.ticker-scroll { flex: 1; overflow: hidden; }
.ticker-inner {
    display: flex;
    white-space: nowrap;
    animation: ticker-move 200s linear infinite;
}
.ticker-inner:hover,
.ticker-inner:focus-within { animation-play-state: paused; }
.ticker-story {
    font-family: 'DM Sans', sans-serif;
    font-size: .76rem;
    font-weight: 500;
    padding: 0 22px;
    flex-shrink: 0;
}
.ticker-story::after { content: ' //'; opacity: .4; }
@keyframes ticker-move {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---------- TYPOGRAPHY HELPERS ---------- */
.col-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--accent);
}
.col-num {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent);
    opacity: .35;
}
.col-label {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    letter-spacing: .14em;
    color: var(--text);
    font-weight: 500;
}

/* Stale data warning banner */
.stale-banner {
    background: rgba(232, 180, 80, 0.12);
    border-bottom: 1px solid rgba(232, 180, 80, 0.3);
    color: #e8b450;
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    text-align: center;
    padding: 8px 16px;
    letter-spacing: .05em;
}

/* Image safety - prevent broken images from blowing layout */
img { max-width: 100%; height: auto; }

/* Animation prefs for blink-style elements */
@keyframes blink { 50% { opacity: .45; } }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
