/* ================================================================
   trialtree.health — /how-it-works
   Reverse-engineered from the landing (index.html) — same design
   language: full-bleed bands, editorial two-column layouts, ultra-light
   display weights, numbers as glyphs, 28px radius, one dark moment,
   zero decorative icons, and generous vertical air.
   ================================================================ */

/* Local tokens — inherit the v4 palette from styles.css, add page-scoped
   type + radius scale (matches v4's --display / --display-lg / --radius). */
.hiw-page {
  --hiw-wrap: 1080px;
  --hiw-display:    clamp(1.85rem, 3.6vw, 2.55rem);
  --hiw-display-lg: clamp(2.4rem, 5.2vw, 3.5rem);
  --hiw-radius: 28px;
  --hiw-ease: cubic-bezier(0.22, 1, 0.36, 1);

  color: var(--ink-soft);
  font-weight: 450;
}
.hiw-page h1, .hiw-page h2, .hiw-page h3 {
  color: var(--ink);
  font-family: var(--font-body);
  letter-spacing: -0.03em;
}

/* full-bleed bands (identical mechanic to v4's .band) */
.hiw-band {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.hiw-wrap {
  max-width: var(--hiw-wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* editorial eyebrow — small mint chip, matches v4's .why label rhythm */
.hiw-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--sage-veil);
  color: var(--forest-mid);
  font-size: 0.75rem;
  font-weight: 620;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ================================================================
   HERO — editorial, generous, centered (matches .thesis on landing)
   ================================================================ */
.hiw-hero {
  max-width: var(--hiw-wrap);
  margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) 24px clamp(48px, 6vw, 72px);
  text-align: center;
}
.hiw-hero h1 {
  margin: 22px auto 0;
  max-width: 20ch;
  font-size: var(--hiw-display-lg);
  font-weight: 480;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hiw-hero .lead {
  margin: 22px auto 0;
  max-width: 54ch;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  line-height: 1.55;
  color: var(--ink-mute);
  text-wrap: pretty;
}
.hiw-hero .lead strong { color: var(--ink); font-weight: 560; }

/* ================================================================
   PROLOGUE — one dark editorial card, echoes the landing's rule-brick
   ================================================================ */
.hiw-prologue {
  max-width: var(--hiw-wrap);
  margin: clamp(48px, 7vw, 88px) auto 0;
  padding: 0 24px;
}
.hiw-prologue-card {
  background: var(--ink);
  color: rgba(245, 247, 245, 0.86);
  border-radius: var(--hiw-radius);
  padding: clamp(36px, 5vw, 56px);
  display: grid;
  gap: 32px;
}
@media (min-width: 800px) {
  .hiw-prologue-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 56px;
    align-items: center;
  }
}
.hiw-prologue-card h2 {
  color: #fafafa;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 480;
  line-height: 1.12;
  max-width: 16ch;
  margin: 12px 0 0;
}
.hiw-prologue-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--gold-hope);
}
.hiw-prologue-body p {
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}
.hiw-prologue-body p + p { margin-top: 14px; }
.hiw-prologue-body p.sub {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.5);
  max-width: 44ch;
}

/* ================================================================
   FUNNEL — full-bleed mint band, editorial split (like .why on landing)
   ================================================================ */
