/* PC Health — the athletic center: black-and-white sport photography, a breath-by-breath readout as proof,
   measured numbers on white. Shares the Lung Institute's layout pieces (lung.css): points, path steps, test list. */

.hx-hero, .hx-cpet, .hx-band, .hx-close { --night: #080d1c; }

/* ---------- hero: a full-bleed photograph, copy on the dark side ---------- */

.hx-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(560px, calc(100svh - var(--header-h) - var(--facet-h)), 820px);
  background: var(--night);
  overflow: clip;
}
.hx-media { position: absolute; inset: 0 0 0 24%; z-index: -2; }
.hx-media img { width: 100%; height: 100%; object-fit: cover; object-position: 58% 40%; }
.hx-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, var(--night) 0%, var(--night) 24%, rgba(8, 13, 28, 0.78) 36%, rgba(8, 13, 28, 0.2) 62%, rgba(8, 13, 28, 0) 100%),
    linear-gradient(0deg, var(--night) 0%, rgba(8, 13, 28, 0) 22%);
}
.hx-grid { padding-block: clamp(56px, 9vh, 110px); }
.hx-copy { max-width: 600px; }
.hx-kicker {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
}
.hx-hero h1 {
  margin-top: 18px;
  font-size: clamp(2.6rem, 4.9vw, 4.7rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #fff;
  max-width: 14ch;
}
.hx-hero .lede { margin-top: 24px; max-width: 42ch; }

@media (max-width: 760px) {
  .hx-hero { align-items: end; min-height: 0; }
  .hx-media { inset: 0 0 auto 0; height: clamp(300px, 88vw, 440px); }
  .hx-media img { object-position: 100% 30%; }
  .hx-hero::before { background: linear-gradient(180deg, rgba(8, 13, 28, 0) 0px, rgba(8, 13, 28, 0.35) 160px, var(--night) clamp(300px, 88vw, 440px)); }
  .hx-grid { padding-block: clamp(240px, 70vw, 360px) 48px; }
}

/* ---------- CPET: the readout beside the explanation ---------- */

.hx-cpet { background: var(--night); }
.hx-cpet-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 5vw, 88px); align-items: center; }
.hx-cpet h2 { color: #fff; }
.hx-cpet .section-head { margin-bottom: 28px; }
.hx-cpet .proc-points li { color: var(--ink-inv); }
.hx-cpet .proc-points li::before { background: var(--signal); }
.hx-cpet .link-arrow { margin-top: 26px; color: #fff; }

.hx-readout {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(141, 180, 255, 0.07), rgba(141, 180, 255, 0.02));
  box-shadow: inset 0 0 0 1px rgba(205, 220, 255, 0.14);
}
.hx-readout-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono, "Atkinson Hyperlegible Mono", monospace);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-inv-2);
}
.hx-live { display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--signal); vertical-align: 0.08em; animation: hx-pulse 1.6s ease-in-out infinite; }
@keyframes hx-pulse { 50% { opacity: 0.25; } }
.hx-trace { width: 100%; height: auto; display: block; overflow: visible; }
.hx-trace .grid line { stroke: rgba(205, 220, 255, 0.09); stroke-width: 1; }
.hx-trace .axis { fill: var(--ink-inv-2); font: 500 11px var(--font-display); letter-spacing: 0.02em; }
.hx-trace .dot-vo2 { fill: #cddcff; }
.hx-trace .dot-vco2 { fill: var(--c-health); }
.hx-trace .line-vo2, .hx-trace .line-vco2 { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hx-trace .line-vo2 { stroke: #cddcff; }
.hx-trace .line-vco2 { stroke: #b6a6e6; }
.hx-trace .mark line { stroke: rgba(255, 255, 255, 0.5); stroke-width: 1; stroke-dasharray: 3 4; }
.hx-trace .mark text { fill: #fff; font: 600 12px var(--font-display); }
.hx-trace .mark .sub { fill: var(--ink-inv-2); font-weight: 500; font-size: 11px; }
.hx-trace .peak circle { fill: none; stroke: #fff; stroke-width: 1.5; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.9rem; color: var(--ink-inv); }
.hx-legend li { display: inline-flex; align-items: center; gap: 9px; }
.hx-legend li::before { content: ""; width: 18px; height: 2.5px; border-radius: 2px; background: #cddcff; }
.hx-legend .is-vco2::before { background: #b6a6e6; }
.hx-readout figcaption { font-size: 0.88rem; color: var(--ink-inv-2); }

/* drawing in: the lines trace left to right, each breath's dot appears as the line passes it */
.hx-trace.is-drawing .line-vo2, .hx-trace.is-drawing .line-vco2 { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hx-draw 2.8s cubic-bezier(0.45, 0, 0.25, 1) forwards; }
.hx-trace.is-drawing .dots circle { opacity: 0; animation: hx-dot 0.3s ease-out forwards; animation-delay: var(--d); }
.hx-trace.is-drawing .mark, .hx-trace.is-drawing .peak { opacity: 0; animation: hx-dot 0.5s ease-out forwards; animation-delay: var(--d); }
@keyframes hx-draw { to { stroke-dashoffset: 0; } }
@keyframes hx-dot { to { opacity: 1; } }

@media (max-width: 960px) { .hx-cpet-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .hx-readout-head span + span { display: none; }
  /* the chart scales down with the screen: its labels are set larger in chart units to stay readable */
  .hx-trace .axis { font-size: 18px; }
  .hx-trace .axis-y { display: none; }
  .hx-trace .mark text { font-size: 19px; }
}

/* ---------- the numbers ---------- */

.hx-numbers { background: var(--white); }
.hx-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(24px, 3vw, 48px); counter-reset: metric; }
.hx-metrics li { display: grid; gap: 10px; align-content: start; padding-block: 28px 34px; border-top: 1px solid var(--line-strong); counter-increment: metric; }
.hx-metrics li::before {
  content: counter(metric, decimal-leading-zero);
  font-family: var(--font-mono, "Atkinson Hyperlegible Mono", monospace);
  font-size: 0.8rem;
  color: var(--violet);
}
.hx-metrics h3 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.5rem, 2.1vw, 1.9rem); line-height: 1.1; letter-spacing: -0.015em; }
.hx-metrics h3 span { margin-left: 6px; font-family: var(--font-display); font-weight: 500; font-size: 0.8rem; letter-spacing: 0.02em; color: var(--ink-2); }
.hx-metrics p { color: var(--ink-2); max-width: 40ch; }
.hx-metrics .hx-use { color: var(--ink); }
.hx-use b {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}
@media (max-width: 960px) { .hx-metrics { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .hx-metrics { grid-template-columns: 1fr; } }

/* the VO₂ max scale: fitness ranges above the axis, clinical ranges below */
.vo2-scale {
  display: grid;
  gap: 28px;
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(24px, 3.4vw, 44px);
  border-radius: 16px;
  background: var(--paper);
}
.vo2-head { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 12px 40px; align-items: baseline; }
.vo2-head h3 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.5rem, 2.2vw, 2rem); letter-spacing: -0.015em; }
.vo2-head p { color: var(--ink-2); max-width: 56ch; }
.vo2-chart { --max: 85; display: grid; gap: 10px; }
.vo2-row { position: relative; height: 64px; }
.vo2-band {
  position: absolute;
  left: calc(var(--a) / var(--max) * 100%);
  width: calc((var(--b) - var(--a)) / var(--max) * 100%);
  display: grid;
  gap: 8px;
}
.vo2-row.is-fit .vo2-band { bottom: 0; align-content: end; }
.vo2-row.is-fit .vo2-band i { order: 2; }
.vo2-band i { display: block; height: 10px; border-radius: 3px; background: var(--c-health); }
.vo2-band em { font-style: normal; font-size: 0.86rem; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
.vo2-band b { display: block; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.vo2-row.is-fit .vo2-band i { background: var(--signal); }
.vo2-row.is-fit .is-elite i { background: var(--blue); }
.vo2-band.is-elite em { justify-self: end; text-align: right; }
.vo2-band.is-severe i { background: var(--c-lung); }
.vo2-band.is-moderate i { background: var(--c-health); }
.vo2-band.is-moderate em { padding-top: 26px; }
.vo2-band.is-preserved i { background: linear-gradient(90deg, var(--c-theravi), rgba(184, 166, 223, 0.15)); }
.vo2-band.is-preserved em { padding-left: 0; }
.vo2-axis { position: relative; height: 22px; border-top: 1px solid var(--line-strong); }
.vo2-axis span {
  position: absolute;
  left: calc(var(--v) / var(--max) * 100%);
  top: 6px;
  transform: translateX(-50%);
  font-family: var(--font-mono, "Atkinson Hyperlegible Mono", monospace);
  font-size: 0.75rem;
  color: var(--ink-2);
}
.vo2-axis span:first-child { transform: none; }
.vo2-axis span::before { content: ""; position: absolute; left: 50%; top: -11px; width: 1px; height: 5px; background: var(--line-strong); }
.vo2-scale figcaption { font-size: 0.95rem; color: var(--ink-2); max-width: 70ch; }
/* on phones the bands are too narrow to label: a key below the chart names them instead */
.vo2-key { display: none; }

@media (max-width: 760px) {
  .vo2-head { grid-template-columns: 1fr; }
  .vo2-row { height: 10px; }
  .vo2-row.is-fit .vo2-band, .vo2-row.is-clinic .vo2-band { position: absolute; top: 0; bottom: auto; }
  .vo2-band em { display: none; }
  .vo2-key { display: grid; gap: 10px; margin-top: 8px; }
  .vo2-key li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 0.95rem; color: var(--ink-2); }
  .vo2-key li::before { content: ""; height: 8px; border-radius: 2px; background: var(--k); }
  .vo2-key b { font-family: var(--font-display); font-weight: 600; color: var(--ink); white-space: nowrap; }
}

/* ---------- photo band with a line from the lab guide ---------- */

.hx-band { position: relative; isolation: isolate; display: grid; align-items: center; min-height: clamp(360px, 46vw, 560px); background: var(--night); overflow: clip; }
.hx-band img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 70%; }
.hx-band::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(8, 13, 28, 0.88) 0%, rgba(8, 13, 28, 0.55) 55%, rgba(8, 13, 28, 0.25) 100%); }
.hx-band blockquote p {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.9rem, 3.8vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 22ch;
}
.hx-band em { font-style: italic; color: var(--signal); }

/* ---------- who it's for ---------- */

.hx-who { background: var(--paper); }
.hx-who-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 5vw, 88px); align-items: center; }
.hx-who-photo .slot-frame img { object-position: 42% 30%; }
.hx-who .section-head { margin-bottom: 32px; }
.hx-who-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px clamp(24px, 3vw, 48px); }
.hx-who-cols h3 { margin-bottom: 16px; font-size: 1.15rem; }
@media (max-width: 960px) {
  .hx-who-grid { grid-template-columns: 1fr; }
  .hx-who-photo { max-width: 520px; }
  .hx-who-photo { --ratio: 3 / 2 !important; }
}
@media (max-width: 600px) { .hx-who-cols { grid-template-columns: 1fr; } }

/* ---------- tests and test day ---------- */

.hx-tests { background: var(--white); }
.hx-tests .diag-list h3 a { text-decoration: none; }
.hx-guide { margin-top: 32px; color: var(--violet); }
.hx-day { background: var(--paper); }
.hx-day .section-head { position: sticky; top: calc(var(--header-now) + var(--facet-h) + 32px); margin: 0; }
.hx-day .slot { margin-top: 10px; }
.hx-prep { display: grid; gap: 14px; margin-top: 10px; }
.hx-prep h3 { font-size: 1.1rem; }
@media (max-width: 900px) { .hx-day .section-head { position: static; } }

/* ---------- close ---------- */

.hx-close { position: relative; isolation: isolate; padding-block: clamp(80px, 10vw, 150px); background: var(--night); overflow: clip; }
.hx-close img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; }
.hx-close::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(8, 13, 28, 0.9) 0%, rgba(8, 13, 28, 0.62) 50%, rgba(8, 13, 28, 0.3) 100%); }
.hx-close h2 { color: #fff; max-width: 18ch; }

@media (prefers-reduced-motion: reduce) {
  .hx-live { animation: none; }
}
