/* ═══════════════════════════════════════════════════
   Vantage Intelligence Platform — v2.0
   Design: Dark-first, glassmorphism, Inter font
   ──────────────────────────────────────────────────────────────────────────  */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&display=swap');

/* Global Font Override to ensure Plus Jakarta Sans loads everywhere */
html, body, input, button, select, textarea {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Design Tokens ── */
:root {
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
    --font-title: var(--font);
    --mono: 'JetBrains Mono', 'Courier New', monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    /* Shared page-transition timing — the view crossfade, the topbar's
       terminal-mode restyle, and app.js's VIEW_MS constant all stay in sync
       on this one value so entering/exiting views never desync. */
    --view-ms: 320ms;
    --radius: 0px;
    --radius-sm: 0px;
    --sidebar-w: 310px;
    --topbar-h: 70px; /* Taller topbar for masthead styling */
    --statusbar-h: 0px;

    /* ── CARD TYPOGRAPHY CONFIGURATION ── */
    --card-body-font: 'Merriweather', Georgia, serif;
    --card-body-size: 0.93rem;
    --card-body-weight: 400;
    --card-body-opacity: 1.0;
    --card-body-lh: 1.6;

    /* ── Semantic aliases (kept in sync with the theme blocks below) ── */
    --font-sans: var(--font);

    /* ── Briefing page content width ── */
    --brief-max: 1340px;
}

[data-theme="dark"],
[data-theme="light"] {
    --accent: var(--blue);
    --danger: var(--red);
    --success: var(--green);
    --text-primary: var(--text);
    --text-secondary: var(--text-2);
    --bg-secondary: var(--surface-2);
}

[data-theme="dark"] {
    --bg:           #0a0b0d; /* Deep ink / black tone */
    --surface:      #0a0b0d; /* Same as body for continuous page look */
    --surface-2:    #121417; /* Soft hover highlight */
    --surface-3:    #181b20;
    --border:       rgba(255, 255, 255, 0.1); /* Thin sharp border lines */
    --border-hover: rgba(255, 255, 255, 0.2);
    --glass:        #0a0b0d;
    --text:         #e3e4db; /* Soft premium warm-white/cream */
    --text-2:       #b5b8b0;
    --text-3:       #7d8179;
    --white:        #e3e4db;

    /* Secondary/accent: warm bronze — blue reads cold against the warm
       cream text on ink. */
    --bronze:  #889E81;
    --accent:  var(--bronze);

    --red:     #ff453a;
    --orange:  #ff9f0a;
    --yellow:  #ffd60a;
    --green:   #30d158;
    --blue:    #0a84ff;
    --purple:  #bf5af2;
    --cyan:    #5ac8fa;

    --chip-bg:        rgba(255,255,255,0.03);
    --chip-bg-hover:  rgba(255,255,255,0.06);
    --chip-bg-active: rgba(255,255,255,0.09);
    --chip-border:    rgba(255,255,255,0.1);
}

[data-theme="light"] {
    --bg:           #f5f2eb; /* Premium newspaper warm cream */
    --surface:      #f5f2eb;
    --surface-2:    #eae6dc;
    --surface-3:    #dad5c8;
    --border:       rgba(0, 0, 0, 0.15); /* Thin sharp dark borders */
    --border-hover: rgba(0, 0, 0, 0.3);
    --glass:        #f5f2eb;
    --text:         #1a1a1a;
    --text-2:       #4c4c4c;
    --text-3:       #7a7a7a;
    --white:        #1a1a1a;

    /* Secondary/accent color: coffee brown instead of blue — matches the
       warm newspaper cream instead of fighting it. */
    --coffee:  #6f4e37;
    --accent:  var(--coffee);

    --red:     #d70015;
    --orange:  #c93400;
    --yellow:  #b37a00;
    --green:   #248a3d;
    --blue:    #0040dd;
    --purple:  #8600c8;
    --cyan:    #0071a4;

    --chip-bg:        rgba(18,19,20,0.03);
    --chip-bg-hover:  rgba(18,19,20,0.06);
    --chip-bg-active: rgba(18,19,20,0.09);
    --chip-border:    rgba(0, 0, 0, 0.15);
}

/* ── Category accent colors ── */
:root {
    --cat-conflict:     #c2bbb2;
    --cat-geopolitical: #b7b0a7;
    --cat-humanitarian: #a8a19a;
    --cat-economy:      #9c958d;
    --cat-technology:   #8f8982;
    --cat-sports:       #b0a9a1;
    --cat-science:      #a39d95;
    --cat-entertainment:#968f87;
    --cat-music:        #cbc5bc;
    --cat-monitoring:   #7a766f;
}

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

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

.hidden {
    display: none !important;
}

/* ── Page-view crossfade (see _switchView in app.js) ──
   All 7 top-level views are symmetric full-viewport boxes (see #map-room-view's
   own position rule below) so the outgoing and incoming view can overlap
   during the transition instead of the old instant display:none cut — that
   asymmetry was the root cause of the topbar/logo "glitch" when navigating
   away from the Terminal. */
#home-view,
#vantage-home-view,
#status-view,
#sports-view,
#forecast-view,
#context-view,
#map-room-view {
    transition: opacity var(--view-ms) var(--ease), transform var(--view-ms) var(--ease);
    /* will-change is applied/cleared by _switchView() in app.js for the
       duration of the crossfade only — promoting a compositor layer ahead of
       the first frame avoids the transition-start stutter, but leaving it on
       permanently is what made text throughout the Terminal (sidebar tabs,
       news cards, map popups) rasterize without subpixel anti-aliasing and
       read as blurry at rest. */
}

/* Incoming view: starts faded/offset below, animates up to resting state. */
#home-view.view-enter-init,
#vantage-home-view.view-enter-init,
#status-view.view-enter-init,
#sports-view.view-enter-init,
#forecast-view.view-enter-init,
#context-view.view-enter-init,
#map-room-view.view-enter-init {
    opacity: 0;
    transform: translateY(6px);
}

/* Outgoing view: drifts the opposite direction while fading, so the swap
   reads as one view directionally replacing the other rather than two
   elements animating identically on top of each other. */
#home-view.view-exit,
#vantage-home-view.view-exit,
#status-view.view-exit,
#sports-view.view-exit,
#forecast-view.view-exit,
#context-view.view-exit,
#map-room-view.view-exit {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

/* Bumps whichever view is actively entering above the one that's exiting
   underneath it — #home-view's resting z-index (5) is otherwise lower than
   the other views' (10), which would invert the stacking on the way home. */
#home-view.view-on-top,
#vantage-home-view.view-on-top,
#status-view.view-on-top,
#sports-view.view-on-top,
#forecast-view.view-on-top,
#context-view.view-on-top,
#map-room-view.view-on-top {
    z-index: 30;
}

@media (prefers-reduced-motion: reduce) {
    #home-view, #vantage-home-view, #status-view, #sports-view,
    #forecast-view, #context-view, #map-room-view,
    .topbar, #map {
        transition: none !important;
    }
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

/* ── Map ── */
#map {
    position: absolute;
    inset: var(--topbar-h) 0 var(--statusbar-h) var(--sidebar-w);
    z-index: 1;
    transition: left 0.45s var(--ease);
}

#map.sidebar-hidden {
    left: 0;
}

