/* ============================================================
   Homepage
   Loaded only on "/" — keeps main.css lean for tool pages.
   ============================================================ */

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: var(--space-9) 0 var(--space-8);
  border-bottom: 2px solid var(--line-strong);
  /* Same jade wash as every other hero on the site. This was the last one still
     fading from white, which made the homepage the odd page out. */
  background: var(--hero-wash);
  overflow: hidden;
}

/* Faint grid, echoing graph paper. Sits behind everything, purely atmospheric. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 90% 70% at 70% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 70% 0%, #000 0%, transparent 75%);
  pointer-events: none;
}

.hero .container { position: relative; }

.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--space-8);
  align-items: start;
}

.hero__kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--jade);
  padding: 6px 12px;
  border: 1.5px solid var(--jade-line);
  border-radius: 100px;
  background: var(--jade-wash);
  margin-bottom: var(--space-5);
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.028em;
  margin-bottom: var(--space-5);
}

.hero h1 em {
  font-style: italic;
  color: var(--jade);
  /* Hand-drawn underline that follows the baseline of the italic. */
  background-image: linear-gradient(var(--jade-line), var(--jade-line));
  background-size: 100% 3px;
  background-position: 0 92%;
  background-repeat: no-repeat;
  padding-bottom: 2px;
}

.hero__lead {
  font-size: 1.1rem;
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 54ch;
  margin-bottom: var(--space-6);
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
}

/* Three plain-English proof points. This used to be raw equations, which read as
   a maths worksheet to anyone who was not already sold. The claim is the same,
   the delivery is quieter: small type, one line each, figures in tabular nums so
   they sit on a common width. */
.hero__proof {
  padding-top: var(--space-5);
  border-top: 1.5px solid var(--line);
}

.hero__proof-label {
  margin: 0 0 var(--space-4);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.hero__proof-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  max-width: 30rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.hero__proof-list b {
  font-weight: 650;
  color: var(--jade);
  font-variant-numeric: tabular-nums;
  margin-right: 3px;
}

/* ---------- Hero quick calculator ---------- */

.quick-calc {
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lift);
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
}

.quick-calc__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 1.5px solid var(--line);
}

.quick-calc__head h2 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.quick-calc__head a {
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.quick-calc__result {
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1.5px solid var(--jade-line);
  border-radius: var(--radius-sm);
  background: var(--jade-wash);
  text-align: center;
}

.quick-calc__num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  color: var(--jade-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.quick-calc__num small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-left: 6px;
  vertical-align: middle;
}

.quick-calc__desc {
  margin: var(--space-4) 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Trust band ---------- */

.trust-band {
  padding: var(--space-7) 0;
  border-bottom: 2px solid var(--line-strong);
  background: var(--ink);
  color: var(--bg);
}

.trust-band__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.trust-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-6);
  border-left: 1.5px solid rgba(255, 255, 255, 0.16);
}

.trust-item:first-child {
  padding-left: 0;
  border-left: 0;
}

.trust-item:last-child { padding-right: 0; }

.trust-item__ic {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs);
}

.trust-item h3 {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--bg);
  margin: 0 0 5px;
}

.trust-item p {
  font-size: 0.83rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.66);
  margin: 0;
}

/* ---------- Tool directory ---------- */

.cat-block { margin-bottom: var(--space-8); }
.cat-block:last-child { margin-bottom: 0; }

.cat-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1.5px solid var(--line);
}

.cat-block__head h3 { margin: 0 0 4px; }
.cat-block__head p { margin: 0; }
.cat-block__more { font-weight: 650; white-space: nowrap; }

/* ---------- Method note ---------- */

.method {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-7);
  align-items: center;
  padding: var(--space-7);
  background: var(--surface);
}

.method h2 {
  font-size: 1.7rem;
  margin-bottom: var(--space-4);
}

.method .muted { margin-bottom: var(--space-5); }

/* Four accepted equations disagreeing about one person. This is the whole
   argument of the site in a single object, so it gets a real plot: a shared
   kg axis, a dot per equation, and a band showing how far apart they get.
   The band edges come from --band-l / --band-w, set inline on the server and
   updated by home.js, so the figure is correct before any script runs. */
.spread {
  margin: 0;
  padding: var(--space-5);
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.spread figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1.5px solid var(--line);
}

