/* XiNi.app shared styles: tokens, light/dark, nav, tiles, figures, charts,
   tooltips and footer. Used by the front page and the analysis page. */

:root {
  --bg: #f5f5f7;
  --tile: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hairline: rgba(0, 0, 0, 0.08);
  --grid: rgba(0, 0, 0, 0.12);
  --link: #0066cc;
  --accent: #0071e3;
  /* Gain / loss: validated pair (blue / orange), colour-blind safe. */
  --gain: #0071e3;
  --loss: #e8590c;
  --tint: linear-gradient(150deg, #eaf2ff 0%, #f4efff 48%, #fff1e8 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.05), 0 24px 48px rgba(0, 0, 0, 0.10);
  --tip-bg: rgba(29, 29, 31, 0.92);
  --tip-text: #f5f5f7;
  --nav-bg: rgba(251, 251, 253, 0.8);
  --nav-link: rgba(29, 29, 31, 0.72);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --tile: #161617;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --hairline: rgba(255, 255, 255, 0.10);
    --grid: rgba(255, 255, 255, 0.18);
    --link: #2997ff;
    --accent: #0071e3;
    --gain: #2997ff;
    --loss: #e8590c;
    --tint: linear-gradient(150deg, #0d1a33 0%, #1a1530 50%, #2a1609 100%);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 48px rgba(0, 0, 0, 0.6);
    --tip-bg: rgba(245, 245, 247, 0.94);
    --tip-text: #1d1d1f;
    --nav-bg: rgba(22, 22, 23, 0.8);
    --nav-link: rgba(245, 245, 247, 0.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.022em; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.display, h1, h2, h3, .num {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Navigation: translucent glass, light or dark with the page ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
}
.nav-inner {
  max-width: 1024px; margin: 0 auto; height: 48px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.wordmark { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.nav a.nav-link { font-size: 0.75rem; color: var(--nav-link); letter-spacing: -0.01em; transition: color .2s ease; }
.nav a.nav-link:hover { color: var(--text); }
.nav a.nav-link + a.nav-link { margin-left: 24px; }

/* ---------- Sections ---------- */
.section { max-width: 1024px; margin: 0 auto; padding: 96px 22px 0; }
main > .section:first-of-type { padding-top: 56px; }
.section:last-of-type { padding-bottom: 112px; }
.section-head { margin: 0 0 32px; font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.08; font-weight: 700; letter-spacing: -0.035em; }
.section-head span { color: var(--text-3); }
.section-head:has(+ .intro) { margin-bottom: 8px; }
.intro { margin: 0 0 32px; font-size: 1.1875rem; line-height: 1.4; color: var(--text-2); letter-spacing: -0.016em; }


.tile {
  position: relative; background: var(--tile); border-radius: 28px; padding: 32px;
  box-shadow: var(--shadow); overflow: hidden;
}

.kicker { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); letter-spacing: -0.005em; }
.kicker .new { color: var(--loss); margin-right: 8px; }

.actions { margin-top: auto; padding-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.pill {
  display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: 980px;
  background: var(--accent); color: #fff; font-size: 1.0625rem; font-weight: 400; letter-spacing: -0.02em;
  transition: background-color .2s ease, transform .1s ease-out;
}
.pill:hover { background: #0077ed; }
.pill:active { transform: scale(0.97); }
.link-more { color: var(--link); font-size: 1.0625rem; }
.link-more::after { content: " ›"; }
.link-more:hover { text-decoration: underline; }

.stat-label { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.stat-sub { margin-top: 2px; font-size: 0.8125rem; color: var(--text-3); letter-spacing: -0.005em; }
.big { margin-top: 14px; display: flex; align-items: baseline; gap: 10px; font-size: clamp(2.5rem, 5vw, 3.5rem); line-height: 1; font-weight: 600; letter-spacing: -0.045em; }
.dir { --c: var(--text-3); display: inline-block; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; transform: translateY(-0.18em); }
.dir.gain { --c: var(--gain); } .dir.loss { --c: var(--loss); }
.dir.up { border-bottom: 11px solid var(--c); }
.dir.down { border-top: 11px solid var(--c); }
/* A figure with a unit (e.g. "+45,000 homes") wraps the unit rather than overflow. */
.big { flex-wrap: wrap; row-gap: 4px; }
.big.long { font-size: clamp(1.75rem, 3vw, 2.25rem) !important; }
/* Who a winner or loser is: named in bold above the figure. */
.name { margin-top: 8px; font-size: 1.0625rem; line-height: 1.3; font-weight: 600; color: var(--text); letter-spacing: -0.016em; text-wrap: balance; }
.name + .big { margin-top: 10px; }
.also { margin-top: 6px; font-size: 0.8125rem; line-height: 1.35; color: var(--text-3); letter-spacing: -0.005em; }
.money { margin-top: 8px; font-size: 0.9375rem; font-weight: 500; color: var(--text-2); letter-spacing: -0.012em; }
.kicker .cat { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--hairline); font-weight: 500; color: var(--text-3); }
.note { margin: 14px 4px 0; font-size: 0.8125rem; line-height: 1.5; color: var(--text-3); letter-spacing: -0.005em; }
.unit { font-size: 0.875rem; font-weight: 500; color: var(--text-3); letter-spacing: -0.01em; }

/* Charts: thin marks, recessive baseline, labels in ink not series colour. */
.chart { display: block; width: 100%; height: auto; overflow: visible; margin-top: 22px; }
.chart .zero { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { opacity: .12; }
.chart .dot { stroke: var(--tile); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .lbl { font-size: 12px; fill: var(--text-3); letter-spacing: 0; }
.t-dist .chart .val { font-size: 17px; }
.chart .val { font-size: 12px; font-weight: 600; fill: var(--text); letter-spacing: 0; }
.s-gain { stroke: var(--gain); } .f-gain { fill: var(--gain); }
.s-loss { stroke: var(--loss); } .f-loss { fill: var(--loss); }
.s-flat { stroke: var(--text-3); } .f-flat { fill: var(--text-3); }
.bars path { transition: opacity .15s ease; }
.bars:hover path { opacity: .45; }
.bars path:hover, .bars path.on { opacity: 1; }
.axis { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.75rem; color: var(--text-3); letter-spacing: 0; }

.wl + .wl { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.wl .big { font-size: 2.25rem; margin-top: 8px; }
.wl .who { margin-top: 6px; font-size: 0.875rem; line-height: 1.3; color: var(--text-2); letter-spacing: -0.01em; }


.tip {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 12px));
  padding: 8px 12px; border-radius: 10px; background: var(--tip-bg); color: var(--tip-text);
  font-size: 0.8125rem; line-height: 1.35; letter-spacing: -0.005em; white-space: nowrap;
  transition: opacity .12s ease;
}
.tip.show { opacity: 1; }
.tip b { font-weight: 600; }

.empty { text-align: center; padding: 80px 22px; border-radius: 28px; background: var(--tile); box-shadow: var(--shadow); color: var(--text-2); }
.empty strong { display: block; color: var(--text); font-size: 1.5rem; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.025em; }

footer { background: var(--bg); }
footer .inner {
  max-width: 1024px; margin: 0 auto; padding: 20px 22px 44px; border-top: 1px solid var(--hairline);
  font-size: 0.75rem; line-height: 1.5; color: var(--text-3); letter-spacing: -0.005em;
}
footer p { margin: 0 0 8px; max-width: 72em; }
footer .links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 14px; font-size: 0.8125rem; }
footer .links a { color: var(--text-2); }
footer .links a:hover { color: var(--text); text-decoration: underline; }

/* Tables: on phones the label column stays put while the years scroll. */
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th, .t td { padding: 13px 10px; text-align: right; border-top: 1px solid var(--hairline); font-size: 0.9375rem; letter-spacing: -0.01em; }
.t thead th { border-top: 0; font-size: 0.8125rem; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.t td { white-space: nowrap; }
.t th:first-child, .t td:first-child { text-align: left; padding-left: 0; white-space: normal; min-width: 9em; }
.t td:first-child { font-weight: 500; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 600px) {
  .t th:first-child, .t td:first-child { position: sticky; left: 0; z-index: 1; background: var(--tile); min-width: 8.5em; max-width: 9.5em; padding-right: 10px; box-shadow: 1px 0 0 var(--hairline); }
}


@media (max-width: 600px) {
  .tile { padding: 26px; border-radius: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .pill:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .tile { box-shadow: none; border: 1px solid var(--text-3); }
}
