:root {
  --bg: #eef3f3;
  --panel: #ffffff;
  --ink: #15343a;
  --muted: #5b7479;
  --line: #d6e2e2;
  --accent: #17777c;
  --chip: #f3f7f7;
  --up: #a8410b;
  --down: #17777c;
  font-size: 16px;
}
:root[data-theme="dark"] {
  --bg: #0f1c1e;
  --panel: #172a2d;
  --ink: #e8f1f1;
  --muted: #9db3b6;
  --line: #2b4447;
  --accent: #5ec4bf;
  --chip: #1f3639;
  --up: #f0a070;
  --down: #5ec4bf;
}
:root.big { font-size: 20px; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.55; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 12px; }

/* Persistent link back to the portfolio. In normal flow, so it never covers content. */
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--accent); text-decoration: underline; }
.back-link:focus-visible { outline-offset: -3px; border-radius: 8px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.toggles { display: flex; gap: 18px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: background 0.2s; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }

.intro { padding: 48px 0 24px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 600; font-size: 0.875rem; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 14px; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 42em; margin: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 1.25rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 0.875rem; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); cursor: pointer; min-height: 40px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .chip.on { color: #0f1c1e; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 12px 0 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--chip); border-radius: 12px; padding: 14px; }
.stat span { display: block; font-size: 0.8rem; color: var(--muted); }
.stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.facts { margin: 14px 0 6px; }
details { color: var(--muted); }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }

#graph { width: 100%; height: auto; background: #fff; border-radius: 10px; display: block; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; max-width: 420px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
td.up { color: var(--up); font-weight: 600; }
td.down { color: var(--down); font-weight: 600; }

.foot { color: var(--muted); font-size: 0.875rem; padding-bottom: 40px; }

@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
