/* ==========================================================================
   powersystemanalysis.org — Design System
   Tokens are taken directly from the UI/UX Design Direction doc (Section 4.2).
   ========================================================================== */

:root {
  /* Colour */
  --c-primary:   #1A7A4A; /* deep green  — authority, energy/nature */
  --c-secondary: #0D2B45; /* dark navy   — headlines, depth (flips light in dark mode) */
  --c-navy:      #0D2B45; /* fixed dark navy — for dark surfaces (ticker, footer, badges); never flips */
  --c-accent:    #F5A623; /* amber       — CTAs, live data */
  --c-bg:        #F8FAFB; /* off-white   */
  --c-surface:   #FFFFFF;
  --c-text:      #16202B;
  --c-muted:     #5B6B7A;
  --c-border:    #E3E9EE;

  /* Type */
  --f-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, sans-serif;
  --f-ui:   "Inter", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Shape */
  --radius: 6px;
  --shadow: 0 1px 2px rgba(13,43,69,.06), 0 4px 12px rgba(13,43,69,.06);
  --maxw: 1280px;
}

[data-theme="dark"] {
  --c-bg:      #050F1C; /* near-black */
  --c-surface: #0B1A2B;
  --c-text:    #E7EEF4;
  --c-muted:   #93A4B5;
  --c-border:  #16293C;
  --c-secondary: #CFE0EE;
}

* { box-sizing: border-box; }

/* Smooth cross-fade when switching light/dark (applied only during the toggle) */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color .7s ease, color .7s ease, border-color .7s ease,
              fill .7s ease, stroke .7s ease, box-shadow .7s ease !important;
  transition-delay: 0s !important;
}

html, body { margin: 0; padding: 0; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .h { font-family: var(--f-head); color: var(--c-secondary); font-weight: 700; line-height: 1.14; letter-spacing: -0.02em; text-wrap: balance; }
h1 { letter-spacing: -0.025em; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--c-secondary); }

