/*! CommodityNode component primitives
 * Reusable component styles factored out of style.css.
 * New components land here before being optionally absorbed into style.css.
 */

/* Shared substitute-card hover (commodity layout related-hubs). */
.substitute-card { transition: border-color var(--motion-fast), transform var(--motion-fast); }
.substitute-card:hover { border-color: var(--accent) !important; transform: translateY(-2px); }

/* Generic focus ring for keyboard users. */
:where(a, button, [role="button"], input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Hidden-visually helper: available to screen readers, painted off-screen. */
.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important;
}

/* Entity chip — used for commodity/ETF/ticker tags in company/theme pages.
 * Replaces inline style chains of rgba+border+radius+padding repetition. */
.entity-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.entity-chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  transition: border-color var(--motion-fast), color var(--motion-fast), background var(--motion-fast);
}
.entity-chip:hover { color: var(--text); border-color: var(--border2); }
.entity-chip--cyan { background: rgba(34,211,238,0.1); border-color: rgba(34,211,238,0.3); color: var(--accent); }
.entity-chip--cyan:hover { background: rgba(34,211,238,0.18); }
.entity-chip--violet { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3); color: var(--purple); }
.entity-chip--gold { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.35); color: var(--gold); }
.entity-chip--green { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.35); color: var(--green); }
.entity-chip--red { background: rgba(244,63,94,0.1); border-color: rgba(244,63,94,0.35); color: var(--red); }

