/* =============================================================
   0. Fonts (self-hosted, latin subset — no third-party requests)
   ============================================================= */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(assets/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url(assets/fonts/manrope-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f5f2ef;
  --surface: #ffffff;
  --surface-2: #ece7e2;
  --text: #18130f;
  --text-soft: #5c5249;
  --border: #ddd5cc;
  --accent: #d81f26;
  --accent-text: #c81c22;
  --error: #c92a2a;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6e5;
  --short: #d81f26;
  --long: #f2a900;
  --ok: #2b8a3e;
  --warn-bg: #fff6df;
  --warn-border: #f0c33c;

  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Manrope', var(--sans);

  --radius: 14px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0908;
    --surface: #141210;
    --surface-2: #1e1a17;
    --text: #f6f2ee;
    --text-soft: #b4a99f;
    --border: #3c362f;
    --accent: #ff3b30;
    --accent-text: #ff3b30;
    --error: #ff7b70;
    --accent-ink: #18130f;
    --accent-soft: #341613;
    --short: #ff3b30;
    --long: #ffc233;
    --ok: #51cf66;
    --warn-bg: #2b2310;
    --warn-border: #6b5720;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; overflow-x: clip; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background:
    radial-gradient(1100px 480px at 50% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; font-family: var(--display); font-weight: 800; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.content-narrow { max-width: 840px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.header-wrap { position: sticky; top: 0; z-index: 50; }
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo {
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  display: inline-flex; align-items: center;
}
.logo span { color: var(--accent); }
.logo-icon { width: 40px; height: 40px; margin-right: .55rem; flex-shrink: 0; border-radius: 9px; box-shadow: 0 2px 8px -2px rgba(216,31,38,.55); }
.header-nav {
  display: flex; gap: 1.1rem; font-size: .87rem; font-weight: 600;
  position: absolute; top: 0; right: max(1.25rem, calc((100% - var(--container)) / 2 + 1.25rem)); height: 60px; align-items: center;
}
.header-nav a { color: var(--text-soft); transition: color .2s var(--ease-out); }
.header-nav a:hover { color: var(--accent); }
.header-nav a.is-active { color: var(--accent); }
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: none; border: none; border-radius: 8px;
  color: var(--text); cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle svg { width: 22px; height: 22px; }

.site-footer {
  margin-top: 3rem;
  background: var(--bg); /* same colour as the page: the checkered band alone marks where it starts */
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: .9rem;
}
/* Checkered band across the top of the footer */
.site-footer::before {
  content: ""; display: block; height: 12px;
  background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 12px 12px;
  opacity: .85;
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 1.25rem 2.5rem;
  align-items: center; justify-content: space-between;
  padding-block: 1.9rem 2.1rem;
}
.footer-brand { flex: 1 1 320px; min-width: 0; }
.footer-brand p { max-width: 62ch; margin: 0; }
.footer-logo {
  display: inline-block; margin-bottom: .45rem;
  font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--text);
}
.footer-logo span { color: var(--accent); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.footer-links a, .footer-links button {
  position: relative; padding-block: .5rem;
  font-weight: 700; color: var(--text);
  transition: color .2s var(--ease-out);
}
.footer-links a::after, .footer-links button::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: .35rem; height: 1.5px;
  background: var(--accent); transition: right .2s var(--ease-out);
}
.footer-links a:hover, .footer-links button:hover { color: var(--accent); }
.footer-links a:hover::after, .footer-links button:hover::after { right: 0; }

/* =============================================================
   4b. Cookie consent banner
   ============================================================= */
.consent {
  position: fixed; z-index: 70;
  left: 1rem; right: 1rem; bottom: 1rem;
  max-width: 760px; margin-inline: auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px -16px rgba(0,0,0,.55);
}
.consent[hidden] { display: none; }
.consent-body { flex: 1 1 320px; min-width: 0; }
.consent-title { font-family: var(--display); font-weight: 800; font-size: 1rem; margin-bottom: .25rem; }
.consent-text { font-size: .88rem; color: var(--text-soft); }
.consent-text a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.consent-actions { display: flex; gap: .6rem; flex: 0 0 auto; }
.consent-btn {
  min-height: 44px; padding: .55rem 1.3rem;
  border: 1.5px solid var(--text); border-radius: 999px;
  font-weight: 700; color: var(--text);
  transition: background .2s var(--ease-out);
}
.consent-btn:hover { background: var(--surface-2); }
@media (max-width: 539px) {
  .consent { left: .5rem; right: .5rem; bottom: .5rem; padding: .8rem .9rem; gap: .65rem; }
  .consent-title { font-size: .95rem; margin-bottom: .15rem; }
  .consent-text { font-size: .8rem; line-height: 1.45; }
  .consent-actions { width: 100%; }
  .consent-btn { flex: 1 1 0; min-height: 44px; padding-block: .4rem; }
}

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 3.5rem 1.75rem; position: relative; overflow: hidden; text-align: center; }
.hero-inner { max-width: 760px; margin-inline: auto; }
.hero-eyebrow {
  display: inline-flex; align-items: center;
  font-size: .82rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
  animation: badgeIn .5s var(--ease-out) both;
}
.hero-eyebrow svg { width: 18px; height: 18px; flex-shrink: 0; }
.hero h1 {
  font-size: clamp(1.8rem, 4.6vw, 2.7rem);
  max-width: 20ch;
  margin-inline: auto;
  animation: heroIn .55s var(--ease-out) .05s both;
}
.hero-sub {
  color: var(--text-soft); margin: .8rem auto 0; max-width: 54ch;
  font-size: 1.05rem;
  animation: heroIn .55s var(--ease-out) .12s both;
}

.hero-flag-decor {
  position: absolute;
  top: -22%; right: -6%;
  width: 620px; height: auto;
  transform-origin: top right;
  transform: rotate(14deg);
  opacity: .1;
  pointer-events: none;
  z-index: 0;
  animation: flagIn .8s var(--ease-out) both;
}
.hero::after {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 360px;
  background: radial-gradient(55% 55% at 50% 15%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }
@media (max-width: 719px) { .hero-flag-decor { width: 380px; top: -22%; right: -9%; } }

@keyframes heroIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes badgeIn { from { opacity: 0; transform: translateY(6px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes flagIn { from { opacity: 0; transform: rotate(14deg) translateY(-8px); } to { opacity: .1; transform: rotate(14deg) translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero h1, .hero-sub, .hero-flag-decor { animation: none; }
}

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-block: .25rem 1.5rem; }

.tool-card {
  position: relative;
  overflow: hidden;
  /* a little wider than the text column below it, not the full frame */
  max-width: 1000px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(20,20,20,.04), 0 20px 44px -22px rgba(20,20,20,.28);
  animation: cardIn .5s var(--ease-out) both;
}
.tool-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--short), var(--accent) 45%, var(--long));
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tool-card { animation: none; } }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.25rem;
}
.field-full { grid-column: 1 / -1; }
.tool-grid-triple { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 899px) {
  .tool-grid-triple { grid-template-columns: repeat(2, 1fr); }
  .tool-grid-triple > .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 539px) { .tool-grid-triple { grid-template-columns: 1fr; } }

/* Converter groups: the pair of fields and, beside them, the button that copies the pair */
.converter-group {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1.25rem; align-items: start;
  margin-bottom: 1.5rem;
}
.converter-group:last-child { margin-bottom: 0; }
.converter-group .converter-label { grid-column: 1 / -1; }
.converter-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .6rem;
}
.converter-label .icon { width: 15px; height: 15px; color: var(--accent); }

.field { display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem; }
.field label {
  font-size: .85rem; font-weight: 600; color: var(--text-soft);
}
.field label .hint { font-weight: 400; opacity: .8; }
.field-error { font-size: .78rem; font-weight: 600; color: var(--error); }
.field-error[hidden] { display: none; }

.field input[type="number"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 600;
  padding: .7rem .85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.field input[type="number"]:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
/* soften native spinners, keep keyboard/touch input */
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { opacity: .5; }

.field select {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  padding: .7rem .85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.field select:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field.is-invalid input[type="number"] {
  border-color: #e03131;
  background: color-mix(in srgb, #e03131 8%, var(--surface-2));
}

.input-with-unit { display: flex; gap: .5rem; align-items: stretch; }
.input-with-unit input { flex: 1 1 auto; min-width: 0; }

.unit-toggle {
  display: flex; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; flex: 0 0 auto;
}
.unit-btn {
  padding: 0 .7rem; font-size: .8rem; font-weight: 700;
  color: var(--text-soft); background: var(--surface-2);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
  white-space: nowrap;
}
.unit-btn.is-active { background: var(--accent); color: var(--accent-ink); }

/* Ratio chips */
.ratio-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.ratio-chip, .pick-chip {
  padding: .4rem .85rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font-weight: 700;
  font-size: .85rem;
  transition: background .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.ratio-chip:hover, .pick-chip:hover { border-color: var(--accent); color: var(--accent); }
.ratio-chip.is-active, .pick-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Results */
.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.result-box {
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: .25rem;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
}
.result-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -14px rgba(20,20,20,.35);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.result-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .03em;
}
.result-icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 2px rgba(20,20,20,.08);
}
.icon { width: 15px; height: 15px; flex-shrink: 0; }
.result-value { font-family: var(--display); font-size: clamp(1.6rem, 4vw, 2.15rem); font-weight: 800; color: var(--accent); line-height: 1.1; }
.result-sub { font-size: .8rem; color: var(--text-soft); }

@keyframes valuePulse { 0% { transform: scale(1); } 35% { transform: scale(1.08); } 100% { transform: scale(1); } }
.result-value.is-updated, .compare-speed.is-updated, .compare-ratio.is-updated { animation: valuePulse .32s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .result-value.is-updated, .compare-speed.is-updated, .compare-ratio.is-updated { animation: none; }
}

/* Gauge */
.gauge-block { margin-top: 1.75rem; }
.gauge-labels {
  display: flex; justify-content: space-between;
  font-size: .78rem; font-weight: 700; color: var(--text-soft);
  margin-bottom: .5rem;
}
.gauge-labels span { display: inline-flex; align-items: center; gap: .3rem; }
.gauge-labels .icon:first-child { color: var(--short); }
.gauge-labels span:last-child .icon { color: var(--long); }
.gauge-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--short), var(--surface-2) 50%, var(--long));
  overflow: visible;
  box-shadow: inset 0 1px 2px rgba(20,20,20,.08);
}
.gauge-marker {
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  background: var(--surface);
  border: 3px solid var(--text);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left .35s var(--ease-out);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
@media (prefers-reduced-motion: reduce) { .gauge-marker { transition: none; } }
.gauge-caption {
  text-align: center; margin-top: .7rem;
  font-size: .9rem; font-weight: 700; color: var(--text);
}

/* Compare toggle + panel */
.compare-toggle {
  margin-top: 1.5rem;
  width: 100%;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  font-weight: 700;
  color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out);
}
.compare-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.compare-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); border-style: solid; }
.compare-toggle .icon { transition: transform .3s var(--ease-out); }
.compare-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }

.compare-panel {
  margin-top: 0;
  padding: 0 1.25rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: max-height .4s var(--ease-out), opacity .3s var(--ease-out), padding .35s var(--ease-out), margin-top .35s var(--ease-out);
}
.compare-panel.is-open {
  margin-top: 1rem;
  padding: 1.25rem;
  max-height: 900px;
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) { .compare-panel { transition: none; } }
.compare-note { font-size: .82rem; color: var(--text-soft); margin-bottom: 1rem; }
.compare-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 1.25rem; }

.compare-results {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  text-align: center;
}
.compare-col-title { font-family: var(--display); font-size: .85rem; color: var(--text-soft); font-weight: 700; margin-bottom: .3rem; line-height: 1.15; }
.compare-ratio { font-family: var(--display); font-size: 1.15rem; font-weight: 800; }
.compare-speed { font-family: var(--display); font-size: 1.5rem; font-weight: 800; color: var(--accent); margin-top: .1rem; }
.compare-character { font-size: .8rem; color: var(--text-soft); margin-top: .2rem; }
.compare-vs { font-size: .8rem; font-weight: 800; color: var(--text-soft); }
.compare-delta {
  margin-top: 1rem;
  font-size: .85rem;
  text-align: center;
  color: var(--text-soft);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  border: 1px solid var(--border);
}

