/* Siberforge — Plug Power project — LIGHT theme.
   Base font slightly larger than the dark dashboards. */

:root {
  --bg:        #fafbfc;
  --panel:     #ffffff;
  --panel-2:   #f3f5f8;
  --line:      #e2e6ec;
  --line-soft: #eef1f5;
  --text:      #0f172a;
  --muted:     #64748b;
  --muted-2:   #94a3b8;
  --accent:    #c47f00;       /* darker orange for contrast on light */
  --accent-bg: #fff5dc;
  --green:     #16a34a;
  --red:       #dc2626;
  --blue:      #1d4ed8;
  --tooltip-bg: #1e293b;
  --tooltip-fg: #f8fafc;

  --cat-cfo:   #1d4ed8;   /* operating */
  --cat-cfi:   #c47f00;   /* investing */
  --cat-cff:   #7c3aed;   /* financing */
  --cat-fcf:   #dc2626;   /* free cash flow */
  --cat-capex: #0f172a;   /* capex */
  --cat-net:   #475569;   /* net change */
  --cat-cash-total: #d97706;  /* cash incl restricted */
  --cat-cash-basic: #0891b2;  /* unrestricted */

  /* ornamental tokens (added with styling pass) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15.5px;
  line-height: 1.45;
}

/* -------- top bar (mirrors econ/macro structure; glass sticky upgrade) -------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow .2s var(--ease-out), background .2s var(--ease-out);
}
.top.scrolled {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.home-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 19px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s, transform .15s var(--ease-out);
}
.home-link:hover { color: var(--accent); background: var(--accent-bg); transform: translateX(-2px); }
.mark {
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  font-size: 18px;
}
.sub {
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.5px;
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  transition: color .15s, border-color .15s, background .15s;
}
.nav-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }

/* live-data pulse pill (drop into .brand) */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 3px 9px 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
  animation: sfg-pulse 2.2s infinite;
}
@keyframes sfg-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* -------- main -------- */
main { max-width: 1440px; margin: 0 auto; padding: 32px 28px 40px; }

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin: 0 0 10px;
  padding: 3px 10px;
  background: var(--accent-bg);
  border-radius: 999px;
}

h1.page-title {
  margin: 0 0 10px 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
}
p.page-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 26px 0;
  line-height: 1.6;
  max-width: 920px;
}

/* CTA primary button (dark slate, pops on light theme) */
.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #0f172a;
  color: #fff;
  border: 1px solid #0f172a;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s;
}
.cta-primary:hover {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.cta-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* scroll reveal — gated by prefers-reduced-motion */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* subtle accent bar on panels (prepends existing .panel defs across pages) */
section.panel {
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease-out), transform .2s var(--ease-out);
}
section.panel:hover {
  box-shadow: var(--shadow-md);
}
section.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  border-radius: 2px;
  opacity: 0;
  transition: opacity .2s var(--ease-out);
}
section.panel:hover::before {
  opacity: 0.6;
}