.leaflet-container {
    background: var(--bg) !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
}

.leaflet-control-zoom a {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.leaflet-control-zoom a:hover {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

/* ── Top Bar / Masthead ── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg);
    border-bottom: none;
    /* Unified with --view-ms (and box-shadow added) so every topbar property
       that changes on entering/leaving Terminal mode animates on the same
       clock as the view crossfade — previously background/border ran at
       300ms while box-shadow snapped instantly, part of the nav "glitch". */
    transition: background var(--view-ms) var(--ease), border-color var(--view-ms) var(--ease), box-shadow var(--view-ms) var(--ease);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    opacity: 1;
    transition: opacity 0.2s var(--ease);
    /* Pin the logo to its own compositing layer and never transform it:
       the old :active scale + the view crossfade underneath made the text
       re-rasterize for a frame (the "glitch" when navigating back home). */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.brand:hover {
    opacity: 0.7;
}

.brand:active {
    opacity: 0.5;
}

.brand-name {
    font-family: var(--font-title) !important;
    font-size: 11px; /* Match HOME size */
    font-weight: 400; /* Not bold */
    letter-spacing: 1px;
    color: var(--text);
    text-transform: uppercase;
}

.brand-sep {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-2);
    opacity: 0.4;
    user-select: none;
    margin: 0 2px;
}

/* The wrapper clips the label swap so the old text visually disappears
   behind the separator bar and the new one emerges from it. */
.brand-sub-wrap {
    display: inline-flex;
    overflow: hidden;
}

.brand-sub {
    display: inline-block;
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-2);
    letter-spacing: 1px;
    text-transform: uppercase;
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.17s var(--ease), opacity 0.17s var(--ease);
}

.brand-sub--swap {
    transform: translateX(-105%);
    opacity: 0;
}

/* Methodology/sources ticker in the topbar gap — shown on Home and Briefing
   (toggled by body.view-has-ticker, set from updateBrandSub() in app.js so
   it always tracks the active view, including on a hash-restored page
   load). Hidden by default so Terminal keeps the plain two-item topbar. */
.topbar-center {
    display: none;
    flex: 1;
    min-width: 0;
    height: 100%;
    margin: 0 28px;
}

body.view-has-ticker .topbar-center {
    display: flex;
}

.topbar-ticker {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    /* MANUAL AYAR: kayan source bar, mono font'un satır metrikleri yüzünden
       optik olarak logo/ikonlarla aynı hizada durmuyor (align-items:center
       kutuyu ortalıyor ama harflerin görsel ağırlığı kaymış oluyor).
       --ticker-nudge-y ile aşağı(+)/yukarı(-) it, px cinsinden; 0 = kapalı. */
    transform: translateY(var(--ticker-nudge-y, 1px));
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Language + theme switches sit in identical 28px boxes so their icons
   share one optical baseline. */
.topbar-right .lang-flag-btn,
.topbar-right .theme-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
}

.lang-flag-btn {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    outline: none !important;
}

.lang-flag-btn svg {
    width: 20px;
    height: 20px;
}

.theme-toggle {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    width: 28px !important;
    height: 28px !important;
    color: var(--text-2);
    transition: all 0.3s var(--ease);
    outline: none;
    margin: 0 !important;
}

.theme-toggle:hover {
    color: var(--text);
    opacity: 0.75;
}

.theme-toggle:active {
    opacity: 0.55;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: var(--statusbar-h);
    width: var(--sidebar-w);
    z-index: 900;
    background: var(--glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.45s var(--ease), background 0.3s var(--ease);
    /* will-change is applied/cleared by JS around the collapse/expand toggle
       only — see setSidebarCollapsed() in app.js. Same reasoning as the view
       containers above: left on permanently, it's what blurred the
       category/region tabs and news card text at rest. */
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-w)));
}

/* ── Filter Bar ── */
.filter-bar {
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Combobox Dropdowns ── */
.combobox {
    position: relative;
    width: 100%;
}

.combo-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    text-align: left;
}

.combo-trigger:hover {
    border-color: var(--border-hover);
    background: var(--chip-bg-hover);
}

.combobox.open .combo-trigger {
    border-color: var(--text-3);
    background: var(--chip-bg-active);
}

.combo-trigger:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 2px;
}

.combo-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.combo-eyebrow {
    font-family: var(--mono);
    font-size: 7.5px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-3);
    transition: color 0.2s var(--ease);
}

.combobox.open .combo-eyebrow {
    color: var(--text-2);
}

.combo-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.combo-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.combo-count {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text);
    color: var(--bg);
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
}

.combo-count[hidden] {
    display: none;
}

.combo-chevron {
    color: var(--text-3);
    transition: transform 0.25s var(--ease), color 0.2s var(--ease);
}

.combo-trigger:hover .combo-chevron,
.combobox.open .combo-chevron {
    color: var(--text);
}

.combobox.open .combo-chevron {
    transform: rotate(180deg);
}

.combo-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    border: 1px solid var(--border-hover);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 16px 48px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-5px);
    pointer-events: none;
    transition: opacity 0.18s var(--ease), transform 0.22s var(--ease), visibility 0s linear 0.18s;
    visibility: hidden;
}

[data-theme="light"] .combo-dropdown {
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.14);
}

.combobox.open .combo-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.18s var(--ease), transform 0.22s var(--ease);
}

.combo-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.combo-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-3);
    pointer-events: none;
    transition: color 0.2s var(--ease);
}

.combo-search-wrapper:focus-within .combo-search-icon {
    color: var(--text);
}

.combo-search {
    width: 100%;
    padding: 10px 12px 10px 31px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    outline: none;
}

.combo-search::placeholder {
    color: var(--text-3);
}

.combo-options {
    overflow-y: auto;
    max-height: 236px;
    padding: 5px 0;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

.combo-options::-webkit-scrollbar { width: 3px; }
.combo-options::-webkit-scrollbar-track { background: transparent; }
.combo-options::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

.combo-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px 7px 13px;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-2);
    transition: background 0.13s, color 0.13s;
    user-select: none;
}

.combo-option::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--text);
    transform: scaleY(0);
    transition: transform 0.18s var(--ease);
}

.combo-option:hover {
    background: var(--chip-bg-hover);
    color: var(--text);
}

.combo-option.selected {
    color: var(--text);
    background: var(--chip-bg-active);
}

.combo-option.selected::before {
    transform: scaleY(1);
}

.combo-check {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.combo-option:hover .combo-check {
    border-color: var(--text-3);
}

.combo-option.selected .combo-check {
    background: var(--text);
    border-color: var(--text);
}

.combo-check::after {
    content: "";
    width: 7px;
    height: 4px;
    border-left: 1.5px solid var(--bg);
    border-bottom: 1.5px solid var(--bg);
    transform: rotate(-45deg) scale(0) translateY(-1px);
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.combo-option.selected .combo-check::after {
    transform: rotate(-45deg) scale(1) translateY(-1px);
}

.combo-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.85;
}

.combo-option-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.combo-option-count {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.combo-option.selected .combo-option-count {
    color: var(--text-2);
}

.combo-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 13px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.combo-footer-status {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-3);
}

.combo-clear {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-3);
    background: transparent;
    border: none;
    padding: 2px 0;
    cursor: pointer;
    transition: color 0.15s var(--ease), opacity 0.15s var(--ease);
}