.hiw-funnel-band {
  margin-top: clamp(64px, 10vw, 112px);
  background: linear-gradient(180deg, #e4ede3 0%, #dce8db 100%);
  padding: clamp(56px, 8vw, 96px) 24px;
}
.hiw-funnel-inner {
  max-width: var(--hiw-wrap);
  margin: 0 auto;
}
.hiw-funnel-grid {
  display: grid;
  gap: 40px;
  align-items: center;
}
@media (min-width: 900px) {
  .hiw-funnel-grid {
    /* canvas column widened (~+40px) so the settled dots aren't crowded */
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 48px;
  }
}
.hiw-funnel-copy h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.55rem);
  font-weight: 480;
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 16ch;
  text-wrap: balance;
  margin: 16px 0 0;
}
.hiw-funnel-copy p {
  margin: 20px 0 0;
  font-size: clamp(1.05rem, 1.5vw, 1.18rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34ch;
  padding-left: 16px;
  border-left: 2px solid rgba(36, 85, 68, 0.28);
}
.hiw-funnel-canvas {
  /* hosts the flip card + the replay button; radius/shadow live on the faces
     so the 3D flip isn't clipped mid-rotation */
}
.hiw-funnel-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── the flip card: front = the sorting animation, back = the example results ── */
.hiw-flip {
  position: relative;
  /* slightly portrait — the back face is a web page, so the card reads as one */
  aspect-ratio: 13 / 14.3;
  perspective: 1600px;
}
.hiw-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.15s cubic-bezier(0.45, 0.05, 0.2, 1);
}
.hiw-flip.is-flipped .hiw-flip-inner { transform: rotateY(180deg); }
.hiw-flip.no-anim .hiw-flip-inner { transition: none; }
.hiw-face {
  position: absolute;
  inset: 0;
  border-radius: var(--hiw-radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 24px 60px rgba(15, 40, 32, 0.16);
}
.hiw-face-front { background: transparent; }
.hiw-face-back {
  transform: rotateY(180deg);
  background: #ffffff;
  border: 1px solid #e6e6e2;
  display: flex;
  flex-direction: column;
}
@media (prefers-reduced-motion: reduce) {
  .hiw-flip-inner { transition: none; }
}

.hiw-replay-row { text-align: center; margin-top: 14px; }
.hiw-replay {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 560;
  color: #245544;
  background: rgba(36, 85, 68, 0.10);
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}
.hiw-replay:hover { background: rgba(36, 85, 68, 0.17); }

/* ── the back face: a miniature of the real results page (white web page).
      Strong match is the focal tier, listed out; worth-confirming under it;
      likely-not collapsed with its count — never hidden. ── */
.dash-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid #ececea;
  background: #fff;
}
.dash-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 580;
  letter-spacing: -0.01em;
  color: #0c0c0c;
}
.dash-brand b { color: #245544; font-weight: 450; }
.dash-chip {
  font-size: 0.6rem;
  font-weight: 640;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #245544;
  background: #e4ede3;
  border-radius: 999px;
  padding: 4px 9px;
}
.dash-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(10px, 1.6vw, 16px) clamp(14px, 2vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: #fff;
}
.dash-head h3 {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 540;
  letter-spacing: -0.02em;
  color: #0c0c0c;
}
.dash-head p {
  margin: 2px 0 0;
  font-size: clamp(0.68rem, 1.2vw, 0.8rem);
  color: #5c5c5c;
}
/* tier headers carry a small round dot in the tier colour — the same dots the
   animation sorts — instead of coloured text or accent bars */
.dash-tier h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(0.6rem, 1vw, 0.68rem);
  font-weight: 620;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5c5c5c;
  font-variant-numeric: tabular-nums;
}
.dash-tier h4::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.tier-strong h4::before { background: #E9B44C; }
.tier-worth h4::before { background: #5B9C84; }
.dash-tier h4 em {
  font-style: normal;
  font-weight: 620;
  color: #0c0c0c;
}
/* rows are a flat list separated by hairlines — no boxes-in-boxes */
.dash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(6px, 1.1vw, 8px) 2px;
  border-top: 1px solid #efefec;
}
.dash-row:first-of-type { margin-top: 6px; }
.dash-main { min-width: 0; flex: 1; }
.dash-main h5 {
  margin: 0;
  font-size: clamp(0.74rem, 1.3vw, 0.84rem);
  font-weight: 560;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: #0c0c0c;
}
.dash-main p {
  margin: 2px 0 0;
  font-size: clamp(0.62rem, 1.1vw, 0.7rem);
  color: #5c5c5c;
}
/* flat mint/gold washes, the landing's pill idiom (sage-veil / gold-hope) */
.dash-pill {
  flex: none;
  font-size: clamp(0.58rem, 1vw, 0.66rem);
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.dash-pill.ok { background: #e4ede3; color: #245544; }
.dash-pill.part { background: #f3ead4; color: #8a6420; }
.dash-more {
  margin: 2px 2px 0;
  padding-top: 6px;
  border-top: 1px solid #efefec;
  font-size: clamp(0.6rem, 1.05vw, 0.7rem);
  color: #7b7b76;
}
/* likely-not: the same flat list idiom, just collapsed */
.dash-not {
  border: 0;
  border-top: 1px solid #efefec;
  border-radius: 0;
  background: none;
  padding-top: 2px;
}
.dash-not summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  padding: 8px 2px;
  font-size: clamp(0.6rem, 1vw, 0.68rem);
  font-weight: 620;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5c5c5c;
  font-variant-numeric: tabular-nums;
}
.dash-not summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: #8B97B4;
}
.dash-not summary::-webkit-details-marker { display: none; }
.dash-not summary em {
  font-style: normal;
  font-weight: 620;
  color: #0c0c0c;
}
.dash-not-hint {
  font-weight: 480;
  letter-spacing: 0;
  text-transform: none;
  color: #8b8b86;
}
.dash-not summary::after {
  content: '▾';
  margin-left: auto;
  color: #8B97B4;
  transition: transform 0.25s;
}
.dash-not[open] summary::after { transform: rotate(180deg); }
.dash-not ul { list-style: none; margin: 0; padding: 0 2px 8px; }
.dash-not li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: clamp(0.62rem, 1.05vw, 0.72rem);
  padding: 5px 0;
  border-top: 1px solid #efefec;
  color: #0c0c0c;
}
.dash-not li span:last-child { color: #5c5c5c; text-align: right; }
.dash-not li.dash-more-li { color: #7b7b76; }
.dash-foot {
  margin: 2px 0 0;
  text-align: center;
  font-size: clamp(0.6rem, 1.05vw, 0.7rem);
  color: #7b7b76;
}
.dash-foot strong { color: #245544; font-weight: 580; }

/* ================================================================
   STEPS — editorial two-column, big number left, copy right.
   No timeline dots. No vertical line. Numbers ARE the design.
   ================================================================ */
.hiw-steps {
  list-style: none;
  padding: 0;
  margin: clamp(72px, 10vw, 120px) auto 0;
  max-width: var(--hiw-wrap);
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 8vw, 96px);
}
.hiw-step {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: start; /* top-align: number sits on the same row as h2 title */
}
@media (min-width: 720px) {
  .hiw-step {
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    gap: 40px;
  }
}
.hiw-step-num {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 380;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hiw-step-time {
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--forest-mid);
  line-height: 1;
}
.hiw-step-body h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: 480;
  line-height: 1.15;
  letter-spacing: -0.025em;
  /* remove max-width so short titles stay one line — every step is now ≤ 32 chars */
  text-wrap: nowrap;
  white-space: nowrap;
  /* optical-align h2 cap top with number cap top */
  padding-top: 0.15em;
}
@media (max-width: 720px) {
  .hiw-step-body h2 { white-space: normal; text-wrap: balance; }
}
.hiw-step-body p {
  margin: 18px 0 0;
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 60ch;
}
.hiw-step-body p strong { color: var(--ink); font-weight: 560; }
.hiw-step-body p + p { margin-top: 14px; }

/* Behind-the-curtain — a border-left editorial callout, not a green box */
.hiw-curtain {
  margin-top: 22px;
  padding: 4px 0 4px 18px;
  border-left: 2px solid rgba(36, 85, 68, 0.28);
  max-width: 56ch;
}
.hiw-curtain .k {
  display: block;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--forest-mid);
  margin-bottom: 6px;
}
.hiw-curtain p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink-mute);
}