.spread__state {
  color: var(--jade-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.spread__ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
}

.spread__range { flex: 1 1 200px; display: block; }

.spread__range-lab {
  display: block;
  margin-bottom: 7px;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.spread__range-lab b {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Range track. Styled per-engine because the shorthand does not exist. */
.spread__range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: ew-resize;
}

.spread__range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
}

.spread__range input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
}

.spread__range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 19px;
  height: 19px;
  margin-top: -7.5px;
  border-radius: 50%;
  background: var(--jade);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 1.5px var(--jade);
}

.spread__range input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--jade);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 1.5px var(--jade);
}

.spread__range input[type="range"]:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.seg--sm button { padding: 7px 13px; font-size: 0.78rem; }

/* The plot. Three columns so every row shares one axis. */
.spread__plot { position: relative; display: grid; gap: 10px; }

.spread__row {
  position: relative;
  display: grid;
  grid-template-columns: 6.9rem 1fr 4.6rem;
  align-items: center;
  gap: var(--space-3);
}

.spread__name {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.spread__name i {
  font-style: normal;
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.spread__track {
  position: relative;
  display: block;
  height: 20px;
}

/* Axis line the dot sits on. */
.spread__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1.5px;
  background: var(--line);
}

/* The disagreement band, drawn once behind all four rows. */
.spread__track::after {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--band-l, 0%);
  width: var(--band-w, 0%);
  background: rgba(15, 122, 90, 0.11);
  border-left: 1.5px solid rgba(15, 122, 90, 0.4);
  border-right: 1.5px solid rgba(15, 122, 90, 0.4);
}

.spread__dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--jade-deep);
  box-shadow: 0 0 0 3px var(--bg);
  transition: left 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
  z-index: 1;
}

.spread__kg {
  font-size: 0.86rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.spread__kg b { color: var(--ink); font-weight: 650; }

.spread__axis {
  display: flex;
  justify-content: space-between;
  margin: 9px 0 0;
  padding-left: calc(6.9rem + var(--space-3));
  padding-right: calc(4.6rem + var(--space-3));
  font-size: 0.68rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.spread__warn {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
}

.spread__warn[hidden] { display: none; }

.spread__total {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
  padding-top: var(--space-3);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--jade-deep);
  font-variant-numeric: tabular-nums;
  border-top: 1.5px solid var(--line);
}

/* ---------- Closing CTA ---------- */

.cta-band {
  position: relative;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  background: var(--surface);
  overflow: hidden;
}

/* Corner ticks — a quiet nod to measurement marks. */
.cta-band::before,
.cta-band::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--jade);
  border-style: solid;
}

.cta-band::before {
  top: 14px; left: 14px;
  border-width: 2px 0 0 2px;
}

.cta-band::after {
  bottom: 14px; right: 14px;
  border-width: 0 2px 2px 0;
}

.cta-band h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  margin-bottom: var(--space-3);
}

.cta-band p {
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto var(--space-6);
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }

  .quick-calc {
    position: static;
    max-width: 480px;
  }

  .method { grid-template-columns: 1fr; }

  .trust-band__grid { grid-template-columns: 1fr; }

  .trust-item {
    padding: var(--space-4) 0;
    border-left: 0;
    border-top: 1.5px solid rgba(255, 255, 255, 0.16);
  }

  .trust-item:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .trust-item:last-child { padding-bottom: 0; }
}

@media (max-width: 620px) {
  .hero { padding: var(--space-7) 0 var(--space-7); }

  .cat-block__head { flex-wrap: wrap; gap: var(--space-2); }

  .method { padding: var(--space-6) var(--space-5); }

  .quick-calc { padding: var(--space-5); }

  .quick-calc__num { font-size: 2.5rem; }

  .cta-band { padding: var(--space-7) var(--space-5); }

  /* The value column is the one thing that cannot shrink, so the name column
     gives up its year and the axis labels drop to the row width. */
  .spread { padding: var(--space-4); }
  .spread__row { grid-template-columns: 5.4rem 1fr 4.2rem; gap: var(--space-2); }
  .spread__name i { display: none; }
  .spread__axis {
    padding-left: calc(5.4rem + var(--space-2));
    padding-right: calc(4.2rem + var(--space-2));
  }
}

/* The dots slide when the height changes, which is motion for its own sake if
   the reader has asked for less of it. */
@media (prefers-reduced-motion: reduce) {
  .spread__dot { transition: none; }
}