.combo-clear:hover {
    color: var(--text);
}

.combo-clear:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}


/* ── Filter meta row (article count + sort buttons) — hidden for now ── */
.filter-meta {
    display: none;
}

.filter-result-count {
    font-size: 9px;
    font-family: var(--mono);
    color: var(--text-3);
}

.sort-group {
    display: flex;
    gap: 2px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: 6px;
    padding: 2px;
}

.sort-btn {
    padding: 3px 9px;
    font-size: 9px;
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.5px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.18s var(--ease);
}

.sort-btn.active {
    background: var(--surface-3);
    color: var(--text);
}

/* ── News Feed ── */
.news-feed {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

.news-feed::-webkit-scrollbar { width: 3px; }
.news-feed::-webkit-scrollbar-track { background: transparent; }
.news-feed::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--text-3);
    font-size: 11px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--text-2);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── News Card ── */
.news-card {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid var(--border);
    border-left: 2px solid transparent;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s var(--ease), border-left-color 0.15s var(--ease);
    font-family: var(--font);
    color: inherit;
    animation: card-in 0.3s var(--ease) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.news-card:hover {
    background: rgba(255,255,255,0.028);
}

[data-theme="light"] .news-card:hover {
    background: rgba(0,0,0,0.028);
}

.news-card:last-child {
    border-bottom: none;
}

.news-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    gap: 8px;
}

.news-source {
    font-size: 9px;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.5px;
    color: var(--text-3);
    text-transform: uppercase;
    flex-shrink: 0;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-cat-badge {
    font-size: 8px;
    font-weight: 700;
    font-family: var(--mono);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.news-title {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 4px;
}

.news-desc {
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--text-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.news-geo {
    font-size: 9px;
    color: var(--text-3);
    font-family: var(--mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-time {
    font-size: 9px;
    color: var(--text-3);
    font-family: var(--mono);
    flex-shrink: 0;
}

.no-news {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 12px;
}

/* ── Sidebar Toggle ── */
.sidebar-toggle {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    left: var(--sidebar-w);
    z-index: 901;
    width: 18px;
    height: 32px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 5px 5px 0;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: left 0.45s var(--ease), color 0.2s;
}

.sidebar-toggle:hover { color: var(--text); }

.sidebar.collapsed ~ .sidebar-toggle {
    left: 0;
}

/* ── Detail Panel ── */
.detail-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 16px);
    right: -400px;
    width: 380px;
    max-height: calc(100vh - var(--topbar-h) - var(--statusbar-h) - 32px);
    z-index: 950;
    background: var(--glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 16px 48px rgba(0,0,0,0.45);
    padding: 20px;
    overflow-y: auto;
    scrollbar-width: none;
    transition: right 0.45s var(--ease);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

[data-theme="light"] .detail-panel {
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.14);
}

.detail-panel::-webkit-scrollbar { display: none; }

.detail-panel.open {
    right: 16px;
}

.detail-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 26px; height: 26px;
    border-radius: 5px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    color: var(--text-3);
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}

.detail-close:hover {
    color: var(--text);
    background: var(--chip-bg-hover);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 36px;
}

.detail-category {
    font-size: 8px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.detail-source {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text);
}

.detail-desc {
    font-size: 13px;
    line-height: 1.75;
    color: var(--text-2);
}

.detail-geo {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-2);
    padding: 8px 12px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: var(--radius-sm);
}

.detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--chip-bg-active);
    border: 1px solid var(--border-hover);
    font-size: 16px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s var(--ease);
    align-self: flex-start;
}

.detail-link:hover {
    background: var(--chip-bg-hover);
    color: var(--white);
    transform: translate(1px, -1px);
}

/* ── Leaflet Popups ── */
.leaflet-popup-content-wrapper {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
    color: var(--text) !important;
    backdrop-filter: blur(24px);
}

.leaflet-popup-tip {
    background: var(--surface) !important;
}

.leaflet-popup-content {
    margin: 14px 16px !important;
    font-family: var(--font) !important;
    font-size: 12px !important;
}

.popup-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.popup-cat {
    font-size: 8px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 6px;
    color: var(--bg);
    flex-shrink: 0;
}

.popup-geo {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-source {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 6px;
}

.popup-title {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    margin-bottom: 6px;
}

.popup-desc {
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-2);
    margin-bottom: 8px;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 13px;
    color: var(--text);
    background: var(--chip-bg-active);
    border: 1px solid var(--border-hover);
    text-decoration: none;
    transition: all 0.2s var(--ease);
}

.popup-link:hover {
    background: var(--chip-bg-hover);
    color: var(--white);
    transform: translate(1px, -1px);
}

/* ── Intelligence Hub View Styles ── */
.vantage-home-view {
    position: absolute;
    inset: var(--topbar-h) 0 var(--statusbar-h) 0;
    z-index: 10;
    background: var(--bg);
    overflow-y: auto;
    padding: 50px 24px;
    display: flex;
    justify-content: center;
    /* Opacity/transform timing lives on the shared #id rule above (view-ms) —
       not duplicated here. */
}

/* Briefing page: narrow side margins for a wide-screen feel, hidden scrollbar
   track so the page reads as one continuous surface, and smooth in-page
   scrolling (entry anchor jumps use behavior:'instant' from JS). */
#vantage-home-view {
    padding: 36px clamp(14px, 2.6vw, 36px);
    scrollbar-width: none;
    scroll-behavior: smooth;
}

#vantage-home-view::-webkit-scrollbar {
    display: none;
}

/* Terminal has no box of its own by default (all its content is fixed/absolute
   children) — give it the same full-viewport rect as the other views so it
   can crossfade symmetrically instead of jumping in/out. */
#map-room-view {
    position: absolute;
    inset: 0;
    z-index: 10;
}

/* Briefing Card */

/* ── Skeleton Loading ── */
.briefing-skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: skeleton-pulse 1.8s infinite ease-in-out;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* ── Language Flag Toggle ── */
.lang-flag-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    width: 28px;
    height: 28px;
    color: var(--text-2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.lang-flag-btn:hover {
    transform: scale(1.08);
    color: var(--accent) !important;
}

.lang-flag-btn:active {
    transform: scale(0.95);
}

.lang-flag-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}

.lang-flag-btn:hover .lang-flag-icon {
    transform: none;
}

.lang-flag-icon .lang-flag-img {
    width: 20px;
    height: 15px;
    display: block;
    border-radius: 2px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    filter: grayscale(1) opacity(0.65);
    transition: filter 0.3s var(--ease), opacity 0.3s var(--ease);
}

.lang-flag-btn:hover .lang-flag-icon .lang-flag-img {
    filter: grayscale(0) opacity(1);
}

/* ── Generating Notice ── */
.generating-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(10, 132, 255, 0.06);
    border: 1px solid rgba(10, 132, 255, 0.15);
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--text-2);
    margin-top: 12px;
}

/* ══════════════════════════════════════════════════════
   HOME VIEW — 2 Big Cards
   ══════════════════════════════════════════════════════ */

/* ── Apple Liquid Glass Background Setup ── */
/* ── Editorial Home View ── */
.home-view {
    position: absolute;
    inset: var(--topbar-h) 0 0 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 5;
    box-sizing: border-box;
    background-color: var(--bg);
}