/* Disclaimer */
.disclaimer {
  margin-top: 1.5rem;
  padding: .85rem 1rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--text-soft);
  display: flex; align-items: flex-start; gap: .55rem;
}
.disclaimer strong { color: var(--text); }
.icon-warn { width: 18px; height: 18px; flex-shrink: 0; margin-top: .1rem; color: #b8860b; }
/* In the calculators only the headline shows; the rest opens when the line is tapped */
details.disclaimer { display: block; padding: 0; }
details.disclaimer summary {
  display: flex; align-items: flex-start; gap: .55rem; padding: .8rem 1rem;
  border-radius: var(--radius-sm); cursor: pointer; list-style: none;
}
details.disclaimer summary::-webkit-details-marker { display: none; }
details.disclaimer summary strong { flex: 1 1 auto; min-width: 0; }
.disclaimer-i { width: 18px; height: 18px; flex-shrink: 0; margin-top: .1rem; color: var(--text-soft); transition: color .2s var(--ease-out); }
details.disclaimer[open] .disclaimer-i { color: var(--text); }
details.disclaimer > p { margin: 0; padding: 0 1rem .85rem calc(1.55rem + 18px); }

/* =============================================================
   8. Content sections
   ============================================================= */
.content-section { padding-block: 1.75rem; }
.content-section h1 { margin-bottom: 1.3rem; }
.content-section h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: .8rem; }
.content-section p { color: var(--text-soft); margin-bottom: 1rem; }
.content-section p strong { color: var(--text); }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { font-size: 1.05rem; margin: 1.3rem 0 .4rem; }
.prose ul { display: grid; gap: .6rem; padding-left: 1.25rem; margin-bottom: 1rem; color: var(--text-soft); }
.prose li strong { color: var(--text); }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }


.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.step { text-align: left; transition: transform .25s var(--ease-out); }
.step:hover { transform: translateY(-3px); }
.step-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--long) 14%, var(--accent-soft)));
  color: var(--accent);
  margin-bottom: .7rem;
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 45%, transparent);
}
.step-icon svg { width: 21px; height: 21px; }
.step h3 { font-size: 1rem; margin-bottom: .3rem; }
.step p { margin-bottom: 0; font-size: .88rem; }

@media (max-width: 719px) {
  .steps { grid-template-columns: 1fr; gap: 1.5rem; }
}

.feature-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.feature-list li {
  color: var(--text-soft);
  padding-left: 1.4rem;
  position: relative;
}
.feature-list li::before {
  content: "→";
  position: absolute; left: 0; color: var(--accent); font-weight: 800;
}
.feature-list li strong { color: var(--text); }

.examples-table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(20,20,20,.04); }
.examples-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 560px; }
.examples-table th, .examples-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.examples-table th { background: var(--surface-2); font-weight: 700; color: var(--text-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.examples-table tbody tr { transition: background .15s var(--ease-out); }
.examples-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.examples-table tbody tr:hover { background: var(--accent-soft); }
.examples-table tbody tr:last-child td { border-bottom: none; }
.examples-table td:nth-child(4) { font-weight: 700; color: var(--accent-text); font-family: var(--display); }

/* More tools cross-links */
.tool-links-list { margin-top: 1rem; border-top: 1px solid var(--border); }
.tool-link-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem;
  padding: .95rem .1rem;
  border-bottom: 1px solid var(--border);
  transition: padding-left .2s var(--ease-out);
}
.tool-link-row:hover { padding-left: .35rem; }
.tool-link-row-text { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.tool-link-row-title { font-weight: 700; color: var(--text); transition: color .2s var(--ease-out); white-space: nowrap; }
.tool-link-row:hover .tool-link-row-title { color: var(--accent); }
.tool-link-row-desc { font-size: .85rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-link-row-arrow { width: 16px; height: 16px; color: var(--text-soft); flex-shrink: 0; transition: transform .2s var(--ease-out), color .2s var(--ease-out); }
.tool-link-row:hover .tool-link-row-arrow { transform: translateX(3px); color: var(--accent); }
@media (max-width: 539px) {
  .tool-link-row-text { flex-direction: column; gap: .15rem; }
  .tool-link-row-desc { white-space: normal; }
}

/* FAQ */
.faq-section details {
  border-bottom: 1px solid var(--border);
  padding-block: .9rem;
}
.faq-section summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .4rem .6rem;
  margin-inline: -.6rem;
  border-radius: var(--radius-sm);
  transition: background .2s var(--ease-out);
}
.faq-section summary:hover { background: var(--surface-2); }
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after {
  content: "+";
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 1.1rem; font-weight: 700;
  transition: transform .25s var(--ease-out), background .2s var(--ease-out), color .2s var(--ease-out);
}
.faq-section details[open] summary::after { transform: rotate(135deg); background: var(--accent); color: var(--accent-ink); }
.faq-section details p { margin-top: .6rem; margin-bottom: 0; padding-inline: .6rem; }

/* =============================================================
   9. Responsive
   ============================================================= */
@media (max-width: 539px) {
  .tool-grid, .results, .compare-grid { grid-template-columns: 1fr; }
  .compare-results { grid-template-columns: 1fr; }
  .compare-vs { padding-block: .25rem; }
}

/* Eight links need about 920px next to the logo; below that the menu folds into the toggle */
@media (max-width: 919px) {
  .nav-toggle { display: inline-flex; }
  .header-nav {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0; height: auto;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 74%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 28px -16px rgba(0,0,0,.4);
  }
  .header-nav.is-open { display: flex; }
  .header-nav a { padding: .85rem 1.25rem; border-top: 1px solid var(--border); }
  .header-nav a:first-child { border-top: none; }
}

@media (min-width: 720px) {
  .tool-card { padding: 2rem; }
}

/* =============================================================
   10. Scroll reveal
   ============================================================= */
/* Desktop only. On a phone or tablet the content is simply there: fading it in while the finger scrolls feels slower, not smoother. */
@media (min-width: 920px) and (hover: hover) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  }
  .js [data-reveal].is-visible { opacity: 1; transform: none; }

  .step:nth-of-type(1) { transition-delay: 0s; }
  .step:nth-of-type(2) { transition-delay: .08s; }
  .step:nth-of-type(3) { transition-delay: .16s; }

  .faq-section details:nth-of-type(1) { transition-delay: .02s; }
  .faq-section details:nth-of-type(2) { transition-delay: .06s; }
  .faq-section details:nth-of-type(3) { transition-delay: .10s; }
  .faq-section details:nth-of-type(4) { transition-delay: .14s; }
  .faq-section details:nth-of-type(5) { transition-delay: .18s; }
  .faq-section details:nth-of-type(6) { transition-delay: .22s; }
  .faq-section details:nth-of-type(7) { transition-delay: .26s; }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* =============================================================
   UX additions: back-to-top, copy result, hover states
   ============================================================= */
.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;
}

