/* ═══════════════════════════════════════════════════════════════════════════
   Catometers
   Worldometers-inspired: dense, typographic, numbers first.
   One accent (marmalade). Light + dark. Works down to 320px.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --accent:        #d4570a;
  --accent-soft:   #fff1e4;
  --accent-line:   #f3c9a4;

  --bg:            #fbfaf8;
  --bg-alt:        #ffffff;
  --bg-sunk:       #f3f1ed;
  --surface:       #ffffff;
  --surface-hover: #fffaf5;

  --ink:           #16130f;
  --ink-2:         #45403a;
  --ink-3:         #78716a;
  --ink-4:         #a39c94;

  --line:          #e6e1da;
  --line-strong:   #d2ccc3;

  --solemn:        #5d6b7a;
  --good:          #2f7a4f;

  --shadow:        0 1px 2px rgba(22,19,15,.05), 0 6px 18px -10px rgba(22,19,15,.16);
  --shadow-pop:    0 12px 34px -8px rgba(22,19,15,.26), 0 2px 6px rgba(22,19,15,.08);

  --radius:        12px;
  --maxw:          1220px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent:        #ff8f42;
    --accent-soft:   #2e1d10;
    --accent-line:   #5c3a1e;

    --bg:            #100e0c;
    --bg-alt:        #17140f;
    --bg-sunk:       #0a0908;
    --surface:       #1a1712;
    --surface-hover: #221d16;

    --ink:           #f6f2ec;
    --ink-2:         #ccc4b9;
    --ink-3:         #978e83;
    --ink-4:         #6d655c;

    --line:          #2c261e;
    --line-strong:   #3d362c;

    --solemn:        #8fa2b5;
    --good:          #6bc48f;

    --shadow:        0 1px 2px rgba(0,0,0,.5), 0 6px 20px -10px rgba(0,0,0,.7);
    --shadow-pop:    0 14px 38px -8px rgba(0,0,0,.72), 0 2px 8px rgba(0,0,0,.5);
  }
}

:root[data-theme="dark"] {
  --accent:        #ff8f42;
  --accent-soft:   #2e1d10;
  --accent-line:   #5c3a1e;

  --bg:            #100e0c;
  --bg-alt:        #17140f;
  --bg-sunk:       #0a0908;
  --surface:       #1a1712;
  --surface-hover: #221d16;

  --ink:           #f6f2ec;
  --ink-2:         #ccc4b9;
  --ink-3:         #978e83;
  --ink-4:         #6d655c;

  --line:          #2c261e;
  --line-strong:   #3d362c;

  --solemn:        #8fa2b5;
  --good:          #6bc48f;

  --shadow:        0 1px 2px rgba(0,0,0,.5), 0 6px 20px -10px rgba(0,0,0,.7);
  --shadow-pop:    0 14px 38px -8px rgba(0,0,0,.72), 0 2px 8px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Every number on the page: tabular, so digits never shift position. */
.num, .topbar-num, .hero-num, .calc-value, .rate {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv05' 1;
}

/* ── Test banner ─────────────────────────────────────────────────────────── */

.test-banner {
  background: var(--accent);
  color: #fff;
  padding: .55rem 1rem;
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.test-banner a { color: #fff; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-alt) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .55rem 16px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: 0 0 auto; }
.brand-text {
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -.035em;
}
.brand-accent { color: var(--accent); }

.topbar-counter {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  min-width: 0;
}
.topbar-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 600;
}
.topbar-num {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.025em;
}

.theme-toggle {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 9px;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--accent); }
.theme-icon { grid-area: 1 / 1; }
.theme-icon--moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon--sun { display: none; }
  :root:not([data-theme="light"]) .theme-icon--moon { display: block; }
}
:root[data-theme="dark"] .theme-icon--sun { display: none; }
:root[data-theme="dark"] .theme-icon--moon { display: block; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 16px 2.4rem;
  text-align: center;
}
.eyebrow {
  margin: 0 0 .75rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  font-size: clamp(1.35rem, 4.4vw, 2rem);
  font-weight: 700;
  color: var(--ink-2);
}
.hero-num {
  font-size: clamp(2.6rem, 12vw, 6.4rem);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1;
  color: var(--accent);
  margin: .9rem 0 1.1rem;
  overflow-wrap: anywhere;
}
.hero-sub {
  max-width: 62ch;
  margin: 0 auto;
  color: var(--ink-3);
  font-size: .92rem;
}
.hero-links { margin: 1.1rem 0 0; font-size: .88rem; font-weight: 600; }