:root[data-theme="dark"] .home-view {
    background-color: var(--bg) !important;
}

:root[data-theme="light"] .home-view {
    background-color: var(--bg) !important;
}

/* ── Full Screen Newspaper Grid (Separating lines via sharp borders) ── */
.home-bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* Skeleton */
.home-bento-skeleton {
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    padding: 40px;
    box-sizing: border-box;
    background: var(--bg);
}

/* Editorial Newspaper Grid Cards */
.bento-widget {
    font-family: var(--font-serif) !important;
    background-color: var(--surface) !important;
    border: none !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    padding: 40px !important; /* Increased padding for breathing space */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: none !important;
    min-height: 0;
    /* No internal scrolling: content is capped in JS; auto-scroll here
       hijacked the wheel and let cards scroll out of alignment. */
    overflow: hidden;
    scrollbar-width: none;
    outline: none;
    transition: background-color 0.25s var(--ease);
}

.bento-widget::-webkit-scrollbar {
    display: none;
}

.bento-widget:hover {
    background-color: var(--surface-2) !important;
}

:root[data-theme="dark"] .bento-widget {
    background: var(--surface) !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    padding: 40px !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] .bento-widget:hover {
    transform: none !important;
    background-color: var(--surface-2) !important;
    box-shadow: none !important;
}

:root[data-theme="light"] .bento-widget {
    background: var(--surface) !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    padding: 40px !important;
    box-shadow: none !important;
}

:root[data-theme="light"] .bento-widget:hover {
    transform: none !important;
    background-color: var(--surface-2) !important;
    box-shadow: none !important;
}

/* ── Unified card typography ── */
.bento-kicker {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    align-self: center; /* Center horizontally in flex column */
    background-color: var(--text) !important; /* Ink box background */
    color: var(--bg) !important; /* Contrasting text color */
    padding: 4px 12px !important;
    font-family: var(--mono) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0 auto 16px auto !important;
    border-radius: 0 !important;
    border: 1px solid var(--text) !important;
    opacity: 1.0 !important;
    transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.bento-headline {
    font-family: var(--font-title) !important;
    font-size: 1.5rem !important; /* Idealized heading size */
    font-weight: 700 !important;
    color: var(--text) !important;
    line-height: 1.35 !important;
    margin: 0 0 20px 0 !important;
    opacity: 1.0 !important;
    display: block !important; /* Crucial: block display to prevent flex height collapse and text overlap */
    text-align: center; /* Centered */
    letter-spacing: -0.2px;
}

:root[data-theme="light"] .bento-headline {
    color: var(--text) !important;
}

.bento-widget-text {
    margin: 0;
    text-align: left;
}

/* Shared manual-image slot used by the Terminal + Sports home cards */
.bento-image-box {
    width: 100%;
    max-width: 440px;
    height: 170px;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.bento-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.bento-image-placeholder {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.bento-image-caption {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
}

/* "Read the full briefing" row inside the collapsible home cards — a
   phone-only affordance (the accordion toggle takes over the card tap
   there); on desktop the whole card navigates, so the row stays hidden. */
.bento-more {
    display: none;
}

/* Accordion wrapper around each text card's content. On desktop it
   dissolves (display:contents) so the layout is exactly the pre-wrapper
   flex column; on phones it becomes the animatable 0fr→1fr grid row. */
.bento-acc {
    display: contents;
}

/* Card Highlight and Content Text Styling */
.hc-highlight-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.bento-content,
.bento-content p,
.bento-content div,
.hc-highlight-item,
.bento-widget-text {
    font-family: var(--card-body-font) !important;
    font-size: var(--card-body-size) !important;
    font-weight: var(--card-body-weight) !important;
    line-height: var(--card-body-lh) !important;
    color: var(--text) !important;
    opacity: 1.0 !important; /* Force opacity 1.0 everywhere to match report card */
}

.bento-content strong,
.hc-highlight-item strong,
.bento-widget-text strong {
    font-weight: 700 !important;
    color: var(--text) !important;
    opacity: 1.0 !important;
}

/* ══════════════════════════════════════════════════════════
   TERMINAL PORTAL
   ══════════════════════════════════════════════════════════ */

/* ── Card hover ── */
.bento-widget:hover {
    background-color: var(--surface-2) !important;
}

/* ── Grid mapping ── */
.widget-headline  { grid-column: 1; grid-row: 1; cursor: pointer; }
.widget-status    { grid-column: 2; grid-row: 1; }
.widget-sports    { grid-column: 3; grid-row: 1; }
.widget-forecast  { grid-column: 1; grid-row: 2; }
.widget-context   { grid-column: 2; grid-row: 2; }
.widget-terminal-portal { grid-column: 3; grid-row: 2; cursor: pointer; }

/* Terminal card: dark glass panel, overrides base .bento-widget glass */
.widget-terminal-portal {
    position: relative;
    overflow: hidden;
    /* No backdrop-filter: live blur forces constant compositing and was a
       major source of scroll/transition jank. */
    background: rgba(15, 23, 42, 0.82) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
:root[data-theme="light"] .widget-terminal-portal {
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Siyah gradient overlay for sports card to ensure readability */
.sports-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 60%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Deactive background image layer for cleaner solid layout */
.sports-bg-image {
    display: none !important;
}

/* Hover: zoom in, slightly sharpen */
.widget-sports:hover .sports-bg-image {
    transform: scale(1.08);
    filter: blur(1px) brightness(0.3);
}
.widget-terminal-portal:hover {
    border-color: rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* Disabled sports card keeps a static background — the Coming Soon veil is
   its only hover response. */
.widget-sports:hover {
    background-color: var(--surface) !important;
}

.hc-skel-line {
    height: 14px;
    background: var(--surface-2);
    border-radius: 4px;
    animation: none;
}

.w-30  { width: 30%; }
.w-80  { width: 80%; }

/* ── Modern Editorial Refinements ── */
#home-card-status,
#home-card-context {
    overflow: hidden !important;
}

/* Uniform rows inside the four text cards — one identical structure
   (spacing + hairline separators) so the cards read symmetric. */
.hc-row {
    padding: 7px 0;
    text-align: left;
}

.hc-row + .hc-row {
    border-top: 1px solid var(--border);
}

.hc-row-time {
    display: block;
    font-family: var(--mono) !important;
    /* MANUAL AYAR: kart satır etiketlerinin punto boyutu (CMT/saat, ör.
       "CMT, 13:00" gibi meta metinler). Büyütmek okunabilirliği artırır;
       kartlarda bolca dikey boşluk var, taşma riski yok. */
    font-size: var(--hc-label-size, 11px) !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent) !important;
    margin-bottom: 3px;
}

/* Card row anatomy: the bold label sits on its own line above the text
   (clearer scanning hierarchy), body text keeps a relaxed line height. */
.hc-row-label {
    display: block;
    font-family: var(--mono) !important;
    /* MANUAL AYAR: kart içi küçük başlıkların punto boyutu (ör. "YAPAY ZEKA
       YATIRIMLARI YÜKSELİYOR" gibi satır etiketleri). Tek bir yerden
       ayarlanır: --hc-label-size değişkenini büyüt/küçült (ör. 12px, 13px). */
    font-size: var(--hc-label-size, 11px) !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent) !important;
    margin-bottom: 3px;
}

/* capSentences() (app.js) caps by character count, which doesn't reliably
   predict rendered line count across viewport heights/fonts — report text
   could still overflow the card's fixed height. This clamp is the visual
   backstop: any row that still overflows ends in an ellipsis instead of
   being invisibly cut off by .bento-widget's overflow:hidden. */
.hc-row-text {
    line-height: 1.55 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ── Clickable-widget affordance: the kicker chip warms to the accent color
   and the corner arrow brightens — quiet, no moving lines. ── */
.widget-headline,
.widget-status,
.widget-forecast,
.widget-context,
.widget-terminal-portal {
    position: relative !important;
    cursor: pointer !important;
}

.widget-headline:hover .bento-kicker,
.widget-status:hover .bento-kicker,
.widget-forecast:hover .bento-kicker,
.widget-context:hover .bento-kicker,
.widget-terminal-portal:hover .bento-kicker {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--bg) !important;
}

.widget-headline::after,
.widget-status::after,
.widget-forecast::after,
.widget-context::after,
.widget-terminal-portal::after {
    content: "↗" !important;
    position: absolute !important;
    top: 16px !important;
    right: 18px !important;
    font-size: 0.95rem !important;
    font-family: var(--font-sans) !important;
    color: var(--text-secondary) !important;
    opacity: 0.3 !important;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), color 0.25s var(--ease) !important;
    pointer-events: none !important;
}

.widget-headline:hover::after,
.widget-status:hover::after,
.widget-forecast:hover::after,
.widget-context:hover::after,
.widget-terminal-portal:hover::after {
    opacity: 1 !important;
    color: var(--accent) !important;
    transform: translate(3px, -3px) scale(1.15) !important;
}

/* ── View-entrance choreography: each bento card drifts up in sequence
   whenever the home view is shown, so page changes feel staged rather
   than cut. display:none → grid restarts the animation on every return. ── */
@keyframes bentoCardIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

#home-view:not(.hidden) .bento-widget {
    animation: bentoCardIn 0.55s var(--ease) backwards;
}

#home-view .bento-widget:nth-child(2) { animation-delay: 0.06s; }
#home-view .bento-widget:nth-child(3) { animation-delay: 0.12s; }
#home-view .bento-widget:nth-child(4) { animation-delay: 0.18s; }
#home-view .bento-widget:nth-child(5) { animation-delay: 0.24s; }
#home-view .bento-widget:nth-child(6) { animation-delay: 0.30s; }

@media (prefers-reduced-motion: reduce) {
    #home-view .bento-widget {
        animation: none !important;
    }
}

