/* ============================================
   UK Electrical News — Global Design Tokens & Base Styles
   New palette + typography + news feed tokens.
   Old aliases preserved for tools/tracker/guides/about pages.
   ============================================ */

/* --- Dark Mode (default) --- */
:root {
  /* Core backgrounds & surfaces */
  --bg-base: #14141F;
  --surface-raised: #1C1C2B;

  /* Core text */
  --text-primary: #F2F2F7;
  --text-secondary: #8F8FA8;
  --text-tertiary: #A0A0B8;

  /* Brand */
  --brand: #7C6FC4;
  --brand-strong: #9A8FD9;
  --brand-on-fill: #14141F;

  /* Accent / interactive */
  --accent: #22D3EE;
  --accent-strong: #67E8F9;
  --text-on-accent: #0A1118;

  /* Lines */
  --line-subtle: #26263A;
  --line-strong: #3B3B58;

  /* Focus ring */
  --focus-ring: #22D3EE;

  /* Status (tracker vocabulary — do not reuse for categories) */
  --status-in-force: #4ADE80;
  --status-transition: #FACC15;
  --status-upcoming: #F87171;

  /* Category badge colours */
  --cat-regulations: #A99BE0;
  --cat-new-products: #22D3EE;
  --cat-industry: #8FA8FF;
  --cat-renewables-ev: #2DD4BF;
  --cat-safety: #FBBF24;
  --cat-technical: #E879C6;

  /* Source-type badge colours */
  --src-rss: #FB923C;
  --src-email: #94A3B8;
  --src-web: #8F8FA8;
  --src-youtube: #F87171;

  /* Typography */
  --font-display: "Space Grotesk", "Avenir Next", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* Spacing */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;

  /* Layout */
  --radius: 8px;
  --container: 1100px;
  --header-h: 56px;

  /* Old shadows (keep so tool/tracker cards don't vanish) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.32);


  /* Timing */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

@media (min-width: 768px) {
  :root { --header-h: 64px; }
}

/* --- Legacy aliases for other pages (tools, tracker, guides, about) --- */
/* These are defined *after* the canonical tokens so both names exist. */
:root {
  --bg: var(--bg-base);
  --surface: var(--bg-base);
  --bg-secondary: var(--surface-raised);
  --text: var(--text-primary);
  --text-muted: var(--text-tertiary);
  --primary: var(--brand);
  --primary-hover: var(--brand-strong);
  --primary-muted: rgba(124, 111, 196, 0.12);
  --border: var(--line-subtle);
  --accent-hover: var(--accent-strong);
  --success: var(--status-in-force);
  --warning: var(--status-transition);
  --danger: var(--status-upcoming);
  --header-height: var(--header-h);
  --max-width: var(--container);
  --max-width-tool: var(--container);
}

@media (min-width: 768px) {
  :root {
    --header-height: var(--header-h);
  }
}

/* --- Light Mode overrides --- */
[data-theme="light"] {
  --bg-base: #FAFAFC;
  --surface-raised: #F1F0F7;

  --text-primary: #16161F;
  --text-secondary: #52526B;
  --text-tertiary: #6B6B83;

  --brand: #4A3F8C;
  --brand-strong: #3B3273;
  --brand-on-fill: #FFFFFF;

  --accent: #00758C;
  --accent-strong: #005E72;
  --text-on-accent: #FFFFFF;

  --line-subtle: #E4E3EE;
  --line-strong: #C9C8DA;

  --focus-ring: #00758C;

  --status-in-force: #15803D;
  --status-transition: #A16207;
  --status-upcoming: #DC2626;

  --cat-regulations: #4A3F8C;
  --cat-new-products: #00758C;
  --cat-industry: #2B53C4;
  --cat-renewables-ev: #0F766E;
  --cat-safety: #B45309;
  --cat-technical: #A2168A;

  --src-rss: #C2410C;
  --src-email: #475569;
  --src-web: #52526B;
  --src-youtube: #DC2626;

  /* Legacy aliases */
  --bg: var(--bg-base);
  --surface: var(--bg-base);
  --bg-secondary: var(--surface-raised);
  --text: var(--text-primary);
  --text-muted: var(--text-tertiary);
  --primary: var(--brand);
  --primary-hover: var(--brand-strong);
  --primary-muted: rgba(74, 63, 140, 0.08);
  --border: var(--line-subtle);
  --accent-hover: var(--accent-strong);
  --success: var(--status-in-force);
  --warning: var(--status-transition);
  --danger: var(--status-upcoming);

  --shadow-sm: 0 1px 2px rgba(22, 22, 31, 0.04);
  --shadow-md: 0 4px 12px rgba(22, 22, 31, 0.08);
}

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

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; }

