/* bodymath daylight theme: the home page and every calculator page share one pixel sky (sky.js)
   and the same light "island" panels and buttons. Loaded after site.css and overrides its colours,
   borders and type. Moving between pages is a view transition: the sky and the title stay put while
   the page content fades/drops out and the next one rises in. */

:root {
  --bg: #e7ebf8;                 /* the sky */
  --text: #1d1b2e;
  --ink: #242424;                /* icons and the outlines on meters, bars and pins: near-black, as before */
  --ink-soft: #4d5170;
  --muted: #6c7090;
  --dim: #8d91ab;
  --line: #e1e4f3;
  --lav: #bcb2f6;
  --lav-dark: #1d1b2e;           /* no light-purple text anywhere: every "accent" text is the dark text colour */
  --lav-line: #d5d8ee;
  --lav-soft: #eeedfc;
  --card: #f7f8fd;
  --paper: #ffffff;
  --px-shadow: none;
  --track: .06em;

  --panel: #f7f8fd;              /* the island */
  --panel-edge: #cdd1ea;
  --panel-lip: #bfc4e4;
  --tabs: #e3e6f4;               /* segmented track */
  --tab: #ffffff;
  --tab-lip: #c6cae6;
  --tile: #ffffff;               /* buttons / cards inside the island */
  --tile-edge: #d5d8ee;
  --tile-hover: #aeb3dc;
  --tile-lip: #c8cce8;
  --arrow: #9a9eba;
  --accent: #bcb2f6;
  --accent-edge: #aa9ff0;
  --accent-lip: #8c80dc;
  --accent-ink: #1d1b2e;
  --vt: "VT323", "Courier New", monospace;
  --fs-xs: 16.667px;
  --fs-s: 20px;
  --fs-m: 22px;
  --fs-l: 25px;
  --fs-xl: 41.667px;
}

html { background: var(--bg); }
body { background: transparent; -webkit-tap-highlight-color: transparent; }
#sky {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0; pointer-events: none;
}
main, .site-header, .site-footer { position: relative; z-index: 1; }

/* ---------- Title: "✦ bodymath.io" (home page h1, calculator pages' link home) ---------- */
.brand { text-align: center; }
.brand h1, .brand-mark {
  margin: 0; font-family: var(--vt); font-size: var(--fs-xl); font-weight: 400; line-height: 1; letter-spacing: 0;
  display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; text-shadow: none;
}
.brand h1 svg, .brand-mark svg { flex: none; display: block; margin-top: -2px; }
.brand .io, .brand-mark .io { color: var(--muted); }
.brand p { margin: 14px 0 0; color: var(--muted); font-family: var(--vt); font-size: var(--fs-s); line-height: 1; }

/* ---------- Calculator pages: title + "calculators" menu (built by layout.js) ---------- */
.site-header {
  position: relative; top: auto; background: none; border: 0; text-align: center;
  padding: max(30px, env(safe-area-inset-top)) 16px 0; z-index: 20;
}
.site-header .nav { display: block; width: fit-content; margin: 14px auto 0; }
.nav-toggle {
  font-family: var(--vt); font-size: var(--fs-s); letter-spacing: 0; text-transform: none; line-height: 1;
  color: var(--text); background: var(--tab); border: 1px solid var(--tile-edge); border-radius: 10px;
  box-shadow: 0 3px 0 var(--tab-lip); padding: 7px 14px 6px; text-shadow: none; gap: 9px;
}
.nav-toggle:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tab-lip); }
.nav-toggle::after { border-top-color: var(--accent-lip); }
.nav-menu {
  top: calc(100% + 10px); min-width: 250px; padding: 6px; text-align: left;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: 0 5px 0 var(--panel-lip), 0 16px 32px rgba(40, 36, 90, .14);
}
.nav-menu a {
  font-family: var(--vt); font-size: 21px; letter-spacing: 0; text-transform: none; line-height: 1.1;
  padding: 7px 12px; border-radius: 8px; color: var(--text);
}
.nav-menu a:hover, .nav-menu a:focus-visible, .nav-menu a[aria-current="page"] { background: var(--lav-soft); }
.nav-menu .nav-home { border-bottom: 1px dashed var(--lav-line); margin-bottom: 4px; padding-bottom: 4px; }
.nav-menu .nav-home a { color: var(--lav-dark); }

