:root {
  --ink: #070a12;
  --midnight: #0b1020;
  --navy: #111a30;
  --slate: #1b2538;
  --graphite: #2a3140;
  --silver: #a9b2c3;
  --mist: #d8dee8;
  --ivory: #f4f0e8;
  --plum: #5a294f;
  --plum-light: #8e5a82;
  --gain: #42c486;
  --loss: #f06b78;

  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;

  --border: rgba(169, 178, 195, 0.17);
  --border-strong: rgba(169, 178, 195, 0.28);
  --loss-bg: rgba(240, 107, 120, 0.1);
  --plum-bg: rgba(142, 90, 130, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--mist);
  background: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--plum-light); color: var(--ivory); }
:focus-visible { outline: 2px solid var(--plum-light); outline-offset: 3px; box-shadow: 0 0 0 5px rgba(244, 240, 232, 0.15); }

/* Header */

.site-header {
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 120%, rgba(90, 41, 79, 0.35), transparent 60%),
    linear-gradient(180deg, var(--midnight), var(--ink));
  position: relative;
  overflow: hidden;
}

.brand-lockup { display: inline-flex; align-items: center; gap: 9px; position: relative; z-index: 1; }
.brand-lockup img { object-fit: contain; object-position: 50% 18%; }
.lockup-image {
  height: 136px;
  width: auto;
  aspect-ratio: 1774 / 887;
  object-position: 50% 50%;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.55));
}
.wordmark { display: flex; align-items: baseline; gap: 7px; color: var(--ivory); line-height: 1; }
.wordmark strong { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -0.02em; }
.wordmark small {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  color: var(--ivory);
  background: var(--plum);
  font: 600 9px/1 var(--mono);
}

/* Ticker strip */

.ticker-strip {
  height: 40px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--midnight);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  animation: ticker-scroll 55s linear infinite;
  will-change: transform;
}

.ticker-strip:hover .ticker-track { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 0 20px;
  border-right: 1px solid var(--border);
  font: 500 11px/1 var(--mono);
  color: var(--silver);
}

.ticker-item b { color: var(--ivory); font-weight: 700; }
.ticker-item .ticker-pct { font-weight: 600; }
.ticker-item .ticker-pct.at-low-text { color: var(--loss); }
.ticker-item .ticker-pct.near-low-text { color: var(--plum-light); }

.ticker-empty { padding: 0 20px; font: 500 11px/1 var(--mono); color: var(--silver); }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Page heading */

main { max-width: 1100px; margin: 0 auto; padding: 48px 32px 96px; }

.page-heading { margin-bottom: 48px; }

.page-heading h1 {
  margin: 0 0 12px;
  color: var(--ivory);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.page-heading h1 em { color: var(--plum-light); font-style: normal; }

.subtitle { margin: 0; max-width: 46em; color: var(--silver); font-size: 15px; }

/* Signup */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.signup-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.signup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 24px 28px;
  border: 1px solid rgba(142, 90, 130, 0.32);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(90, 41, 79, 0.16), rgba(17, 26, 48, 0.3));
}

.signup-copy h2 {
  margin: 0 0 4px;
  color: var(--ivory);
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
}

.signup-copy p { margin: 0; color: var(--silver); font-size: 13px; }

.signup-controls { display: flex; gap: 10px; flex-wrap: wrap; }

.signup-field input[type="email"] {
  height: 44px;
  min-width: 240px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--navy);
  color: var(--ivory);
  font: 500 13px/1 var(--sans);
}

.signup-field input[type="email"]::placeholder { color: #5c6577; }
.signup-field input[type="email"]:focus { border-color: var(--plum-light); outline: none; }

.signup-controls .button-primary {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 6px;
  background: var(--plum);
  color: var(--ivory);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
  transition: background 160ms ease;
}

.signup-controls .button-primary:hover { background: #68345e; }
.signup-controls .button-primary:disabled { opacity: 0.6; cursor: default; }

.signup-message { flex-basis: 100%; margin: 4px 0 0; font: 500 12px/1.5 var(--sans); color: var(--silver); }
.signup-message.success { color: var(--gain); }
.signup-message.error { color: var(--loss); }

/* Controls */

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.filter-btn {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--silver);
  padding: 10px 16px;
  cursor: pointer;
  font: 500 12px/1 var(--sans);
  transition: background 160ms ease, color 160ms ease;
}

.filter-btn:last-child { border-right: 0; }

.filter-btn.active { background: var(--plum); color: var(--ivory); }
.filter-btn:not(.active):hover { background: var(--navy); color: var(--mist); }

.status { color: var(--silver); font: 500 11px/1.5 var(--mono); text-align: right; }

/* Table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--navy);
  box-shadow: 0 24px 48px rgba(4, 6, 12, 0.4);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 680px; }

th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }

th {
  color: var(--silver);
  font: 600 10px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td { color: var(--mist); }
td:first-child { color: var(--ivory); font: 600 13px/1 var(--mono); }

.num, td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 160ms ease; }

tbody tr.at-low { background: var(--loss-bg); }
tbody tr.near-low { background: var(--plum-bg); }

.pct { font-weight: 600; }
.pct.at-low-text { color: var(--loss); }
.pct.near-low-text { color: var(--plum-light); }

.at-low-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--loss);
  font: 600 8px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.badge {
  display: inline-block;
  font: 500 9px/1 var(--mono);
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: var(--silver);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.industry { color: var(--silver); font-size: 12px; }

.sentiment-badge {
  display: inline-block;
  font: 600 9px/1 var(--mono);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sentiment-badge.sentiment-bullish { color: var(--gain); }
.sentiment-badge.sentiment-bearish { color: var(--loss); }
.sentiment-badge.sentiment-neutral { color: var(--silver); }
.sentiment-badge.sentiment-none { color: #4a5164; border-color: var(--border); }

.empty { text-align: center; color: var(--silver); padding: 48px; white-space: normal; }

/* Footer */

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}

footer .brand-lockup { opacity: 0.85; }

footer p { margin: 0; color: #687489; font: 500 11px/1.5 var(--sans); }

footer a[href*="finnhub"] { color: var(--plum-light); }

@media (max-width: 640px) {
  main { padding: 32px 20px 64px; }
  .site-header { height: 108px; padding: 0 20px; }
  .lockup-image { height: 84px; }
  .controls { flex-direction: column; align-items: flex-start; }
  .status { text-align: left; }
  .signup-card { flex-direction: column; align-items: stretch; }
  .signup-field input[type="email"] { min-width: 0; width: 100%; }
  /* Same content crosses a much narrower screen far more often per minute
     at the same animation-duration, so it reads as scrolling faster than
     on desktop even though the CSS value is identical. Slow it down here
     specifically — tune this value directly based on feedback. */
  .ticker-track { animation-duration: 110s; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .ticker-track { animation: none; }
}