/* Tabular (monospaced-width) figures for all numeric/data type so columns align */
.ticker, .price, .price__val, .price__chg, .data-table, .data-table__val,
.capacity__val, .tag, .card__meta, .hero__meta, .article__meta, .coverage,
.trend, .footer__stats { font-variant-numeric: tabular-nums; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.nav__inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; flex: 0 1 auto; min-width: 0; overflow: hidden; font-family: var(--f-head); font-weight: 700; font-size: clamp(13px, 4vw, 23px); color: var(--c-secondary); letter-spacing: -.5px; white-space: nowrap; }
.brand__word { overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 1.35em; height: 1.35em; flex: none; transition: transform .18s ease; }
.brand:hover .brand__mark { transform: scale(1.07) rotate(-3deg); }
.brand__badge { fill: var(--c-primary); }
.brand__pulse { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand__word { color: inherit; }
.brand__word > span { color: var(--c-primary); }
.nav__links { display: flex; gap: 20px; font-family: var(--f-ui); font-size: 15px; margin-left: auto; }
.nav__links a { color: var(--c-muted); transition: color .12s; }
.nav__links a:hover { color: var(--c-primary); text-decoration: none; }
.nav__links a.is-active { color: var(--c-secondary); font-weight: 600; }
.nav__links a.nav__study { color: var(--c-text); font-weight: 800; letter-spacing: -0.01em; }
.nav__links a.nav__study:hover { color: var(--c-text); opacity: .8; }
.nav__study-suffix { color: var(--c-primary); font-weight: 700; }
.btn { transition: filter .12s, transform .06s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 3px;
}
.nav__actions { display: flex; align-items: center; gap: 12px; flex: none; }

@keyframes navClockPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.btn {
  font-family: var(--f-ui); font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: var(--c-primary); color: #fff;
}
.btn--ghost { background: transparent; color: var(--c-muted); border: 1px solid var(--c-border); }
.btn--accent { background: var(--c-accent); color: #21160a; }

.iconbtn { background: transparent; border: 1px solid var(--c-border); border-radius: var(--radius);
  width: 38px; height: 38px; cursor: pointer; color: var(--c-muted); font-size: 16px; line-height: 1; }
.iconbtn:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* Burger only appears on mobile (see responsive block) */
.nav__burger { display: none; }

/* Mobile slide-out drawer — pops out from the right edge of the screen */
.mobile-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(82vw, 320px);
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 20px 24px;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
  box-shadow: -2px 0 24px rgba(0, 0, 0, .28);
  font-family: var(--f-ui);
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .26s ease, visibility .26s ease;
}
.mobile-menu.is-open { transform: translateX(0); visibility: visible; }
.mobile-menu a { text-decoration: none; }
.mobile-menu a:hover { text-decoration: none; }

/* Search and close share a row, reclaiming a full row of height. */
.mobile-menu__top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mobile-menu__close { flex: 0 0 auto; align-self: auto; margin: 0; font-size: 18px; line-height: 1; }

/* Primary destinations and the Participate group share one link style: simple
   full-width rows. The explicit font-size matters — without it these inherit the
   global mobile `body { font-size: 17px }` bump and each row grows to ~40px.
   Scoped to these two containers so the border-bottom never bleeds onto the
   category chips below. (Buttons were tried here and read heavier than the nav
   itself, inverting the hierarchy.) */
.mobile-menu__primary,
.mobile-menu__secondary { display: flex; flex-direction: column; }
.mobile-menu__primary a,
.mobile-menu__secondary a {
  font-size: 15px; color: var(--c-text); padding: 9px 0;
  border-bottom: 1px solid var(--c-border);
}
.mobile-menu__primary a:hover,
.mobile-menu__secondary a:hover { color: var(--c-primary); }
.mobile-menu__primary a.is-active,
.mobile-menu__secondary a.is-active { color: var(--c-primary); font-weight: 600; }
/* PSS.study is off-site — mark it so it doesn't read as another internal page. */
.mobile-menu__study::after { content: "\2197"; margin-left: 5px; font-size: 11px; color: var(--c-muted); }

.mobile-menu__rule { height: 1px; background: var(--c-border); margin: 10px 0 2px; }
.mobile-menu__heading {
  margin: 12px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-muted, #8a93a0);
}

/* Categories as wrapping pills — same chip language as the category tabs on
   phones. Chips flow regardless of label length, so long names like
   "Research & Academia" no longer break a rigid two-column grid. */
.mobile-menu__cats { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.mobile-menu__cats a {
  font-size: 12px; padding: 7px 13px; border-radius: 20px;
  border: 1px solid var(--c-border); color: var(--c-muted, #8a93a0);
}
.mobile-menu__cats a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.mobile-menu__cats a.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* Dimmed backdrop behind the open drawer */
.mobile-menu__backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity .26s ease;
}
.mobile-menu__backdrop.is-open { opacity: 1; }

/* ---------- Reading-progress bar ---------- */
.readbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: var(--c-primary); transform: scaleX(0); transform-origin: left;
  display: none;
}
.readbar.is-active { display: block; }

/* ---------- Skip link (a11y) ---------- */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--c-primary); color: #fff; padding: 9px 16px; border-radius: var(--radius);
  font-family: var(--f-ui); font-weight: 600; font-size: 14px; transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Nav search ---------- */
.nav__search input {
  font-family: var(--f-ui); font-size: 14px; padding: 8px 12px; width: 160px;
  border: 1px solid var(--c-border); border-radius: 20px; background: var(--c-bg); color: var(--c-text);
  transition: width .2s, border-color .15s;
}
.nav__search input:focus { width: 210px; outline: none; border-color: var(--c-primary); }
.mobile-menu__search { flex: 1 1 auto; min-width: 0; margin: 0; }
.mobile-menu__search input { width: 100%; font-family: var(--f-ui); font-size: 14px; padding: 9px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-bg); color: var(--c-text); }

/* ---------- Live ticker (Data as Design) ---------- */
.ticker {
  background: var(--c-navy); color: #cfe7da;
  font-family: var(--f-mono); font-size: 13px; overflow: hidden; white-space: nowrap;
  border-bottom: 2px solid var(--c-primary);
}
.ticker .container { display: flex; align-items: center; }
.ticker__clock {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px 8px 0; margin-right: 18px; border-right: 1px solid rgba(255,255,255,.16);
  color: #fff; font-weight: 600; letter-spacing: .06em;
}
.ticker__clock time { font-variant-numeric: tabular-nums; }
.ticker__clock-zone { color: #9fb8ac; font-size: 11px; letter-spacing: .14em; }
.ticker__clock-loc { color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.ticker__clock-loc::before { content: "\1F4CD"; margin-right: 4px; font-weight: 400; -webkit-text-fill-color: initial; }
.ticker__clock-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--c-primary);
  box-shadow: 0 0 8px var(--c-primary); animation: navClockPulse 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .ticker__clock-dot { animation: none; } }