/* Back to top: bottom-right, appears after one screen of scrolling */
.to-top {
  position: fixed; z-index: 45;
  right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom));
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 22px -10px rgba(20,20,20,.45);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out), visibility .25s, border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.to-top svg { width: 20px; height: 20px; }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
/* stay out of the way of the cookie banner while it is open */
body:has(.consent:not([hidden])) .to-top { opacity: 0; visibility: hidden; }

/* Copy result */
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: .85rem; }
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-width: 10.5rem; padding: .5rem 1rem;
  border: 1.5px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-soft);
  font-size: .82rem; font-weight: 700;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), background .2s var(--ease-out);
}
.copy-btn .icon { width: 16px; height: 16px; }
.copy-btn .check-icon { display: none; }
.copy-btn.is-copied .copy-icon { display: none; }
.copy-btn.is-copied .check-icon { display: block; }
.copy-btn.is-copied { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.copy-btn.is-failed { border-color: var(--error); color: var(--error); }
.copy-btn:disabled { opacity: .45; cursor: not-allowed; }
/* In the converter the button stands level with the inputs: the spacer above it is as tall as a field label */
.converter-group .result-actions { flex-direction: column; justify-content: flex-start; gap: .4rem; margin-top: 0; }
.converter-group .result-actions::before { content: "\00a0"; font-size: .85rem; font-weight: 600; }
.converter-group .copy-btn { width: 10.5rem; min-width: 0; height: 2.84rem; padding: 0 .75rem; white-space: nowrap; }
@media (max-width: 539px) {
  /* On a phone the two units stay side by side and the button shrinks to its icon */
  .converter-group { column-gap: .6rem; }
  .converter-group .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .converter-group .copy-btn { width: 2.84rem; padding: 0; }
  .converter-group .copy-btn-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
}

/* Hover states (pointer devices only) */
@media (hover: hover) {
  .to-top:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
  .copy-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
  .unit-btn:not(.is-active):hover { background: var(--accent-soft); color: var(--accent-text); }
  .field input[type="number"]:hover:not(:focus), .field select:hover:not(:focus) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .logo:hover .logo-icon { transform: scale(1.06); }
}
.logo-icon { transition: transform .2s var(--ease-out); }

/* 404 page */
.not-found { max-width: 60ch; text-align: center; padding-block: 3.5rem 3rem; margin-inline: auto; }
.not-found-logo { margin: 0 auto 1.4rem; border-radius: var(--radius); box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 45%, transparent); }
.not-found-eyebrow { display: inline-block; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; color: var(--accent-text); margin-bottom: .5rem; }
.not-found h1 { margin-bottom: .7rem; }
.not-found .lead { color: var(--text-soft); max-width: 42ch; margin: 0 auto 2rem; font-size: 1.05rem; }
.not-found-links { max-width: 30rem; margin: 0 auto; text-align: left; }
@media (hover: hover) {
  main p a:not(.btn), .content-narrow li a, .disclaimer a { transition: color .2s var(--ease-out), text-decoration-color .2s var(--ease-out); }
  main p a:not(.btn):hover, .content-narrow li a:hover, .disclaimer a:hover { color: var(--accent-text); text-decoration-color: currentColor; }
}

/* =============================================================
   12. Guides (articles under /guias/)
   ============================================================= */
