@keyframes tpRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tpPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--pulse); } 50% { box-shadow: 0 0 0 6px transparent; } }

:root {
  --surface: var(--bg-2);
  --grid: rgba(167, 139, 250, .09);
  --axis: rgba(167, 139, 250, .26);
  --wash: rgba(167, 139, 250, .24);          /* the series' own band */
  --shade-paused: rgba(156, 159, 194, .1);
  --shade-off: rgba(248, 113, 113, .16);
  --budget: rgba(198, 200, 226, .5);
}

/* ---------- hero ---------- */
.tp-hero {
  text-align: center;
  padding: clamp(28px, 5vw, 52px) var(--gutter) clamp(18px, 3vw, 28px);
  background:
    radial-gradient(ellipse 70% 120% at 50% 0%, rgba(167, 139, 250, .1), transparent 70%),
    linear-gradient(#0d0f33, var(--bg));
}
.tp-hero > div { animation: tpRise .7s ease-out both; }
.tp-hero h1 { font-size: clamp(28px, 4.6vw, 44px); font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.tp-hero p { margin: 14px auto 0; max-width: 600px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.tp-hero strong { color: var(--ink-2); }

/* ---------- right now ---------- */
.tp-now {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 36px;
  margin-top: 8px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--line);
  --dot: var(--fainter); --pulse: transparent;
}
.tp-now[data-state="ok"] { --dot: var(--ok); --pulse: rgba(16, 185, 129, .5); }
.tp-now[data-state="slow"] { --dot: var(--amber); --pulse: rgba(251, 191, 36, .5); }
.tp-now[data-state="bad"], .tp-now[data-state="off"] { --dot: var(--red); }
.tp-now[data-state="paused"] { --dot: var(--muted); }
.tp-now-main { display: flex; align-items: baseline; gap: 10px; }
.tp-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--dot); align-self: center;
  animation: tpPulse 2s ease-in-out infinite;
}
.tp-now-v { font-size: 52px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.tp-now-u { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tp-now-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.tp-now-facts div { min-width: 0; }
.tp-now-facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.tp-now-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.tp-now-facts dd small { font-weight: 500; color: var(--faint); font-size: 12.5px; }
.tp-now-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .tp-now { padding: 16px; gap: 12px 24px; }
  .tp-now-v { font-size: 44px; }
}

/* ---------- filters ---------- */
.tp-filters {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px;
  margin: 28px 0 16px;
}
.tp-filters .seg button { padding: 8px 14px; min-height: 36px; font-size: 11px; white-space: nowrap; }
.tp-shade-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tp-updated { margin-left: auto; font: 11.5px var(--mono); color: var(--faint); }
@media (max-width: 640px) {
  .tp-filters .seg { width: 100%; }
  .tp-filters .seg button { flex: 1; padding: 8px 6px; justify-content: center; letter-spacing: .04em; }
  .tp-updated { margin-left: 0; }
}
.key { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px var(--sans); color: var(--muted); }
.sw { display: inline-block; flex-shrink: 0; width: 12px; height: 12px; border-radius: 2px; }
.sw-line { width: 14px; height: 2px; border-radius: 1px; background: var(--accent); }
.sw-wash { background: var(--wash); }
.sw-paused { background: rgba(156, 159, 194, .3); }
.sw-off { background: rgba(248, 113, 113, .45); }
.sw-budget { width: 14px; height: 1px; border-radius: 0; background: var(--budget); }

.tp-error { margin: 0 0 16px; padding: 12px 16px; border: 1px solid rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); color: #fecaca; font-size: 13px; }
#tp-body { transition: opacity .25s; }
#tp-body.loading { opacity: .5; }

/* ---------- KPI tiles (hairline cells) ---------- */
.tp-kpis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.tp-kpis > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi { background: var(--surface); padding: 14px 16px 15px; min-width: 0; }
.kpi-l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.kpi-v { margin-top: 6px; font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; line-height: 1.15; }
.kpi-v small { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.kpi-sub { margin-top: 4px; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-coverage { margin: 10px 0 0; font-size: 12px; color: var(--faint); }

/* ---------- chart cards ---------- */
.tp-card { background: var(--surface); border: 1px solid var(--line); padding: 18px 20px 16px; margin-top: 16px; min-width: 0; }
.tp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.tp-card-title { font-size: 14px; font-weight: 800; color: var(--ink); margin: 0; }
.tp-card-sub { margin: 4px 0 10px; font-size: 12px; color: var(--faint); line-height: 1.5; }
.tp-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; }
@media (max-width: 680px) { .tp-card { padding: 16px 14px 14px; } }

.tp-chart { position: relative; width: 100%; min-height: 80px; }
.tp-chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.tp-chart text { font-family: var(--mono); }
.tp-chart .ax { font-size: 10.5px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.tp-chart .note { font: 600 11px var(--sans); fill: var(--muted); }
.tp-chart .peak { font-size: 11px; font-weight: 700; fill: var(--ink-2); }
.tp-chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.tp-chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.tp-chart .budget { stroke: var(--budget); stroke-width: 1; shape-rendering: crispEdges; }
.tp-chart .sh-p { fill: var(--shade-paused); }
.tp-chart .sh-d { fill: var(--shade-off); }
.tp-chart .band { fill: var(--wash); }
.tp-chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tp-chart .pt { fill: var(--accent); }
.tp-chart .hit { fill: transparent; cursor: crosshair; outline: none; }
.tp-chart .hit:focus-visible { fill: rgba(167, 139, 250, .05); stroke: var(--accent-2); stroke-width: 1; }
.tp-chart .cross line { stroke: var(--ink-2); stroke-opacity: .45; stroke-width: 1; }
.tp-chart .cross circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tp-chart .now-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

/* ---------- tooltip ---------- */
.tp-tip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 170px; max-width: 280px;
  background: rgba(17, 19, 47, .97); border: 1px solid var(--line-2); padding: 9px 11px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5); font-size: 12px; color: var(--muted);
}
.tp-tip[hidden] { display: none; }
.tt-t { font-weight: 700; color: var(--ink-2); margin-bottom: 5px; font-size: 11.5px; }
.tt-r { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.tt-r b { font: 700 12px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.tt-k { width: 12px; height: 2px; border-radius: 1px; flex-shrink: 0; background: var(--accent); }
.tt-k.wash { height: 8px; border-radius: 2px; background: var(--wash); }
.tt-k.none { background: none; }
.tt-k.paused { height: 8px; border-radius: 2px; background: rgba(156, 159, 194, .3); }
.tt-k.off { height: 8px; border-radius: 2px; background: rgba(248, 113, 113, .45); }

/* ---------- table view ---------- */
.tp-table { margin-top: 14px; border-top: 1px solid var(--line-3); padding-top: 10px; }
.tp-table summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
}
.tp-table summary::-webkit-details-marker { display: none; }
.tp-table summary::before { content: "+"; font: 700 13px var(--mono); color: var(--accent); width: 10px; }
.tp-table[open] summary::before { content: "−"; }
.tp-table summary:hover { color: var(--ink-2); }
.tv-wrap { overflow-x: auto; margin-top: 10px; max-height: 420px; overflow-y: auto; }
.tv { width: 100%; border-collapse: collapse; font-size: 12px; }
.tv th, .tv td { padding: 5px 10px; border-bottom: 1px solid var(--line-3); text-align: left; white-space: nowrap; }
.tv thead th { position: sticky; top: 0; background: var(--surface); color: var(--faint); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-bottom-color: var(--line); }
.tv tbody th { color: var(--ink-2); font-weight: 600; }
.tv .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.tv thead .n { font-family: var(--sans); }
.tv .st { color: var(--muted); }

/* ---------- explainer ---------- */
.tp-explain { padding-top: 48px; }
.tp-explain h2 { margin-bottom: 18px; }
.tp-explain-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tp-explain-grid > div { border-left: 2px solid var(--line-2); padding: 2px 0 2px 16px; }
.tp-explain-grid h3 { font-size: 14px; margin-bottom: 6px; }
.tp-explain-grid p { margin: 0; font-size: 13px; line-height: 1.6; }
.site-footer code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* page slide: arrives from the right, like the other inner pages */
::view-transition-old(root) { animation: vt-to-left-dim .45s cubic-bezier(.2, .8, .25, 1) both; }
::view-transition-new(root) { animation: vt-from-right .45s cubic-bezier(.2, .8, .25, 1) both; box-shadow: -16px 0 48px rgba(0, 0, 0, .55); }
