/* apu.tools – shared structure. Colours and personality live in theme.css. Mobile first. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque-latin-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* Tokens from apustaja.io */
:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --bg-alt: #0f110d;
  --surface: #141513;
  --surface-2: #1a1c18;
  --border: #252822;
  --border-strong: #33372e;
  --text: #f5f7f2;
  --muted: #9b9f96;
  --faint: #6b7066;
  --green: #74a84a;
  --lime: #a1f666;
  --green-deep: #334f21;
  --mint: #f3f9ee;
  --font-ui: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: var(--font-ui);
  --radius: 20px;
  --radius-sm: 12px;
  --gutter: clamp(16px, 4vw, 32px);
  --container: 1120px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* chart */
  --chart-total: var(--green);
  --chart-total-fill: rgba(116, 168, 74, .42);
  --chart-fill-end: rgba(116, 168, 74, .03);
  --chart-w1: #a1f666;
  --chart-w2: #74a84a;
  --chart-w3: #4b7a2c;
  --chart-w1-fill: rgba(161, 246, 102, .55);
  --chart-w2-fill: rgba(116, 168, 74, .5);
  --chart-w3-fill: rgba(51, 79, 33, .85);
  --chart-grid: rgba(245, 247, 242, .06);
  --chart-tick: #8a8f84;
  --chart-crosshair: rgba(245, 247, 242, .35);
  --chart-marker: rgba(255, 206, 0, .55);
  --chart-marker-text: #e9d27a;
  --chart-zoom-fill: rgba(161, 246, 102, .12);
  --chart-zoom-border: rgba(161, 246, 102, .6);
  --tt-swatch: var(--faint);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}
main { flex: 1; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }

.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 10; padding: 8px 14px; border-radius: 999px; background: var(--lime); color: #0b0b0b; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 6px; }

/* ---- header ---- */
.site-header { position: relative; z-index: 2; }
.site-header__inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand__logo { width: 32px; height: 32px; border-radius: 50%; }
.brand__name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand__tld { color: var(--lime); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .15s, background .15s; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"] { color: var(--lime); background: rgba(116, 168, 74, .16); }

/* ---- footer ---- */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); }
.site-footer__inner { padding-block: 20px 28px; font-size: 13px; color: var(--faint); }

/* ---- splash ---- */
.hero { padding-block: 32px 28px; }
.hero__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(40px, 11vw, 84px); line-height: .98; letter-spacing: -.045em; }
.hero__lede { margin-top: 14px; color: var(--muted); font-size: clamp(16px, 2.4vw, 19px); }
.accent { color: var(--green); }

.tools { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tools { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .tools { grid-template-columns: repeat(3, 1fr); } }
.tool-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s; }
.tool-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.tool-card__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: rgba(116, 168, 74, .14); color: var(--lime); }
.tool-card__icon svg { width: 34px; height: 34px; }
.tool-card__body { display: grid; gap: 2px; }
.tool-card__title { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.tool-card__blurb { color: var(--muted); font-size: 14px; line-height: 1.4; }
.tool-card__go { grid-column: 1 / -1; justify-self: start; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--lime); background: rgba(116, 168, 74, .16); }

/* ---- Apu badge: ring text around a dark-green disc with the hoodie Apu inside ---- */
.badge { position: relative; width: 220px; aspect-ratio: 1; }
.badge__ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.badge__ring text { font-family: var(--font-ui); font-size: 15px; font-weight: 700; fill: var(--lime); }
.badge__disc { position: absolute; inset: 14%; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 38% 32%, #3d6031, #1d3018 78%); box-shadow: 0 0 0 3px #5b8f3f, 0 12px 44px rgba(0, 0, 0, .4); }
.badge__disc img { position: absolute; max-width: none; width: 92%; height: auto; left: -3%; top: 4%; }

/* ---- tool page ---- */
.tool-head { padding-block: 24px 18px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tool-head__title { margin-top: 6px; font-family: var(--font-display); font-weight: 800; font-size: clamp(36px, 9vw, 64px); line-height: 1; letter-spacing: -.04em; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; }
.stat { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.stat dt { color: var(--muted); }
.stat dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .unit { color: var(--muted); font-weight: 500; }

.chart-card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); padding: 12px 10px 10px; }
@media (min-width: 720px) { .chart-card { padding: 16px 18px 12px; } }
.chart-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 10px; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--green); color: #0b0b0b; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; min-height: 36px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background .2s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .2s var(--ease); }
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: #0b0b0b; }
.switch input:checked ~ * , .switch:has(input:checked) { color: var(--text); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--lime); outline-offset: 2px; }

.chart-box { position: relative; height: clamp(300px, 58vh, 460px); }
.chart-box[aria-busy="true"] canvas { opacity: .5; transition: opacity .2s; }
.chart-box canvas { touch-action: pan-y; }
.chart-error { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.tooltip { position: absolute; z-index: 3; min-width: 190px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(15, 17, 13, .96); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); pointer-events: none; font-size: 13px; }
.tt-time { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.tt-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; line-height: 1.7; }
.tt-swatch { width: 10px; height: 10px; border-radius: 3px; }
.tt-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.tt-total { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); font-weight: 700; }

.chart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 8px 4px 0; font-size: 12px; color: var(--faint); }
.zoom-hint { margin-left: auto; }
/* drag-to-zoom is mouse-only (chartjs-plugin-zoom drag), so don't promise it on touch screens */
@media (pointer: coarse) { .zoom-hint { display: none; } }
.reset-zoom { margin-left: auto; border: 1px solid var(--border-strong); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--lime); cursor: pointer; }

.source { margin-top: 14px; font-size: 13px; color: var(--faint); line-height: 1.6; }
.source a { color: var(--muted); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.source a:hover { color: var(--text); }
.addr { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

.notfound { padding-block: 64px; }
.notfound p { margin-top: 16px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
