/* ============================================================================
   Ride Height Guide — the "Height Gate" tool + the SEO body.
   Built on the site's Nightfall tokens (--paper, --ink, --gold, --rule ...).
   The tool is a CSS measuring wall; ride-height-explorer.js drives one --in
   variable and toggles .is-open / .is-cleared. A Three.js gate corridor lazy-
   loads into .hg-corridor behind it as pure enhancement.
   ========================================================================== */

:root {
  --hg-green:      oklch(78% 0.15 150);   /* "cleared / you can ride" */
  --hg-green-soft: oklch(78% 0.15 150 / 0.16);
  --hg-locked:     oklch(60% 0.02 280);
}

/* This page runs wider than the 820px prose default. */
.guide--height { max-width: 1080px; }
.guide--height .hg-prose { max-width: 760px; margin: 0 auto; }
.hg-hero { max-width: 760px; margin: 0 auto; }
.guide--height .guide-title { text-wrap: balance; }
.guide .hg-standfirst {
  text-align: center; max-width: 60ch; margin-inline: auto;
  text-wrap: pretty; color: var(--ink-soft);
}

/* ── The tool ─────────────────────────────────────────────────────────── */
.hg-tool {
  margin: var(--space-2xl) 0 var(--space-3xl);
  padding: var(--space-xl);
  background: linear-gradient(180deg, var(--paper-2), color-mix(in oklab, var(--paper-2) 70%, var(--paper)));
  border: 1px solid var(--rule);
  border-radius: 20px;
  box-shadow: 0 20px 60px -30px oklch(0% 0 0 / 0.6);
}
.hg-tool-h {
  font-family: var(--display); font-size: clamp(20px, 3vw, 28px);
  color: var(--ink); text-align: center; margin: 0 0 var(--space-lg);
}

/* ── The gauge: a precision height instrument (no illustration) ───────── */
.hg-gauge {
  max-width: 720px;
  margin: var(--space-xl) auto 0;
  padding: var(--space-2xl) var(--space-lg) 0;
}
.hg-gauge-label {
  display: block; text-align: center;
  font-family: var(--label); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.16em; font-size: 11px; color: var(--gold);
}

.hg-rail {
  position: relative; height: 10px;
  margin: 64px 18px 56px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--paper) 70%, #000 12%);
  box-shadow: inset 0 1px 3px oklch(0% 0 0 / 0.5);
}
.hg-rail-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  box-shadow: 0 0 16px oklch(84% 0.13 86 / 0.55);
  will-change: width;
}

/* tick marks sit above the rail; threshold labels sit below it */
.hg-rail-ticks { position: absolute; inset: 0; }
.hg-rt { position: absolute; top: 0; width: 0; }
.hg-rt::before {
  content: ""; position: absolute; left: 0; bottom: 16px;
  transform: translateX(-50%);
  width: 2px; height: 8px; border-radius: 1px;
  background: color-mix(in oklab, var(--rule) 55%, transparent);
  transition: background 200ms ease, height 200ms ease;
}
.hg-rt.is-major::before { height: 15px; background: var(--rule); }
.hg-rt.is-major.is-cleared::before { background: var(--hg-green); }
.hg-rt b {
  position: absolute; left: 0; top: 22px; transform: translateX(-50%);
  font-family: var(--label); font-weight: 700; font-size: 12px;
  color: var(--muted); font-variant-numeric: tabular-nums;
  transition: color 200ms ease;
}
.hg-rt.is-cleared b { color: var(--hg-green); }

.hg-knob {
  position: absolute; top: 50%; left: 40%;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff, var(--gold) 52%, var(--gold-deep));
  box-shadow: 0 0 0 5px oklch(84% 0.13 86 / 0.16), 0 4px 14px oklch(0% 0 0 / 0.5);
  z-index: 4; pointer-events: none; will-change: left;
}
.hg-rail:focus-within .hg-knob { box-shadow: 0 0 0 6px oklch(84% 0.13 86 / 0.4), 0 4px 14px oklch(0% 0 0 / 0.5); }
.hg-knob-val {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%);
  font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1;
  color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 9px;
  padding: 5px 11px; white-space: nowrap;
  box-shadow: 0 6px 18px oklch(0% 0 0 / 0.35);
}
.hg-knob-val::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--paper-2);
}