/* -------- landing-page cards -------- */
.section-label {
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 14px;
  font-weight: 600;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(196,127,0,.08);
  transform: translateY(-1px);
}
.card .tag {
  display: inline-block;
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 700;
}
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.card .arrow { display: block; margin-top: 14px; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.card:hover .arrow { color: var(--accent); }
.card.placeholder { border-style: dashed; opacity: 0.55; cursor: default; }
.card.placeholder:hover { border-color: var(--line); transform: none; box-shadow: none; }
.card.placeholder .arrow { display: none; }

/* Card illustration header */
.card-illust {
  width: 100%;
  height: 86px;
  margin: -4px 0 14px;
  display: block;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.card:hover .card-illust {
  border-color: var(--line);
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

/* -------- controls (chart page) -------- */
.ctrls {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  align-items: flex-end;
}
.grp { display: flex; flex-direction: column; gap: 8px; }
.grp-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.chk { display: flex; gap: 14px; flex-wrap: wrap; }
label.chkitem {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  padding: 3px 0;
  color: var(--text);
}
label.chkitem input { cursor: pointer; width: 14px; height: 14px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.mode-btns { display: flex; gap: 4px; }
.mbtn {
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.mbtn:hover { border-color: var(--accent); }
.mbtn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* -------- chart container -------- */
#chart {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  height: 560px;
}

/* -------- detail panel -------- */
#detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-top: 14px;
  display: none;
}
#detail-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
#detail-title { margin: 0; font-size: 17px; font-weight: 600; }
#detail-close {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
#detail-close:hover { border-color: var(--accent); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.metric {
  background: var(--panel-2);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
}
.metric-lbl { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-val { font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.d-card {
  background: var(--panel-2);
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
}
.d-card h3 { margin: 0 0 10px 0; font-size: 14.5px; font-weight: 600; }
.d-card .hdrmeasure { font-size: 12px; color: var(--muted); font-weight: 400; }
.drow {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line-soft);
}
.drow:last-child { border-bottom: none; }
.dname { color: var(--text); flex: 1; padding-right: 8px; }
.dval { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.zer { color: var(--muted); }

/* -------- methodology note -------- */
.note {
  background: var(--accent-bg);
  border: 1px solid #fcd68a;
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 6px;
  margin-top: 14px;
  color: #5c4102;
  font-size: 13px;
  line-height: 1.55;
}
.note strong { color: #3c2a00; }

/* -------- data table -------- */
.tbl-wrap {
  max-height: 440px;
  overflow-y: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}
table.data th, table.data td {
  padding: 9px 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
table.data th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--line);
}
table.data th:first-child, table.data td:first-child,
table.data td:nth-child(2) { text-align: left; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data tr.sel { background: #fff5dc; }

/* -------- term definitions (dotted underline + custom tooltip) -------- */
.term {
  border-bottom: 1px dotted var(--muted);
  cursor: help;
  position: relative;
  color: inherit;
}
.term:hover { border-bottom-color: var(--accent); color: var(--accent); }
.term::after {
  content: attr(data-def);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  width: 280px;
  max-width: 90vw;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, visibility .15s;
  z-index: 1000;
  text-align: left;
  border-bottom: none;
}
.term::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 1000;
}
.term:hover::after, .term:hover::before { opacity: 1; visibility: visible; }

/* -------- footer -------- */
footer {
  padding: 22px 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
  margin-top: 30px;
}

/* -------- reduced-motion accessibility -------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .pulse-dot { animation: none; }
}


/* ========== Synced dashboard nav (mirrored from macro/styles.css) ========== */
/* ========================================================================= */
/* Deep-dive nav strip — sits below the sticky header on every macro page.   */
/* Solves the "users can't find related views unless they scroll" problem.   */
/* ========================================================================= */
.deep-dive-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  position: sticky;
  top: 53px; /* sits just below the .top header (which is also sticky) */
  z-index: 95;
}
.dd-label {
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
  margin-right: 14px;
  white-space: nowrap;
}
/* Section-grouping label inside .section-pages — used to mark distinct
   sub-sections of nav (e.g. Top-down vs Bottom-up). Visually heavier than
   .dd-label so the grouping reads as a real divider. */
.dd-section-label {
  color: var(--accent);
  letter-spacing: 1.0px;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(247, 167, 0, 0.08);
  border: 1px solid rgba(247, 167, 0, 0.22);
  margin: 0 6px 0 2px;
  white-space: nowrap;
}
.dd-link {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color .15s, background-color .15s, border-color .15s;
  font-size: 12px;
}
.dd-link:hover {
  color: var(--text);
  background: var(--panel-2);
}
.dd-link.active {
  color: var(--accent);
  background: rgba(247, 167, 0, 0.10);
  border-color: rgba(247, 167, 0, 0.30);
  font-weight: 600;
}
.dd-link-secondary {
  font-size: 11px;
  opacity: 0.80;
}
.dd-link-secondary:hover { opacity: 1; }

/* Hierarchy: master/sub grouping for Regime + its 6 deep-dive subcomponents,
   then visually separated standalone groups (Regional/Backtest/Pair Explorer,
   then Data/Indicator Library/Theme). */
.dd-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dd-group-master {
  background: rgba(247, 167, 0, 0.05);
  border: 1px solid rgba(247, 167, 0, 0.18);
  border-radius: 6px;
  padding: 3px 6px;
}
.dd-master {
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(247, 167, 0, 0.14);
  border: 1px solid rgba(247, 167, 0, 0.40);
  color: var(--accent);
  font-size: 12.5px;
  padding: 6px 14px;
}
.dd-master:hover {
  background: rgba(247, 167, 0, 0.22);
  color: var(--accent);
}
.dd-master.active {
  background: var(--accent);
  color: #13171c;
  border-color: var(--accent);
}
.dd-tree {
  color: rgba(247, 167, 0, 0.55);
  font-size: 14px;
  font-weight: 700;
  margin: 0 2px;
  user-select: none;
}
.dd-sub {
  font-size: 11.5px;
  color: var(--muted);
}
.dd-sub.active {
  color: var(--accent);
  background: rgba(247, 167, 0, 0.12);
  border-color: rgba(247, 167, 0, 0.32);
  font-weight: 700;
}
.dd-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 8px;
}
.dd-group-tail {
  margin-left: auto;
}

@media (max-width: 1100px) {
  .dd-group-master { padding: 2px 4px; }
  .dd-tree { display: none; }
}
@media (max-width: 800px) {
  .deep-dive-nav { padding: 8px 12px; gap: 2px; }
  .dd-label { display: none; }
  .dd-link { padding: 5px 8px; font-size: 11px; }
  .dd-master { padding: 5px 10px; font-size: 11.5px; }
  .dd-sub { font-size: 11px; }
  .dd-divider { margin: 0 4px; height: 16px; }
  .dd-group-tail { margin-left: 0; }
  .dd-link-secondary { display: none; }
}


/* ========================================================================= */
/* Two-tier deep-dive nav (Markets restructure 2026-04)                       */
/* Top tier = section tabs (FINANCIALS / MACRO / TOOLS / REFERENCE)           */
/* Bottom tier = pages within active section                                  */
/* ========================================================================= */
.deep-dive-nav.two-tier {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
}
.deep-dive-nav.two-tier .section-tabs {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 24px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.deep-dive-nav.two-tier .section-tab {
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px;
  letter-spacing: 1.4px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.deep-dive-nav.two-tier .section-tab:hover {
  color: var(--text);
}
.deep-dive-nav.two-tier .section-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.deep-dive-nav.two-tier .section-tabs .theme-toggle {
  margin-left: auto;
}
.deep-dive-nav.two-tier .section-pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 24px;
}
@media (max-width: 800px) {
  .deep-dive-nav.two-tier .section-tabs { gap: 12px; padding: 6px 12px; }
  .deep-dive-nav.two-tier .section-tab { font-size: 10.5px; letter-spacing: 1px; }
  .deep-dive-nav.two-tier .section-pages { padding: 8px 12px; }
}