/* ── Sports card: disabled, veiled by a Coming Soon notice on hover ── */
.widget-sports {
    cursor: default !important;
}

.bento-coming-soon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
    z-index: 3;
}

.widget-sports:hover .bento-coming-soon,
.widget-sports:focus-within .bento-coming-soon {
    opacity: 1;
}

/* ── Theme Toggle SVG Animations ── */
.theme-toggle-svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

.theme-toggle-svg .sun-center {
    transition: r 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle-svg .sun-dots {
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s var(--ease);
    transform-origin: center;
    transform-box: viewBox;
}

:root[data-theme="dark"] .theme-toggle-svg .sun-center {
    r: 6px !important;
}

:root[data-theme="light"] .theme-toggle-svg .sun-center {
    r: 4.5px !important;
}

:root[data-theme="dark"] .theme-toggle-svg .sun-dots {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
}

:root[data-theme="light"] .theme-toggle-svg .sun-dots {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

/* ── Terminal Mode Layout Overrides ── */
body.terminal-mode .topbar {
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

body.terminal-mode .topbar-left,
body.terminal-mode .topbar-right {
    pointer-events: auto; /* Allow clicking logo and toggles */
}

body.terminal-mode #map {
    inset: 0 0 var(--statusbar-h) var(--sidebar-w) !important;
}

body.terminal-mode #map.sidebar-hidden {
    inset: 0 0 var(--statusbar-h) 0 !important;
}

body.terminal-mode .sidebar {
    top: 0 !important;
    height: calc(100vh - var(--statusbar-h)) !important;
    padding-top: 60px !important; /* Push filter bar below the floating logo */
    background: var(--bg-secondary) !important; /* solid panel for filters */
}

/* ── Editorial Markdown Styling ── */
.editorial-markdown {
    font-family: var(--card-body-font);
    font-size: var(--card-body-size);
    line-height: var(--card-body-lh);
    color: var(--text);
}

.editorial-markdown h2 {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    margin: 2rem 0 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editorial-markdown h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
    margin: 1.5rem 0 0.75rem;
}

.editorial-markdown p {
    margin-bottom: 1.25rem;
}

.editorial-markdown ul, .editorial-markdown ol {
    margin: 0 0 1.5rem 1.5rem;
    padding: 0;
}

.editorial-markdown li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.editorial-markdown li strong {
    color: var(--white);
}

.editorial-markdown blockquote {
    border-left: 3px solid var(--blue);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-2);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════
   THE BRIEFING — Four Compact Screens
   Open layout, sharp hairlines, high contrast, but tight:
   the page is a five-minute scan, not a magazine spread.
   Content spans the structure the editorial prompt
   (src/analysis/editorial.py) generates — Summary (with a
   takeaway strip), Feed (wire timeline), 101 (concept
   brief + term cards), Outlook (forward vectors).
   Sections drift in softly on scroll via .reveal
   (see initBriefReveals in app.js).
   ══════════════════════════════════════════════════════ */

.brief-container {
    width: 100%;
}

/* ── Scroll reveals — soft upward drift, staggered children ── */
#vantage-home-view .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

#vantage-home-view .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

#vantage-home-view .reveal .chrono-item,
#vantage-home-view .reveal .asym-item,
#vantage-home-view .reveal .horizon-card {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}

#vantage-home-view .reveal.is-visible .chrono-item,
#vantage-home-view .reveal.is-visible .asym-item,
#vantage-home-view .reveal.is-visible .horizon-card {
    opacity: 1;
    transform: translateY(0);
}

/* Outlook rows fade in without translating — serif text rasterizes soft
   while transformed, which reads as blur on this screen. */
#vantage-home-view .reveal .horizon-card,
#vantage-home-view .reveal.is-visible .horizon-card {
    transform: none;
}

#vantage-home-view .reveal.is-visible .chrono-item:nth-child(2),
#vantage-home-view .reveal.is-visible .asym-item:nth-child(2),
#vantage-home-view .reveal.is-visible .horizon-card:nth-child(2) { transition-delay: 0.08s; }
#vantage-home-view .reveal.is-visible .chrono-item:nth-child(3),
#vantage-home-view .reveal.is-visible .asym-item:nth-child(3),
#vantage-home-view .reveal.is-visible .horizon-card:nth-child(3) { transition-delay: 0.16s; }
#vantage-home-view .reveal.is-visible .chrono-item:nth-child(4),
#vantage-home-view .reveal.is-visible .asym-item:nth-child(4),
#vantage-home-view .reveal.is-visible .horizon-card:nth-child(4) { transition-delay: 0.24s; }
#vantage-home-view .reveal.is-visible .chrono-item:nth-child(5) { transition-delay: 0.32s; }
#vantage-home-view .reveal.is-visible .chrono-item:nth-child(6) { transition-delay: 0.40s; }
#vantage-home-view .reveal.is-visible .chrono-item:nth-child(7) { transition-delay: 0.48s; }

