/* ==========================================================================
   Capita Drishti — Market Portal design system (V4 Premium, evolved)
   Palette: indigo #1B1B3A · emerald #10B981 · lavender #A78BFA · rose #F43F5E
   Type: Calistoga (display) · Inter (UI) · JetBrains Mono (numerals)
   ========================================================================== */

:root {
  --ink: #1B1B3A;
  --ink-soft: #3d3d63;
  --muted: #6b6b8a;
  --canvas: #F7F7FB;
  --surface: #ffffff;
  --hairline: #E8E8F2;
  --emerald: #10B981;
  --emerald-deep: #0a8f66;
  --emerald-soft: #e6f7f1;
  --lavender: #A78BFA;
  --lavender-soft: #f1ebfe;
  --rose: #F43F5E;
  --rose-soft: #fee9ee;
  --amber: #D97706;
  --amber-soft: #fdf1e0;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(27, 27, 58, .07);
  --shadow-md: 0 6px 24px -8px rgba(27, 27, 58, .14);
  --shadow-lg: 0 18px 50px -18px rgba(27, 27, 58, .25);
  --font-display: "Calistoga", "Georgia", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --header-h: 62px;
  --ticker-h: 36px;
  --container: 1200px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--emerald-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
h3 { font-size: 1.1rem; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

:focus-visible { outline: 2.5px solid var(--lavender); outline-offset: 2px; border-radius: 4px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: .5rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }
.main { min-height: 60vh; }

/* ---------- ticker ---------- */
.ticker {
  height: var(--ticker-h);
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  z-index: 60;
}
.ticker__label {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .12em;
  padding-inline: 14px;
  color: var(--lavender);
  border-right: 1px solid rgba(255, 255, 255, .15);
  flex: none;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.ticker__viewport { flex: 1; overflow: hidden; }
.ticker__track {
  display: inline-flex;
  gap: 34px;
  white-space: nowrap;
  padding-inline: 20px;
  animation: ticker-scroll 45s linear infinite;
}
.ticker:hover .ticker__track, .ticker:focus-within .ticker__track { animation-play-state: paused; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker__item { display: inline-flex; gap: 8px; align-items: baseline; font-size: .82rem; }
.ticker__item .mono { font-size: .82rem; }
.ticker__name { color: rgba(255, 255, 255, .72); }
.ticker__skeleton { color: rgba(255, 255, 255, .5); font-size: .82rem; padding-inline: 20px; }
.ticker__status {
  flex: none; align-self: stretch; display: flex; align-items: center;
  padding-inline: 14px; font-size: .75rem; border-left: 1px solid rgba(255, 255, 255, .15);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.header__inner { display: flex; align-items: center; gap: 22px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__logo { width: 34px; height: 34px; border-radius: 9px; }
.brand__name { font-family: var(--font-display); font-size: 1.22rem; letter-spacing: .01em; }
.brand__name em { font-style: normal; color: var(--emerald-deep); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav__link {
  padding: 7px 12px; border-radius: 9px; color: var(--ink-soft); font-weight: 500; font-size: .92rem;
}
.nav__link:hover { background: var(--canvas); text-decoration: none; }
.nav__link.is-active { color: var(--ink); background: var(--lavender-soft); }
.header__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: transparent; border: 1px solid var(--hairline); border-radius: 10px;
  padding: 8px 12px; color: var(--ink); transition: background .15s;
}
.icon-btn:hover { background: var(--canvas); }
.search-btn__text { font-size: .85rem; color: var(--muted); }
.burger { display: none; flex-direction: column; gap: 4px; padding: 10px; }
.burger span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(27, 27, 58, .45);
  backdrop-filter: blur(4px);
  display: flex; justify-content: center; padding: 9vh 16px 16px;
}
.search-panel {
  width: min(640px, 100%); background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start;
}
.search-panel__field {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--hairline); color: var(--muted);
}
.search-panel__field input { flex: 1; border: none; outline: none; font-size: 1.05rem; background: transparent; }
.search-panel__close {
  border: 1px solid var(--hairline); background: var(--canvas); border-radius: 7px;
  font-size: .72rem; padding: 4px 8px; color: var(--muted); font-family: var(--font-mono);
}
.search-results { max-height: 55vh; overflow: auto; padding: 10px; }
.search-empty { color: var(--muted); padding: 14px; text-align: center; margin: 0; }
.search-group-label {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px 4px; margin: 0;
}
.search-hit {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--ink);
}
.search-hit:hover, .search-hit.is-hover { background: var(--lavender-soft); text-decoration: none; }
.search-hit__meta { font-size: .8rem; color: var(--muted); }

/* ---------- hero ---------- */
.hero { padding: clamp(40px, 7vw, 84px) 0 30px; }
.hero__inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--emerald-deep); background: var(--emerald-soft);
  padding: 6px 12px; border-radius: 999px; margin: 0 0 18px;
}
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); }
.hero__title { font-size: clamp(2.3rem, 5vw, 3.4rem); margin-bottom: 16px; }
.grad-text {
  background: linear-gradient(100deg, var(--emerald), var(--lavender));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { font-size: 1.08rem; color: var(--ink-soft); max-width: 34rem; }
.hero__cta { display: flex; gap: 12px; margin: 24px 0 26px; flex-wrap: wrap; }
.hero__facts { display: flex; gap: 26px; flex-wrap: wrap; }
.fact { font-size: .86rem; color: var(--muted); display: inline-flex; flex-direction: column; }
.fact strong { color: var(--ink); font-size: 1.05rem; }

.glass {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}
.hero__panel { padding: 22px 24px; }
.hero__panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hero__panel-head h2 { font-size: 1rem; margin: 0; color: var(--muted); font-weight: 600; }

/* ---------- buttons / pills / chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 12px; font-weight: 600; font-size: .95rem;
  border: 1.5px solid transparent; transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--emerald); color: #fff; box-shadow: 0 6px 18px -6px rgba(16, 185, 129, .55); }
.btn--primary:hover { background: var(--emerald-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn--ghost:hover { background: var(--surface); }
.btn--block { width: 100%; }
.link-button { background: none; border: none; color: var(--emerald-deep); font-weight: 600; padding: 0; font-size: .88rem; }
.link-button:hover { text-decoration: underline; }
.link-more { font-size: .88rem; font-weight: 600; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill--up { background: var(--emerald-soft); color: var(--emerald-deep); }
.pill--down { background: var(--rose-soft); color: #b32b43; }
.pill--neutral { background: var(--lavender-soft); color: #6d4fd0; }
.pill--flat { background: var(--canvas); color: var(--muted); }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem;
  background: var(--canvas); color: var(--ink-soft); border: 1px solid var(--hairline); font-weight: 500;
}
.chip--lavender { background: var(--lavender-soft); color: #6d4fd0; border-color: transparent; }
.chip-btn {
  padding: 7px 15px; border-radius: 999px; border: 1.5px solid var(--hairline);
  background: var(--surface); color: var(--ink-soft); font-size: .85rem; font-weight: 500;
  transition: all .15s;
}
.chip-btn:hover { border-color: var(--lavender); }
.chip-btn.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.badge { display: inline-flex; padding: 3px 10px; border-radius: 7px; font-size: .72rem; font-weight: 600; }
.badge--gainers { background: var(--emerald-soft); color: var(--emerald-deep); }
.badge--losers { background: var(--rose-soft); color: #b32b43; }
.badge--demo { background: var(--amber-soft); color: var(--amber); }
.badge--stale { background: var(--canvas); color: var(--muted); border: 1px solid var(--hairline); }

/* ---------- change indicators ---------- */
.chg { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: .88rem; }
.chg--up { color: var(--emerald-deep); }
.chg--down { color: #c62b45; }
.chg--flat { color: var(--muted); }

/* ---------- sections / panels ---------- */
.section { padding: clamp(28px, 4.5vw, 52px) 0; }
.section--tight { padding-top: clamp(18px, 3vw, 30px); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-title { margin-bottom: 18px; }

.panel {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel__title { font-size: 1.02rem; margin: 0; }
.panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.movers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.data-stamp { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 10px 0 0; }

/* ---------- page head ---------- */
.page-head { padding: clamp(28px, 5vw, 46px) 0 8px; }
.page-head__sub { color: var(--muted); max-width: 46rem; margin-top: 4px; }
.page-head__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head--centered { text-align: center; padding: 12vh 0; }
.page-head--centered .hero__cta { justify-content: center; }
.breadcrumbs { display: flex; gap: 8px; font-size: .82rem; color: var(--muted); margin-bottom: 12px; align-items: center; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span:last-child { color: var(--ink); font-weight: 500; }

/* ---------- index cards ---------- */
.index-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.index-grid--wide { grid-template-columns: repeat(5, 1fr); }
.index-card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 14px 16px; transition: box-shadow .15s, transform .15s;
}
.index-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.index-card__name { font-size: .8rem; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.index-card__value { font-size: 1.22rem; font-weight: 600; }
.index-card__chg { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: .82rem; }
.index-card__abs { color: var(--muted); font-size: .78rem; }
.index-card__spark { margin-top: 10px; height: 30px; }
.index-card--skeleton { display: grid; gap: 10px; }
.index-card--skeleton span { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--hairline) 25%, #f4f4fb 50%, var(--hairline) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.index-card--skeleton span:first-child { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-panel { opacity: .75; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-inline: -8px; padding-inline: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th {
  text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1.5px solid var(--hairline);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--canvas); }
.data-table tbody tr:last-child td { border-bottom: none; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th.is-sorted::after { content: " ▾"; font-size: .7rem; }
th.is-sorted-asc::after { content: " ▴"; }
.sym-link { display: flex; flex-direction: column; color: var(--ink); }
.sym-link:hover { text-decoration: none; color: var(--emerald-deep); }
.sym-link strong { font-family: var(--font-mono); font-size: .88rem; }
.sym-name { font-size: .8rem; color: var(--muted); }
.table-empty { text-align: center; color: var(--muted); padding: 26px !important; }
.watch-toggle { padding: 6px; border-radius: 8px; }
.watch-toggle.is-added { background: var(--emerald-soft); color: var(--emerald-deep); border-color: var(--emerald); }

/* ---------- breadth ---------- */
.breadth__bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--canvas); }
.breadth__adv { background: var(--emerald); }
.breadth__unch { background: #cbd0e0; }
.breadth__dec { background: var(--rose); }
.breadth__legend { display: flex; gap: 22px; margin-top: 12px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.breadth__legend strong { color: var(--ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot--up { background: var(--emerald); }
.dot--flat { background: #cbd0e0; }
.dot--down { background: var(--rose); }

/* ---------- responsive base ---------- */
@media (max-width: 1020px) {
  .hero__inner { grid-template-columns: 1fr; }
  .index-grid, .index-grid--wide { grid-template-columns: repeat(3, 1fr); }
  .movers-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .nav {
    position: fixed; inset: calc(var(--ticker-h) + var(--header-h)) 0 auto 0;
    background: var(--surface); flex-direction: column; padding: 14px 20px 22px;
    border-bottom: 1px solid var(--hairline); box-shadow: var(--shadow-lg);
    display: none; z-index: 49;
  }
  .nav.is-open { display: flex; }
  .nav__link { padding: 12px 10px; font-size: 1rem; }
  .burger { display: inline-flex; }
  .search-btn__text { display: none; }
}
@media (max-width: 640px) {
  .index-grid, .index-grid--wide { grid-template-columns: repeat(2, 1fr); }
  .hero__facts { gap: 16px; }
  .panel { padding: 16px; border-radius: var(--radius); }
}

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

@media print {
  .ticker, .site-header, .site-footer, .toast-stack, .search-overlay { display: none !important; }
  body { background: #fff; }
}