/* ---------- Calculator header: icon + title straight on the sky (no dark banner) ---------- */
.hero.sm {
  background: none; color: var(--text); border: 0; border-radius: 0; overflow: visible;
  margin: 0 auto 14px; padding: 34px 0 4px;
}
.hero::before, .hero::after, .hero .stars { display: none !important; }
.hero.sm .px { filter: none; opacity: .88; height: 52px; margin: 0 auto 14px; }
.hero.sm .px.ico-dumbbell { height: 38px; margin: 8px auto 20px; }
.hero.sm .px.ico-bars { height: 44px; margin: 6px auto 16px; }
.hero.sm h1 {
  font-family: var(--vt); font-weight: 400; font-size: 37.5px; line-height: 1; letter-spacing: 0;
  text-transform: none; text-shadow: none; margin: 0; color: var(--text);
}
@media (max-width: 560px) { .hero.sm h1 { font-size: 33.333px; letter-spacing: 0; margin-right: 0; } }   /* smaller than the bodymath.io title above it */
.lede { color: var(--ink-soft); font-size: 22px; letter-spacing: 0; }
.lede-sub { color: var(--muted); }
.section-title { font-family: var(--vt); text-transform: none; letter-spacing: 0; }

/* ---------- The island: calculator card ---------- */
.calc {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 18px;
  box-shadow: 0 5px 0 var(--panel-lip); padding: 24px 20px 22px;
}
@media (max-width: 560px) { .calc { padding: 22px 16px 20px; box-shadow: 0 5px 0 var(--panel-lip); border-radius: 18px; } }
.calc h2, .results h2 {
  font-family: var(--vt); font-weight: 400; font-size: 28px; line-height: 1.1; letter-spacing: 0;
  text-transform: none; text-shadow: none; color: var(--text);
}
@media (max-width: 560px) { .calc h2 { font-size: 28px; letter-spacing: 0; line-height: 1.1; } }

/* small pixel labels and section titles: dark caps, like the titles on the home page */
.field label, .field .label, .goal-k, .calc .sub-h, .big .k, .stat .k, .goal-target .k, .goal-target .u,
.lift-head .k, .part-name, .learn-k, .meter-labels, .gauge-tick, .tl-y, .tl-done, .method summary,
.test-info .t-name, table.tbl th, .next-k {
  letter-spacing: .1em; text-shadow: none;
}
.field label, .field .label { font-size: 18px; color: var(--text); }
.label-row > span:last-child, #bf-out, #steps-out { color: var(--text); letter-spacing: .04em; }
@media (max-width: 560px) { .field .label-row { font-size: 17px; letter-spacing: .08em; } }
.big .k, .stat .k, .goal-target .k, .lift-head .k { color: var(--text); }
.goal-k, .calc .sub-h, .learn-k { color: var(--text); }
@media (max-width: 560px) { .goal-k { font-size: 21px; letter-spacing: .1em; } .calc .sub-h { font-size: 19px; letter-spacing: .1em; } }
.field .hint, .goal-hint, .goal-foot, .note, .range-ends, .goal-ticks span { color: var(--muted); }

/* inputs: white fields with a soft lip */
input[type="number"], input[type="date"], select {
  color: var(--text); background-color: var(--tile); border: 1px solid var(--tile-edge); border-radius: 10px;
  box-shadow: 0 3px 0 var(--tile-lip);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* sliders: a soft track with the lavender tile as the handle */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 30px; margin: 4px 0 0; cursor: pointer; }
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent-lip); outline-offset: 2px; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: var(--tabs); border: 1px solid var(--tile-edge); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 8px;
  background: var(--accent); border: 1px solid var(--accent-edge); box-shadow: 0 3px 0 var(--accent-lip);
}
input[type="range"]::-moz-range-track { height: 10px; border-radius: 999px; background: var(--tabs); border: 1px solid var(--tile-edge); }
input[type="range"]::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 8px; background: var(--accent); border: 1px solid var(--accent-edge); box-shadow: 0 3px 0 var(--accent-lip); }