h1, h2, h3 { font-family: var(--font-display); }
h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
p { margin-bottom: 1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-strong); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius);
}

button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

/* --- Layout --- */
.site-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: calc(var(--header-h) + var(--space-3)) var(--space-2) var(--space-6);
}
.site-main--tool { max-width: var(--max-width-tool); }

@media (min-width: 768px) {
  .site-main { padding-left: var(--space-3); padding-right: var(--space-3); }
}

/* --- Container helper --- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}
@media (min-width: 768px) {
  .container { padding-left: var(--space-3); padding-right: var(--space-3); }
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--bg-base);
  border-bottom: 1px solid var(--line-subtle);
  z-index: 50;
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wordmark:hover { text-decoration: none; color: var(--text-primary); }
.wordmark svg { width: 20px; height: 20px; flex: 0 0 20px; fill: var(--accent); }

.main-nav {
  display: none;
  align-items: center;
  gap: var(--space-3);
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 8px 4px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.main-nav a:hover { color: var(--text-primary); text-decoration: none; }
.main-nav a[aria-current="true"],
.main-nav a.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.theme-toggle,
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-base);
  color: var(--text-secondary);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.theme-toggle:hover,
.menu-btn:hover { background: var(--surface-raised); }
.theme-toggle svg,
.menu-btn svg { stroke: currentColor; }

:root:not([data-theme="dark"]) .theme-icon-dark,
[data-theme="dark"] .theme-icon-light { display: none; }

@media (min-width: 768px) {
  .header-inner { padding: 0 var(--space-3); }
  .main-nav { display: flex; }
  .header-actions { margin-left: 0; }
  .menu-btn { display: none; }
}

/* --- Mobile Nav Drawer --- */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
}
.nav-drawer.is-open { pointer-events: auto; visibility: visible; }
.nav-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.nav-drawer.is-open .nav-drawer__overlay { opacity: 1; }
.nav-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: var(--bg-base);
  border-left: 1px solid var(--line-subtle);
  transform: translateX(100%);
  transition: transform var(--transition-base);
  padding: var(--space-2);
}
.nav-drawer.is-open .nav-drawer__panel { transform: translateX(0); }
.nav-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.nav-drawer__title { font-weight: 600; font-size: 1.125rem; }
.nav-drawer__close {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-base);
  color: var(--text-primary);
}
.nav-drawer__nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav-drawer__link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
  text-decoration: none;
}
.nav-drawer__link:hover { background: var(--surface-raised); color: var(--text-primary); text-decoration: none; }

/* --- Feed Status Bar --- */
.feed-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 var(--space-2);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line-subtle);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.feed-status__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.feed-status__meta { white-space: nowrap; }
@media (max-width: 767px) {
  .feed-status__meta .feed-status__count { display: none; }
}

/* --- Filter Tabs --- */
.filter-tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line-subtle);
  margin-bottom: var(--space-2);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.filter-tabs a:hover { text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .filter-tabs a:not([aria-current="true"]):hover {
    border-color: var(--brand);
    color: var(--text-primary);
  }
}
.filter-tabs a[aria-current="true"] {
  background: var(--brand);
  color: var(--brand-on-fill);
  border-color: var(--brand);
  font-weight: 700;
}
.filter-tabs a[aria-current="true"]:hover { color: var(--brand-on-fill); }

/* --- Date Groups --- */
.date-group {
  border-bottom: 1px solid var(--line-subtle);
}
.date-group__heading {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  margin-bottom: var(--space-1);
  padding-left: var(--space-1);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.date-group__heading::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.date-group__heading--relative { color: var(--brand); }
@media (min-width: 768px) {
  .date-group__heading { font-size: 17px; }
}

/* --- News Item --- */
[hidden] { display: none !important; }

.news-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-subtle);
}