/* The tiny "we can only see …" line — quieter, no more decorative lock */
.hiw-guarantee {
  display: block;
  margin-top: 22px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--forest-mid);
  max-width: 44ch;
}

/* ================================================================
   PROMISES — clean white cards, big radius, near-zero border
   ================================================================ */
.hiw-promises-section {
  max-width: var(--hiw-wrap);
  margin: clamp(96px, 13vw, 140px) auto 0;
  padding: 0 24px;
}
.hiw-promises-section .hiw-eyebrow { margin-bottom: 20px; }
.hiw-promises-section h2 {
  font-size: var(--hiw-display);
  font-weight: 480;
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 22ch;
  text-wrap: balance;
  margin: 0 0 clamp(32px, 4vw, 48px);
}
.hiw-promises-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 800px) {
  .hiw-promises-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}
.hiw-promise {
  background: #fff;
  border: 0;
  border-radius: var(--hiw-radius);
  padding: 28px 28px 30px;
  box-shadow: 0 1px 0 rgba(12, 12, 12, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hiw-promise .k {
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--forest-mid);
}
.hiw-promise h3 {
  font-size: 1.24rem;
  font-weight: 520;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.hiw-promise p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* The "when you come back" loop — quiet border-left callout */
.hiw-loop {
  max-width: var(--hiw-wrap);
  margin: clamp(72px, 10vw, 120px) auto 0;
  padding: 8px 24px 8px 42px;
  position: relative;
}
.hiw-loop::before {
  content: "";
  position: absolute;
  left: 24px; top: 8px; bottom: 8px;
  width: 2px;
  background: rgba(36, 85, 68, 0.28);
}
.hiw-loop p {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
}
.hiw-loop p strong { color: var(--ink); font-weight: 560; }

/* ================================================================
   CLOSE — dark editorial card, echoes the landing's .waitlist card
   ================================================================ */
.hiw-close {
  max-width: var(--hiw-wrap);
  margin: clamp(96px, 13vw, 140px) auto 0;
  padding: 0 24px;
}
.hiw-close-card {
  background: var(--ink);
  color: #fafafa;
  border-radius: 32px;
  padding: clamp(48px, 7vw, 88px) clamp(32px, 5vw, 64px);
  text-align: center;
}
.hiw-close-card h2 {
  font-size: clamp(1.75rem, 4vw, 2.7rem);
  font-weight: 480;
  color: #fafafa;
  line-height: 1.08;
  letter-spacing: -0.035em;
  max-width: 22ch;
  margin: 0 auto;
  text-wrap: balance;
}
.hiw-close-card p {
  margin: 22px auto 0;
  max-width: 42ch;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.62);
}
.hiw-close-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 36px auto 0;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  background: #eef4ef;
  color: var(--forest-dark);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 580;
  text-decoration: none;
  transition: background 160ms var(--hiw-ease), transform 160ms var(--hiw-ease);
}
.hiw-close-card .btn:hover { background: #fff; }
.hiw-close-card .btn:active { transform: scale(0.98); }

/* ================================================================
   FALLBACK for legacy .hiw-* classes still referenced in markup
   (harmless if the markup is fully updated; safety net)
   ================================================================ */
.hiw-never { display: none; } /* remove the decorative-lock guarantee row */