@media (prefers-reduced-motion: reduce) {
    #vantage-home-view .reveal,
    #vantage-home-view .reveal .chrono-item,
    #vantage-home-view .reveal .asym-item,
    #vantage-home-view .reveal .horizon-card {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ── Header: the date alone, set between hairlines ── */
.brief-header {
    display: flex;
    align-items: center;
    gap: 28px;
    max-width: var(--brief-max, 1340px);
    margin: 0 auto 76px;
}

.brief-header::before,
.brief-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.brief-date {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-2);
    white-space: nowrap;
}

.brief-content {
    max-width: var(--brief-max, 1340px);
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(72px, 9vh, 112px);
}

.brief-screen {
    scroll-margin-top: 20px;
    /* Offscreen sections skip layout/paint entirely — keeps long-page
       scrolling smooth. */
    content-visibility: auto;
    contain-intrinsic-size: auto 720px;
}

/* ── Methodology / sources ticker — the single source bar, inline in the
   topbar gap on Home and Briefing (see .topbar-center above). ── */
.brief-ticker-track {
    display: flex;
    width: max-content;
    animation: brief-ticker-scroll 110s linear infinite;
}

.topbar-ticker:hover .brief-ticker-track {
    animation-play-state: paused;
}

.brief-ticker-seg {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    padding-right: 56px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-3);
}

.brief-ticker-tag {
    color: var(--text-2);
}

.brief-ticker-dot {
    font-size: 6px;
    opacity: 0.5;
}

.brief-ticker-label {
    color: var(--text-2);
}

.brief-ticker-label::after {
    content: ':';
}

@keyframes brief-ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .brief-ticker-track {
        animation: none;
    }
    .topbar-ticker {
        overflow-x: auto;
    }
}

/* The ticker can be scrubbed with a two-finger trackpad swipe or a mouse
   wheel (see initTickerScrub in app.js, which reads the wheel event and
   nudges .brief-ticker-track's animation currentTime) — the grab cursor
   hints that at rest. */
.topbar-ticker {
    cursor: grab;
}

/* Each screen opens with a faint index numeral + kicker, and a hairline
   running to the page edge — a clean, unmistakable section break. */
.brief-screen-head {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 42px;
}

.brief-screen-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.brief-screen-num {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-3);
}

/* ── Brief dividers — panoramic image strips between screens 01→04 ──────
   Görseller: static/assets/briefing/briefing1.jpg, briefing2.jpg, briefing3.jpg
   Dosyayı klasöre atınca otomatik görünür; dosya yoksa kesikli çerçeveli
   placeholder (dosya adı etiketiyle) görünür.

   Manuel ayar — global olarak buradan, tek divider için index.html'deki
   inline style'dan:
     --divider-h        şerit yüksekliği            (varsayılan 180px)
     --divider-pos      görselin odak noktası        (örn. "center 30%")
     --divider-radius   köşe yuvarlaklığı            (varsayılan 0)
     --divider-opacity  görsel opaklığı              (varsayılan 1)
     --divider-filter   CSS filtresi                 (örn. grayscale(1))
     --divider-my       üst/alt ekstra boşluk        (varsayılan 0; brief-content
                        gap'ini daraltmak için negatif değer verilebilir)      */
.brief-divider {
    position: relative;
    width: 100%;
    height: var(--divider-h, 180px);
    margin: var(--divider-my, 0) 0;
    border: 1px dashed var(--border);
    border-radius: var(--divider-radius, 0);
    overflow: hidden;
}

.brief-divider img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--divider-pos, center);
    opacity: var(--divider-opacity, 1);
    filter: var(--divider-filter, none);
}

/* Görsel yüklenince placeholder çerçevesi kalkar */
.brief-divider.has-img {
    border-color: transparent;
}

/* Placeholder etiketi — hangi dosyanın beklendiğini gösterir */
.brief-divider::before {
    content: attr(data-label) '.jpg — static/assets/briefing/';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-3);
}

.brief-divider.has-img::before {
    content: none;
}

/* Section kicker — accent tick + mono label, no card chrome */
.brief-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text);
    white-space: nowrap;
}

.brief-kicker::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 1px;
    background: var(--accent);
    flex-shrink: 0;
}

.brief-kicker--sub {
    margin: 0 0 26px;
}

.brief-subhead {
    font-family: var(--font-title);
    font-size: clamp(1.35rem, 2.2vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--white);
    margin: 0 0 26px;
    line-height: 1.2;
    max-width: 820px;
}

.brief-subhead-sm {
    font-family: var(--font-title);
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--white);
    margin: 2.4rem 0 0.9rem;
    max-width: 76ch;
}

/* ── Flowing prose — a single open column; every paragraph spans the
      full section width and stacks naturally ── */
.brief-prose {
    font-family: var(--card-body-font);
    font-size: 1.08rem;
    line-height: 1.75;
    color: var(--text);
}

.brief-prose p {
    margin: 0 0 1.3rem;
}

.brief-prose p:last-child {
    margin-bottom: 0;
}

.brief-prose h3,
.brief-prose h4 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.1px;
    color: var(--white);
    margin: 2.6rem 0 1rem;
}

.brief-prose ul,
.brief-prose ol {
    margin: 0 0 1.05rem 1.15rem;
    padding: 0;
}

.brief-prose li {
    margin-bottom: 0.6rem;
    line-height: 1.7;
}

.brief-prose li strong,
.brief-prose p strong {
    color: var(--white);
}

.brief-prose blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.2rem;
    margin: 0 0 1.45rem;
    color: var(--text-2);
}

/* ══ SCREEN 01 — SUMMARY ══
   Open headline, the day's thesis beside a tall image slot, then the
   takeaway strip. */

.brief-headline {
    font-family: var(--font-title);
    font-size: clamp(2.1rem, 3.5vw, 3rem);
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.8px;
    line-height: 1.1;
    margin: 0 0 40px;
    max-width: 1020px;
    text-wrap: balance;
}

/* Summary lede reads slightly larger */
#macro-body p:first-child {
    font-size: 1.2rem;
    line-height: 1.7;
}

/* Key takeaways — an open metric strip: top rules, no boxes */
.brief-asym-block {
    margin-top: 56px;
    clear: both;
}

.asymmetries-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 20px clamp(24px, 3vw, 44px);
}

.asym-item {
    border-top: 1px solid var(--border-hover);
    padding-top: 12px;
}

.asym-item-label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.asym-item p {
    font-family: var(--card-body-font);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
}

.asym-item strong {
    color: var(--white);
}

/* ══ SCREEN 02 — FEED ══
   An open wire timeline: hairline rail, accent markers, date column. */

.chrono-feed {
    position: relative;
    padding-left: 36px;
}

.chrono-feed::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: var(--border-hover);
}

.chrono-item {
    position: relative;
    display: grid;
    grid-template-columns: 175px minmax(0, 1fr);
    gap: 26px;
    padding: 20px 0;
}

.chrono-item::before {
    content: '';
    position: absolute;
    left: -39px;
    top: 28px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--bg);
}

