/* Pulse — shared tokens, layout, dark mode, motion */

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

:root {
  /* Motion */
  --motion-fast: 0.15s;
  --motion-med: 0.28s;
  --motion-slow: 0.45s;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);

  /* Stripe-inspired — clean fintech */
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  --accent:       #635BFF;
  --accent-hover: #5851E6;
  --accent-bg:    rgba(99, 91, 255, 0.08);
  --navy:         #0A2540;
  --navy-mid:     #183558;

  --bg:              #F6F9FC;
  --bg-mid:          #EEF2F6;
  --bg-gradient-end: #FFFFFF;
  --surface:         #FFFFFF;
  --surface-muted:   rgba(255, 255, 255, 0.92);
  --border:          rgba(66, 84, 102, 0.12);
  --border-strong:   rgba(66, 84, 102, 0.2);
  --hover:           rgba(99, 91, 255, 0.05);
  --table-row-border: rgba(66, 84, 102, 0.08);
  --text:            #0A2540;
  --text-2:          #425466;
  --text-3:          #697386;
  --blue:            var(--accent);
  --blue-hover:      var(--accent-hover);
  --blue-bg:         var(--accent-bg);
  --md-em:           var(--navy);
  --header-bg:       rgba(255, 255, 255, 0.92);
  --footer-bg:       #F6F9FC;
  --search-bg:       #FFFFFF;
  --chip-bg:         rgba(99, 91, 255, 0.06);
  --shadow-sm:       0 2px 5px rgba(50, 50, 93, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-md:       0 13px 27px rgba(50, 50, 93, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);
  --radius:          12px;
  --radius-sm:       8px;

  --green:     #09825D;
  --green-bg:  rgba(9, 130, 93, 0.08);
  --purple:    var(--accent);
  --purple-bg: var(--accent-bg);
  --amber:     #C47F00;
  --amber-bg:  rgba(196, 127, 0, 0.1);

  --bull-text: #09825D;
  --bull-bg:   rgba(9, 130, 93, 0.08);
  --bull-bd:   rgba(9, 130, 93, 0.24);
  --neut-text: #697386;
  --neut-bg:   rgba(105, 115, 134, 0.1);
  --neut-bd:   rgba(105, 115, 134, 0.24);
  --bear-text: #DF1B41;
  --bear-bg:   rgba(223, 27, 65, 0.08);
  --bear-bd:   rgba(223, 27, 65, 0.24);

  --logo-shadow: rgba(50, 50, 93, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:              #0A2540;
  --bg-mid:          #0F3055;
  --bg-gradient-end: #122E50;
  --surface:         #122E50;
  --surface-muted:   rgba(18, 46, 80, 0.94);
  --border:          rgba(255, 255, 255, 0.1);
  --border-strong:   rgba(255, 255, 255, 0.16);
  --hover:           rgba(99, 91, 255, 0.12);
  --table-row-border: rgba(255, 255, 255, 0.08);
  --text:            #F6F9FC;
  --text-2:          #ADBDCC;
  --text-3:          #8898AA;
  --blue:            #818CF8;
  --blue-hover:      #A5B4FC;
  --blue-bg:         rgba(99, 91, 255, 0.16);
  --md-em:           #E0E7FF;
  --header-bg:       rgba(10, 37, 64, 0.94);
  --footer-bg:       #081C32;
  --search-bg:       #122E50;
  --chip-bg:         rgba(99, 91, 255, 0.14);
  --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-md:       0 16px 40px rgba(0, 0, 0, 0.32);

  --green:     #34D399;
  --green-bg:  rgba(52, 211, 153, 0.12);
  --purple:    #A5B4FC;
  --purple-bg: rgba(99, 91, 255, 0.16);
  --amber:     #FBBF24;
  --amber-bg:  rgba(251, 191, 36, 0.12);

  --bull-text: #34D399;
  --bull-bg:   rgba(52, 211, 153, 0.12);
  --bull-bd:   rgba(52, 211, 153, 0.32);
  --neut-text: #FBBF24;
  --neut-bg:   rgba(251, 191, 36, 0.12);
  --neut-bd:   rgba(251, 191, 36, 0.32);
  --bear-text: #FB7185;
  --bear-bg:   rgba(251, 113, 133, 0.12);
  --bear-bd:   rgba(251, 113, 133, 0.32);

  --logo-shadow: rgba(0, 0, 0, 0.35);
}

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

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0.01ms;
    --motion-med: 0.01ms;
    --motion-slow: 0.01ms;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes ti-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ti-slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ti-spin {
  to { transform: rotate(360deg); }
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'kern' 1;
}

main {
  flex: 1;
  width: 100%;
  animation: ti-fade-in var(--motion-slow) var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
}

/* ── Header ── */
.header {
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 max(24px, 4vw);
  height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--motion-med) var(--ease-out), border-color var(--motion-med) var(--ease-out);
}