/* ── Bands & grids ───────────────────────────────────────────────────────── */

.band {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.6rem 16px;
}
.band--realblock { padding-top: .5rem; }

.band-head { margin-bottom: 1.35rem; }
.band-head h2 {
  font-size: clamp(1.25rem, 3.4vw, 1.6rem);
  font-weight: 800;
  padding-bottom: .55rem;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}
.band-blurb {
  margin: .8rem 0 0;
  max-width: 68ch;
  color: var(--ink-3);
  font-size: .92rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}
.grid--real { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 0.9rem;
  box-shadow: var(--shadow);
  transition: border-color .15s, background .15s;
  min-width: 0;
}
.card:hover { border-color: var(--line-strong); background: var(--surface-hover); }

.card--real { border-top: 3px solid var(--accent); }
.card--real.is-solemn { border-top-color: var(--solemn); }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  min-height: 2.5em;
}
.card-head h3 {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
  line-height: 1.3;
  flex: 1 1 auto;
  min-width: 0;
}

.stat-icon {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  color: var(--accent);
  margin-top: -1px;
}
.stat-icon--sm { width: 18px; height: 18px; }
.is-solemn .stat-icon { color: var(--solemn); }

.num {
  font-size: clamp(1.55rem, 5.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
  margin: .45rem 0 .1rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.is-solemn .num { color: var(--solemn); }
.num--funny { color: var(--ink); }

.card-foot {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .4rem 0 .15rem;
  min-height: 1.9em;
}
.rate {
  font-size: .7rem;
  color: var(--ink-4);
  font-weight: 500;
  letter-spacing: .01em;
}
.card-note {
  font-size: .68rem;
  color: var(--ink-4);
  line-height: 1.4;
  border-top: 1px dashed var(--line);
  padding-top: .35rem;
}

/* ── Info tooltips ───────────────────────────────────────────────────────── */

.info-wrap { position: relative; flex: 0 0 auto; }

.info {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 11px/1 var(--font);
  font-style: italic;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: background .15s, color .15s;
}
.info:hover, .info[aria-expanded="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100vw - 32px));
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: .8rem .9rem;
  z-index: 30;
  text-align: left;
  font-weight: 400;
}
.tip[hidden] { display: none; }
/* Cards near the right edge flip their tip so it stays on screen. */
.tip--flip { left: auto; right: 0; transform: none; }

.tip-title {
  display: block;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .4rem;
}
.tip-formula {
  margin: 0;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.tip-anchor {
  margin: .6rem 0 0;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
  font-size: .75rem;
  line-height: 1.5;
  color: var(--ink-3);
}
.tip-anchor-flag {
  display: block;
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--good);
  margin-bottom: .25rem;
}
.tip-anchor-flag--inline {
  display: inline;
  font-size: .62rem;
  white-space: nowrap;
}
.tip-scope {
  margin: .55rem 0 0;
  font-size: .68rem;
  color: var(--ink-4);
  font-style: italic;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  max-width: var(--maxw);
  margin: 1.2rem auto .4rem;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px);
}
.divider span {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-4);
  text-align: center;
}

/* ── Calculator ──────────────────────────────────────────────────────────── */