/* segmented toggles: the home page's tab track */
.seg { gap: 4px; padding: 4px; background: var(--tabs); border-radius: 11px; }
.seg button {
  font-family: var(--vt); font-size: var(--fs-s); letter-spacing: 0; text-transform: none; line-height: 1;
  background: transparent; color: var(--muted); border: 0; border-radius: 8px; padding: 9px 6px 8px; text-shadow: none;
}
.seg button:hover { background: transparent; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--tab); color: var(--text); box-shadow: 0 3px 0 var(--tab-lip); text-shadow: none; }
.seg button:focus-visible { outline: 2px solid var(--accent); }
@media (max-width: 560px) {
  .seg button { font-size: 19px; letter-spacing: 0; padding: 9px 4px 8px; }
  .goal-tabs button { font-size: 18px; letter-spacing: 0; padding: 9px 2px 8px; }
}

/* buttons: the lavender tile */
.btn {
  font-family: var(--vt); font-size: 26px; letter-spacing: .02em; text-transform: none; line-height: 1;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent-edge); border-radius: 12px;
  padding: 11px 30px 10px; text-shadow: none; box-shadow: 0 4px 0 var(--accent-lip);
}
.btn:hover { transform: none; box-shadow: 0 4px 0 var(--accent-lip); filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-lip); }
.next-btn, .learn-btn { font-size: 20px; padding: 8px 18px 7px; letter-spacing: 0; }
@media (max-width: 560px) { .next-btn { font-size: 19px; letter-spacing: 0; } }