.item-image-container {
  display: none;
  width: 112px;
  height: 72px;
  border-radius: var(--radius);
  border: 1px solid var(--line-subtle);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-raised);
  align-items: center;
  justify-content: center;
}
.item-image {
  object-fit: cover;
  width: 100%;
  height: 100%;
}
.item-image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
}
.item-image-fallback svg {
  width: 24px;
  height: 24px;
  fill: var(--text-tertiary);
  opacity: 0.3;
}

.item-content {
  min-width: 0;
  flex: 1;
}

.item-headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.011em;
  color: var(--text-primary);
}
.item-headline a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}
.item-headline a:hover { text-decoration: underline; }
@media (min-width: 768px) {
  .item-headline { font-size: 18px; }
}

.item-summary {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 22px;
  transition: max-height 250ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 200ms ease;
}

.item-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
}
.item-meta a { color: var(--accent); }
.item-meta a:hover { color: var(--accent-strong); }
.item-meta__sep { user-select: none; }
.item-source {
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-tldr {
  margin-left: auto;
}

/* TLDR — mobile: tap-to-toggle */
.tldr-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
}
.tldr-toggle::after {
  content: " \2304";
  margin-left: 4px;
}
.item-tldr.is-open .tldr-toggle::after {
  content: " \2303";
}
.item-tldr .tldr-body { display: none; }
.item-tldr.is-open .tldr-body { display: block; }

.tldr-body {
  margin-top: var(--space-1);
  padding: 12px var(--space-2);
  background: var(--surface-raised);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .news-item {
    display: flex;
    flex-direction: row;
    gap: var(--space-2);
    align-items: flex-start;
  }

  .item-image-container { display: flex; }

  .tldr-toggle { display: none; }
  .item-tldr .tldr-body {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 200ms ease, opacity 200ms ease;
  }
  .news-item:hover .item-tldr .tldr-body,
  .news-item:focus-within .item-tldr .tldr-body {
    max-height: 200px;
    opacity: 1;
  }

  .news-item:hover .item-summary,
  .news-item:focus-within .item-summary {
    white-space: normal;
    max-height: 250px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .item-tldr .tldr-body { transition: none; }
}

/* --- Load More --- */
.load-more-wrap {
  margin: var(--space-4) auto var(--space-5);
  text-align: center;
}
.load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(320px, 100%);
  height: 48px;
  border: 1.5px solid var(--brand);
  border-radius: var(--radius);
  background: transparent;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.load-more:hover {
  background: var(--brand);
  color: var(--brand-on-fill);
  text-decoration: none;
}
.load-more.is-loading { opacity: 0.6; cursor: wait; }
.load-more-caption {
  margin: var(--space-1) 0 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-tertiary);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--line-subtle);
  background: var(--bg-base);
  padding: var(--space-5) 0 var(--space-4);
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.footer-row--split {
  align-items: flex-start;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}
.footer-brand:hover { text-decoration: none; color: var(--text-primary); }
.footer-brand svg { width: 18px; height: 18px; fill: var(--accent); }
.footer-tagline {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 420px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.footer-links a { color: var(--accent); }
.footer-links a:hover { color: var(--accent-strong); }
.footer-links svg { stroke: currentColor; }
.footer-disclaimer-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: var(--space-2);
}

.disclaimer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 840px) {
  .disclaimer-grid {
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
  }
}

.disclaimer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.disclaimer-heading {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin: 0;
}

.disclaimer-text {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-tertiary);
  margin: 0;
}

.disclaimer-text strong {
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .footer-inner { padding: 0 var(--space-3); }
  .footer-row--split {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
  }
}

/* --- Trust Strip --- */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 24px;
  padding: 12px 0;
  margin-bottom: 24px;
  border-top: 1px solid var(--line-subtle);
  border-bottom: 1px solid var(--line-subtle);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.trust-strip__item { display: inline-flex; align-items: center; gap: 6px; }
.trust-strip__check { color: var(--status-in-force); font-weight: 700; }

/* --- Amendment Tracker Hero --- */
.tracker-hero { margin-bottom: 32px; }
.tracker-hero__card {
  padding: 24px;
  background: var(--bg-base);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  border-left: 4px solid var(--brand);
}
.tracker-hero__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}
.tracker-hero__dot { width: 10px; height: 10px; border-radius: 50%; }
.tracker-hero__title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.tracker-hero__summary { color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }
.tracker-hero__link { font-weight: 600; }
@media (min-width: 768px) {
  .tracker-hero__card { padding: 32px; }
}