.status-bar {
  background: var(--bg-mid);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 72px;
  z-index: 99;
}

.status-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 7px max(24px, 4vw);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(99, 91, 255, 0.4); }
  50%       { opacity: 0.75; box-shadow: 0 0 0 4px rgba(99, 91, 255, 0); }
}

[data-theme="dark"] .status-dot {
  animation: status-pulse-dark 2.4s ease-in-out infinite;
}

@keyframes status-pulse-dark {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(99, 91, 255, 0.4); }
  50%       { opacity: 0.75; box-shadow: 0 0 0 4px rgba(99, 91, 255, 0); }
}

.status-divider {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

.status-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-label--live   { color: var(--accent); }
.status-label--agents { color: var(--text-2); }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform var(--motion-fast) var(--ease-spring);
}

.logo:hover {
  transform: scale(1.02);
}

@media (prefers-reduced-motion: reduce) {
  .logo:hover { transform: none; }
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f9f6f1;
  box-shadow: 0 2px 8px var(--logo-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: box-shadow var(--motion-med) var(--ease-out), transform var(--motion-fast) var(--ease-spring);
}

.logo:hover .logo-icon {
  box-shadow: 0 4px 14px var(--logo-shadow);
}

.logo-icon-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

[data-theme="dark"] .logo-icon {
  border: 1px solid var(--border);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.03em;
}

.logo-text span {
  color: var(--text);
  font-style: italic;
  font-weight: 500;
  opacity: 0.92;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-spring);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--hover);
  border-color: var(--border);
}

.theme-toggle:active {
  transform: scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle:active { transform: none; }
}

.theme-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .theme-toggle__icon--sun,
[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

.header-spacer {
  flex: 1;
  min-width: 0;
}

.header-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

@media (max-width: 420px) {
  .header {
    gap: 8px;
    padding: 0 max(12px, 3vw);
  }

  .logo {
    gap: 6px;
  }

  .logo-text {
    font-size: 15px;
  }

  .header-nav .nav-link {
    padding: 8px 8px;
    font-size: 13px;
    gap: 4px;
  }

  .nav-link__label {
    display: none;
  }
}

.header-nav .nav-link:hover {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: rgba(99, 91, 255, 0.18);
}

[data-theme="dark"] .header-nav .nav-link:hover {
  border-color: rgba(129, 140, 248, 0.28);
}

.header-nav .nav-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.header-nav .nav-link--active {
  color: var(--text);
  background: var(--hover);
  border-color: var(--border);
  cursor: default;
}

.header-nav .nav-link--active:hover {
  color: var(--text);
  background: var(--hover);
  border-color: var(--border);
}

/* ── Footer ── */
footer {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-3);
  padding: 32px max(24px, 4vw);
  border-top: 1px solid var(--border);
  line-height: 1.65;
  background: var(--footer-bg);
  transition: background var(--motion-med) var(--ease-out), border-color var(--motion-med) var(--ease-out);
}

.site-footer .footer-primary {
  max-width: 560px;
  margin: 0 auto;
}

.site-footer .footer-primary p {
  margin: 0;
}

.site-footer .footer-primary p + p {
  margin-top: 10px;
}

.site-footer .footer-disclaimer {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  font-size: 12px;
  line-height: 1.65;
}

.site-footer .footer-credit {
  margin: 16px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

.site-footer .footer-credit a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.site-footer .footer-credit a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Stagger helper for children */
.motion-stagger > * {
  animation: ti-slide-up var(--motion-slow) var(--ease-out) both;
}

.motion-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.motion-stagger > *:nth-child(2) { animation-delay: 0.08s; }
.motion-stagger > *:nth-child(3) { animation-delay: 0.12s; }
.motion-stagger > *:nth-child(4) { animation-delay: 0.16s; }
.motion-stagger > *:nth-child(5) { animation-delay: 0.2s; }
.motion-stagger > *:nth-child(6) { animation-delay: 0.24s; }
.motion-stagger > *:nth-child(7) { animation-delay: 0.28s; }
.motion-stagger > *:nth-child(8) { animation-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  .motion-stagger > * {
    animation: none;
  }
}

/* ── Sector tag ────────────────────────────────────────────────────── */
.sector-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--chip-bg);
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.6;
}
