/* AI Trends Index page (/trends and /trends/<topic>).
   Loaded after style.css, so it inherits the
   site's tokens (--bg, --gold, --ink, fonts, .wrap, .btn, .site-header,
   .site-footer) and only adds what this page needs. Nothing here touches a
   class the production pages use. */

.tp-body { background: var(--bg); }

.tp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- hero: compact, data starts almost immediately ---- */
.tp-hero { padding: 40px 0 8px; }
.tp-hero-inner { display: block; }
.tp-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.5px;
  text-transform: none;
  color: var(--ink);
}
.tp-lede { margin: 10px 0 4px; font-size: clamp(16px, 2vw, 19px); color: var(--ink); }
.tp-sub { margin: 0; max-width: 56ch; font-size: 13.5px; line-height: 1.5; color: var(--ink-faint); }
.tp-hero-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-alt);
}
.tp-range-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-faint); }
.tp-range-note { flex-basis: 100%; }
.tp-live { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.tp-dot { width: 9px; height: 9px; border-radius: 50%; background: #5fc08a; box-shadow: 0 0 0 0 rgba(95, 192, 138, 0.55); animation: tp-pulse 2.8s ease-out infinite; }
@keyframes tp-pulse { 70% { box-shadow: 0 0 0 9px rgba(95, 192, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(95, 192, 138, 0); } }
.tp-range { display: flex; gap: 6px; }
.tp-range-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.tp-range-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.tp-range-btn.is-on { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.tp-range-note { margin: 0; min-height: 16px; font-size: 11.5px; color: var(--ink-faint); }

/* ---- shared section chrome ---- */
.tp-section { padding: 34px 0; }
.tp-section-tight { padding: 8px 0 26px; }
.tp-head { margin-bottom: 16px; }
.tp-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.tp-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-faint); }
.tp-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.tp-note { margin: 12px 0 0; font-size: 12px; color: var(--ink-faint); }
.tp-link { font-size: 13px; color: var(--gold); }

/* ---- biggest movers ---- */
.tp-movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-alt);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s;
}
.tp-card:hover, .tp-card:focus-visible { border-color: var(--line-strong); background: var(--bg-alt-2); transform: translateY(-2px); }
.tp-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tp-card-name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.tp-card-rank { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tp-score { font-family: var(--font-display); font-size: 42px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tp-change { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-up { color: #6fa8e0; }
.tp-down { color: #e08a5e; }
.tp-flat { color: var(--ink-faint); }
.tp-status {
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}
.tp-spark { display: block; width: 100%; height: 34px; overflow: visible; }
.tp-spark path { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tp-spark .tp-spark-area { fill: currentColor; opacity: .10; stroke: none; }
.tp-coverage { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-faint); }
.tp-dots { display: inline-flex; gap: 4px; }
.tp-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.tp-dots i.on { background: var(--gold); }

/* ---- how to read ---- */
.tp-read {
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-dim);
  border-radius: 14px;
  background: rgba(230, 206, 142, 0.05);
}
.tp-read h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 17px; text-transform: none; letter-spacing: 0; }
.tp-read ul { margin: 0 0 8px; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.tp-read p { margin: 0 0 8px; font-size: 13px; color: var(--ink-faint); }

/* ---- tools ---- */
.tp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tp-search input, .tp-sort select {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.tp-search input::placeholder { color: var(--ink-faint); }
.tp-search input:focus-visible, .tp-sort select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.tp-compare-btn.is-on { border-color: var(--gold); color: var(--gold); }

/* ---- compare ---- */
.tp-compare { margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-alt); }
.tp-compare-help { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-faint); }
.tp-compare-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tp-pick {
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: none;
  color: var(--ink-soft); font: inherit; font-size: 12.5px; cursor: pointer;
}
.tp-pick.is-on { border-color: var(--gold); color: var(--gold); background: rgba(230, 206, 142, 0.08); }
.tp-compare-rows { display: grid; gap: 10px; }
.tp-compare-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.tp-bar { position: relative; height: 8px; border-radius: 999px; background: rgba(243, 232, 200, 0.09); overflow: hidden; }
.tp-bar span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--gold); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.tp-bar-mid { position: absolute; top: -3px; bottom: -3px; left: 50%; width: 1px; background: rgba(243, 232, 200, 0.35); }

/* ---- table ---- */
.tp-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-alt); }
.tp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tp-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tp-table td { padding: 12px 14px; border-bottom: 1px solid rgba(243, 232, 200, 0.07); vertical-align: middle; }
.tp-table tr:last-child td { border-bottom: 0; }
.tp-table tbody tr { transition: background .2s; }
.tp-table tbody tr:hover { background: rgba(243, 232, 200, 0.04); }
.tp-num { text-align: right; }
.tp-table td.tp-num { font-variant-numeric: tabular-nums; }
.tp-topic { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.tp-move { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tp-row-score { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.tp-open {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: none;
  color: var(--ink-soft); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.tp-open:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ---- breakout / cooling lists ---- */
/* Breakout and Cooling: the two columns share rows, so a heading that wraps to
   two lines doesn't push its list below the one beside it. */
.tp-two { display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; row-gap: 14px; align-items: start; }
@media (min-width: 861px) {
  /* breakout above cooling, each across the full width: the cards flow in rows, and an empty breakout is a slim notice */
  .tp-two { grid-template-columns: 1fr; }
  .tp-two .tp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-two .tp-list > .tp-empty { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .tp-two .tp-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tp-two > div:has(#tp-breakout .tp-empty) > .tp-head p { display: none; }
  .tp-two > div:has(#tp-breakout .tp-empty) > .tp-head { margin-bottom: 0; }
}
@media (min-width: 861px) {
  /* flatten the two column wrappers and place the parts explicitly, so both
     headings share row 1 and both lists share row 2 */
  .tp-two > div { display: contents; }
  .tp-two > div:nth-child(1) > .tp-head { grid-area: 1 / 1; }
  .tp-two > div:nth-child(2) > .tp-head { grid-area: 3 / 1; margin-top: 14px; }
  .tp-two > div:nth-child(1) > .tp-list { grid-area: 2 / 1; }
  .tp-two > div:nth-child(2) > .tp-list { grid-area: 4 / 1; }
}
.tp-list { display: grid; gap: 10px; }
.tp-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-alt);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.tp-item:hover, .tp-item:focus-visible { border-color: var(--line-strong); background: var(--bg-alt-2); }
.tp-item-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.tp-item-why { margin-top: 3px; font-size: 12px; color: var(--ink-faint); }
.tp-item-score { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-empty { padding: 16px; border: 1px dashed var(--line); border-radius: 13px; font-size: 13px; color: var(--ink-faint); }

/* ---- snapshot card ---- */
.tp-snapshot { display: flex; justify-content: center; }
.tp-head-center { text-align: center; }
.tp-snap-tools { justify-content: center; margin-top: 16px; }
.tp-note-center { text-align: center; }
.tp-snap {
  width: min(420px, 100%);
  padding: 26px 26px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(230, 206, 142, 0.14), transparent 60%),
    linear-gradient(150deg, var(--bg-alt-2), var(--bg));
}
.tp-snap-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; color: var(--gold); }
.tp-snap h3 { margin: 8px 0 2px; font-family: var(--font-display); font-size: 26px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.tp-snap-date { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-faint); }
.tp-snap ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.tp-snap li { display: grid; grid-template-columns: 20px 1fr auto auto; align-items: baseline; gap: 10px; font-size: 14px; color: var(--ink); }
.tp-snap li i { font-style: normal; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tp-snap-foot { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-faint); }

/* ---- detail panel ---- */
.tp-panel[hidden] { display: none; }
.tp-panel { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; background: rgba(10, 6, 20, 0.72); overflow-y: auto; }
.tp-panel-card {
  position: relative;
  width: min(760px, 100%);
  margin: auto;
  padding: 26px 26px 30px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--bg-alt);
  animation: tp-rise .22s ease-out;
}
@keyframes tp-rise { from { opacity: 0; transform: translateY(10px); } }
.tp-panel-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--ink-soft); font-size: 14px; cursor: pointer;
}
.tp-panel-close:hover { color: var(--gold); border-color: var(--gold-dim); }
.tp-panel h3 { margin: 0; font-family: var(--font-display); font-size: 26px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.tp-panel h4 { margin: 22px 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.tp-panel-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; }
.tp-signals { display: grid; gap: 8px; }
.tp-signal { display: grid; grid-template-columns: 1fr 74px 96px; align-items: center; gap: 12px; font-size: 13px; }
.tp-signal-meta { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tp-missing { color: var(--ink-faint); font-style: italic; }
.tp-drivers { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.tp-coverage-list { display: grid; gap: 8px; }
.tp-cov-item { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.tp-cov-item:hover { border-color: var(--gold-dim); }
.tp-cov-meta { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-faint); }
.tp-chart { width: 100%; height: 190px; overflow: visible; }
.tp-chart .tp-grid { stroke: rgba(243, 232, 200, 0.09); stroke-width: 1; }
.tp-chart .tp-mid { stroke: rgba(243, 232, 200, 0.28); stroke-width: 1; stroke-dasharray: 4 5; }
.tp-chart path.tp-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tp-chart .tp-area { opacity: .12; stroke: none; }
.tp-chart text { font-family: var(--font-body); font-size: 10px; fill: var(--ink-faint); }
.tp-chart .tp-event { stroke: var(--gold-dim); stroke-width: 1; stroke-dasharray: 3 4; }
.tp-chart-controls { display: flex; gap: 6px; margin: 4px 0 10px; }
.tp-events { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 12px; color: var(--ink-faint); }

/* ---- responsive: the table becomes cards, controls scroll ---- */
@media (max-width: 860px) {
  .tp-two { grid-template-columns: 1fr; gap: 24px; }
  .tp-hero { padding-top: 26px; }
  .tp-hero-inner { align-items: flex-start; }
  .tp-tools { width: 100%; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tp-tools::-webkit-scrollbar { display: none; }
  .tp-search input { min-width: 180px; }
  .tp-table-wrap { border: 0; background: none; overflow: visible; }
  .tp-table, .tp-table tbody, .tp-table tr, .tp-table td { display: block; width: 100%; }
  .tp-table thead { display: none; }
  .tp-table tr {
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-alt);
  }
  .tp-table td { padding: 0; border: 0; }
  .tp-table td + td { margin-top: 8px; }
  .tp-table td.tp-num { text-align: left; }
  .tp-table td::before {
    content: attr(data-label) " ";
    font-size: 10.5px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-right: 8px;
  }
  .tp-table td.tp-cell-topic::before, .tp-table td.tp-cell-actions::before { content: none; }
  .tp-cell-topic { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .tp-signal { grid-template-columns: 1fr 60px; }
  .tp-signal .tp-signal-meta { grid-column: 1 / -1; }
  .tp-compare-row { grid-template-columns: 96px 1fr 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .tp-dot { animation: none; }
  .tp-card, .tp-item, .tp-bar span, .tp-panel-card { transition: none; animation: none; }
  .tp-spark path, .tp-chart path { transition: none; }
}

/* ---- topic page ---- */
.tp-topic-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; margin-bottom: 6px; }
.tp-topic-head h1 { margin: 0; font-family: var(--font-display); font-size: clamp(32px, 4vw, 46px); text-transform: none; letter-spacing: -0.5px; color: var(--ink); }
.tp-back { display: inline-block; margin-bottom: 18px; font-size: 13px; color: var(--ink-faint); }
.tp-back:hover { color: var(--gold); }
.tp-topic-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 860px) { .tp-topic-grid { grid-template-columns: 1fr; gap: 22px; } }
/* one column on phones: each block keeps its own heading above its list */
.tp-panel-block { padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-alt); }
.tp-panel-block h2 { margin: 0 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.tp-history-empty { padding: 26px; border: 1px dashed var(--line); border-radius: 13px; font-size: 13px; color: var(--ink-faint); text-align: center; }
/* section nav in the header of /trends and the topic pages */
.tp-nav-inline { display: flex; flex-wrap: wrap; gap: 20px; margin-left: auto; font-size: 13px; }
.tp-nav-inline a { color: var(--ink-faint); text-decoration: none; }
.tp-nav-inline a:hover, .tp-nav-inline a:focus-visible { color: var(--gold); }
@media (max-width: 860px) {
  .tp-body .header-inner { flex-wrap: wrap; }
  .tp-nav-inline { width: 100%; margin: 8px 0 0; justify-content: center; gap: 16px; }
}

/* Phones: get the first mover card onto the first screen. */
@media (max-width: 760px) {
  .tp-hero { padding: 20px 0 4px; }
  .tp-hero h1 { font-size: 32px; }
  .tp-lede { margin: 8px 0 0; font-size: 16px; }
  .tp-sub { display: none; }          /* the same point is made in "How to read the score" */
  .tp-hero-side { margin-top: 12px; padding: 10px 12px; gap: 8px 12px; }
  .tp-live { font-size: 12px; }
  .tp-range-note { font-size: 11px; }
  .tp-section { padding: 22px 0; }
  .tp-head { margin-bottom: 12px; }

  /* the cards were ~470px tall, mostly empty while history is still short */
  .tp-movers { gap: 10px; }
  .tp-card { padding: 14px 16px; gap: 7px; }
  .tp-card .tp-score { font-size: 34px; }
  .tp-card .tp-spark { height: 26px; }
  .tp-card .tp-spark:empty { display: none; }
  .tp-nav-inline { gap: 14px; font-size: 12.5px; }
  .tp-nav-inline a { padding: 7px 0; }
}

/* Phones: three lines per topic instead of seven labelled rows.
   line 1  name ....... score  vs normal  change
   line 2  trend  signals ............... details */
@media (max-width: 760px) {
  .tp-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 12px 14px; }
  .tp-table td { display: inline-flex; width: auto; align-items: baseline; gap: 6px; margin: 0; }
  .tp-table td + td { margin-top: 0; }
  .tp-table td::before { font-size: 10px; }

  .tp-cell-topic { flex: 1 1 auto; }
  .tp-cell-topic .tp-topic { font-size: 15.5px; }
  .tp-table td[data-label="Score"] { margin-left: auto; }
  .tp-table td[data-label="Score"]::before { content: none; }
  .tp-table td[data-label="Score"] .tp-row-score { font-size: 21px; }

  .tp-table td[data-label="Change vs normal"] { flex-basis: auto; }
  .tp-table td[data-label="Change vs normal"]::before { content: "vs normal"; }
  .tp-table td[data-label="Trend"]::before { content: none; }
  .tp-table td[data-label="Change vs normal"], .tp-table td[data-label="Trend"] { order: 1; }

  .tp-table td[data-label="7-day score"], .tp-table td[data-label="History"] { display: none; }

  .tp-table td[data-label="Signals"] { order: 2; }
  .tp-table td[data-label="Signals"]::before { content: none; }
  .tp-cell-actions { order: 3; margin-left: auto; }
  .tp-open { padding: 7px 14px; }
}

/* ---- dials and scales: the score shown as a position against normal (50),
   drawn from the same number the table prints ---- */
.tp-gauge { display: block; width: 100%; height: auto; overflow: visible; }
.tp-gauge path { fill: none; stroke-linecap: round; }
.tp-gauge-track { stroke: rgba(243, 232, 200, 0.09); }
.tp-gauge-value { stroke: currentColor; }
.tp-gauge-tick { stroke: rgba(243, 232, 200, 0.55); stroke-width: 2; }
.tp-gauge-dot { fill: currentColor; stroke: var(--bg); stroke-width: 3; }
.tp-gauge.tp-up { color: #6fa8e0; }
.tp-gauge.tp-down { color: #e08a5e; }
.tp-gauge.tp-flat { color: var(--gold); }

.tp-overall { display: grid; justify-items: center; gap: 4px; margin: 22px auto 0; max-width: 260px; text-align: center; min-height: 236px; }
.tp-overall.is-loading > * { visibility: hidden; }
.tp-overall-dial { position: relative; width: 220px; }
.tp-overall-num {
  position: absolute; left: 0; right: 0; bottom: 2px;
  font-family: var(--font-display); font-size: 50px; line-height: 1; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tp-overall-scale { display: flex; justify-content: space-between; width: 240px; font-size: 10.5px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-faint); }
.tp-overall-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 10px; }
.tp-overall-label { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-soft); }

.tp-card-dial { position: relative; width: 150px; max-width: 100%; margin: 2px auto 0; }
.tp-card-dial .tp-score { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 34px; }

.tp-cell-scale { width: 160px; }
.tp-scale { position: relative; display: block; height: 8px; border-radius: 999px; background: rgba(243, 232, 200, 0.09); }
.tp-scale-mid { position: absolute; top: -4px; bottom: -4px; left: 50%; width: 2px; margin-left: -1px; border-radius: 1px; background: rgba(243, 232, 200, 0.45); }
.tp-scale-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: currentColor; transition: left .8s cubic-bezier(.2,.7,.2,1), width .8s cubic-bezier(.2,.7,.2,1); }
.tp-scale-dot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--bg-alt); }
.tp-scale.tp-up { color: #6fa8e0; }
.tp-scale.tp-down { color: #e08a5e; }
.tp-scale.tp-flat { color: var(--gold); }

/* "How to read the score" folds on phones; its heading is the toggle */
details.tp-read > summary { list-style: none; cursor: pointer; }
details.tp-read > summary::-webkit-details-marker { display: none; }
details.tp-read > summary h2 { display: inline; }
details.tp-read > summary::after { content: ' ▾'; color: var(--gold); font-size: 13px; }
details.tp-read[open] > summary::after { content: ' ▴'; }
details.tp-read[open] > summary { margin-bottom: 8px; }
.tp-table tbody tr { cursor: pointer; }

@media (min-width: 861px) {
  .tp-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) 260px; column-gap: 40px; align-items: center; }
  .tp-hero-copy { grid-column: 1; }
  .tp-overall { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .tp-hero-side { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tp-scale-fill { transition: none; }
}

/* ---- phones: dials and scales instead of a stack of boxes ---- */
@media (max-width: 760px) {
  .tp-overall { margin-top: 16px; }

  /* four movers as a 2x2 of small dials */
  .tp-movers { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tp-card { padding: 10px 10px 10px; gap: 4px; border-radius: 14px; }
  .tp-card-top { justify-content: center; }
  .tp-card-name { font-size: 13.5px; text-align: center; }
  .tp-card-rank, .tp-card .tp-coverage { display: none; }
  .tp-card-dial { width: 120px; }
  .tp-card-dial .tp-score { font-size: 28px; }
  .tp-card-row { flex-direction: column; gap: 4px; }
  .tp-card .tp-change { font-size: 12px; }
  .tp-card .tp-status { font-size: 9.5px; padding: 2px 8px; }

  details.tp-read { padding: 12px 14px; }
  details.tp-read > summary h2 { font-size: 15px; }

  /* the table: one card, one line per topic -- name, scale, score, change */
  .tp-table-wrap { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-alt); padding: 2px 12px; }
  .tp-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px 30px 52px;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 11px 0;
    border: 0;
    border-bottom: 1px solid rgba(243, 232, 200, 0.07);
    border-radius: 0;
    background: none;
  }
  .tp-table tr:last-child { border-bottom: 0; }
  .tp-table td { display: block; width: auto; margin: 0; }
  .tp-table td::before { content: none !important; }
  .tp-cell-topic { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  .tp-cell-topic .tp-topic { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tp-cell-topic .tp-move { display: none; }
  .tp-cell-scale { width: auto; }
  .tp-table td[data-label="Score"] { margin: 0; text-align: right; }
  .tp-table td[data-label="Score"] .tp-row-score { font-size: 18px; }
  .tp-table td[data-label="Change vs normal"] { text-align: right; }
  .tp-table td[data-label="Change vs normal"] .tp-change { font-size: 12px; }
  .tp-table td[data-label="Trend"],
  .tp-table td[data-label="Signals"],
  .tp-table td[data-label="7-day score"],
  .tp-table td[data-label="History"],
  .tp-cell-actions { display: none !important; }
}

/* phones: search, sort and compare on one line */
@media (max-width: 760px) {
  .tp-tools:has(.tp-search) { flex-wrap: nowrap; gap: 6px; overflow: visible; }
  .tp-tools:not(:has(.tp-search)) .btn { padding: 11px 16px; font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
  .tp-search { flex: 1 1 auto; min-width: 0; }
  .tp-search input { width: 100%; min-width: 0; padding: 9px 12px; }
  .tp-sort select { padding: 9px 10px; }
  .tp-compare-btn { flex: 0 0 auto; padding: 9px 12px; font-size: 10.5px; letter-spacing: 0.8px; min-height: 40px; }
}
@media (max-width: 760px) {
  .tp-tools:has(.tp-search) .tp-sort { flex: 0 0 auto; }
  /* overflow-x:auto on the other tool rows clipped the first button's rounded edge */
  .tp-tools:not(:has(.tp-search)) { overflow: visible; flex-wrap: wrap; }
  .tp-tools:has(.tp-search) .tp-sort select { width: 100%; }
  .tp-tools:has(.tp-search) .tp-compare-btn { padding: 9px 10px; font-size: 10px; letter-spacing: 0.5px; }
}

/* Space held for the blocks that arrive with the data. Without it the page
   jumped 0.114 (Cumulative Layout Shift) about a second after it opened. */
.tp-movers { min-height: 236px; }
.tp-table-wrap { min-height: 430px; }
.tp-list { min-height: 168px; }
@media (min-width: 861px) {
  #tp-breakout { min-height: 56px; }
  #tp-cooling { min-height: 132px; }
}
@media (max-width: 760px) {
  .tp-overall { min-height: 210px; }
  .tp-movers { min-height: 430px; }   /* two rows of two */
  .tp-table-wrap { min-height: 420px; }
  .tp-list { min-height: 120px; }
  #tp-breakout { min-height: 64px; }
}

/* phones: the Now / 7D switch and the updated line come first, then the big gauge */
@media (max-width: 759px) {
  .tp-hero-inner { display: flex; flex-direction: column; }
  .tp-hero-copy { order: 1; }
  .tp-hero-side { order: 2; margin-top: 12px; }
  .tp-overall { order: 3; margin-top: 14px; }
  .tp-range-note { display: none; }
}
