@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* Stocks HQ Live — bright, light market theme (Rumel, Nov 16: lighter/brighter than the original dark navy).
   Layout: Google-Finance style three columns under the header —
   left market summary, center chart/news, right watchlist —
   with the movers boards full-width below.
   The logo animation (draw / pop / heartbeat) is the final "Pulse"
   spec: white line + arrowhead in a circle on dark navy. */

:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #eef2f7;
  --text: #14213a;
  --dim: #5b6b84;
  --border: #d9e1ec;
  --up: #1d9e5f;
  --down: #d93a2e;
  --amber: #b97a1c;
  --logo-disc: #12294d;
  --logo-fg: #ffffff;
  --radius: 10px;
  --radius-lg: 14px;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); }

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

.mono { font-family: var(--font-mono); }
.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--dim); }

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

.site-header {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.brand-name .live { color: var(--up); }

.brand-tag {
  font-size: 12px;
  color: var(--dim);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-search {
  flex: 1 1 340px;
  max-width: 600px;
  margin: 0 auto;
}

.header-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--dim);
  flex: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 11px;
  font-weight: 600;
  color: var(--text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
}

.status-dot.open { background: var(--up); }

/* ------------------------------------------------------------------ */
/* Logo: the pulse line draws itself, the arrowhead pops in, then the  */
/* whole mark beats twice — one 3.6s loop.                             */
/* ------------------------------------------------------------------ */

@keyframes logo-draw-line {
  0% { stroke-dashoffset: 100; opacity: 1; }
  45%, 88% { stroke-dashoffset: 0; opacity: 1; }
  97% { stroke-dashoffset: 0; opacity: 0; }
  100% { stroke-dashoffset: 100; opacity: 0; }
}

@keyframes logo-pop-arrow {
  0%, 43% { opacity: 0; transform: scale(0.3); }
  53% { opacity: 1; transform: scale(1.25); }
  62%, 88% { opacity: 1; transform: scale(1); }
  97%, 100% { opacity: 0; transform: scale(1); }
}

@keyframes logo-beat {
  0%, 62% { transform: scale(1); }
  68% { transform: scale(1.14); }
  74% { transform: scale(1); }
  79% { transform: scale(1.08); }
  85%, 100% { transform: scale(1); }
}

.logo-draw-line {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: logo-draw-line 3.6s ease-in-out infinite;
}

.logo-pop-arrow {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: logo-pop-arrow 3.6s ease-in-out infinite;
}

.logo-beat {
  transform-origin: center;
  animation: logo-beat 3.6s ease-in-out infinite;
}

.logo-mark { width: 46px; height: 46px; flex: none; }
.logo-mark-lg { width: 84px; height: 84px; }

/* Blinking live dot */
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.blink-dot { animation: blink-dot 1.6s ease-in-out infinite; }

/* ------------------------------------------------------------------ */
/* Ticker tape                                                         */
/* ------------------------------------------------------------------ */

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

.tape {
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tape-track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 34px;
  padding: 8px 16px;
  animation: tape-scroll 60s linear infinite;
}

.tape-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
}

.tape-item .sym { font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Search (in the header, Google-Finance style)                        */
/* ------------------------------------------------------------------ */

.search-box { position: relative; }

.search-row { display: flex; gap: 10px; }

.search-input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 0 18px;
  text-transform: uppercase;
}

.search-input::placeholder { color: var(--dim); text-transform: none; font-family: var(--font-display); font-size: 15px; }
.search-input:focus { outline: 2px solid var(--up); outline-offset: 1px; }

.btn {
  min-height: 46px;
  border: none;
  border-radius: 999px;
  background: var(--up);
  color: #06130b;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  padding: 0 20px;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); }

.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 30;
  box-shadow: 0 14px 34px rgba(16, 42, 80, 0.18);
}

.suggest button {
  display: flex;
  width: 100%;
  align-items: baseline;
  gap: 10px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: 15px;
}

.suggest button:last-child { border-bottom: none; }
.suggest button:hover, .suggest button.active { background: var(--surface); }
.suggest .sym { font-family: var(--font-mono); font-weight: 600; min-width: 74px; }
.suggest .nm { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .ex { color: var(--dim); font-size: 12px; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chips-label { color: var(--dim); font-size: 13px; font-weight: 600; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 13px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.chip:hover { border-color: var(--up); }

/* ------------------------------------------------------------------ */
/* Three-column layout                                                 */
/* ------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 332px;
  grid-template-areas: "left center right";
  gap: 18px;
  align-items: start;
  padding-top: 18px;
}

.col-left { grid-area: left; }
.col-center { grid-area: center; min-width: 0; }
.col-right { grid-area: right; }

@media (min-width: 1101px) {
  .col-left, .col-right { position: sticky; top: 14px; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 16px 10px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(16, 42, 80, 0.06);
}

/* Quick-nav shortcut buttons (top of the left column) */
.quick-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.quick-nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(16, 42, 80, 0.06);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
}

.quick-nav button:hover { border-color: var(--up); }
.quick-nav .qn-arrow-up { color: var(--up); }
.quick-nav .qn-arrow-down { color: var(--down); }

@keyframes board-flash {
  0%, 60% { box-shadow: 0 0 0 3px var(--amber); }
  100% { box-shadow: 0 1px 3px rgba(16, 42, 80, 0.06); }
}

.board.flash { animation: board-flash 1.6s ease; }

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-head .asof { color: var(--dim); font-size: 12px; margin-left: auto; }

/* Compact quote rows (summary + watchlist) */
.sum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-display);
  padding: 9px 4px;
  cursor: pointer;
  text-align: left;
}