/* white tiles inside the island */
.big, .stat, .tbl-wrap, .lift-card, .part, .tdee-fig, .faq details, .method, .food, .chart, .gym, .trail,
.bf-card:not(.photo), .test-info, .callout {
  background: var(--tile); border: 1px solid var(--tile-edge); border-radius: 14px; box-shadow: 0 4px 0 var(--tile-lip);
}
.stat.hl, .callout-tip { background: var(--lav-soft); }
.test-info, .callout { border-left: 6px solid var(--accent); }
.big .v, .stat .v, .goal-target .v, .lift-head .lvl, .part-k, .tf-total { text-shadow: none; color: var(--text); }
.big .v small, .stat .v small, .goal-target .u { color: var(--muted); }
.big .s, .stat .s, .lift-sub, .goal-sub, .goal-diff, .tf-cap { color: var(--ink-soft); }
.lift-head .lvl { color: var(--lav-dark); }
.results { border-top: 1px dashed var(--panel-edge); }
.info { border: 1px solid var(--tile-edge); background: var(--lav-soft); color: var(--lav-dark); box-shadow: 0 2px 0 var(--tile-lip); }
.info:hover, .info[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.info-pop { background: var(--text); color: #f1eff8; box-shadow: 0 4px 0 var(--accent-lip); border-radius: 10px; }
.info-pop b { color: #ffffff; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl th { background: var(--lav-soft); color: var(--text); border-color: var(--line); font-size: 16px; }
table.tbl th, table.tbl td { border-color: var(--line); }
table.tbl td + td, table.tbl th + th { border-left-color: var(--line); }

/* "next up" card: a lavender tile */
.next-card {
  background: var(--lav-soft); border: 1px solid var(--accent-edge); border-radius: 16px; box-shadow: 0 5px 0 var(--accent-lip);
}
.next-card:hover { transform: none; box-shadow: 0 5px 0 var(--accent-lip); }
.next-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-lip); }
.next-k { color: var(--lav-dark); }
.next-h { font-family: var(--vt); font-size: 28px; letter-spacing: 0; text-transform: none; text-shadow: none; line-height: 1.05; }
@media (max-width: 560px) { .next-h { font-size: 26px; letter-spacing: 0; } }
.next-card p { color: var(--ink-soft); }

/* TDEE goal target */
.goal-target { background: var(--lav-soft); border: 1px solid var(--accent-edge); border-radius: 16px; box-shadow: 0 5px 0 var(--accent-lip); }
.goal-target .v { text-shadow: none; }
.goal-rate { border: 1px solid var(--accent-edge); box-shadow: 0 3px 0 var(--accent-lip); letter-spacing: .06em; }
.goal-diff { border-top-color: var(--lav-line); }

/* meters and bars keep their segment lines, drawn in indigo */
.gym-bar { background: var(--tabs); }
.gym-fill, .lvl-track span.on { background: repeating-linear-gradient(to bottom, var(--accent) 0 2px, #a79ced 2px 3px); }
.tl-bar i { background: var(--accent); }
.z-target { background: var(--accent); color: var(--accent-ink); text-shadow: none; }
.gauge-pin span { background: var(--text); box-shadow: 0 2px 0 var(--accent-lip); }
.lvl-track { background: var(--tabs); }

/* learn / article sections */
.learn-h, .learn-end h3, .article h2, .article h3 {
  font-family: var(--vt); font-weight: 400; letter-spacing: 0; text-transform: none; text-shadow: none; color: var(--text);
}
.learn-h { font-size: clamp(30px, 7vw, 38px); line-height: 1.05; }
.learn-end h3 { font-size: 26px; line-height: 1.1; }
.article h2 { font-size: clamp(28px, 5vw, 34px); line-height: 1.1; }
.article h3 { font-size: 24px; }
@media (max-width: 560px) { .learn-h { font-size: 32px; letter-spacing: 0; } }
.learn-sub { color: var(--ink-soft); }
.learn-end { background: var(--lav-soft); border: 1px solid var(--accent-edge); border-radius: 16px; box-shadow: 0 5px 0 var(--accent-lip); }
.part-share { border-color: var(--lav-line); }
.faq details { box-shadow: 0 4px 0 var(--tile-lip); }
.food { background: var(--tile); }
.food-h { background: var(--lav-soft); color: var(--text); text-shadow: none; letter-spacing: .1em; }
.food-h i { border-color: var(--text); }
.food li { border-color: var(--lav-line); }
hr.rule { border-top-color: var(--panel-edge); }
.callout-tip { border-left-color: var(--accent-lip); }
@keyframes rk-max { from { background: var(--lav); } to { background: var(--accent-lip); } }   /* strength footer meter flashing at max */
/* body fat guide: white photo cards on the soft track instead of the dark slab */
.bf-cards:has(.bf-card.photo) { background: var(--tabs); border-radius: 14px; }
.bf-card.photo { background: var(--tile); border: 1px solid var(--tile-edge); box-shadow: 0 3px 0 var(--tile-lip); }
.bf-card.photo .r { background: var(--tile); border: 1px solid var(--tile-edge); color: var(--text); text-shadow: none; }
.bf-card.photo:hover { background: var(--tile); border-color: var(--tile-hover); }
.bf-card.photo[aria-pressed="true"] { background: var(--lav-soft); border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent); }
.bf-card.photo[aria-pressed="true"] .r { background: var(--accent); border-color: var(--accent-edge); color: var(--accent-ink); }
.bf-card .r { text-shadow: none; }
.cta a, .article .closing a { color: var(--lav-dark); }

/* ---------- Dropdowns: FAQ, "how this is calculated", test steps, body fat guide ----------
   Questions in pixel type with a "Q" badge and a +/- tile; answers in a cleaner, smaller sans on a soft
   tinted panel, with pixel-square bullets, numbered step badges and highlighted key phrases. */
.faq details, .method { overflow: hidden; }
.faq summary, .method summary {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 26px; align-items: center; gap: 12px;
  padding: 13px 14px; list-style: none; cursor: pointer;
  font-family: var(--vt); font-size: 22px; line-height: 1.12; letter-spacing: 0; text-transform: none; color: var(--text);
}
.faq summary::-webkit-details-marker, .method summary::-webkit-details-marker { display: none; }
.faq summary::before, .method summary::before {          /* the badge */
  content: "Q"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  font-family: "Jersey 10", var(--vt); font-size: 19px; line-height: 1; color: var(--accent-ink);
  background: var(--accent); border: 1px solid var(--accent-edge); box-shadow: 0 2px 0 var(--accent-lip);
}
.method summary::before { content: "i"; }
.faq summary::after, .method summary::after {           /* the +/- tile */
  content: "+"; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  font-family: "Jersey 10", var(--vt); font-size: 20px; line-height: 1; color: var(--text);
  background: var(--tabs); border: 1px solid var(--tile-edge); box-shadow: 0 2px 0 var(--tile-lip);
  transition: background .15s;
}
.faq details[open] summary::after, .method[open] summary::after { content: "\2212"; background: var(--accent); border-color: var(--accent-edge); box-shadow: 0 2px 0 var(--accent-lip); }
.faq summary:hover::after, .method summary:hover::after { background: var(--lav-soft); }
.faq details[open] summary:hover::after, .method[open] summary:hover::after { background: var(--accent); }
.faq details[open] summary, .method[open] summary { border-bottom: 1px dashed var(--panel-edge); }
.method summary { font-size: 21px; }
.faq summary::before, .faq summary::after, .method summary::before, .method summary::after { align-self: start; }   /* stay level with the first line of a long question */

.faq .body, .method .body {
  padding: 14px 18px 16px 54px; background: var(--panel);
  font-family: var(--sans); font-size: 14.5px; line-height: 1.62; color: var(--ink-soft);
  animation: bm-open .28s ease-out;
}
.faq .body p, .method .body p { margin: 0 0 10px; }
.faq .body > :last-child, .method .body > :last-child { margin-bottom: 0; }
.faq .body > p:first-child { color: var(--text); font-size: 15px; }
.faq .body strong, .faq .body b, .method .body strong, .method .body b, .test-info li b, .test-info li strong {
  font-weight: 600; color: var(--text); background: linear-gradient(transparent 58%, #e1dcfb 58%); padding: 0 2px;
}
.faq .body a, .method .body a { color: var(--text); text-decoration-color: var(--accent-lip); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.faq .body ul, .method .body ul { list-style: none; margin: 8px 0 12px; padding: 0; }
.faq .body ul li, .method .body ul li { position: relative; margin: 6px 0; padding-left: 20px; }
.faq .body ul li::before, .method .body ul li::before {
  content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px;
  background: var(--accent); box-shadow: 2px 2px 0 var(--accent-lip);
}
.faq .body ol, .method .body ol, .test-info ol { list-style: none; counter-reset: step; margin: 8px 0 12px; padding: 0; }
.faq .body ol li, .method .body ol li, .test-info ol li { counter-increment: step; position: relative; margin: 7px 0; padding-left: 32px; }
.faq .body ol li::before, .method .body ol li::before, .test-info ol li::before {
  content: counter(step); position: absolute; left: 0; top: .05em; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center; font-family: "Jersey 10", var(--vt); font-size: 16px; line-height: 1; color: var(--accent-ink);
  background: var(--lav-soft); border: 1px solid var(--accent-edge); box-shadow: 0 2px 0 var(--accent-lip);
}
.faq .body p.tldr {
  margin: 0 0 12px; padding: 10px 12px 11px; border-radius: 10px; background: var(--lav-soft);
  border: 1px solid var(--accent-edge); box-shadow: 0 2px 0 var(--accent-lip); color: var(--text); font-size: 15px; line-height: 1.5;
}
.faq .body .tldr-k {
  display: inline-block; margin: 0 8px 0 0; padding: 2px 7px 1px; border-radius: 6px; vertical-align: 1px;
  font-family: "Jersey 10", var(--vt); font-size: 14px; line-height: 1.1; letter-spacing: .08em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink);
}
.faq .body .foods { margin: 10px 0 2px; }
.faq .body .food { border-radius: 12px; }
.faq .body .food-h { font-size: 15px; padding: 7px 12px; }
.faq .body .food ul { padding: 10px 12px; margin: 0; }
.faq .body .food li { padding: 4px 8px 3px; margin: 0; font-family: var(--vt); font-size: 17px; line-height: 1; color: var(--text); background: var(--tile); }
.faq .body .food li::before { content: none; }
@keyframes bm-open { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 560px) {
  .faq summary, .method summary { grid-template-columns: 26px minmax(0, 1fr) 24px; gap: 10px; font-size: 21px; padding: 12px 12px; }
  .faq summary::before, .method summary::before { width: 26px; height: 26px; font-size: 18px; }
  .faq summary::after, .method summary::after { width: 24px; height: 24px; }
  .faq .body, .method .body { padding: 13px 14px 15px 14px; }
}
@media (prefers-reduced-motion: reduce) { .faq .body, .method .body { animation: none; } }

/* VO2 test card: "How to do the test" in purple, steps as numbered badges in a clean sans */
.test-info summary {
  display: inline-flex; align-items: center; gap: 8px; list-style: none; margin-top: 4px;
  font-family: var(--vt); font-size: 20px; color: #6f69d4;
}
.test-info summary::-webkit-details-marker { display: none; }
.test-info summary::before {
  content: ""; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-left: 7px solid #6f69d4; transition: transform .15s;
}
.test-info details[open] summary::before { transform: rotate(90deg); }
.test-info ol { margin: 10px 0 2px; font-family: var(--sans); font-size: 14px; line-height: 1.55; color: var(--ink-soft); animation: bm-open .28s ease-out; }
.test-info li { margin-bottom: 0; }

/* "Not sure? Use the body fat guide": a small toggle button instead of a bare link */
.bf-guide summary {
  display: inline-flex; align-items: center; gap: 9px; list-style: none; text-decoration: none;
  padding: 6px 12px 6px 7px; border-radius: 10px; background: var(--tab); border: 1px solid var(--tile-edge);
  box-shadow: 0 3px 0 var(--tab-lip); font-family: var(--vt); font-size: 19px; line-height: 1; color: var(--text);
}
.bf-guide summary::-webkit-details-marker { display: none; }
.bf-guide summary::before {
  content: "+"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  font-family: "Jersey 10", var(--vt); font-size: 17px; background: var(--accent); border: 1px solid var(--accent-edge); color: var(--accent-ink);
}
.bf-guide[open] summary::before { content: "\2212"; }
.bf-guide summary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tab-lip); }

/* ---------- Home page ---------- */
main.home { width: 100%; max-width: 480px; margin: 0 auto; padding: max(30px, env(safe-area-inset-top)) 24px 44px; --gap: 34px; }
.hero-box {
  position: relative; width: min(100vw, 560px);
  margin: var(--gap) 0 0 calc((100% - min(100vw, 560px)) / 2); aspect-ratio: 640 / 294;
}
.hero-box .hero-stage { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.hero-box .hero-stage text { font-family: "Jersey 10", "VT323", monospace; letter-spacing: 2px; }
.hero-box .hero-stage .hs-l { fill: var(--text); font-size: 26px; }
.hero-box .hero-stage .hs-v { fill: var(--text); font-size: 40px; }
.hero-box .hero-stage .hs-u { fill: var(--muted); font-size: 22px; }
.hero-box .hero-stage .hl { fill: none; stroke: #2b2942; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 0.1 7; opacity: .55; }
.hero-box .hero-stage .hlm { fill: none; stroke: #fff; stroke-width: 10; }
.hero-box .hero-stage .hd circle { fill: #8a85e0; }
.hero-box .hero-stage .hd .hd-glow { fill: #b9b4f2; opacity: .45; }
.hero-box .hero-stage .hd-dots { opacity: .8; }
.hero-box .hero-stage .hm-fig { fill: var(--bg); stroke: #3d3974; stroke-width: 1.3px; stroke-linejoin: round; filter: none; }

/* Typing (home tagline, calculator subtitles): a terminal-style block cursor sitting on the next letter.
   The cursor is that letter's own cell (letter hidden, cell filled), so it always lines up exactly and the
   line never reflows; at the very end it becomes a zero-width block after the last letter. */
.typer { font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }   /* VT323's "fi" ligature would type the i early and swallow the cursor */
.typer .tl-off { visibility: hidden; }
.typer .tl-cur { color: transparent; }
.typer.caret .tl-cur { background: linear-gradient(var(--caret, var(--muted)), var(--caret, var(--muted))) 0 62% / 100% 74% no-repeat; }
.typer.caret.idle .tl-cur { animation: tl-blink 1.05s steps(1) infinite; }
.typer.end .tl-cur { display: inline-block; width: .5em; height: 1em; margin-right: -.5em; vertical-align: -.16em; }
.typer:not(.caret) .tl-cur { background: none; }
@keyframes tl-blink { 50% { background-size: 0 0; } }

.panel {
  margin-top: var(--gap); background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 18px;
  padding: 22px 18px 20px; box-shadow: 0 5px 0 var(--panel-lip);
}
.ph { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.ph h2 { margin: 0; font-family: var(--vt); font-size: var(--fs-l); font-weight: 400; line-height: 1; letter-spacing: 0; text-transform: none; text-shadow: none; }
.sq { width: 10px; height: 10px; background: var(--accent); box-shadow: 3px 3px 0 var(--accent-lip); margin: -4px 3px 0 0; flex: none; }
.tabs { display: flex; gap: 4px; margin: 16px 0; padding: 4px; background: var(--tabs); border-radius: 11px; }
.tab {
  flex: 1 1 0; appearance: none; border: 0; margin: 0; padding: 7px 2px 6px; border-radius: 8px; background: transparent;
  color: var(--muted); font-family: var(--vt); font-size: var(--fs-s); line-height: 1; white-space: nowrap; cursor: pointer; transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--tab); color: var(--text); box-shadow: 0 3px 0 var(--tab-lip); }
.tab:focus-visible, .tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; padding-bottom: 4px; container-type: inline-size; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px 11px 12px; border-radius: 12px; background: var(--tile); border: 1px solid var(--tile-edge);
  box-shadow: 0 4px 0 var(--tile-lip); color: var(--text); text-decoration: none; font-family: var(--vt);
  font-size: 20px; font-size: min(var(--fs-m), calc(((100cqw - 10px) / 2 - 25px) / 6));   /* longest line, "How Long Should", fits */
  line-height: 1.02; transition: transform .08s ease, box-shadow .08s ease, border-color .15s;
}
.tile .ar { position: absolute; top: 12px; left: 12px; color: var(--arrow); display: block; }
.tile .ic { position: absolute; top: 10px; right: 10px; height: 32px; width: auto; max-width: 42px; display: block; opacity: .82; }
.tile:hover { border-color: var(--tile-hover); }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--tile-lip); }
.tile.hot { background: var(--accent); border-color: var(--accent-edge); box-shadow: 0 4px 0 var(--accent-lip); color: var(--accent-ink); }
.tile.hot .ar { color: var(--accent-ink); }
.tile.hot .ic { opacity: .9; }
.tile.hot:active { box-shadow: 0 1px 0 var(--accent-lip); }
.tile[hidden] { display: none; }
.tile.wide { grid-column: 1 / -1; }                                    /* Supplement Check: a tool, not a calculator, spans the row */
.foot { margin: 18px 0 0; text-align: center; color: var(--dim); font-family: var(--vt); font-size: var(--fs-xs); line-height: 1; }
.foot i { display: inline-block; width: 4px; height: 4px; margin: 0 8px; vertical-align: 2px; background: var(--dim); }

/* ---------- Footer: same as before, on the sky; room for the planet curve under it ---------- */
.site-footer { padding-bottom: 96px; }
.site-footer .by-name { color: var(--text); }
.site-footer .by-ig { color: #6f69d4; }                 /* the handle (and its little arrow) stays light purple */
.site-footer .by-ig:hover { color: var(--text); }

/* ---------- Page transitions (browsers with cross-document view transitions) ---------- */
@view-transition { navigation: auto; }
#sky { view-transition-name: sky; }
.brand h1, .brand-mark { view-transition-name: brand; }
.site-header .nav { view-transition-name: navtab; }
main { view-transition-class: content; }   /* each page's main gets its own name (sky.js), so the old page's
                                               content fades out right where it was and the new one rises in place */
::view-transition-group(sky) { animation-duration: 0s; }
::view-transition-group(brand) { animation-duration: .5s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }   /* still when it's in the same place; glides in if the last page was scrolled */
::view-transition-old(sky) { animation: bm-fade-out .25s ease both; }
::view-transition-new(sky) { animation: none; }
::view-transition-old(brand) { animation: none; opacity: 0; }
/* The "calculators" tab: calculator to calculator it stays put like the title; coming from the home page
   it rises in first (html.from-home below); going home it leaves with the page. */
::view-transition-group(navtab) { animation-duration: .5s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(navtab) { animation: none; opacity: 0; }
::view-transition-new(navtab) { animation: none; }
::view-transition-old(navtab):only-child { animation: bm-drop-out .4s cubic-bezier(.4, 0, 1, 1) both; opacity: 1; }
::view-transition-new(brand) { animation: none; }
::view-transition-old(*.content) { animation: bm-drop-out .4s cubic-bezier(.4, 0, 1, 1) both; }
/* The new page's content isn't moved as one block: its snapshot is live, so the pieces inside it rise in
   one after another (the html.nav-in rules below) while the old page is still clearing. */
::view-transition-new(*.content) { animation: none; }
::view-transition-old(root) { animation: bm-fade-out .35s ease both; }
::view-transition-new(root) { animation: bm-fade-in .5s ease .3s both; }
@keyframes bm-drop-out { to { opacity: 0; transform: translateY(14px); } }
@keyframes bm-rise-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes bm-fade-out { to { opacity: 0; } }
@keyframes bm-fade-in { from { opacity: 0; } }

/* Arriving from another page of the site (the <head> script adds .nav-in): once the old page has gone,
   icon, title, description and the calculator panel each fade up a few px in quick succession.
   Same in browsers without view transitions (there the old page just vanishes). The sky isn't touched. */
html.nav-in {
  --in-ease: cubic-bezier(.22, 1, .36, 1);
  --in-dur: .7s;
}
@media (prefers-reduced-motion: no-preference) {
  html.nav-in main.wrap > *,
  html.nav-in .hero.sm > *,
  html.nav-in main.home > .brand > p,
  html.nav-in main.home > .hero-box,
  html.nav-in main.home > .panel,
  html.from-home .site-header .nav {
    animation: bm-step-in var(--in-dur) var(--in-ease) var(--in-at, .9s) backwards;
  }
}
html.nav-in main.wrap > .hero.sm { animation: none; }            /* its icon and title go separately */
html.from-home .site-header .nav { --in-at: .34s; }             /* the tab under the title leads the sequence */
html.nav-in .hero.sm > img       { --in-at: .44s; }
html.nav-in .hero.sm > h1        { --in-at: .54s; }
html.nav-in main.wrap > .lede    { --in-at: .64s; }
html.nav-in main.wrap > .lede-sub { --in-at: .72s; }
html.nav-in main.wrap > .calc    { --in-at: .8s; }
html.nav-in main.home > .brand > p { --in-at: .34s; }            /* home: the title stays put; tagline, figures, panel */
html.nav-in main.home > .hero-box  { --in-at: .46s; }
html.nav-in main.home > .panel     { --in-at: .6s; }
@keyframes bm-step-in { from { opacity: 0; translate: 0 16px; } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
