/* ETF pages (STO-423). Builds on /stock/stock.css (ticker header, price chart)
   and the design-system tokens; sizes that are tunables live in
   /js/etf_config.js and are applied from etf.js. */

.etf-page { max-width: 1180px; margin: 0 auto; padding: 0 0 40px; }
.etf-page [hidden] { display: none !important; }

.etf-card { display: block; margin: 16px 24px 0; }
.etf-note { color: var(--muted); margin: 12px 24px; font-size: 0.9rem; }
.etf-foot { color: var(--muted); font-size: 0.78rem; margin: 10px 0 0; }

.up { color: var(--up); }
.down { color: var(--down); }

/* ── index ── */
.etf-index { padding: 24px 0 0; }
.etf-index-head { padding: 0 24px; }
.etf-index-title { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); margin: 0 0 6px; }
.etf-index-lede { color: var(--text-soft); margin: 0 0 14px; max-width: 640px; line-height: 1.5; }
.etf-index-legend { color: var(--text-soft); font-size: 12px; margin: -8px 0 14px; max-width: 640px; line-height: 1.5; }
#etf-missing { padding: 24px; }
#etf-missing a { color: var(--accent); }
.etf-filter {
  width: 100%; max-width: 360px; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text);
  font: inherit; font-size: 0.88rem;
}
.etf-filter:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent-line); }

/* ── header facts ── */
.etf-header { border-bottom: 0; }
.etf-facts {
  display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 12px 24px 0; padding: 12px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.etf-facts div { display: flex; flex-direction: column; gap: 2px; }
.etf-facts dt, .etf-facts-list dt {
  font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.etf-facts dd { margin: 0; font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 0.95rem; color: var(--text-strong); }

/* ── CAGR ── */
.etf-cagr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 40px; margin: 18px 24px 0; }
.etf-cagr-label {
  font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.etf-cagr-big { font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.etf-cagr-num { font-size: 1.5rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.etf-cagr-vs { display: block; margin-top: 4px; color: var(--muted); font-size: 0.82rem; font-family: var(--mono, 'IBM Plex Mono', monospace); }
.etf-cagr-main { padding-right: 40px; border-right: 1px solid var(--border); }

/* ── growth ── */
.etf-range { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.etf-range button {
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
  border-radius: 4px; padding: 4px 10px; font: 600 11px/1 var(--mono, 'IBM Plex Mono', monospace);
}
.etf-range button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.etf-range button:focus-visible { outline: none; box-shadow: var(--ring); }
.etf-growth-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; margin-bottom: 4px; }
.etf-lg { font-family: var(--mono, 'IBM Plex Mono', monospace); color: var(--text); }
.etf-lg::before { content: ''; display: inline-block; width: 12px; height: 3px; background: var(--c); margin-right: 6px; vertical-align: middle; }
.etf-lg-start { color: var(--muted); }
.etf-growth-chart { width: 100%; }

/* ── tables ── */
.etf-table-scroll { overflow-x: auto; }
.etf-holds { margin: 0; color: var(--text); line-height: 1.5; }
.etf-treemap { width: 100%; }

.etf-toggle {
  margin-top: 12px; border: 1px solid var(--border); background: var(--bg-panel); color: var(--text);
  border-radius: 6px; padding: 8px 14px; cursor: pointer; font: inherit; font-size: 0.85rem;
}
.etf-toggle:hover { border-color: var(--accent-line); }
.etf-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

/* Full holdings: fixed max height (set from etf_config.js), scrolls inside. */
.etf-hp-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.etf-hp-count { color: var(--muted); font-size: 0.8rem; font-family: var(--mono, 'IBM Plex Mono', monospace); }
.etf-hp-scroll { border: 1px solid var(--border); border-radius: 6px; overscroll-behavior: contain; }
.etf-hp-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.etf-hp-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-panel); text-align: left;
  border-bottom: 1px solid var(--border); padding: 0;
}
.etf-hp-table th button {
  all: unset; display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; cursor: pointer;
  font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.etf-hp-table th.num button { text-align: right; }
.etf-hp-table th[aria-sort="ascending"] button::after { content: ' ↑'; color: var(--accent); }
.etf-hp-table th[aria-sort="descending"] button::after { content: ' ↓'; color: var(--accent); }
.etf-hp-table th button:focus-visible { box-shadow: inset var(--ring); }
.etf-hp-table td {
  padding: 0 10px; border-bottom: 1px solid var(--border-soft); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px;
}
.etf-hp-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono, 'IBM Plex Mono', monospace); }
.etf-hp-table td.sym { font-family: var(--mono, 'IBM Plex Mono', monospace); }
.etf-hp-table td a { color: var(--accent); text-decoration: none; }
.etf-hp-table td.empty { padding: 16px 10px; color: var(--muted); text-align: center; }

/* ── fund facts ── */
.etf-facts-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 24px; margin: 0; }
.etf-facts-list dd { margin: 2px 0 0; color: var(--text-strong); }

@media (max-width: 700px) {
  .etf-card { margin: 12px 12px 0; }
  .etf-facts, .etf-cagr { margin-left: 14px; margin-right: 14px; }
  .etf-index-head { padding: 0 14px; }
  .etf-cagr-main { border-right: 0; padding-right: 0; width: 100%; }
  .etf-cagr-big { font-size: 2.1rem; }
  .etf-hp-table td.sector, .etf-hp-table th[data-key="sector"] { display: none; }
}
