/* Shared across every page: reset, typography base, and the site chrome
   (header/footer/logo) pieces that look the same everywhere. Each page's
   own stylesheet overrides what it needs (header background, main width...). */

:root {
  --brand-ink: #16233d;
  --brand-blue: #0e6dd1;
  --brand-blue-soft: #eaf3fc;

  --color-bg: #f4f7fa;
  --color-surface: #ffffff;
  --color-surface-soft: #f5f8fc;
  --color-surface-tint: #eef2fa;
  --color-border: #dde2e8;
  --color-border-soft: #d1d5db;
  --color-text: #16233d;
  --color-text-secondary: #5c6b82;
  --color-text-muted: #8894a8;
  --color-positive: #1f8a4c;
  --color-negative: #c23b3b;
  --color-footer-bg: #222222;
  --color-footer-text: #eeeeee;
  --color-footer-link: #9fd0ff;
  --color-shadow: rgba(20, 30, 50, 0.12);

  --chart-axis: #8894a8;
  --chart-grid: #dde2e8;
  --chart-line: #0e6dd1;
  --chart-volume: #c3cad6;
  --chart-series-1: #3a75d5;
  --chart-series-2: #e08a3c;
  --chart-series-3: #3fa66b;
  --chart-series-4: #c14f6e;
  --chart-series-5: #7a5cc9;
  --chart-series-6: #4bb6c9;
  --chart-series-7: #c9a227;
  --chart-series-8: #8a6d4f;
  --chart-series-other: #b7bec9;
  --chart-series-other-faint: #d8dde3;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-ink: #e8edf5;
    --brand-blue: #3d8bef;
    --brand-blue-soft: #1b2c47;

    --color-bg: #0f1620;
    --color-surface: #182130;
    --color-surface-soft: #1c2636;
    --color-surface-tint: #23324a;
    --color-border: #2c3a52;
    --color-border-soft: #33445e;
    --color-text: #e8edf5;
    --color-text-secondary: #a9b6ca;
    --color-text-muted: #7f8ea6;
    --color-positive: #3ecb77;
    --color-negative: #ef6262;
    --color-footer-bg: #0a0e15;
    --color-footer-text: #eeeeee;
    --color-footer-link: #9fd0ff;
    --color-shadow: rgba(0, 0, 0, 0.45);

    --chart-axis: #7f8ea6;
    --chart-grid: #2c3a52;
    --chart-line: #3d8bef;
    --chart-volume: #445872;
    --chart-series-1: #5b9bf0;
    --chart-series-2: #f0a35e;
    --chart-series-3: #5ecb8f;
    --chart-series-4: #e07a95;
    --chart-series-5: #a184e0;
    --chart-series-6: #6fd0e0;
    --chart-series-7: #e0c15e;
    --chart-series-8: #b09472;
    --chart-series-other: #4a5872;
    --chart-series-other-faint: #2e3a4e;
  }
}

:root[data-theme="dark"] {
  --brand-ink: #e8edf5;
  --brand-blue: #3d8bef;
  --brand-blue-soft: #1b2c47;

  --color-bg: #0f1620;
  --color-surface: #182130;
  --color-surface-soft: #1c2636;
  --color-surface-tint: #23324a;
  --color-border: #2c3a52;
  --color-border-soft: #33445e;
  --color-text: #e8edf5;
  --color-text-secondary: #a9b6ca;
  --color-text-muted: #7f8ea6;
  --color-positive: #3ecb77;
  --color-negative: #ef6262;
  --color-footer-bg: #0a0e15;
  --color-footer-text: #eeeeee;
  --color-footer-link: #9fd0ff;
  --color-shadow: rgba(0, 0, 0, 0.45);

  --chart-axis: #7f8ea6;
  --chart-grid: #2c3a52;
  --chart-line: #3d8bef;
  --chart-volume: #445872;
  --chart-series-1: #5b9bf0;
  --chart-series-2: #f0a35e;
  --chart-series-3: #5ecb8f;
  --chart-series-4: #e07a95;
  --chart-series-5: #a184e0;
  --chart-series-6: #6fd0e0;
  --chart-series-7: #e0c15e;
  --chart-series-8: #b09472;
  --chart-series-other: #4a5872;
  --chart-series-other-faint: #2e3a4e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light dark;
  min-height: 100%;
  background: var(--color-bg);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: 'Segoe UI', 'Poppins', Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
}

header {
  background:
    radial-gradient(120% 220% at 12% -20%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(120deg, rgba(234, 243, 255, 0.82) 0%, rgba(255, 255, 255, 0.6) 45%, rgba(210, 232, 255, 0.78) 100%);
  -webkit-backdrop-filter: saturate(200%) blur(20px);
  backdrop-filter: saturate(200%) blur(20px);
  border-bottom: 1px solid rgba(14, 109, 209, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 30px -14px rgba(14, 109, 209, 0.45);
  color: var(--brand-ink);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 56px;
  padding: 0 1.25rem;
}

header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--brand-blue) 50%, transparent 100%);
  opacity: 0.55;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) header {
    background:
      radial-gradient(120% 220% at 12% -20%, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 55%),
      linear-gradient(120deg, rgba(27, 44, 71, 0.9) 0%, rgba(15, 22, 32, 0.85) 45%, rgba(20, 34, 58, 0.9) 100%);
    border-bottom: 1px solid rgba(61, 139, 239, 0.25);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.05),
      0 10px 30px -14px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] header {
  background:
    radial-gradient(120% 220% at 12% -20%, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(120deg, rgba(27, 44, 71, 0.9) 0%, rgba(15, 22, 32, 0.85) 45%, rgba(20, 34, 58, 0.9) 100%);
  border-bottom: 1px solid rgba(61, 139, 239, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 30px -14px rgba(0, 0, 0, 0.6);
}

.header-content {
  flex: 0 0 auto;
  text-align: left;
}

.header-content h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-ink);
}

.logo-top-left {
  position: static;
  width: 30px;
  height: auto;
  display: block;
  filter: drop-shadow(0 1px 6px rgba(14, 109, 209, 0.4));
}

main {
  margin: 0 auto;
}

footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  text-align: center;
  padding: 0.5rem;
  position: fixed;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  bottom: 0;
  overflow-x: auto;
  z-index: 9999;
}

@media (max-width: 768px) {
  /* On phones the fixed footer permanently overlaps page content (no page
     reserves padding-bottom for its height) - switch it to a normal
     in-flow block so it only shows once, at the true end of the page. */
  footer {
    position: static;
    width: auto;
    max-width: none;
    bottom: auto;
  }
}

footer a {
  color: var(--color-footer-link);
}

@media (max-width: 360px) {
  /* At the narrowest phone widths there isn't room for the logo, the
     "FilingsAtlas" wordmark, the theme toggle, and the sign-in control all
     in one row without overflowing -- drop the wordmark and keep the logo
     (still identifies the brand) since it's the one piece that's purely
     decorative duplication of the logo image's alt text. */
  .header-content {
    display: none;
  }
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  margin-left: 0.4rem;
  flex: 0 0 auto;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.theme-toggle:hover, .theme-toggle:focus-visible {
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-icon-dark {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .theme-icon-light {
    display: none;
  }

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