/* --- Tools Strip --- */
.tools-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin-bottom: 32px;
  -webkit-overflow-scrolling: touch;
}
.tool-card {
  flex: 0 0 auto;
  width: 140px;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  background: var(--bg-base);
  color: var(--text-primary);
  scroll-snap-align: start;
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.tool-card:hover {
  border-color: var(--brand);
  background: rgba(74, 63, 140, 0.08);
  color: var(--brand);
  text-decoration: none;
}
.tool-card .tool-icon { color: var(--brand); margin-bottom: 4px; font-size: 1.5rem; }
.tool-card .tool-name { font-weight: 600; font-size: 0.9375rem; }
.tool-card .tool-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }
@media (min-width: 768px) {
  .tools-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow-x: visible;
    gap: 16px;
  }
  .tool-card { width: auto; min-height: 120px; }
}

/* --- News Card (legacy, used by tracker/guides pages) --- */
.news-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-base);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast);
}
.news-card:hover { border-color: var(--brand); }
.news-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
}
.category-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--line-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.news-card__timestamp { color: var(--text-secondary); }
.news-card__title { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.news-card__title a { color: var(--text-primary); text-decoration: none; }
.news-card__title a:hover { color: var(--brand); text-decoration: underline; }
.news-card__summary {
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
.news-card__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
}
.news-card__source { color: var(--accent); font-weight: 500; }

/* --- Article pages --- */
.article-body h1 { font-size: 1.5rem; margin-bottom: 8px; }
.article-body p { margin-bottom: 1rem; color: var(--text-secondary); }
.article-body .article-meta { font-size: 0.875rem; color: var(--text-tertiary); margin-bottom: var(--space-3); }
.article-body ul { margin-left: 1.5rem; margin-bottom: 1rem; color: var(--text-secondary); }
.article-body ul li { list-style: disc; padding: 4px 0; }
.article-body h2 { font-size: 1.25rem; margin-top: var(--space-4); margin-bottom: 8px; color: var(--text-primary); }

/* --- Tool pages --- */
.tool-disclaimer {
  margin-top: var(--space-3);
  padding: var(--space-2);
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--line-subtle);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* --- Section headings --- */
.section-heading { font-size: 1.5rem; font-weight: 600; margin-bottom: var(--space-2); }

/* ============================================
   Instrument layer — shared components, 2026-08-25 design refresh.
   ADDITIVE ONLY: nothing above this line renamed or removed.
   Tokens: --inst-field (panel ground), --inst-grid (grid line),
   --inst-chrome (bracket/frame cyan). Light overrides below.
   ============================================ */
:root {
  --inst-field: #1B1830;
  --inst-field-2: var(--bg-base);
  --inst-grid: rgba(124, 111, 196, 0.07);
  --inst-chrome: rgba(34, 211, 238, 0.55);
  --inst-hairline: rgba(124, 111, 196, 0.35);
}
[data-theme="light"] {
  --inst-field: #EFEDF8;
  --inst-field-2: var(--bg-base);
  --inst-grid: rgba(74, 63, 140, 0.05);
  --inst-chrome: rgba(0, 117, 140, 0.6);
  --inst-hairline: rgba(74, 63, 140, 0.35);
}

/* guard for full-bleed bands */
body { overflow-x: clip; }

/* Full-bleed instrument band behind a page header */
.inst-band {
  position: relative;
  margin: calc(-1 * (var(--header-h) + var(--space-3))) calc(50% - 50vw) var(--space-4);
  padding: calc(var(--header-h) + 16px) var(--space-2) 0;
  background:
    radial-gradient(60% 90% at 70% 20%, rgba(124, 111, 196, 0.20), transparent 60%),
    repeating-linear-gradient(0deg, var(--inst-grid) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, var(--inst-grid) 0 1px, transparent 1px 56px),
    linear-gradient(180deg, var(--inst-field) 0%, var(--inst-field-2) 100%);
  border-bottom: 1px solid var(--line-strong);
}
.inst-band__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-bottom: var(--space-3);
}
@media (min-width: 768px) {
  .inst-band { padding-left: var(--space-3); padding-right: var(--space-3); }
}