.guide-hero h1 { max-width: 24ch; }
.guide-byline { font-size: .85rem; margin-bottom: 1.25rem; }
.guide-summary {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1.4rem 1.1rem; margin-bottom: 1.75rem;
  box-shadow: 0 12px 30px -22px rgba(20,20,20,.35);
}
.guide-summary::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--short), var(--accent) 45%, var(--long));
}
.guide-summary h2 { margin-top: 0; font-size: 1.15rem; }
.guide-summary ul { margin-bottom: .4rem; }
.prose ol { display: grid; gap: .6rem; padding-left: 1.4rem; margin-bottom: 1rem; color: var(--text-soft); }
.prose ol li::marker { color: var(--accent-text); font-weight: 700; }
.guide ul li::marker { color: var(--accent); }
/* A formula on its own line */
.guide .guide-eq {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: .75rem 1rem;
  font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
}
/* Tables: the caption stays put while a wide table scrolls sideways */
.guide-fig { margin: 0 0 1.1rem; }
.guide-fig figcaption { font-size: .8rem; color: var(--text-soft); padding: .5rem .1rem 0; }
.guide-table { min-width: 0; font-variant-numeric: tabular-nums; }
.guide-table td:nth-child(4) { font-weight: inherit; color: inherit; font-family: inherit; }
.guide-table td.n, .guide-table th.n { white-space: nowrap; font-weight: 700; color: var(--text); }
.guide-table th[scope="row"] { background: none; text-transform: none; letter-spacing: 0; font-size: .88rem; color: var(--text); }
/* On a phone, tighter cells let a four-column table fit without scrolling sideways */
@media (max-width: 480px) {
  .guide-table th, .guide-table td { padding-inline: .6rem; }
}
.guide .disclaimer { margin: 0 0 1.1rem; font-size: .88rem; }
/* The calculator that goes with the guide */
.guide-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
  background: var(--accent-soft); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 2rem;
}
.guide-cta > div { flex: 1 1 300px; min-width: 0; }
.guide-cta h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.guide-cta p { margin: 0; font-size: .92rem; }
.guide-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .55rem 1.4rem;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; white-space: nowrap;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.guide-btn:active { transform: scale(.97); }
.guide-sources { margin-bottom: 2rem; }
.guide-sources ol { display: grid; gap: .5rem; padding-left: 1.4rem; font-size: .85rem; color: var(--text-soft); }
.guide-sources a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
/* Lists of guides: long titles wrap instead of being cut */
.guide-links .tool-link-row { align-items: center; }
.guide-links .tool-link-row-text { flex-direction: column; gap: .15rem; }
.guide-links .tool-link-row-title, .guide-links .tool-link-row-desc { white-space: normal; }
/* The index groups the guides under a heading each */
.guide-index h2 { margin-top: 2.25rem; margin-bottom: 0; }
.guide-index h2:first-child { margin-top: 0; }
.guide-all { margin-top: 1rem; }
/* Glossary: one term per row instead of a bulleted list */
.guide .glossary { list-style: none; padding-left: 0; gap: 0; border-top: 1px solid var(--border); }
.guide .glossary li { padding: .75rem .1rem; border-bottom: 1px solid var(--border); scroll-margin-top: 6rem; }
.guide .glossary li:target { background: var(--accent-soft); padding-inline: .75rem; border-radius: var(--radius-sm); }
/* "Related guide" line under each calculator */
.guide-related-section { padding-block: .25rem 0; }
.guide-related { font-size: .92rem; margin-bottom: 0; }
.guide-related a { color: var(--accent-text); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) {
  .guide-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
}

/* =============================================================
   13. Air density calculator: two sets of four fields
   ============================================================= */