/* the real control: a transparent native range over the rail (keyboard + AT) */
.hg-rail-input {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 100%; height: 44px; margin: 0; padding: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer; z-index: 5;
}
.hg-rail-input:focus { outline: none; }
.hg-rail-input::-webkit-slider-runnable-track { background: transparent; border: none; }
.hg-rail-input::-moz-range-track { background: transparent; border: none; }
.hg-rail-input::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 44px; opacity: 0; cursor: grab; }
.hg-rail-input::-webkit-slider-thumb:active { cursor: grabbing; }
.hg-rail-input::-moz-range-thumb { width: 44px; height: 44px; border: none; opacity: 0; cursor: grab; }

.hg-gauge-count {
  margin: 0; text-align: center;
  font-family: var(--text); font-size: 16px; color: var(--ink-soft);
}
.hg-gauge-count b {
  font-family: var(--display); font-size: 30px; color: var(--hg-green);
  margin-right: 6px; font-variant-numeric: tabular-nums;
}

/* ── Gate list ────────────────────────────────────────────────────────── */
.hg-list-h {
  font-family: var(--label); text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-align: center; margin: var(--space-2xl) 0 var(--space-md);
}
/* A dense, scannable reference list, not 57 cards. Rows flow into as many
   columns as fit; a hairline separates each row. State reads from the marker,
   the name weight/colour, and the requirement colour, never from opacity, so
   locked rows stay fully legible. */
.hg-gates {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr));
  gap: 0 var(--space-2xl);
}
.hg-gate { border-bottom: 1px solid var(--hair); }
.hg-gate a {
  display: flex; align-items: center; gap: var(--space-sm);
  min-height: 54px; padding: 8px; border-radius: 8px;
  text-decoration: none; border-bottom: none;
  transition: background 200ms ease;
}
.hg-gate a:hover { background: color-mix(in oklab, var(--gold) 7%, transparent); }
.hg-gate-mark {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--hg-locked);
  display: grid; place-items: center;
  transition: border-color 240ms ease, background 240ms ease;
}
.hg-gate-mark::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--hg-locked);
}
.hg-gate.is-open .hg-gate-mark { border-color: var(--hg-green); background: var(--hg-green); }
.hg-gate.is-open .hg-gate-mark::before {
  width: 4px; height: 8px; border-radius: 0; background: transparent;
  border: solid var(--paper); border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.hg-gate-body { flex: 1 1 auto; min-width: 0; }
.hg-gate-name {
  font-family: var(--text); font-size: 15px; line-height: 1.25; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 200ms ease;
}
.hg-gate.is-open .hg-gate-name { color: var(--ink); }
.hg-gate a:hover .hg-gate-name { color: var(--gold); }
.hg-gate-meta {
  display: block; margin-top: 1px;
  font-family: var(--label); font-size: 11px; color: var(--muted);
}
.hg-gate-req {
  flex: none; width: 42px; text-align: right;
  font-family: var(--label); font-weight: 800; font-size: 12px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.hg-gate.is-open .hg-gate-req { color: var(--hg-green); }
.hg-note { text-align: center; color: var(--muted); font-size: 14px; margin: var(--space-xl) 0 0; }

/* ── Ladder ───────────────────────────────────────────────────────────── */
.hg-ladder { display: grid; gap: var(--space-md); margin: var(--space-xl) 0 var(--space-2xl); }
.hg-rung {
  padding: var(--space-md) var(--space-lg);
  background: color-mix(in oklab, var(--paper-2) 55%, transparent);
  border: 1px solid var(--hair);
  border-radius: 14px;
}
.hg-rung-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--space-sm);
}
.hg-rung-in {
  font-family: var(--display); font-size: 16px; font-weight: 700;
  color: var(--paper); background: var(--gold);
  padding: 3px 12px; border-radius: 999px; line-height: 1.3;
}
.hg-rung--any .hg-rung-in { background: var(--hg-green); }
.hg-rung-count {
  font-family: var(--label); font-weight: 700; font-size: 13px;
  color: var(--ink-soft); letter-spacing: 0.02em;
}
.hg-rung p { margin: 0 0 var(--space-xs); font-size: 15px; color: var(--muted); }
.hg-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.hg-chips li {
  font-size: 14px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--paper);
}
.hg-chips a { border-bottom: none; }
.hg-chips em { color: var(--muted); font-style: normal; font-size: 12px; }