/* Mono status strip — page context line */
.inst-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 0;
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--inst-hairline);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.inst-status a { color: var(--accent); text-decoration: none; font-weight: 700; }
.inst-status a:hover { color: var(--accent-strong); text-decoration: underline; }
.inst-status__rule { flex: 1 1 40px; border-top: 1px dashed var(--inst-hairline); }
.inst-status .inst-amber { color: var(--status-transition); font-weight: 700; }
.inst-live { color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.inst-live__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: inst-pulse 2s ease-in-out infinite;
}
@keyframes inst-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .inst-live__dot { animation: none; } }

/* Right-aligned mono standard reference */
.inst-std { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; color: var(--brand-strong); }
.inst-caps { text-transform: uppercase; }

/* Calculator results read as instrument values (2026-08-25) */
.results-panel .mono {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
}


/* ==========================================================================
   VISUAL LAB NAVIGATION & PAGINATION
   ========================================================================== */
.lab-nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.lab-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--line-subtle);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.lab-back-btn:hover {
  background: rgba(34, 211, 238, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-2px);
  text-decoration: none;
}

.lab-back-btn svg {
  stroke: currentColor;
  transition: transform var(--transition-fast);
}

.lab-back-btn:hover svg {
  transform: translateX(-3px);
}

.lab-crumb-sep {
  color: var(--line-strong);
  font-size: 0.85rem;
}

.lab-crumb-current {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Bottom Sequential Lab Pagination Strip */
.lab-pagination {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: var(--space-5);
  margin-bottom: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-subtle);
}

@media (min-width: 768px) {
  .lab-pagination {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
}

.lab-page-link {
  background: var(--surface-raised);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.lab-page-link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}

.lab-page-prev {
  text-align: left;
}

.lab-page-next {
  text-align: right;
}

.page-link-dir {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.page-link-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.lab-page-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.lab-page-all:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
  text-decoration: none;
}

/* --- Navigation Dropdown (Desktop) --- */
.nav-item-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-item-dropdown > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dropdown-chevron {
  transition: transform var(--transition-fast);
}
.nav-item-dropdown:hover .dropdown-chevron,
.nav-item-dropdown:focus-within .dropdown-chevron {
  transform: rotate(180deg);
}
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 520px;
  background: var(--surface-card, #12121e);
  border: 1px solid var(--line-strong, #2d2d42);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(34, 211, 238, 0.08);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  z-index: 100;
}
.nav-item-dropdown:hover .nav-dropdown,
.nav-item-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.nav-dropdown-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-dropdown-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-subtle);
}
.nav-dropdown-link {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-radius: 4px;
  text-decoration: none !important;
  color: var(--text-primary) !important;
  border-bottom: none !important;
  min-height: auto !important;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-dropdown-link:hover {
  background: rgba(124, 111, 196, 0.15);
  color: var(--accent) !important;
}
.nav-dropdown-link strong {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}
.nav-dropdown-link:hover strong {
  color: var(--accent);
}
.nav-dropdown-link span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}
.nav-dropdown-link.highlight {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
}
.nav-dropdown-link.highlight:hover {
  background: rgba(34, 211, 238, 0.18);
}

/* --- Mobile Drawer Sub-Navigation --- */
.nav-drawer-group {
  margin: 4px 0;
}
.nav-drawer-group .nav-drawer__link {
  font-weight: 700;
  color: var(--accent);
}
.nav-drawer-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 12px;
  margin-bottom: 8px;
  border-left: 2px solid rgba(34, 211, 238, 0.2);
}
.nav-drawer-sublink {
  padding: 6px 12px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-drawer-sublink:hover {
  background: var(--surface-raised);
  color: var(--text-primary);
  text-decoration: none;
}

/* --- Instrument Back Bar & Breadcrumb --- */
.inst-back-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.back-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border: 1px solid var(--line-subtle);
  border-radius: 4px;
  padding: 6px 12px;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.back-btn-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  text-decoration: none;
  transform: translateX(-2px);
}
.back-btn-link.alt-hub {
  color: var(--brand-strong);
  border-color: rgba(124, 111, 196, 0.3);
}
.back-btn-link.alt-hub:hover {
  color: #fff;
  background: rgba(124, 111, 196, 0.25);
  border-color: var(--brand);
  transform: translateX(2px);
}