.sum-row:last-child { border-bottom: none; }
.sum-row:hover { background: var(--bg-2); }

.sum-name { font-weight: 600; font-size: 14.5px; }

.sum-id { display: flex; flex-direction: column; min-width: 0; }
.sum-id .sym { font-family: var(--font-mono); font-weight: 600; font-size: 14.5px; }
.sum-id .nm { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }

.sum-vals { display: flex; align-items: center; gap: 9px; flex: none; }
.sum-vals .px { font-family: var(--font-mono); font-size: 14.5px; font-weight: 500; }

.pct-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: 999px;
  min-width: 68px;
  text-align: center;
}

.pct-pill.up { color: var(--up); background: rgba(47, 191, 113, 0.13); }
.pct-pill.down { color: var(--down); background: rgba(240, 86, 74, 0.13); }
.pct-pill.dim { color: var(--dim); background: rgba(143, 163, 192, 0.13); }

/* ------------------------------------------------------------------ */
/* Sections + movers boards (full width, below the columns)            */
/* ------------------------------------------------------------------ */

section.block { padding: 10px 0 6px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 { font-size: 21px; margin: 0; font-weight: 700; }
.section-head .asof { color: var(--dim); font-size: 13px; }

.boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(16, 42, 80, 0.06);
}

.board h3 {
  margin: 0;
  padding: 12px 14px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.board table { width: 100%; border-collapse: collapse; font-size: 14px; }

.board td, .board th {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.board tr:last-child td { border-bottom: none; }
.board td:first-child, .board th:first-child { text-align: left; }
.board tbody tr { cursor: pointer; }
.board tbody tr:hover { background: var(--bg-2); }
.board .sym { font-weight: 600; }
.board .nm { display: block; font-family: var(--font-display); font-size: 11px; color: var(--dim); white-space: normal; }

/* ------------------------------------------------------------------ */
/* Ticker detail (center column)                                       */
/* ------------------------------------------------------------------ */

.detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(16, 42, 80, 0.06);
}

.detail-head { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; }
.detail-head .sym { font-family: var(--font-mono); font-size: 15px; color: var(--dim); font-weight: 600; }
.detail-head h2 { margin: 0; font-size: 26px; }
.detail-price { font-family: var(--font-mono); font-size: 34px; font-weight: 600; line-height: 1.1; }
.detail-chg { font-family: var(--font-mono); font-size: 16px; }

.range-row { display: flex; gap: 6px; margin: 16px 0 6px; flex-wrap: wrap; }

.range-btn {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--dim);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.range-btn.active { color: var(--text); border-color: var(--up); background: var(--surface-alt); }

.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-axis { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; font-family: var(--font-mono); margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 18px;
}

.stat { background: var(--bg-2); padding: 10px 13px; }
.stat .k { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat .v { font-family: var(--font-mono); font-size: 16px; margin-top: 2px; }

.detail-news { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.detail-news h3 { margin: 0 0 6px; font-size: 16px; }

/* ------------------------------------------------------------------ */
/* News                                                                */
/* ------------------------------------------------------------------ */

.news-panel { padding-bottom: 6px; }

.news-list { list-style: none; margin: 0; padding: 0; }

.news-list li { border-bottom: 1px solid var(--border); padding: 11px 2px; }
.news-list li:last-child { border-bottom: none; }

.news-list a { text-decoration: none; font-weight: 600; font-size: 16px; }
.news-list a:hover { text-decoration: underline; }

.news-meta { color: var(--dim); font-size: 13px; margin-top: 2px; }
.news-meta .tickers { font-family: var(--font-mono); color: var(--amber); }

/* ------------------------------------------------------------------ */
/* Signup (right column panel) + footer                                */
/* ------------------------------------------------------------------ */

.signup-panel .signup-copy { color: var(--dim); font-size: 14px; margin: 0 0 14px; }

.signup-panel form { display: flex; flex-direction: column; gap: 10px; }

.signup-panel input[type="email"] {
  width: 100%;
  min-height: 46px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 0 14px;
  font-family: var(--font-display);
}

.signup-panel input[type="email"]:focus { outline: 2px solid var(--up); outline-offset: 1px; }

.signup-msg { font-size: 14px; min-height: 20px; }
.signup-msg.ok { color: var(--up); }
.signup-msg.err { color: var(--down); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding: 22px 0 30px;
  color: var(--dim);
  font-size: 13px;
}

.footer-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.footer-row .brand-name { font-size: 17px; color: var(--text); }

.state-msg {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--dim);
  text-align: center;
  font-size: 14px;
}

.state-msg.err { color: var(--down); border-color: var(--down); }

/* ------------------------------------------------------------------ */
/* Responsive: two columns, then one                                   */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas: "left center" "right right";
  }
  .col-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
  }
  .col-right .panel { margin-bottom: 0; }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "center" "right" "left";
  }
  .col-right { display: block; }
  .col-right .panel { margin-bottom: 18px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-name { font-size: 21px; }
  .detail { padding: 16px; }
  .detail-price { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .tape-track { animation: none; }
  .logo-draw-line { animation: none; stroke-dashoffset: 0; }
  .logo-pop-arrow { animation: none; opacity: 1; transform: none; }
  .logo-beat { animation: none; transform: none; }
  .blink-dot { animation: none; }
  .status-dot.open { animation: none; }
}

/* Phone tap targets */
button, input, select { min-height: 2rem; }
