/* MU Equity Research Dashboard, stylesheet part 5/7: 05-dark-mode-and-modes.css
   Files load in numeric order; the cascade relies on source order. */
/* ============= DARK MODE ============= */
body.dark {
  --bg: #16130E;
  --panel: #211C15;
  --ink: #F2EFE3;
  --muted: #A8A192;
  --line: #322B20;
  --accent: #c45576;
  --accent-soft: #2a1820;
  --green: #4ec872;
  --green-soft: #163b22;
  --red: #ec6868;
  --red-soft: #3a1a1a;
  --amber: #d9a443;
  --amber-soft: #3a2b16;
  --chip: #2A241B;
  /* Dark-mode accents are light, so white text on them fails contrast. Flip the
     on-accent / on-green foreground to near-black (passes >=4.5:1 on every theme's
     dark accent + the shared dark --green). Accent hues themselves are unchanged. */
  --on-accent: #15171a;
  --on-green: #15171a;
  color-scheme: dark;
}
body.dark section.block,
body.dark .sources,
body.dark .chart-card,
body.dark .calc,
body.dark .kpi,
body.dark .roadmap,
body.dark .risk-card {
  background: var(--panel);
  border-color: var(--line);
}
body.dark .kpi { background: #2A241B; }
body.dark .chart-card { background: #251F16; }
body.dark .calc { background: #251F16; }
body.dark table.fin thead th { background: #322B20; color: var(--ink); }
body.dark table.fin tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
body.dark .calc-output { background: #2A241B; }
body.dark .rr-cell { background: #2A241B; color: var(--ink); }
body.dark .calc-row input[type="number"] { background: #2A241B; color: var(--ink); border-color: var(--line); }
body.dark .toggle-btn { background: #2A241B; color: var(--muted); }
body.dark .toggle-btn.on { background: var(--accent); color: var(--on-accent); }
body.dark nav.side { background: var(--panel); border-color: var(--line); }
body.dark .hero { background: linear-gradient(135deg, #100D08 0%, #1F1610 60%, var(--accent-deep) 100%); }
body.dark .risk-card { background: #2A241B; }
body.dark .data-gaps { background: #3a2b16; color: var(--ink); }
body.dark .accent-soft { background: #2a1820; }
body.dark .kpi.accent { background: linear-gradient(135deg, #2a1820 0%, #3a1f2a 100%); }
body.dark .prob-card.bull { background: #163b22; color: var(--green); }
body.dark .prob-card.base { background: #3a2b16; color: var(--amber); }
body.dark .prob-card.bear { background: #3a1a1a; color: var(--red); }

/* ============= TOP-RIGHT CONTROL CLUSTER ============= */
.top-controls {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 250;
  display: flex;
  gap: 6px;
  align-items: center;
  background: var(--panel);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}
.top-controls button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
  color: var(--ink);
  font-family: inherit;
  padding: 0;
  position: relative;
}
.top-controls button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.06);
}
.top-controls button.active {
  background: var(--accent);
  color: var(--on-accent);
}
.top-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Custom tooltip on hover */
.top-controls button::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  right: 50%;
  transform: translateX(50%);
  background: var(--ink);
  color: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out);
  box-shadow: var(--shadow-md);
}
.top-controls button:hover::after { opacity: 1; }

/* Dark mode adjustments */
body.dark .top-controls { background: rgba(24, 28, 34, 0.85); border-color: var(--line); }
body.dark .top-controls button:hover { background: var(--accent); color: var(--on-accent); }

/* Hide the legacy fixed positioning since we now use cluster */
.theme-toggle, .slide-mode-toggle { position: static !important; top: auto !important; right: auto !important; box-shadow: none !important; }
.slide-mode-toggle { padding: 0 !important; min-width: 34px !important; }

@media (max-width: 600px) {
  .top-controls { top: 6px; right: 6px; gap: 6px; padding: 4px; }
  /* Phones: clean icon-only tap targets. The previous always-visible
     data-tip mini-label ("Switch to scroll view", "All dashboards", …) was
     far wider than its 40px button, so three side-by-side labels overlapped
     into garbled text across the header. Drop the persistent label entirely
     (each button keeps its aria-label, so screen readers still name it) and
     keep a comfortable 44px icon tap target. */
  .top-controls button {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 16px;
    border-radius: 12px;
  }
  .top-controls button::after { content: none !important; }
}
@media (hover: none) and (pointer: coarse) {
  .top-controls { gap: 6px; padding: 4px; }
  .top-controls button { width: 44px; height: 44px; font-size: 15px; min-height: 44px; }
  .top-controls .theme-toggle { width: 44px; height: 44px; font-size: 15px; }
}

/* ============= OVERVIEW MODE (slide grid) ============= */
.overview-grid {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  padding: var(--sp-8) var(--sp-6);
  overflow-y: auto;
}
body.overview-mode .overview-grid { display: block; }
body.overview-mode .slide-nav,
body.overview-mode .slide-progress-bar,
body.overview-mode nav.side,
body.overview-mode header.top,
body.overview-mode .hero,
body.overview-mode .layout,
body.overview-mode footer.site-footer,
body.overview-mode .slide-mode-toggle,
body.overview-mode .menu-toggle { display: none !important; }
.overview-grid h2 {
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  color: var(--accent);
  margin: 0 0 var(--sp-2);
}
.overview-grid .ov-sub {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--sp-6);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}
.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
  max-width: 1400px;
  margin: 0 auto;
}
.ov-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.ov-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.ov-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }
.ov-num {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}
.ov-card .ov-title {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-top: var(--sp-2);
  color: var(--ink);
  line-height: 1.3;
}
.ov-card .ov-tag {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: var(--sp-2);
}
.ov-close {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 301;
  box-shadow: var(--shadow-md);
}
.ov-hint {
  position: fixed;
  bottom: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--panel);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.kbd-key {
  background: var(--ink);
  color: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  margin: 0 2px;
}

/* Animated counter for hero stats */
.hero-stat.counted .num { transition: none; }

/* ============= MOBILE FLOW IMPROVEMENTS ============= */
@media (max-width: 600px) {
  /* Larger tap zones on calculator inputs */
  .calc-row input[type="range"] { height: 28px; }
  /* Bigger tabs */
  .tab-btn { padding: 10px 14px; font-size: var(--fs-base); }
  /* Swipe hint */
  body.slide-mode main::before {
    content: '← swipe →';
    position: fixed;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--muted);
    background: var(--panel);
    padding: 2px 8px;
    border-radius: 999px;
    opacity: 0.65;
    z-index: 190;
    pointer-events: none;
    box-shadow: var(--shadow-sm);
  }
  body.slide-mode main:hover::before { opacity: 0; }
  /* Bigger sidebar links */
  nav.side a { padding: 14px 18px; font-size: var(--fs-md); }
  /* Theme toggle - smaller on phone */
  .theme-toggle { width: 32px; height: 32px; font-size: 14px; }
}

/* Smooth scroll for inner content */
html { scroll-behavior: smooth; }

/* Better focus indicators for keyboard users */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