/* KPI row — small metric label/value pairs inside TOC/sidebar blocks. */
.kpi-row { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.kpi-row > li, .kpi-row > div { display: flex; justify-content: space-between; font-size: 0.8rem; list-style: none; }
.kpi-row .kpi-label { color: var(--text3); }
.kpi-row .kpi-value { color: var(--text2); }
.kpi-row .kpi-value--accent { color: var(--accent); }

/* TOC explore links — small list of related surfaces. */
.toc-explore { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 0; }
.toc-explore a { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.toc-explore a:hover { color: var(--accent2); text-decoration: underline; }

/* Section divider wrapper used inside sidebar TOC. */
.sidebar-divider { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Generic micro-link (0.8rem accent, no underline) — used in sidebars/quick lists. */
.link-micro { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.link-micro:hover { color: var(--accent2); text-decoration: underline; }

/* TOC explore list (unstyled vertical link column). */
.toc-explore-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; padding: 0; }

/* KPI row cell (single label/value line). */
.kpi-row-cell { display: flex; justify-content: space-between; font-size: 0.8rem; }

/* Text color utilities — scoped to components layer. */
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.text-body2 { color: var(--text2); }

/* Spacing utilities used by post/hub scaffolds. */
.section-pad-lg { padding: 48px 24px 80px; }
.mt-48 { margin-top: 48px; }

/* Body-text lockups (paragraph with specific line-height variants). */
.body-text   { margin: 0; color: var(--text2); line-height: 1.7; }
.body-text-65 { margin: 0; color: var(--text2); line-height: 1.65; }

/* Eyebrow kicker labels. */
.eyebrow-cyan {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
}
.eyebrow-cyan--74 { font-size: 0.74rem; }

/* Entity chip — dim gold (tertiary importance / "out of scope" tag). */
.entity-chip--gold-dim {
  background: rgba(251,191,36,0.06);
  border-color: rgba(251,191,36,0.12);
  color: rgba(251,191,36,0.5);
}

/* Surface card — reusable padded surface. */
.surface-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
}
.surface-card--cyan {
  background: rgba(34,211,238,0.05);
  border-color: rgba(34,211,238,0.14);
}

/* Grid helpers. */
.auto-grid-220 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.chip-group-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-group-center { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Final callout band (centered CTA zone at bottom of content pages). */
.final-callout {
  text-align: center;
  padding: 40px 24px;
  margin-top: 32px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Link primitives. */
.link-block { text-decoration: none; display: block; }
.link-inherit { text-decoration: none; color: inherit; }

/* Typography micro-utilities (used only where inline patterns had been standardized). */
.title-1rem { margin: 0 0 8px; font-size: 1rem; }
.title-bold-1rem { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.title-1-2rem { margin: 0 0 10px; font-size: 1.2rem; }
.title-bold-white { font-size: 1rem; font-weight: 800; color: #f8fafc; }
.text-1-4rem { font-size: 1.4rem; }
.body-muted-mb20 { color: var(--text2); margin-bottom: 20px; font-size: 0.9rem; }
.mb-8 { margin-bottom: 8px; }
.border-bottom-rule { border-bottom: 1px solid var(--border); }

/* Utilities. */
.hidden { display: none !important; }

/* Inline code swatch used inside markdown-ish snippets. */
.code-inline { background: #1e1e2e; color: #64748b; padding: 0 4px; border-radius: 4px; }

/* Panel variants. */
.panel-cyan {
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(34,211,238,0.05);
  border: 1px solid rgba(34,211,238,0.14);
}
.panel-cyan--row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.surface-card--compact { padding: 16px 18px; border-radius: 16px; }

/* Stack helpers. */
.stack-1080 { max-width: 1080px; display: grid; gap: 18px; margin: 0 auto; }
.chip-group-end { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Eyebrow margin variants. */
.eyebrow-cyan--mb6 { margin-bottom: 6px; }

/* Title/text micros. */
.bold-white { color: #f8fafc; font-weight: 700; }
.white-text { color: #f8fafc; }
.title-white-block { color: #f8fafc; display: block; margin-bottom: 4px; }
.body-muted-720 { margin: 6px 0 0; color: var(--text2); line-height: 1.65; max-width: 720px; }

/* Spacing utilities. */
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.pt-0 { padding-top: 0 !important; }
.pad-8-12 { padding: 8px 12px; }
.w-100 { width: 100%; }
.grid-gap-10 { display: grid; gap: 10px; }

/* Min-width centered helpers (CTAs in hero/role rows). */
.min-w-180-center { min-width: 180px; justify-content: center; }
.min-w-200-center { min-width: 200px; justify-content: center; }
.min-w-220-center { min-width: 220px; justify-content: center; }

/* Footnote + badge. */
.footnote-muted { font-size: 0.72rem; color: #64748b; margin-left: 20px; }
.badge-solid-accent { background: var(--accent); color: #050508; padding: 2px 8px; border-radius: 4px; font-weight: 700; }

/* ── Next-best-path block ──────────────────────────────────────────────
 * Shipped via _includes/next-best-path.html. Shows up at the bottom of
 * commodity hubs, company pages, and any long reference surface — giving
 * the reader a single paragraph of context and three sharp action cards.
 */
.next-best-path {
  margin: 48px 0;
  padding: 32px 24px 28px;
  background: linear-gradient(135deg, rgba(34,211,238,0.04), rgba(168,85,247,0.04));
  border: 1px solid rgba(34,211,238,0.14);
  border-radius: 16px;
}
.next-best-path__head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 22px;
}
.next-best-path__head h2 {
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 8px;
}
.next-best-path__lede {
  color: var(--text2);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.55;
}
.next-best-path__freshness {
  color: var(--text3);
  font-size: 0.78rem;
  margin: 8px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.next-best-path__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
}
@media (max-width: 860px) { .next-best-path__grid { grid-template-columns: 1fr; } }

.next-best-path__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 20px;
  border-radius: 12px;
  background: rgba(10,10,20,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast);
  position: relative;
}
.next-best-path__card:hover {
  transform: translateY(-2px);
  border-color: rgba(34,211,238,0.4);
  background: rgba(10,10,20,0.8);
  color: var(--text);
}
.next-best-path__kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
}
.next-best-path__card strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 700;
}
.next-best-path__arrow {
  position: absolute;
  right: 16px; top: 16px;
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform var(--motion-fast);
}
.next-best-path__card:hover .next-best-path__arrow { transform: translateX(4px); }

.next-best-path__card--primary {
  background: linear-gradient(180deg, rgba(34,211,238,0.14), rgba(34,211,238,0.04));
  border-color: rgba(34,211,238,0.35);
}
.next-best-path__card--primary .next-best-path__kicker { color: var(--accent); }
.next-best-path__card--primary:hover { background: linear-gradient(180deg, rgba(34,211,238,0.2), rgba(34,211,238,0.06)); }

/* Merged Tools dropdown — two-column grouped layout. Hidden by default;
   opened only by the dropdown controller to prevent active-route menus from
   covering page content on mobile and desktop. */
.nav-dropdown-menu--tools {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  min-width: 520px;
  padding: 18px 20px !important;
}
.nav-dropdown.open .nav-dropdown-menu--tools {
  display: grid;
}
.nav-dropdown-group { display: flex; flex-direction: column; gap: 2px; }
.nav-dropdown-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--text3);
  margin: 0 0 8px;
}
@media (max-width: 900px) {
  .nav-dropdown-menu--tools { grid-template-columns: 1fr; min-width: 0; }
}

/* Mobile-only utility surface for About/Methodology/Contact inside the mobile menu.
 * Desktop users reach these via the footer only. */
@media (min-width: 981px) {
  .nav-secondary--mobile-only { display: none !important; }
}

/* ── Flagship visual guardrails ─────────────────────────────────────────
 * Heavy canvases / 3D scenes ship a defensive mobile fallback and honor
 * prefers-reduced-motion. Keep 3D for flagship surfaces only (home hero,
 * commodity universe). Other pages never get the Three.js stack.
 */
@media (max-width: 720px) {
  /* Drop only the ambient hero background on small devices; keep the impact
     canvas visible because it carries the actual shock path visualization. */
  #hero-canvas { display: none !important; }
  /* Collapse 3D universe to a static proof card instead of rendering Three.js. */
  #universe-canvas { min-height: 260px; }
  .universe-frame .universe-orbit-info { display: none !important; }
  /* Force-graph style visuals hide by default on mobile; pages can opt-in. */
  [data-viz="force-graph"] { display: none; }
  [data-viz="force-graph"] + [data-viz="force-graph-fallback"] { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  #hero-canvas,
  #hero-impact-canvas,
  #universe-canvas,
  [data-motion="ambient"],
  [data-motion="parallax"] {
    display: none !important;
  }
  /* Keep simple fades; kill scroll-linked narrative. */
  [data-scrolltrigger], [data-motion="scrollytelling"] { animation: none !important; transform: none !important; }
}

/* Mobile fallback hint: hide heavy visual and show table/summary stand-in. */
[data-fallback="visual"] { display: none; }
@media (max-width: 720px) {
  [data-fallback="visual"] { display: block; }
  [data-heavy-visual] { display: none !important; }
}

/* Skip-to-content accessibility link. */
.skip-to-content {
  position: absolute;
  top: -40px; left: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  border-radius: 6px;
  z-index: 10000;
  transition: top var(--motion-fast);
}
.skip-to-content:focus { top: 8px; }