.chrono-time {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.7;
    color: var(--accent);
    padding-top: 3px;
}

.chrono-content {
    display: flex;
    min-width: 0;
}

.chrono-text {
    font-family: var(--font);
    font-size: 1.05rem;
    line-height: 1.72;
    color: var(--text);
}

.chrono-text strong {
    color: var(--white);
}

/* Inline links inside briefing/card text — quiet accent, no visible URL */
.chrono-text a,
.asym-item a,
.bento-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
}

.chrono-text a:hover,
.asym-item a:hover,
.bento-content a:hover {
    border-bottom-style: solid;
}

.brief-prose table {
    width: 100%;
    max-width: 100%;
    margin: 1.6rem 0 2rem;
    border-collapse: collapse;
    font-size: 0.9rem;
    border-top: 1px solid var(--text-3);
    border-bottom: 1px solid var(--text-3);
}

.brief-prose tbody tr:nth-child(even) {
    background: var(--surface-2);
}

.brief-prose th,
.brief-prose td {
    text-align: left;
    padding: 15px 22px 15px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.6;
    vertical-align: top;
}

.brief-prose th {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-2);
    border-bottom: 1px solid var(--border-hover);
    padding-top: 10px;
    padding-bottom: 10px;
}

.brief-prose td strong {
    color: var(--white);
}

/* ══ SCREEN 03 — 101 ══
   The concept brief flows as full-width prose; the adaptive sub-sections
   (key-term mosaic, rhetoric/reality contrast) sit below it at the full
   section width. */

/* Key terms — a hairline mosaic: cells separated by 1px seams, no fills */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin: 1.4rem 0 2rem;
    clear: both;
}

.glossary-card {
    background: var(--bg);
    padding: 22px 24px;
}

.glossary-term {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.glossary-card p {
    font-family: var(--card-body-font);
    font-size: 1rem;
    line-height: 1.68;
    color: var(--text);
}

/* Rhetoric vs Reality — two open columns split by a single hairline */
.brief-contrast {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 1.4rem 0 2rem;
    border-top: 1px solid var(--border-hover);
    border-bottom: 1px solid var(--border-hover);
    clear: both;
}

.brief-contrast-col {
    padding: 26px clamp(24px, 3vw, 48px) 26px 0;
}

.brief-contrast-col--reality {
    border-left: 1px solid var(--border);
    padding-left: clamp(24px, 3vw, 48px);
    padding-right: 0;
}

.brief-contrast-label {
    display: block;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.brief-contrast-col--rhetoric .brief-contrast-label {
    color: var(--text-2);
}

.brief-contrast-col--reality .brief-contrast-label {
    color: var(--accent);
}

.brief-contrast-col p {
    font-family: var(--card-body-font);
    font-size: 1.02rem;
    line-height: 1.72;
    color: var(--text);
}

/* ══ SCREEN 04 — OUTLOOK ══
   Each vector is a full-width ledger row: numeral + theme on the left,
   the three fields (direction / why / trigger) spread across the rest of
   the page width — nothing crammed into narrow columns. */

.horizon-grid {
    display: flex;
    flex-direction: column;
    counter-reset: horizon;
}

.horizon-card {
    display: grid;
    grid-template-columns: minmax(200px, 4fr) minmax(0, 11fr);
    gap: 22px clamp(40px, 6vw, 90px);
    align-items: start;
    border-top: 1px solid var(--border-hover);
    padding: 38px 0;
    counter-increment: horizon;
}

.horizon-card-head::before {
    content: counter(horizon, decimal-leading-zero);
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-3);
    margin-bottom: 14px;
}

.horizon-card-title {
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--white);
    line-height: 1.3;
    margin: 0 0 12px;
}

.horizon-card-intro {
    font-family: var(--card-body-font);
    font-size: 1.02rem;
    line-height: 1.68;
    color: var(--text);
    margin: 0;
}

.horizon-card-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px clamp(28px, 3.5vw, 56px);
    margin: 0;
}

