/**
 * Global Energy Flow — Main Dashboard CSS
 * Linear-inspired design · Flat surfaces · Hairline borders · No gradients · No glows
 * Color used only where data itself is a signal (red/amber/green dots)
 */

  :root {
    --bg:           #08090A;
    --surface:      #0F1011;
    --surface-2:    #141516;
    --border:       rgba(255,255,255,0.05);
    --border-s:     rgba(255,255,255,0.08);
    --text:         #F7F8F8;
    --text-2:       #8A8F98;
    --text-3:       #62666D;
    --text-4:       #50535A;
    --accent:       #5E6AD2;
    --crit:         #F87171;
    --watch:        #F59E0B;
    --ok:           #34D399;
  }
  *{box-sizing:border-box;margin:0;padding:0}
  html,body{background:var(--bg);color:var(--text);font-family:'Inter',-apple-system,system-ui,sans-serif;font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased}
  a{color:inherit;text-decoration:none}

  /* Header / nav / mobile-nav — owned by assets/css/gef-header.css since
     May 13, 2026. Header markup is `<header class="gef-header-v2">` on
     every page including this one. */

  /* ─────────────────────────────────────────────────────
     TICKER STRIP — scrolling, hover-pause, disciplined
     ───────────────────────────────────────────────────── */
  .ticker-strip {
    border-bottom: 1px solid var(--border);
    padding: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: stretch;
  }
  /* Fixed-position prefix on the left — always visible */
  .ticker-prefix {
    flex-shrink: 0;
    padding: 10px 16px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .ticker-prefix .label {
    font-size: 10px;
    color: var(--text-3);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  /* Scrolling region */
  .ticker-track {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
    /* Edge fade so text doesn't slam into the prefix or right edge */
    mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
  }
  .ticker-content {
    display: inline-flex;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    /* Two identical content blocks side-by-side, scrolled by transform */
    animation: ticker-scroll 120s linear infinite;
  }
  /* Hover anywhere on the strip pauses */
  .ticker-strip:hover .ticker-content { animation-play-state: paused; }

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

  /* Individual items in the ticker */
  .ti {
    display: inline-flex;
    align-items: center;
    padding: 0 24px;
    gap: 8px;
    border-right: 1px solid var(--border);
  }
  .ti:last-child { border-right: none; }
  .ti .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .ti.crit .dot   { background: var(--crit); }
  .ti.watch .dot  { background: var(--watch); }
  .ti.ok .dot     { background: var(--ok); }
  .ti.muted .dot  { background: var(--text-4); }
  .ti .txt { color: var(--text-2); }
  .ti .num { color: var(--text); font-weight: 500; }

  /* Hover hint (only visible on hover, very subtle) */
  .ticker-strip::after {
    content: 'hover to pause';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 3;
    background: var(--bg);
    padding: 2px 6px;
  }
  .ticker-strip:hover::after { opacity: 1; }

  /* ─── Rest of the dashboard ─── */
  .main { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
  .grid { display: grid; gap: 12px; }
  .grid-r1 { grid-template-columns: repeat(4, 1fr); }
  .grid-r2 { grid-template-columns: 1.4fr 1fr; margin-top: 12px; }
  .grid-r3 { grid-template-columns: 1fr; margin-top: 12px; }
  .grid-r4 { display: grid; grid-template-columns: 1fr; margin-top: 12px; }

  /* Country Status card (Row 4) — primary nav surface for the 5 country pages */
  .country-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
  }
  .country-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border: 1px solid var(--border, #2A2E37);
    border-radius: 8px;
    background: var(--surface-1, #0F1115);
    color: var(--text-1, #E6E8EB);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
    min-width: 0;
  }
  .country-card:hover {
    border-color: var(--accent, #5E6AD2);
    background: var(--surface-2, #14161B);
  }
  .country-flag { font-size: 22px; flex-shrink: 0; line-height: 1; }
  .country-body { flex: 1; min-width: 0; }
  .country-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1, #E6E8EB);
    margin-bottom: 3px;
  }
  .country-meta {
    font-size: 11px;
    color: var(--text-3, #8A8F9A);
    line-height: 1.35;
    display: flex;
    align-items: flex-start;
    gap: 5px;
  }
  .cdot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
  }
  .cdot-crit  { background: var(--crit, #ef4444); }
  .cdot-watch { background: var(--watch, #f59e0b); }
  .country-arrow {
    font-size: 14px;
    color: var(--text-3, #8A8F9A);
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s, transform 0.15s;
  }
  .country-card:hover .country-arrow {
    opacity: 1;
    transform: translateX(3px);
    color: var(--accent, #5E6AD2);
  }

  .spot {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
  }
  /* Tiles that link to a dedicated page (Hormuz, EU gas trajectory) */
  .spot-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
  }
  .spot-link:hover {
    border-color: var(--accent, #5E6AD2);
    background: var(--surface-2, #14161B);
  }
  .spot-cta {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent, #5E6AD2);
    opacity: 0.85;
    transition: opacity 0.15s;
  }
  .spot-link:hover .spot-cta { opacity: 1; }
  .spot-label {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-3);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .spot-label-right { font-size: 11px; color: var(--text-3); }

  .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .dot-crit { background: var(--crit); }
  .dot-watch { background: var(--watch); }
  .dot-ok { background: var(--ok); }

  /* Spot 1 — Hormuz */
  .hormuz-line { display: flex; align-items: baseline; gap: 8px; }
  .hormuz-day-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
  .hormuz-day-num { font-size: 22px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
  .hormuz-status-text { font-size: 12px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
  .hormuz-status-text .neg { color: var(--crit); }
  .num-detail { font-size: 11px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }

  /* Spot 2 — EU Gas */
  .gauge-compact { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
  .gauge-pct { font-size: 22px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
  .gauge-sub { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; margin-top: 4px; }
  .gauge-detail { font-size: 11px; color: var(--text-3); margin-top: 10px; font-variant-numeric: tabular-nums; }

  /* Spot 3 — Fuel Extremes */
  .fuel-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 2px; }
  .fuel-col-head { font-size: 11px; color: var(--text-3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px; }
  .fuel-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-size: 12px; border-top: 1px solid var(--border); }
  .fuel-row:first-of-type { border-top: none; }
  .fuel-row .label { color: var(--text-2); }
  .fuel-row .value { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }
  .fuel-row .country { color: var(--text-3); font-size: 10px; }

  /* Spot 4 — Brent / WTI */
  .price-table { width: 100%; }
  .price-row { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); }
  .price-row:first-of-type { border-top: none; }
  .price-label-cell { font-size: 12px; color: var(--text-2); }
  .price-value-cell { font-size: 16px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
  .price-change-cell { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
  .price-change-cell.up { color: var(--crit); }
  .sparkline-row { margin-top: 8px; }

  /* Spot 5 — Globe (production component via iframe)
     The globe spot has NO inner padding so the iframe fills edge-to-edge.
     The wrap is the same height as the Live Alerts panel beside it. */
  .spot-globe {
    padding: 0;
    overflow: hidden;
  }
  .globe-wrap {
    width: 100%;
    height: 100%;
    min-height: 520px;
    position: relative;
    background: #08090A;
    border-radius: 8px;
    overflow: hidden;
  }
  .globe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #08090A;
  }

  /* Spot 6 — Live Alerts
     CAP alerts panel height so content drift in any individual alert
     (long source lists, long body text) doesn't blow out Row 2 height —
     globe will stretch to match alerts panel via grid align-stretch.
     Past 520px, the alerts list becomes internally scrollable. */
  .alerts-list {
    display: flex;
    flex-direction: column;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Subtle scrollbar — only show when needed */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
  }
  .alerts-list::-webkit-scrollbar { width: 4px; }
  .alerts-list::-webkit-scrollbar-track { background: transparent; }
  .alerts-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
  .alert-item { padding: 10px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
  .alert-item:first-of-type { border-top: none; padding-top: 4px; }
  .alert-dot-wrap { padding-top: 4px; }
  .alert-title { font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 3px; }
  .alert-text { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 4px; }
  .alert-source { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .alert-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

  /* Spot 7 — Active Disruptions list */
  .disruption-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 12px; }
  .disruption-row:first-of-type { border-top: none; padding-top: 4px; }
  .disruption-name { color: var(--text); font-weight: 500; }
  .disruption-detail { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .disruption-day { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

  /* Spot 8 — Cross-System
     Sits below the Live Alerts row. Use --text-2 (not --text) so it reads
     as substantive editorial but doesn't visually outweigh the alerts above
     — the alerts have already done the headline work; this paragraph is
     the connective tissue, not the lead. */
  .cross-text { font-size: 14px; color: var(--text-2); line-height: 1.55; }
  .cross-text .conn { color: var(--text-3); margin: 0 6px; }
  .cross-meta { font-size: 11px; color: var(--text-3); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }

  /* Footer */
  .footer { border-top: 1px solid var(--border); margin-top: 32px; padding: 16px 24px; font-size: 11px; color: var(--text-3); }

  /* Site-wide footer (matches /risk-analysis/, /shortages/, etc.) */
  .gef-footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-3);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }
  .gef-footer p { margin: 0; line-height: 1.6; }
  .gef-footer a { color: inherit; }
  .gef-footer a:hover { color: var(--text-2); }

  /* ═══════════════════════════════════════════════════════════════════
     MOBILE RESPONSIVENESS
     Breakpoints:
       <= 1024px (tablet)        — 4-tile row → 2x2; row 2 still side-by-side
       <= 768px  (small tablet)  — row 2 stacks; nav switches to hamburger
       <= 480px  (phone)         — 4 tiles stack 1-col; tighter paddings
     ═══════════════════════════════════════════════════════════════════ */

  /* Hamburger button + mobile nav — owned by assets/css/gef-header.css. */

  @media (max-width: 1024px) {
    /* 4 KPI tiles → 2x2 grid */
    .grid-r1 { grid-template-columns: repeat(2, 1fr); }
  }

  @media (max-width: 768px) {
    /* Header rules at <=768px are owned by assets/css/gef-header.css. */

    /* Ticker: tighten prefix so the scrolling area gets more room */
    .ticker-prefix {
      padding: 8px 10px;
      font-size: 11px;
    }
    .ticker-prefix .label { display: none; }     /* drop "Hormuz" label, keep "Day NN" */
    .ticker-content { font-size: 11px; }
    .ti { padding: 0 16px; }

    /* Row 2: stack globe over alerts */
    .grid-r2 { grid-template-columns: 1fr; }

    /* Row 4 country grid: switch to 2 columns at tablet, 1 column at phone */
    .country-grid { grid-template-columns: repeat(2, 1fr); }

    /* Main padding tighter */
    .main { padding: 12px 16px; }
    .grid { gap: 8px; }
    .grid-r2 { margin-top: 8px; }
    .grid-r3 { margin-top: 8px; }
    .grid-r4 { margin-top: 8px; }

    /* Spot tightening */
    .spot { padding: 12px; }
    .spot-label { margin-bottom: 10px; font-size: 10px; }

    /* Globe minimum height shrinks on mobile */
    .globe-wrap { min-height: 320px; }

    /* Alarm strip / ticker height */
    .ticker-strip { font-size: 11px; }
  }

  @media (max-width: 480px) {
    /* 4 KPI tiles fully stack 1-column */
    .grid-r1 { grid-template-columns: 1fr; }

    /* Country grid: 1 column on phones */
    .country-grid { grid-template-columns: 1fr; }

    /* Number sizes drop slightly */
    .hormuz-day-num,
    .disruptions-num,
    .gauge-pct {
      font-size: 20px;
    }
    .price-value-cell { font-size: 15px; }

    /* Fuel extremes: stack the cheapest/most-expensive pair vertically
       so values don't get crushed */
    .fuel-pair { grid-template-columns: 1fr; gap: 12px; }

    /* Cross-system text smaller */
    .cross-text { font-size: 13px; line-height: 1.55; }
    .cross-text .conn { margin: 0 4px; }

    /* Live Alerts: time column drops to its own line */
    .alert-item {
      grid-template-columns: auto 1fr;
    }
    .alert-time {
      grid-column: 2;
      margin-top: 4px;
      font-size: 10px;
    }

    /* Footer */
    .gef-footer { padding: 16px; font-size: 11px; }

    /* Globe min-height further reduced on phone */
    .globe-wrap { min-height: 280px; }
  }