.band--calc { background: var(--bg-sunk); max-width: none; }
.band--calc > * { max-width: var(--maxw); margin-inline: auto; }

.calc {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}

.calc-controls label {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  margin-bottom: .55rem;
}
.calc-input-row { display: flex; flex-direction: column; gap: .7rem; }

#cat-age {
  width: 100%;
  font: 800 2rem/1 var(--font);
  font-variant-numeric: tabular-nums;
  padding: .45rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-alt);
  color: var(--accent);
}
#cat-age-range { width: 100%; accent-color: var(--accent); }

.calc-hint {
  margin: .8rem 0 0;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--ink-3);
}

.calc-list { list-style: none; margin: 0; padding: 0; }
.calc-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: .7rem;
  padding: .52rem 0;
  border-bottom: 1px solid var(--line);
}
.calc-row:last-child { border-bottom: 0; }
.calc-icon { display: flex; color: var(--accent); }
.calc-label { font-size: .85rem; color: var(--ink-2); min-width: 0; }
.calc-value {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  text-align: right;
}

/* ── Methodology ─────────────────────────────────────────────────────────── */

.band--method { background: var(--bg-alt); max-width: none; border-top: 1px solid var(--line); }
.band--method > * { max-width: var(--maxw); margin-inline: auto; }

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}
.method-col h3 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--accent);
  margin-bottom: .7rem;
}
.method-col h3:not(:first-child) { margin-top: 1.6rem; }
.method-col p {
  margin: 0 0 .85rem;
  font-size: .86rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 64ch;
}
.method-caveat, .method-warning {
  padding: .75rem .9rem;
  border-radius: 9px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-2);
}

.source-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--ink-3);
}
.source-list li { margin-bottom: .2rem; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  background: var(--bg-sunk);
  border-top: 1px solid var(--line);
  padding: 2rem 16px 2.6rem;
}
.footer > * { max-width: var(--maxw); margin-inline: auto; }
.disclaimer {
  font-size: .86rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 78ch;
  margin: 0 auto .9rem;
  padding: .85rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 9px 9px 0;
}
/* Made by / donate — the one place on the page asking anything of the visitor,
   so it gets the accent card treatment and sits above the small print. */
.made-by {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  max-width: 78ch;
  margin: 0 auto 1.1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.made-by-text { flex: 1 1 320px; min-width: 0; }
.made-by-line {
  margin: 0;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.made-by-line strong { color: var(--ink); }
.made-by-promise { margin-top: .3rem; color: var(--ink-3); }

.donate {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .62rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: -.01em;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.donate:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--accent) 65%, transparent);
  text-decoration: none;
}
.donate:active { transform: translateY(0); }
.donate-mark { width: 20px; height: 20px; flex: 0 0 auto; }

@media (max-width: 560px) {
  .made-by { flex-direction: column; align-items: stretch; gap: .9rem; }
  /* The row's flex-basis is a WIDTH; once stacked it would become a 320px
     HEIGHT and open a large gap above the button. Reset it. */
  .made-by-text { flex: 0 0 auto; }
  .donate { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .donate:hover { transform: none; }
}


/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .calc { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  html { scroll-padding-top: 64px; }
  .topbar-inner { padding: .45rem 16px; gap: .6rem; }
  .brand-text { font-size: 1rem; }
  .brand-mark { width: 26px; height: 26px; }
  .topbar-num { font-size: 1.05rem; }
  .topbar-label { font-size: .56rem; letter-spacing: .07em; }
  .theme-toggle { width: 32px; height: 32px; }

  .hero { padding: 2.2rem 16px 1.8rem; }
  .band { padding: 2rem 16px; }

  .grid, .grid--real { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: .85rem .9rem .8rem; }
  .card-head { min-height: 0; }
  .num { font-size: 1.85rem; }

  .tip { width: calc(100vw - 32px); }
}

@media (max-width: 380px) {
  .topbar-label { display: none; }
  .brand-text { font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