.horizon-field dt {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    text-align: center;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.horizon-field dd {
    font-family: var(--card-body-font);
    font-size: 1.04rem;
    line-height: 1.72;
    color: var(--text);
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 1000px) {
    .horizon-card {
        grid-template-columns: 1fr;
        padding: 28px 0;
    }
    .horizon-card-fields {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

@media (max-width: 720px) {
    .brief-headline {
        font-size: 1.7rem;
        letter-spacing: -0.5px;
        margin-bottom: 28px;
    }
    .brief-header {
        margin-bottom: 44px;
    }
    .brief-content {
        gap: 68px;
    }
    .brief-asym-block {
        margin-top: 44px;
    }
    .brief-contrast {
        grid-template-columns: 1fr;
    }
    .brief-contrast-col {
        padding-right: 0;
    }
    .brief-contrast-col--reality {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
    }
    .chrono-feed {
        padding-left: 22px;
    }
    .chrono-item {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 12px 0;
    }
    .chrono-item::before {
        left: -25px;
        top: 18px;
    }
}

/* ═══ Admin Duyuru Bandı ═══
   /Admin Panelden yayınlanır; app.js initAdminBanner() body'nin en
   üstüne ekler. Duyuru aktif değilken bu DOM hiç oluşturulmaz. */
.site-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 9px 40px 9px 16px;
    font-size: 13.5px;
    font-weight: 500;
    text-align: center;
    position: relative;
    z-index: 3000;
}
.site-banner--info  { background: #1d3a6e; color: #cfe0ff; }
.site-banner--warn  { background: #6e5a1d; color: #ffedb0; }
.site-banner--alert { background: #6e1d1d; color: #ffd0d0; }
.site-banner-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: .7;
    padding: 2px 6px;
}
.site-banner-close:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — tablet + phone
   Desktop-first: everything above stays untouched; these
   blocks only relax the fixed viewport layout as the
   screen narrows.
   ══════════════════════════════════════════════════════ */

/* ── Tablet (≤1024px): home grid 3×2 → 2 columns, page scrolls ── */
@media (max-width: 1024px) {
    .home-view {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .home-bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: none;
        grid-auto-rows: minmax(280px, auto);
        height: auto;
        min-height: 100%;
        /* .home-view is itself a column flex container: without this the
           grid gets shrunk to the viewport height and the cards are crushed
           instead of the page scrolling. */
        flex: 0 0 auto;
    }

    /* Neutralize the explicit desktop cell assignments (.widget-headline
       { grid-column:1; grid-row:1 } etc.) so cards auto-flow. */
    .home-bento-grid > .bento-widget {
        grid-column: auto;
        grid-row: auto;
    }

    #home-view .bento-widget {
        padding: 30px 28px !important;
    }
}

/* ── Phone (≤768px) ── */
@media (max-width: 768px) {
    :root {
        /* Safe-area aware compact topbar: every view insets itself off this
           one variable, so notched devices are handled everywhere at once. */
        --topbar-h: calc(56px + env(safe-area-inset-top, 0px));
        /* Terminal sidebar becomes an overlay sheet on top of the map. */
        --sidebar-w: min(86vw, 340px);
    }

    /* ── Topbar ── */
    .topbar {
        padding: env(safe-area-inset-top, 0px) 16px 0;
    }

    /* No room for the ticker next to the brand + toggles on a phone-width
       topbar — Home and Briefing fall back to the plain two-item layout here too. */
    .topbar-center {
        display: none !important;
    }

    .topbar-right {
        gap: 12px;
    }

    /* ── Home: single scrollable column ── */
    .home-bento-grid {
        display: flex;
        flex-direction: column;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    #home-view .bento-widget {
        padding: 26px 20px !important;
        border-right: none !important;
        /* Cards keep their natural content height in the flex column —
           the base .bento-widget min-height:0 would otherwise let them
           shrink-to-fit and clip their rows. */
        flex-shrink: 0;
        min-height: 0;
    }

    /* Reading order on the phone column: briefing, feed, outlook, 101,
       terminal, sports — text cards first, the two image portals last. */
    .widget-headline        { order: 1; }
    .widget-status          { order: 2; }
    .widget-forecast        { order: 3; }
    .widget-context         { order: 4; }
    .widget-terminal-portal { order: 5; }
    .widget-sports          { order: 6; }

    /* ── Accordion cards ──
       The four text cards collapse to their kicker row so the whole page
       fits one screen; tapping a card expands it in place (wired in
       initViewTabs), and only the "read more" row navigates to the
       briefing. The open/close animates via the grid 0fr→1fr row trick —
       no measured heights, works with any content length. */
    #home-view .bento-collapsible {
        padding: 18px 20px !important;
        transition: background-color 0.35s var(--ease);
    }

    #home-view .bento-collapsible .bento-kicker {
        margin-bottom: 0 !important;
    }

    /* All card header chips share one width — sized to clear the longest
       label in both languages — so the closed stack reads as one system. */
    .bento-kicker {
        min-width: 128px;
    }

    #home-view .bento-collapsible .bento-acc {
        display: grid;
        grid-template-rows: 0fr;
        transition: grid-template-rows 0.45s var(--ease);
    }

    #home-view .bento-collapsible.expanded .bento-acc {
        grid-template-rows: 1fr;
    }

    #home-view .bento-collapsible .bento-acc-inner {
        overflow: hidden;
        min-height: 0;
        padding-top: 14px;
        opacity: 0;
        transform: translateY(-6px);
        transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
    }

    #home-view .bento-collapsible.expanded .bento-acc-inner {
        opacity: 1;
        transform: translateY(0);
        transition-delay: 0.08s;
    }

    /* The desktop ↗ nav arrow becomes the accordion's state marker: a +
       aligned to the kicker row that rotates into an × when open. */
    #home-view .bento-collapsible::after {
        content: "+" !important;
        top: 19px !important;
        right: 20px !important;
        transform: none !important;
        font-size: 1.15rem !important;
        line-height: 1 !important;
        opacity: 0.5 !important;
    }

    #home-view .bento-collapsible.expanded::after {
        content: "+" !important;
        transform: rotate(45deg) !important;
        color: var(--accent) !important;
        opacity: 0.9 !important;
    }

    /* Touch keeps :hover stuck on the last-tapped card — neutralize the
       desktop hover accents and tie them to the expanded state instead,
       so the open card is the highlighted one. */
    #home-view .bento-collapsible:hover {
        background-color: var(--surface) !important;
    }

    #home-view .bento-collapsible:hover .bento-kicker {
        background-color: var(--text) !important;
        border-color: var(--text) !important;
        color: var(--bg) !important;
    }

    #home-view .bento-collapsible.expanded,
    #home-view .bento-collapsible.expanded:hover {
        background-color: var(--surface-2) !important;
    }

    #home-view .bento-collapsible.expanded .bento-kicker,
    #home-view .bento-collapsible.expanded:hover .bento-kicker {
        background-color: var(--accent) !important;
        border-color: var(--accent) !important;
        color: var(--bg) !important;
    }

    /* Lives inside .bento-acc-inner, so while the card is collapsed it is
       clipped away with the content and rides the same reveal animation. */
    #home-view .bento-collapsible .bento-more {
        display: block;
        width: 100%;
        margin-top: 16px;
        padding: 12px 0 4px;
        background: none;
        border: none;
        border-top: 1px solid var(--border);
        font-family: var(--mono);
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        text-align: center;
        color: var(--accent);
        cursor: pointer;
    }

    .home-bento-skeleton {
        padding: 24px 16px;
    }

    .bento-image-box {
        height: 150px;
    }

    /* Touch has no real hover and taps leave :hover stuck — on phones the
       Coming Soon veil is driven only by the tap-toggled class (wired in
       initViewTabs): one tap shows it, the next hides it. */
    .widget-sports:hover .bento-coming-soon,
    .widget-sports:focus-within .bento-coming-soon {
        opacity: 0;
    }

    .widget-sports.show-coming-soon .bento-coming-soon {
        opacity: 1;
    }

    /* ── Briefing ── */
    #vantage-home-view {
        padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .brief-header {
        gap: 16px;
        margin-bottom: 40px;
    }

    .brief-date {
        font-size: 10px;
        letter-spacing: 3px;
    }

    .brief-screen-head {
        margin-bottom: 28px;
    }

    /* Wide markdown tables scroll inside their own box instead of
       stretching the page. */
    .brief-prose table {
        display: block;
        overflow-x: auto;
    }

    .horizon-card {
        padding: 24px 0;
    }

    /* ── Terminal: full-bleed map, sidebar overlays it ── */
    #map {
        inset: var(--topbar-h) 0 0 0;
    }

    #map.sidebar-hidden {
        left: 0;
    }

    body.terminal-mode #map,
    body.terminal-mode #map.sidebar-hidden {
        inset: 0 !important;
    }

    .sidebar {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
    }

    .sidebar.collapsed {
        box-shadow: none;
    }

    body.terminal-mode .sidebar {
        padding-top: calc(60px + env(safe-area-inset-top, 0px)) !important;
    }

    /* Larger touch target for the sidebar handle */
    .sidebar-toggle {
        width: 26px;
        height: 46px;
        font-size: 13px;
    }

    /* iOS zooms into focused inputs under 16px — keep the dropdown search
       at 16px so the layout doesn't jump. */
    .combo-search {
        font-size: 16px;
        padding: 10px 12px 10px 33px;
    }

    .news-card {
        padding: 14px 16px;
    }

    /* ── Detail drawer: full-width sheet ── */
    .detail-panel {
        top: var(--topbar-h);
        bottom: var(--statusbar-h);
        max-height: none;
        width: 100vw;
        right: -102vw;
        border: none;
        border-left: 1px solid var(--border);
        box-shadow: none;
        padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .detail-panel.open {
        right: 0;
    }

    .detail-close {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .site-banner {
        font-size: 12.5px;
        padding: 8px 36px 8px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bento-acc,
    .bento-acc-inner,
    .sidebar {
        transition: none !important;
    }
}

/* ── Small phones (≤480px) ── */
@media (max-width: 480px) {
    #home-view .bento-widget {
        padding: 22px 16px !important;
    }

    .bento-kicker {
        margin-bottom: 12px !important;
    }

    .brief-headline {
        font-size: 1.5rem;
    }

    #macro-body p:first-child {
        font-size: 1.1rem;
    }

    .chrono-text {
        font-size: 1rem;
    }

    .horizon-card-title {
        font-size: 1.15rem;
    }
}