.air-group { margin-bottom: 1.5rem; }
.air-group .converter-label { flex-wrap: wrap; }
.air-group .converter-label .hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.air-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 899px) {
  /* Two by two, also on a phone: the four values of a day stay together on screen */
  .air-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.air-use-today { margin-top: .6rem; font-size: .85rem; }
.air-table { min-width: 0; } /* three short columns: it fits a phone without scrolling sideways */
@media (max-width: 480px) { .air-table th, .air-table td { padding-inline: .6rem; } }

/* =============================================================
   14. Ballast planner (lastre.html): share the lead between the four usual places
   ============================================================= */
.ballast {
  display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
  grid-template-areas: "total total" "kart rows";
  gap: 1.25rem 2rem; align-items: center;
  margin-block: 1.25rem 1.75rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 30px -22px rgba(20,20,20,.35);
}
.ballast-total { grid-area: total; }
.ballast-kart { grid-area: kart; }
.ballast-panel { grid-area: rows; min-width: 0; }
@media (max-width: 719px) {
  /* On a phone: the count on top, then the kart, then the rows */
  .ballast { grid-template-columns: minmax(0, 1fr); grid-template-areas: "total" "kart" "rows"; gap: 1rem; padding: 1rem; }
  .ballast-kart { width: min(100%, 250px); margin-inline: auto; }
}

/* How much is placed */
.ballast-count { margin: 0 0 .45rem; font-size: .95rem; color: var(--text-soft); }
.ballast .ballast-count strong { font-family: var(--display); font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.ballast-count span { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ballast-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ballast-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--short), var(--long));
  transform: scaleX(0); transform-origin: left center; transition: transform .28s var(--ease-out);
}
.ballast-status { margin: .5rem 0 0; min-height: 1.4em; font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.ballast-status.is-done { color: var(--text); }
.ballast-status.is-over { color: var(--error); }

/* The kart. It takes its colours from the theme, so it follows light and dark mode */
.ballast-kart svg { display: block; width: 100%; height: auto; overflow: visible; -webkit-tap-highlight-color: transparent; }
.ballast-hint { margin: .6rem 0 0; font-size: .78rem; line-height: 1.4; text-align: center; color: var(--text-soft); }
.bk-tyre { fill: var(--text); opacity: .86; }
.bk-floor { fill: var(--surface-2); }
.bk-frame { fill: none; stroke: var(--text-soft); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.bk-thin { stroke-width: 3; }
.bk-wheel { fill: none; stroke: var(--text-soft); stroke-width: 5; }
.bk-part { fill: var(--surface-2); stroke: var(--text-soft); stroke-width: 3; stroke-linejoin: round; }
.bk-body { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.bk-label { fill: var(--text-soft); font: 600 12px var(--sans); text-anchor: middle; }
/* Where the weight goes: a ring at the start, a dot that moves */
.bk-cog-base { fill: none; stroke: var(--text); stroke-width: 2; stroke-dasharray: 3 3; }
.bk-cog-line { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; }
.bk-cog-dot { fill: var(--text); stroke: var(--surface); stroke-width: 2.5; }
/* The four places: a round button that grows with its share of the lead */
.bk-zone { cursor: pointer; outline: none; }
.ballast.is-idle .bk-zone { cursor: default; }
.bk-zone-hit { fill: transparent; }
.bk-zone-mark { transform-box: fill-box; transform-origin: center; transition: transform .25s var(--ease-out); }
.bk-zone-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.ballast.is-idle .bk-zone-dot { fill: var(--text-soft); }
.bk-zone-text { fill: var(--accent-ink); font: 800 14px var(--display); text-anchor: middle; dominant-baseline: central; pointer-events: none; font-variant-numeric: tabular-nums; }
.bk-zone-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: 0; transition: opacity .2s var(--ease-out); }
.bk-zone.is-active .bk-zone-ring, .bk-zone:focus-visible .bk-zone-ring { opacity: 1; }
.bk-zone-ping { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.bk-zone.is-ping .bk-zone-ping { animation: bkPing .5s var(--ease-out); }
@keyframes bkPing { from { opacity: .45; transform: scale(1); } to { opacity: 0; transform: scale(2.1); } }
@media (prefers-reduced-motion: reduce) {
  .bk-zone-mark, .ballast-bar span { transition: none; }
  .bk-zone.is-ping .bk-zone-ping { animation: none; }
}

/* One row per place: its name, what it changes, and the − / + buttons */
.ballast-rows { margin: 0; padding: 0; list-style: none; }
.ballast-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .75rem;
  padding: .4rem .6rem; border-top: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background .2s var(--ease-out);
}
.ballast-row:first-child { border-top-color: transparent; }
.ballast-row.is-active { background: var(--accent-soft); border-top-color: transparent; }
.ballast-row.is-active + .ballast-row { border-top-color: transparent; }
.ballast-pick { display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-height: 44px; text-align: left; }
.ballast-name { font-weight: 700; color: var(--text); }
.ballast-tag { font-size: .8rem; color: var(--text-soft); }
.ballast-step { display: inline-flex; align-items: center; gap: .15rem; }
.ballast-step button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1.5px solid var(--border); border-radius: 50%; background: var(--surface);
  font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--text);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), transform .12s var(--ease-out);
}
.ballast-step button:active:not(:disabled) { transform: scale(.94); }
.ballast-step button:disabled { opacity: .35; cursor: not-allowed; }
.ballast-step output { min-width: 4.1rem; text-align: center; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ballast-more { grid-column: 1 / -1; margin: .15rem 0 .35rem; font-size: .85rem; color: var(--text-soft); }
.ballast-more[hidden], .ballast-clear[hidden] { display: none; }
.ballast-trend { margin: .9rem .6rem .1rem; min-height: 2.8em; font-size: .92rem; font-weight: 700; color: var(--text); }
.ballast-clear { margin-left: .6rem; font-size: .85rem; }
@media (hover: hover) {
  .ballast-step button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
  .ballast-row:not(.is-active):hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
}

/* =============================================================
   15. Saved setups (the "Guardar" button of each calculator)
   ============================================================= */
.save-btn { min-width: 0; }
@media (max-width: 539px) {
  /* On a phone the two buttons fill the row, edge to edge with the result boxes */
  .tool-card > .result-actions .copy-btn { flex: 1 1 auto; }
}
@media (max-width: 379px) {
  /* On the narrowest phones "Guardar" and "Copiar resultado" still share one row */
  .tool-card > .result-actions .copy-btn { min-width: 0; padding-inline: .6rem; }
}
.save-btn[hidden], .setups-note[hidden], .setup-form[hidden], .setup-msg[hidden], .setup-list[hidden] { display: none; }
.setups > :not(.sr-only):not([hidden]) { margin-top: .85rem; }
/* "We brought back your last values" */
.setups-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; margin-bottom: 0; font-size: .85rem; color: var(--text-soft); }
.link-btn { padding: .3rem 0; color: var(--accent-text); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
/* Name for the setup being saved */
.setup-form { padding: .9rem 1rem 1rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.setup-form label { display: block; margin-bottom: .4rem; font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.setup-form label .hint { font-weight: 400; opacity: .8; }
.setup-form-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.setup-form input[type="text"] {
  flex: 1 1 12rem; min-width: 0; padding: .6rem .8rem;
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.setup-form input[type="text"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.setup-ok, .setup-cancel { min-height: 44px; padding: 0 1.2rem; border-radius: 999px; font-size: .88rem; font-weight: 700; }
.setup-ok { background: var(--accent); color: var(--accent-ink); }
.setup-cancel { padding-inline: .8rem; color: var(--text-soft); }
.setup-msg { margin-bottom: 0; font-size: .82rem; font-weight: 600; color: var(--error); }
/* The saved setups: tap one to load it */
.setup-list { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.setup-list summary {
  display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem;
  font-size: .88rem; font-weight: 700; color: var(--text); cursor: pointer; list-style: none;
}
.setup-list summary::-webkit-details-marker { display: none; }
.setup-list summary::after {
  content: ""; width: .5rem; height: .5rem; margin-left: auto; margin-right: .25rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s var(--ease-out);
}
.setup-list[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.setup-count { padding: .05rem .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: .75rem; }
.setup-list ul { list-style: none; margin: 0; padding: 0; }
.setup-row { display: flex; align-items: center; border-top: 1px solid var(--border); transition: background .3s var(--ease-out); }
.setup-row.is-loaded { background: var(--accent-soft); }
.setup-load { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; padding: .65rem .9rem; text-align: left; }
.setup-name { font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.setup-sum { font-size: .82rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.setup-when { white-space: nowrap; }
.setup-del {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin-right: .3rem; padding: 0 .7rem;
  border-radius: var(--radius-sm); color: var(--text-soft); font-size: .8rem; font-weight: 700;
}
.setup-del .icon { width: 18px; height: 18px; }
.setup-del.is-confirm { background: var(--error); color: var(--surface); }
.setup-foot { margin: 0; padding: .6rem .9rem .7rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-soft); }
@media (hover: hover) {
  .setup-load:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
  .setup-del:not(.is-confirm):hover { color: var(--error); }
  .link-btn:hover { text-decoration-thickness: 2px; }
}

/* =============================================================
   16. Interactive drawings under the calculators (one per page; the ballast planner has its own section)
   ============================================================= */
.viz {
  margin-block: 1.25rem .5rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 30px -22px rgba(20,20,20,.35);
}
@media (max-width: 719px) { .viz { padding: 1rem; } }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; -webkit-tap-highlight-color: transparent; }
.viz svg text { font-family: var(--sans); }
/* The lettering inside the drawings is sized for a phone, so on a wide screen the drawing stops growing */
.straight > svg, .airmap > svg { max-width: 540px; margin-inline: auto; }
.jug > svg { max-width: 460px; margin-inline: auto; }

.viz-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem 1.75rem; margin-top: 1rem; }
.viz-controls-top { margin: 0 0 1rem; gap: .5rem; }
.viz-control { display: inline-flex; align-items: center; gap: .6rem; }
.viz-control-label { font-size: .85rem; font-weight: 700; color: var(--text-soft); }
.pick-chip { min-height: 44px; padding-inline: 1.1rem; font-variant-numeric: tabular-nums; }
/* − value + : a press steps once, holding it keeps stepping */
.stepper { display: inline-flex; align-items: center; gap: .15rem; }
.stepper button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1.5px solid var(--border); border-radius: 50%; background: var(--surface);
  font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--text);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), transform .12s var(--ease-out);
}
.stepper button:active:not(:disabled) { transform: scale(.94); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 5.6rem; text-align: center; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
@media (hover: hover) { .stepper button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); } }
/* A slider with its value */
.viz-slider { display: grid; gap: .35rem; max-width: 420px; margin: 1rem auto 0; }
.viz-slider span { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; font-weight: 700; color: var(--text-soft); }
.viz-slider output { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.viz input[type="range"] { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; touch-action: pan-y; }

/* What the drawing says, in words */
.viz-answer { margin-top: 1.1rem; text-align: center; }
.viz .viz-result {
  margin: 0; font-family: var(--display); font-size: clamp(1.2rem, 3.4vw, 1.55rem); font-weight: 800; line-height: 1.2;
  color: var(--accent-text); outline: none;
}
.viz .viz-sub { margin: .35rem 0 0; font-size: .9rem; color: var(--text-soft); }
.viz-tag {
  display: inline-block; vertical-align: middle; margin-right: .2rem; padding: .15rem .55rem; border-radius: 999px;
  background: var(--surface-2); font: 700 .7rem/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--text-soft);
}
.viz-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem .75rem; margin-top: 1rem; }
.viz-actions-label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.viz .guide-btn { white-space: normal; text-align: center; }
.viz .viz-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.25rem; margin: .7rem 0 0; font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.viz-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.viz-key { flex: none; width: 18px; height: 4px; border-radius: 2px; background: var(--text); }
.viz-key-b { background: var(--accent); }
.viz-key-less, .viz-key-more { width: 11px; height: 11px; border-radius: 3px; background: var(--short); }
.viz-key-more { background: var(--long); }
.viz .viz-caption { margin: .9rem 0 0; font-size: .8rem; line-height: 1.5; text-align: center; color: var(--text-soft); }
.viz-caption a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.content-section .viz-foot { margin: .75rem 0 0; font-size: .8rem; line-height: 1.5; }
.viz-tag[hidden], .viz-actions[hidden], .viz-legend [hidden], .tyres-clear[hidden] { display: none; }
@media (max-width: 539px) {
  /* On a phone the main button fills the row, like the ones of the calculators */
  .viz-actions .guide-btn { flex: 1 1 100%; }
  .viz-controls { gap: .5rem 1rem; }
  .viz-controls:not(.viz-controls-top) .viz-control { width: 100%; justify-content: space-between; }
  .viz-controls-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .viz-controls-top .viz-control-label { grid-column: 1 / -1; text-align: center; }
  .viz-controls-top { gap: .35rem; }
  .viz-controls-top .pick-chip { padding-inline: 0; font-size: .8rem; white-space: nowrap; }
  .viz-actions-label { flex-basis: 100%; text-align: center; }
}

/* Piñón y corona: the revs along the straight */
.st-grid { stroke: var(--border); stroke-width: 1; }
.st-tick { fill: var(--text-soft); font-size: 12px; font-weight: 600; text-anchor: end; font-variant-numeric: tabular-nums; }
.st-target { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.st-target-label { fill: var(--accent-text); font-size: 12.5px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5; stroke-linejoin: round; }
.st-curve { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.st-curve-a { stroke: var(--text); }
.st-curve-b { stroke: var(--accent); }
.st-gap { fill: none; stroke: var(--text-soft); stroke-width: 1.5; }
.st-gap-label { fill: var(--text); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.st-play { stroke: var(--text-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.st-play-dot { fill: var(--surface); stroke: var(--text); stroke-width: 2.5; }
.st-readout { fill: var(--text); font: 800 15px var(--display); text-anchor: end; font-variant-numeric: tabular-nums; }
.st-road { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.st-road-line { fill: none; stroke: var(--text-soft); stroke-width: 1; stroke-dasharray: 6 5; opacity: .55; }
.st-brake { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.st-kart-wheel { fill: var(--text); }
.st-kart-body { fill: var(--accent); }
.st-kart-helmet { fill: var(--surface); stroke: var(--text); stroke-width: 1; }
.st-end { fill: var(--text-soft); font-size: 12px; font-weight: 600; }
.st-end-right { text-anchor: end; }
.st-handle { cursor: ns-resize; outline: none; touch-action: none; }
.st-hit { fill: transparent; }
.st-knob { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.st-handle:focus-visible .st-knob, .st-handle.is-dragging .st-knob { stroke: var(--text); }

/* Mezcla: the can of petrol and the measuring jug */
.jug-hit { fill: transparent; cursor: pointer; outline: none; }
.jug-hit:focus-visible { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 4; }
.jug-can, .jug-can-top { fill: none; stroke: var(--text-soft); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.jug-level { transition: transform .45s var(--ease-out); }
.jug-fuel { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; animation: jugWave 2.8s linear infinite; }
@keyframes jugWave { to { transform: translateX(-40px); } }
.jug-litres { fill: var(--text); font: 800 30px var(--display); text-anchor: middle; }
.jug-sub { fill: var(--text-soft); font-size: 13px; font-weight: 600; text-anchor: middle; }
.jug-note { fill: var(--text-soft); font-size: 12px; font-weight: 600; text-anchor: middle; }
.jug-plus { fill: none; stroke: var(--text-soft); stroke-width: 3.5; stroke-linecap: round; }
.jug-ratio { fill: var(--text); font: 800 15px var(--display); text-anchor: middle; }
.jug-glass { fill: none; stroke: var(--text-soft); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.jug-oil { fill: var(--long); }
.jug-tick { fill: none; stroke: var(--text-soft); stroke-width: 1.5; stroke-linecap: round; }
.jug-mark { fill: var(--text-soft); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.jug-mark-can { text-anchor: end; }
.jug-pointer-line { stroke: var(--accent); stroke-width: 2; }
.jug-pointer { fill: var(--accent); }
.jug-top { fill: var(--text); font-size: 13.5px; font-weight: 700; text-anchor: middle; }
.jug-bottom { fill: var(--accent-text); font: 800 16px var(--display); text-anchor: middle; }

/* Presión: the four tyres on the kart, and the cut of the one being worked on */
.tyres { display: grid; grid-template-columns: minmax(0, 270px) minmax(0, 1fr); gap: 1.25rem 2rem; align-items: center; }
.tyres-panel { min-width: 0; }
@media (max-width: 719px) {
  .tyres { grid-template-columns: minmax(0, 1fr); }
  .tyres-kart { width: min(100%, 260px); margin-inline: auto; }
}
.tw { cursor: pointer; outline: none; }
.tw-rubber { fill: var(--text); opacity: .86; }
.tw-band { fill: var(--accent); opacity: 0; transition: opacity .25s var(--ease-out); }
.tw-band.is-ok { fill: var(--ok); opacity: .95; }
.tw-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: 0; transition: opacity .2s var(--ease-out); }
.tw.is-picked .tw-ring, .tw:focus-visible .tw-ring { opacity: 1; }
.tw-value { fill: var(--surface); font: 800 26px var(--display); text-anchor: middle; dominant-baseline: central; pointer-events: none; font-variant-numeric: tabular-nums; opacity: .75; }
.tw.is-measured .tw-value { font-size: 19px; opacity: 1; }
.tw-next { fill: var(--accent-text); font-size: 12px; font-weight: 700; text-anchor: middle; pointer-events: none; font-variant-numeric: tabular-nums; }
.viz .tyres-target { margin: 0 0 .5rem; font-size: .9rem; color: var(--text-soft); }
.viz .tyres-target strong { font-family: var(--display); font-size: 1.2rem; font-weight: 800; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.tyres-name { margin-bottom: .7rem; font-size: 1.15rem; outline: none; }
.tyres-steps { display: grid; gap: .5rem; }
.tyres-steps .viz-control { justify-content: space-between; }
.tyres-profile { max-width: 300px; margin: .9rem auto .5rem; }
.tp-rim { fill: var(--text-soft); }
.tp-tyre { fill: var(--surface-2); stroke: var(--text); stroke-width: 3; stroke-linejoin: round; }
.tp-ground { stroke: var(--text-soft); stroke-width: 2; stroke-linecap: round; }
.tp-seg { fill: var(--border); transition: opacity .25s var(--ease-out); }
.tp-seg.is-hot { fill: var(--accent); }
.tp-seg.is-ok { fill: var(--ok); }
.tp-label { fill: var(--text-soft); font-size: 10.5px; font-weight: 600; text-anchor: middle; }
.viz .tyres-state { margin: 0 0 .6rem; min-height: 2.9em; font-size: .9rem; font-weight: 600; text-align: center; color: var(--text); }
.tyres .viz-result, .tyres .viz-sub { text-align: center; }
.tyres-clear { display: block; margin: .6rem auto 0; font-size: .85rem; }

/* Carburación: the map of the air */
.am-frame { fill: none; stroke: var(--border); stroke-width: 1.5; }
.am-area { fill: transparent; cursor: crosshair; }
.am-tick { fill: var(--text-soft); font-size: 12px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
.am-tick-y { text-anchor: end; }
.am-axis { fill: var(--text-soft); font-size: 12px; font-weight: 700; text-anchor: middle; }
.am-axis-y { text-anchor: start; }
.am-line { fill: none; stroke: var(--text); stroke-width: 1; stroke-dasharray: 4 4; opacity: .5; }
.am-line-zero { stroke-width: 2; stroke-dasharray: none; opacity: .9; }
.am-line-label { fill: var(--text); font-size: 11px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5; stroke-linejoin: round; }
.am-pin { cursor: grab; outline: none; touch-action: none; }
.am-pin.is-dragging { cursor: grabbing; }
.am-hit { fill: transparent; }
.am-dot { fill: var(--text); stroke: var(--surface); stroke-width: 3; }
.am-ring { fill: var(--surface); stroke: var(--text); stroke-width: 3; }
.am-label { fill: var(--text); font-size: 13px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 4; stroke-linejoin: round; pointer-events: none; }
.am-pin:focus-visible .am-hit { stroke: var(--text); stroke-width: 2; stroke-dasharray: 4 4; }

@media (prefers-reduced-motion: reduce) {
  .jug-fuel { animation: none; }
  .jug-level, .tw-band, .tw-ring, .tp-seg { transition: none; }
}