/* ── By the numbers (to-scale bars) ───────────────────────────────────── */
.hg-stats {
  display: grid; gap: var(--space-xl);
  grid-template-columns: 1fr; margin: var(--space-lg) 0;
}
.hg-stat-group h3 {
  font-family: var(--display); font-size: 18px; color: var(--ink);
  margin: 0 0 var(--space-sm); display: flex; align-items: baseline; gap: 8px;
}
.hg-stat-group h3 span {
  font-family: var(--label); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.hg-bar {
  display: grid; grid-template-columns: 1fr; gap: 4px;
  padding: 8px 0; border-bottom: none;
}
.hg-bar-name { font-family: var(--text); font-size: 14px; color: var(--ink); }
.hg-bar-track {
  display: block; height: 14px; border-radius: 7px;
  background: color-mix(in oklab, var(--paper-2) 80%, transparent);
  overflow: hidden;
}
.hg-bar-fill {
  display: block; height: 100%; width: 0; border-radius: 7px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 900ms cubic-bezier(.2,.8,.2,1);
}
.hg-bar-val {
  font-family: var(--label); font-weight: 800; font-size: 13px; color: var(--gold);
}
.hg-microcredit { font-size: 13px; color: var(--muted); font-style: italic; }

/* ── Park tables ──────────────────────────────────────────────────────── */
.hg-parktable { margin: var(--space-lg) 0; }
.hg-parktable h3 { font-family: var(--display); font-size: 22px; color: var(--ink); margin: 0 0 var(--space-sm); }
.hg-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.hg-table th, .hg-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--hair);
  vertical-align: baseline;
}
.hg-table thead th {
  font-family: var(--label); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); font-weight: 700;
}
.hg-table tbody th { font-weight: 500; }
.hg-table tbody th a { color: var(--ink); border-bottom: 1px solid oklch(84% 0.13 86 / 0.3); }
.hg-table td { color: var(--muted); }
.hg-td-req { font-family: var(--label); font-weight: 800; color: var(--gold); white-space: nowrap; }
.hg-table tr.is-any .hg-td-req { color: var(--hg-green); }

/* ── FAQ ──────────────────────────────────────────────────────────────── */
.hg-faq { margin: var(--space-md) 0 var(--space-2xl); }
.hg-faq-item { border-bottom: 1px solid var(--hair); padding: var(--space-sm) 0; }
.hg-faq-item summary {
  font-family: var(--display); font-size: 18px; color: var(--ink);
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: var(--space-md);
}
.hg-faq-item summary::after { content: "+"; color: var(--gold); font-weight: 700; }
.hg-faq-item[open] summary::after { content: "−"; }
.hg-faq-item p { margin: var(--space-sm) 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.6; }

/* ── Cross-links ──────────────────────────────────────────────────────── */
.hg-cross { margin: var(--space-2xl) 0 0; }
.hg-cross h2 { margin-bottom: var(--space-md); }
.hg-cross-grid { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hg-cross-grid a {
  display: grid; gap: 2px; padding: var(--space-md);
  border: 1px solid var(--hair); border-radius: 12px; border-bottom: 1px solid var(--hair);
  background: var(--paper-2);
}
.hg-cross-grid b { font-family: var(--display); font-size: 17px; color: var(--ink); font-weight: 600; }
.hg-cross-grid span { font-size: 14px; color: var(--muted); }

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

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hg-rail-fill, .hg-knob, .hg-bar-fill, .hg-gate a { transition: none; }
}