.ticker__viewport { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__track { display: inline-block; padding: 8px 0; animation: ticker 40s linear infinite; }
.ticker__item { padding: 0 26px; }
.ticker__item b { color: #fff; }
.ticker .up { color: #58d39b; } .ticker .down { color: #ff7a7a; } .ticker .amber { color: var(--c-accent); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Category tabs ---------- */
.cats { position: sticky; top: 64px; z-index: 40; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
/* Right-edge fade to hint that the tabs scroll horizontally */
.cats::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 36px; pointer-events: none; background: linear-gradient(to right, rgba(0,0,0,0), var(--c-surface)); }
.cats__inner { position: relative; display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; font-family: var(--f-ui); }
.cats a {
  padding: 14px 14px; font-size: 14px; font-weight: 600; color: var(--c-muted);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.cats a:hover { color: var(--c-secondary); text-decoration: none; }
.cats a.is-active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* ---------- Layout grid ---------- */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 36px; padding: 32px 0; }

/* ---------- Hero ---------- */
.hero { position: relative; display: flex; flex-direction: column; min-height: 420px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 32px; }
.hero__imglink { position: absolute; inset: 0; z-index: 0; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__body {
  position: relative; z-index: 1; margin-top: auto; padding: 28px;
  background: linear-gradient(to top, rgba(5,15,28,.96), rgba(5,15,28,.55) 70%, rgba(5,15,28,0));
  color: #fff;
}
.hero__body h1 { color: #fff; font-size: 38px; margin: 8px 0 10px; max-width: 760px; }
.hero__summary {
  font-family: var(--f-ui); font-size: 16px; color: #dbe6ef; max-width: 680px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.hero__meta { font-family: var(--f-ui); font-size: 13px; color: #9fb3c6; margin-top: 12px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-family: var(--f-ui); font-weight: 700; font-size: 11px;
  letter-spacing: .4px; text-transform: uppercase; padding: 4px 9px; border-radius: 4px;
  background: var(--c-primary); color: #fff;
}
.badge--ai { background: var(--c-accent); color: #21160a; }
.badge--sources { background: var(--c-navy); color: #fff; }
.cluster__toggle { border: 0; cursor: pointer; font: inherit; font-family: var(--f-ui); }
.cluster__toggle:hover { filter: brightness(1.15); }
.cluster__list {
  list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--c-border);
  font-family: var(--f-ui); font-size: 12.5px; color: var(--c-muted);
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
}
.cluster__list li { position: relative; padding-left: 12px; }
.cluster__list li::before { content: "•"; position: absolute; left: 0; color: var(--c-primary); }

/* ---------- Card grid (Flipboard-style) ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .12s ease;
}
.card:hover { transform: translateY(-3px); }
.card img { width: 100%; height: 160px; object-fit: cover; background: var(--c-border); }
/* Subtle placeholder tint while images stream in */
.card a img, .sidecard__img img, .hero img, .article__lead { background: var(--c-border); }
.card__body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__cat { font-family: var(--f-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--c-primary); letter-spacing: .4px; }
.card__title { font-family: var(--f-head); font-size: 18px; font-weight: 700; color: var(--c-secondary); line-height: 1.25; }
.card__title:hover { color: var(--c-primary); text-decoration: none; }
.card img { transition: transform .25s ease; }
.card:hover img { transform: scale(1.04); }
.card__meta { font-family: var(--f-ui); font-size: 12px; color: var(--c-muted); margin-top: auto; display: flex; justify-content: space-between; align-items: center; }

/* ---------- Sidebar widgets ---------- */
.widget { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; box-shadow: var(--shadow); }
.widget h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .5px; margin: 0 0 14px; font-family: var(--f-ui); color: var(--c-muted); }
/* Live Energy Prices — market-terminal style */
.widget__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.live-badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-ui); font-size: 10px; font-weight: 700; letter-spacing: .6px; color: #1a9d63; background: rgba(26,157,99,.12); padding: 2px 8px; border-radius: 20px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #1a9d63; animation: live-pulse 1.8s ease-in-out infinite; }
@keyframes live-pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(26,157,99,.5); } 50% { opacity: .5; box-shadow: 0 0 0 4px rgba(26,157,99,0); } }

.price {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--c-border);
}
.price:last-of-type { border-bottom: 0; }
.price__spark { position: absolute; right: 0; bottom: 4px; width: 56px; height: 22px; opacity: .35; pointer-events: none; }
.price__spark polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.price__spark.up polyline   { stroke: #1a9d63; }
.price__spark.down polyline { stroke: #d9534f; }
.price__spark.flat polyline { stroke: var(--c-accent); }
.price__name { position: relative; z-index: 1; font-family: var(--f-mono); font-size: 13px; color: var(--c-text); }
.price__right { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; }
.price__val { font-family: var(--f-mono); font-size: 14px; font-weight: 500; color: var(--c-secondary); }
[data-theme="dark"] .price__val { color: var(--c-text); }
.price__chg { font-family: var(--f-ui); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.price__chg.up   { color: #1a9d63; background: rgba(26,157,99,.12); }
.price__chg.down { color: #d9534f; background: rgba(217,83,79,.12); }
.price__chg.flat { color: #b9831a; background: rgba(245,166,35,.16); }
.trend { font-family: var(--f-ui); font-size: 14px; padding: 7px 0; color: var(--c-text); border-bottom: 1px solid var(--c-border); }
.trend:last-child { border-bottom: 0; }
.trend small { color: var(--c-muted); }

/* Renewable Capacity — area sparkline */
.live-badge--wk { color: var(--c-muted); background: var(--c-bg); border: 1px solid var(--c-border); }
.capacity__top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.capacity__val { font-family: var(--f-mono); font-size: 26px; font-weight: 500; color: var(--c-secondary); line-height: 1; }
[data-theme="dark"] .capacity__val { color: var(--c-text); }
.capacity__val small { font-size: 11px; font-family: var(--f-ui); color: var(--c-muted); font-weight: 400; }
.capacity__chart { width: 100%; height: 64px; display: block; }
.capacity__area { fill: url(#capGrad); }
.capacity__line { fill: none; stroke: var(--c-primary); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.capacity__dot { fill: var(--c-primary); }

/* Global coverage widget */
.coverage__map { width: 100%; height: auto; display: block; margin-bottom: 14px; }
.coverage__dot { fill: var(--c-border); }
.coverage__dot.is-on { fill: var(--c-primary); }
.coverage__row { display: flex; align-items: center; gap: 10px; font-family: var(--f-ui); font-size: 13px; padding: 5px 0; }
.coverage__label { flex: 0 0 96px; color: var(--c-muted); }
.coverage__bar { flex: 1; height: 6px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 4px; overflow: hidden; }
.coverage__bar span { display: block; height: 100%; background: var(--c-primary); border-radius: 4px; }
.coverage .data-chart__cap { margin-top: 12px; }

.newsletter { background: var(--c-navy); color: #fff; }
.newsletter h3 { color: #9fc7b2; }
.newsletter p { font-family: var(--f-ui); font-size: 14px; color: #cdddec; }
.newsletter input { width: 100%; padding: 10px; border-radius: var(--radius); border: 0; margin-bottom: 10px; font-family: var(--f-ui); }

/* ---------- Article page ---------- */
.article { max-width: 760px; margin: 0 auto; padding: 36px 0 60px; }
.article h1 { font-size: 40px; margin: 14px 0 16px; }
.article__meta { font-family: var(--f-ui); font-size: 14px; color: var(--c-muted); margin-bottom: 24px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.ai-summary { border-left: 4px solid var(--c-primary); background: rgba(26,122,74,.06); padding: 18px 20px; border-radius: 4px; margin: 0 0 28px; }
.ai-summary h4 { font-family: var(--f-ui); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-primary); margin: 0 0 8px; }
.ai-summary p { margin: 0; font-size: 17px; }
.article__body { font-size: 19px; line-height: 1.78; }
.article__body p { margin: 0 0 20px; }
.article__body p:first-of-type::first-letter { font-family: var(--f-head); font-weight: 700; font-size: 3em; line-height: .82; float: left; padding: 4px 10px 0 0; color: var(--c-primary); }
.source-box { font-family: var(--f-ui); font-size: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 14px 16px; margin: 28px 0; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.tag { font-family: var(--f-mono); font-size: 12px; background: var(--c-bg); border: 1px solid var(--c-border); padding: 5px 10px; border-radius: 20px; color: var(--c-muted); }
.tag:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }

.article__back { font-family: var(--f-ui); font-size: 14px; color: var(--c-muted); display: inline-block; margin-bottom: 16px; }
.article__back:hover { color: var(--c-primary); text-decoration: none; }
.article__lead { width: 100%; height: 380px; object-fit: cover; border-radius: var(--radius); margin: 8px 0 28px; box-shadow: var(--shadow); }

/* Share row */
.share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 24px 0; padding: 16px 0; border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.share__label { font-family: var(--f-ui); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); }
.share__btn { font-family: var(--f-ui); font-size: 13px; font-weight: 600; padding: 7px 14px; border: 1px solid var(--c-border); border-radius: 20px; color: var(--c-secondary); }
.share__btn:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; background: rgba(26,122,74,.06); }

/* Source list inside source box */
.source-box__list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.source-box__listhead { color: var(--c-muted); font-weight: 600; }
.source-box__note { color: var(--c-muted); font-size: 13px; margin: 12px 0 0; }

/* ---------- Footer ---------- */
.footer { background: var(--c-navy); color: #aebfce; font-family: var(--f-ui); font-size: 14px; margin-top: 48px; border-top: 3px solid var(--c-primary); }
.footer a { color: #cdddec; }
.footer__grid { display: grid; grid-template-columns: 1.7fr 1.4fr 1fr 1.5fr; gap: 36px; padding: 44px 0 28px; }
.footer__grid > * { min-width: 0; } /* let cells shrink instead of forcing overflow */
.footer__brand { font-size: clamp(15px, 5vw, 20px); color: #fff; }
.footer__brand .brand__word > span { color: var(--c-primary); }
.footer__tag { margin: 12px 0 16px; max-width: 320px; line-height: 1.6; color: #aebfce; }
.footer__stats { display: flex; flex-wrap: wrap; gap: 8px; }
.footer__stats span { font-family: var(--f-mono); font-size: 12px; padding: 4px 10px; border-radius: 20px; color: #cdddec; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.footer__col h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; margin: 0 0 14px; }
.footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer__links--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; }
.footer__links a:hover, .footer__bar a:hover { color: #fff; text-decoration: none; }
.footer__about { margin: 0; line-height: 1.6; color: #aebfce; }
.footer__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; color: #8aa0b4; }
.footer__disclaimer { color: #8aa0b4; }

.section-title { font-family: var(--f-head); font-size: 22px; color: var(--c-secondary); margin: 0 0 18px; padding-bottom: 8px; border-bottom: 2px solid var(--c-primary); }

/* ---------- Page header (Data / Submit) ---------- */
.page-head { padding: 36px 0 24px; border-bottom: 1px solid var(--c-border); margin-bottom: 28px; }
.page-head h1 { font-size: 34px; margin: 0 0 8px; }
.page-head__sub { font-family: var(--f-ui); font-size: 16px; color: var(--c-muted); max-width: 680px; margin: 0; }

/* ---------- Data page ---------- */
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; padding-bottom: 8px; }
.data-chart { grid-column: 1 / -1; }
.data-table { width: 100%; border-collapse: collapse; font-family: var(--f-mono); font-size: 14px; }
.data-table td { padding: 11px 0; border-bottom: 1px dashed var(--c-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table__name { color: var(--c-text); }
.data-table__spark { width: 70px; padding: 0 12px; }
.data-table__spark .price__spark { position: static; width: 64px; height: 22px; opacity: .55; }
.data-table__val { text-align: right; color: var(--c-secondary); white-space: nowrap; font-weight: 500; }
[data-theme="dark"] .data-table__val { color: var(--c-text); }
.data-table__chgcell { text-align: right; white-space: nowrap; padding-left: 16px; }
.data-chart__cap { display: block; margin-top: 12px; font-family: var(--f-ui); color: var(--c-muted); }

/* Large area chart on the Data page */
.data-area { width: 100%; height: 220px; display: block; margin-top: 4px; }
.data-area__fill { fill: url(#capGradData); }
.data-note { font-family: var(--f-ui); font-size: 13px; color: var(--c-muted); margin: 24px 0 48px; }

/* ---------- Submit page / forms ---------- */
.submit-wrap { max-width: 640px; margin: 0 auto; }
.form { padding-bottom: 48px; }
.form__row { margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.form__row label { font-family: var(--f-ui); font-weight: 600; font-size: 14px; color: var(--c-secondary); }
.form__opt { font-weight: 400; color: var(--c-muted); }
.form input, .form select, .form textarea {
  font-family: var(--f-ui); font-size: 15px; padding: 11px 13px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-text); width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(26,122,74,.15); }
.form textarea { resize: vertical; }
.form__fine { font-family: var(--f-ui); font-size: 12px; color: var(--c-muted); margin: 14px 0 0; }
.submit-done { text-align: center; padding: 48px 0; }
.submit-done h2 { font-size: 26px; margin: 0 0 10px; }
.submit-done p { font-family: var(--f-ui); color: var(--c-muted); max-width: 460px; margin: 0 auto; }

/* ---------- Featured row (hero + 2 secondary) ---------- */
.featured { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; margin-bottom: 32px; }
.hero { margin-bottom: 0; }
.hero__imglink { display: block; }
.hero__body h1 a { color: #fff; }
.hero__body h1 a:hover { text-decoration: none; opacity: .92; }
.featured__side { display: flex; flex-direction: column; gap: 22px; }
.sidecard { display: flex; flex-direction: column; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); flex: 1; }
.sidecard__img { display: block; overflow: hidden; }
.sidecard__img img { width: 100%; height: 120px; object-fit: cover; display: block; transition: transform .25s ease; }
.sidecard:hover .sidecard__img img { transform: scale(1.05); }
.sidecard__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.sidecard__title { font-family: var(--f-head); font-size: 16px; font-weight: 700; color: var(--c-secondary); line-height: 1.25; }
.sidecard__title:hover { color: var(--c-primary); text-decoration: none; }

/* ---------- Widget extras ---------- */
.widget__link { display: inline-block; margin-top: 12px; font-family: var(--f-ui); font-size: 13px; font-weight: 600; }
.trend { display: block; }
.trend:hover { color: var(--c-primary); text-decoration: none; }
.newsletter__form .form-msg { display: block; font-family: var(--f-ui); font-size: 13px; margin-top: 8px; min-height: 1em; }
.form-msg.is-ok { color: #8fe0b8; }
.form-msg.is-err { color: #ffb0b0; }

/* ---------- Load more / empty / search ---------- */
.loadmore-wrap { text-align: center; margin: 28px 0 8px; }
.empty-state { text-align: center; padding: 48px 0; font-family: var(--f-ui); color: var(--c-muted); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.searchpage__form { display: flex; gap: 10px; margin: 14px 0; max-width: 560px; }
.searchpage__form input { flex: 1; font-family: var(--f-ui); font-size: 16px; padding: 11px 14px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-text); }
.searchpage__form input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(26,122,74,.15); }
.searchpage__filters { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.searchpage__filters select {
  font-family: var(--f-ui); font-size: 14px; padding: 9px 12px; cursor: pointer;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-text);
}
.searchpage__filters select:focus { outline: none; border-color: var(--c-primary); }
.page-head--tight { padding-top: 28px; }

/* ---------- Scroll-reveal & motion ---------- */
/* Uses the `translate` property (not `transform`) so it never clashes with
   transform-based hover effects. Gated behind `.js` so non-JS users see content. */
.js .is-in { opacity: 1 !important; translate: 0 0 !important; }
/* Cards surfaced by the "Load more" button stay visible permanently. Without
   this the scroll-reveal observer strips `.is-in` back off while they sit just
   below the fold, leaving them at opacity:0 (looked like the button did nothing). */
.js .grid .card.is-loaded { opacity: 1 !important; translate: 0 0 !important; }

@media (prefers-reduced-motion: no-preference) {
  .js .reveal, .js .hero, .js .sidecard, .js .card, .js .widget,
  .js .page-head, .js .section-title, .js .featured, .js .ai-summary,
  .js .source-box, .js .share, .js .tags, .js .article__body,
  .js .article__lead, .js .data-area, .js .empty-state, .js .footer__grid {
    opacity: 0; translate: 0 16px;
    transition: opacity .55s ease, translate .55s ease;
  }
  /* Subtle stagger so grid cards cascade in rather than popping together */
  .js .grid .card:nth-child(2) { transition-delay: .05s; }
  .js .grid .card:nth-child(3) { transition-delay: .10s; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ticker__track { animation: none; }
}

/* ---------- Ad slots ---------- */
/* Data-driven sponsor slots (App\Libraries\Ads + partials/ad_slot). Every ad
   is labelled "Sponsored"; unsold slots show a house promo linking to /advertise. */
.adslot__tag { display: block; font-family: var(--f-ui); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }

/* Sidebar ad card — reuses .widget chrome, image goes edge-to-edge */
.adslot--sidebar { padding: 0; overflow: hidden; }
.adslot--sidebar .adslot__tag { padding: 10px 14px 8px; }
.adslot__link { display: block; text-decoration: none; color: var(--c-text); }
.adslot__link:hover { text-decoration: none; }
.adslot__img { display: block; width: 100%; height: auto; }
.adslot__headline { display: block; font-family: var(--f-head); font-size: 15px; line-height: 1.3; padding: 12px 14px 0; }
.adslot__by { display: block; font-family: var(--f-ui); font-size: 12px; color: var(--c-muted); padding: 6px 14px 14px; }
.adslot__link:hover .adslot__headline { color: var(--c-primary); }

/* House promo shown when a slot is unsold (no border — sits inside .widget) */
.adslot__house { display: block; text-decoration: none; padding: 22px 16px; text-align: center; background: rgba(26,122,74,.05); }
.adslot__house:hover { background: rgba(26,122,74,.09); text-decoration: none; }
.adslot__house-eyebrow { display: block; font-family: var(--f-ui); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--c-primary); margin-bottom: 8px; }
.adslot__house-title { display: block; font-family: var(--f-head); font-size: 15px; line-height: 1.35; color: var(--c-secondary); margin-bottom: 10px; }
.adslot__house-cta { display: inline-block; font-family: var(--f-ui); font-size: 13px; font-weight: 600; color: var(--c-primary); }

/* Banner ad — homepage + category top */
.adslot--banner { margin: 0 0 24px; }
.adslot--banner .adslot__tag { margin-bottom: 6px; }
.adslot__banner-link { display: block; }
.adslot__banner-img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.adslot__banner-text { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.adslot__banner-text strong { font-family: var(--f-head); font-size: 18px; color: var(--c-secondary); }
.adslot__house--banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; border: 1px dashed var(--c-border); border-radius: var(--radius); }
.adslot__house--banner:hover { border-color: var(--c-primary); }
.adslot__house--banner .adslot__house-title { margin: 0; }
.adslot__house--banner .adslot__house-cta { margin: 0; }

/* Sponsor logo row */
.adslot-row { margin: 28px 0; padding: 20px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); text-align: center; }
.adslot-row__label { display: block; font-family: var(--f-ui); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 14px; }
.adslot-row__logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 32px; }
.adslot-row__logo { display: inline-flex; align-items: center; opacity: .85; transition: opacity .2s ease; }
.adslot-row__logo:hover { opacity: 1; }
.adslot-row__logo img { max-height: 38px; width: auto; filter: grayscale(1); transition: filter .2s ease; }
.adslot-row__logo:hover img { filter: grayscale(0); }
.adslot-row__name { font-family: var(--f-head); font-size: 16px; color: var(--c-secondary); }

/* Sponsored-article card in the story grid — muted "Sponsored" label so it's
   clearly distinguished from the green editorial category labels. */
.card__cat--sponsored { color: var(--c-muted); }

/* ---------- Responsive ---------- */
/* Mobile menu is hidden on desktop regardless of the [hidden] toggle */
@media (min-width: 861px) { .mobile-menu { display: none !important; } }

/* Never let media overflow its container, on any screen */
img, svg, video, table { max-width: 100%; }
.cats__inner { scrollbar-width: none; }
.cats__inner::-webkit-scrollbar { display: none; }

/* Laptops / small desktops */
@media (max-width: 1024px) {
  .container { padding: 0 18px; }
}

/* Tablet landscape — sidebar drops below, grid to 2-up, featured stacks */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured__side { flex-direction: row; }
  .sidecard { flex: 1; }
}

/* Below nav breakpoint — switch to the burger menu */
@media (max-width: 860px) {
  .nav__links, .nav__search, .nav__subscribe, .cats { display: none; }
  .nav__actions { margin-left: auto; } /* keep toggle + burger pinned right once links hide */
  .nav__inner { gap: 12px; }
  .iconbtn { width: 34px; height: 34px; }
  .nav__burger { display: inline-flex; align-items: center; justify-content: center; }
  .hero__body h1 { font-size: 30px; }
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* Tablet portrait */
@media (max-width: 760px) {
  .data-grid { grid-template-columns: 1fr; }
  .featured__side { flex-direction: column; }
  .searchpage__form { flex-direction: column; align-items: stretch; }
  .searchpage__filters select { flex: 1 1 auto; }
  .article__lead { height: 300px; }
}

/* Large phones */
@media (max-width: 620px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  /* Scale card text down to fit the narrower 2-up cards */
  .grid .card__body { padding: 10px 11px 12px; gap: 5px; }
  .grid .card__cat { font-size: 9px; letter-spacing: .3px; }
  .grid .card__title { font-size: 13.5px; line-height: 1.22; }
  .grid .card__meta { font-size: 10px; flex-direction: column; align-items: flex-start; gap: 2px; }
  .grid .card__meta > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  /* Compact footer for small screens */
  .footer__grid { gap: 22px; padding: 28px 0 18px; }
  .footer__tag { font-size: 11.5px; margin: 8px 0 12px; line-height: 1.5; }
  .footer__stats span { font-size: 10px; padding: 3px 8px; }
  .footer__col h4 { font-size: 10.5px; margin: 0 0 8px; }
  .footer__links { gap: 5px; font-size: 11.5px; }
  .footer__links--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  /* Smaller article body text for phones */
  .article__body { font-size: 13.5px; line-height: 1.6; }
  .article__body p { margin: 0 0 12px; }
  .article__body p:first-of-type::first-letter { font-size: 2.3em; padding: 2px 6px 0 0; }
  .ai-summary { padding: 13px 14px; margin: 0 0 18px; }
  .ai-summary h4 { font-size: 11px; margin: 0 0 6px; }
  .ai-summary p { font-size: 13.5px; line-height: 1.55; }
  .footer__about { font-size: 11.5px; line-height: 1.5; }
  .footer__bar { font-size: 10px; padding: 12px 0; }
  /* Shrink the ticker clock so the scrolling feed gets more room */
  .ticker__clock { gap: 5px; padding-right: 9px; margin-right: 9px; font-size: 11px; letter-spacing: .03em; }
  .ticker__clock-zone { font-size: 9px; letter-spacing: .08em; }
  .ticker__clock-loc { font-size: 9px; letter-spacing: .04em; }
  .ticker__clock-loc::before { margin-right: 2px; }
  .ticker__clock-dot { width: 6px; height: 6px; }
  /* Shrink the scrolling market items too, so prices like "$2.95/MMBtu ▲ +2.6%"
     aren't oversized on phones (the clock was already shrunk above). */
  .ticker { font-size: 10px; }
  .ticker__item { padding: 0 12px; }
  /* Keep the richer desktop look on phones: photo fills the card with the text
     overlaid on a dark gradient (instead of a plain stacked block). Just size it
     down. This reads the same in light and dark mode, like the desktop hero. */
  .hero { min-height: 380px; }
  .hero__body h1 { font-size: 24px; }
  .hero__summary { -webkit-line-clamp: 3; line-clamp: 3; }
  .article h1 { font-size: 28px; }
  .article__lead { height: 240px; }
  .page-head { padding: 28px 0 20px; }
  .page-head h1 { font-size: 27px; }
  body { font-size: 17px; }
  .footer__grid { grid-template-columns: 1fr; gap: 26px; padding: 34px 0 22px; }
  .footer__grid { gap: 22px; padding: 28px 0 18px; } /* keep footer compact on small phones */
  .footer__bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .data-table__spark { display: none; } /* keep price tables readable on phones */
  /* Category tabs become rounded filter chips on phones (Doc 4 mobile spec) */
  .cats__inner { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .cats a { padding: 7px 14px; border: 1px solid var(--c-border); border-radius: 20px; }
  .cats a:hover { border-color: var(--c-primary); }
  .cats a.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
}

/* Small phones */
@media (max-width: 400px) {
  .container { padding: 0 14px; }
  .brand { gap: 6px; }
  .nav__inner { gap: 10px; }
  .hero__body h1 { font-size: 22px; }
  .hero__body { padding: 16px; }
  .section-title { font-size: 19px; }
  .cluster__list { grid-template-columns: 1fr; }
  .footer__stats span { font-size: 11px; }
  /* Even smaller ticker on very small phones */
  .ticker { font-size: 9px; }
  .ticker__item { padding: 0 10px; }
}

/* Link-only "brief" article: AI summary (shown above) + prominent source CTA */
.article__brief { margin: 1.5rem 0 2rem; }
.article__brief .brief-note { color: var(--muted, #8a94a6); font-size: .98rem; margin-bottom: 1rem; }
.article__brief .brief-cta {
  display: inline-block; padding: .8rem 1.3rem; border-radius: 8px;
  background: var(--accent, #21c17a); color: #05140d; font-weight: 700;
  text-decoration: none; transition: opacity .15s ease;
}
.article__brief .brief-cta:hover { opacity: .85; }
