/* =====================================================================
   NYRA Bets case study (nyra.html) — page-only styles.
   Loaded after css/project.css; uses the same scale unit:
   calc(N * var(--p)) = N Figma px on the 1440 canvas.
   Phones (≤767px) at the bottom.
   ===================================================================== */

/* ---------- Hero facts / overview (Figma: info box is 99 tall, overview starts 120 below) ---------- */
.page-nyra .facts { min-height: calc(99 * var(--p)); }
.page-nyra .overview { margin-top: calc(120 * var(--p)); }
.page-nyra .overview__image {
  flex: 0 0 calc(632 * var(--p)); height: calc(408 * var(--p)); margin-top: calc(25 * var(--p));
  border-radius: calc(16 * var(--p)); overflow: hidden;
}
.page-nyra .overview__image img { object-fit: cover; }
.page-nyra .overview__text { margin-top: calc(91 * var(--p)); }

/* ---------- The challenge (reuses the Outcomes cards) ---------- */
.challenge { margin-top: calc(115 * var(--p)); }
.page-nyra .challenge .stat { min-height: calc(202 * var(--p)); }
.squiggle--challenge { left: calc(28.5 * var(--p)); top: calc(58.5 * var(--p)); width: calc(214 * var(--p)); height: calc(34 * var(--p)); }
.page-nyra .chapters { margin-top: calc(316 * var(--p)); }

/* ---------- Chapter spacing (Figma: content end → next chapter title) ---------- */
.chapter--learning  { --after: calc(305 * var(--p)); }
.chapter--race-card { --after: calc(222.5 * var(--p)); --intro-w: calc(670 * var(--p)); }
.chapter--betslip   { --after: calc(96 * var(--p)); }
.chapter--insights  { --after: calc(190 * var(--p)); }
.chapter--team      { --after: calc(134 * var(--p)); }

.chapter--learning .chapter__figure { margin-top: calc(65 * var(--p)); }
.chapter--insights .chapter__figure { margin-top: calc(70 * var(--p)); }
.chapter--betslip .chapter__figure  { margin-top: calc(20 * var(--p)); }
/* mockup composites that sit straight on the page (no card behind them) */
.chapter__figure--plain { border-radius: 0; }

/* ---------- 02: horse card anatomy (diagram image + numbered legend) ---------- */
.anatomy { margin-top: calc(81 * var(--p)); display: flex; align-items: flex-start; }
.anatomy__stage { flex: 0 0 calc(871 * var(--p)); }
.anatomy__stage img { width: 100%; }
.anatomy__parts { margin: calc(12.11 * var(--p)) 0 0 calc(84 * var(--p)); }
.parts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: calc(11.413 * var(--p)); }
.parts li {
  display: flex; align-items: center; gap: calc(8.152 * var(--p));
  font-weight: 500; font-size: calc(12.228 * var(--p)); line-height: calc(22.826 * var(--p)); color: #242c2d;
}
.parts__num {
  flex: none; width: calc(22.826 * var(--p)); height: calc(22.826 * var(--p)); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #242c2d; color: #fff; font-weight: 700; font-size: calc(10.598 * var(--p));
}
.parts__tag {
  display: table; margin-top: calc(4.891 * var(--p));
  padding: calc(2.446 * var(--p)) calc(6.522 * var(--p)); border-radius: calc(4.891 * var(--p));
  background: rgba(0,0,0,.06); color: #707070; font-size: calc(10.598 * var(--p)); line-height: calc(13 * var(--p));
}
.parts__tag--strong { margin-top: calc(16.3 * var(--p)); color: #242c2d; font-weight: 700; }

/* ---------- 03: betslip ---------- */
.chapter .stats--points { margin-top: calc(20 * var(--p)); }
.page-nyra .stats--points .stat { min-height: calc(172 * var(--p)); }
.stat__title { font-weight: 500; font-size: calc(16 * var(--p)); line-height: 1.5; color: var(--body-2); }
/* one very wide image you drag sideways (no snapping, there's only one panel) */
.chapter .rail.rail--states { margin-top: calc(109 * var(--p)); scroll-snap-type: none; }
.rail--states .rail__item { flex: 0 0 calc(2912 * var(--p)); }
.rail--states .rail__item img { height: calc(664 * var(--p)); border-radius: calc(12 * var(--p)); }
.chapter__caption.body-text { margin-top: calc(20 * var(--p)); width: calc(524 * var(--p)); font-size: calc(14 * var(--p)); line-height: calc(24 * var(--p)); }

/* ---------- 05: team process diagram (HTML, scaled with --q) ---------- */
.flow-panel {
  --q: var(--p);
  position: relative; margin-top: calc(20 * var(--p)); height: calc(609 * var(--p));
  background: var(--soft); border-radius: calc(32.49 * var(--p)); overflow: hidden;
}
.flow { position: absolute; left: calc(43.2 * var(--q)); top: calc(94 * var(--q)); width: calc(1113.6 * var(--q)); height: calc(502 * var(--q)); }
.flow__steps { position: relative; z-index: 1; margin: 0; padding: 0; list-style: none; display: flex; height: calc(384 * var(--q)); }
.flow__arrow {
  flex: 0 0 calc(26.4 * var(--q)); display: flex; align-items: center; justify-content: center;
  color: #8a8d94; font-size: calc(15.6 * var(--q));
}
.step {
  flex: 0 0 calc(var(--w) * var(--q)); position: relative;
  display: flex; flex-direction: column; gap: calc(8.4 * var(--q)); padding: calc(16.8 * var(--q));
  background: #fff; border-radius: calc(14.4 * var(--q)); filter: drop-shadow(0 6px 13.5px rgba(0,0,0,.1));
  color: #222326;
}
.step__num { font-weight: 700; font-size: calc(28.8 * var(--q)); line-height: calc(36 * var(--q)); color: #c9ccd3; }
.step__label { font-weight: 500; font-size: calc(7.8 * var(--q)); line-height: calc(9.6 * var(--q)); letter-spacing: calc(1.5 * var(--q)); text-transform: uppercase; color: #5e7a00; }
.step__title { font-weight: 700; font-size: calc(13.2 * var(--q)); line-height: 1.25; }
.step__note { margin-top: auto; font-size: calc(9 * var(--q)); line-height: 1.5; color: #3d4047; }

.owners { margin: calc(8.5 * var(--q)) 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: calc(5 * var(--q)); }
.owner {
  display: flex; align-items: center; gap: calc(7.2 * var(--q)); min-height: calc(33.6 * var(--q));
  padding: calc(7.2 * var(--q)) calc(8.4 * var(--q)); border-radius: calc(7.2 * var(--q)); background: #f1f2f5;
  font-weight: 500; font-size: calc(9.6 * var(--q)); line-height: calc(12 * var(--q));
}
.owner--me { background: #3d4949; color: #fff; font-size: calc(8.6 * var(--q)); }
.owner__badge {
  flex: none; width: calc(19.2 * var(--q)); height: calc(19.2 * var(--q)); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #222326; color: #ddf56b; font-weight: 700; font-size: calc(7.8 * var(--q));
}

.step__sub { font-weight: 500; font-size: calc(7.2 * var(--q)); line-height: calc(9 * var(--q)); letter-spacing: calc(.9 * var(--q)); text-transform: uppercase; color: #8a8d94; }
.step--share .step__title + .step__sub { margin-top: calc(9.6 * var(--q)); }
.step__item { font-weight: 500; font-size: calc(9.6 * var(--q)); line-height: calc(12 * var(--q)); }
.chips { display: flex; gap: calc(3.6 * var(--q)); }
.chips span {
  padding: calc(3.6 * var(--q)) calc(7.2 * var(--q)); border-radius: 999px; background: #3d4949; color: #fff;
  font-weight: 500; font-size: calc(7.8 * var(--q)); line-height: calc(9 * var(--q)); white-space: nowrap;
}

.decision { position: relative; align-self: center; width: calc(90 * var(--q)); height: calc(90 * var(--q)); margin: calc(18 * var(--q)) 0; }
.decision img { width: 100%; height: 100%; }
.decision span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: calc(10.8 * var(--q)); }
.outcome { display: flex; align-items: center; gap: calc(6 * var(--q)); font-size: calc(9 * var(--q)); color: #3d4047; white-space: nowrap; }
.pill-yes, .pill-no {
  padding: calc(2.4 * var(--q)) calc(7.2 * var(--q)); border-radius: 999px;
  font-weight: 700; font-size: calc(7.8 * var(--q)); line-height: calc(9 * var(--q));
}
.pill-yes { background: #ddf56b; color: #222326; }
.pill-no { background: #fff4ed; color: #9a3412; border: calc(.9 * var(--q)) dashed #f59e6b; }

.step--dark { background: #3d4949; color: #fff; }
.step--dark .step__num { color: #637070; }
.step--dark .step__label { color: #ddf56b; }
.doclist { margin: 0; padding: 0; list-style: none; }
.doclist li { padding: calc(10 * var(--q)) 0; border-top: calc(.6 * var(--q)) solid #626365; font-size: calc(9.6 * var(--q)); line-height: calc(12 * var(--q)); }
.step__callout {
  margin-top: auto; padding: calc(9.6 * var(--q)) calc(10.8 * var(--q)); border-radius: calc(8.4 * var(--q));
  background: #bcfb20; color: #222326; font-weight: 500; font-size: calc(9.6 * var(--q)); line-height: 1.4;
}

.flow__loop { position: absolute; left: calc(101.4 * var(--q)); top: calc(384 * var(--q)); width: calc(456.6 * var(--q)); height: calc(60 * var(--q)); max-width: none; }
.flow__loop-label {
  position: absolute; left: calc(231.45 * var(--q)); top: calc(440.4 * var(--q));
  padding: calc(4.8 * var(--q)) calc(9.6 * var(--q)); border-radius: 999px;
  background: #fff4ed; border: calc(.9 * var(--q)) dashed #f59e6b; color: #9a3412;
  font-weight: 500; font-size: calc(8.4 * var(--q)); line-height: calc(10.5 * var(--q)); white-space: nowrap;
}

/* ---------- What stayed with me: three columns, no side padding on each lesson ---------- */
.page-nyra .learnings__grid { grid-template-columns: repeat(3, 1fr); column-gap: calc(32 * var(--p)); min-height: calc(267 * var(--p)); }
.page-nyra .lesson { padding: calc(32 * var(--p)) 0; }
.page-nyra .squiggle--number { left: calc(2.86 * var(--p)); }

/* =====================================================================
   Phones (≤767px)
   ===================================================================== */
@media (max-width: 767px) {
  .page-nyra .facts { min-height: 0; }
  .page-nyra .overview { margin-top: 80px; }
  .page-nyra .overview__image { flex: none; width: 100%; height: auto; aspect-ratio: 632 / 408; margin-top: 0; border-radius: 12px; }
  .page-nyra .overview__text { margin-top: 0; }

  .challenge { margin-top: 80px; }
  .page-nyra .challenge .stat, .page-nyra .stats--points .stat { min-height: 0; }
  .squiggle--challenge { left: 18px; top: 46px; width: 170px; height: 27px; }
  .page-nyra .chapters { margin-top: 96px; }

  .chapter--learning, .chapter--race-card, .chapter--betslip, .chapter--insights, .chapter--team { --after: 96px; }
  .chapter--learning .chapter__figure, .chapter--insights .chapter__figure, .chapter--betslip .chapter__figure { margin-top: 24px; }
  .chapter__figure--plain { border-radius: 0; }

  .anatomy { margin-top: 32px; flex-direction: column; gap: 20px; }
  .anatomy__stage { flex: none; width: 100%; }
  .anatomy__parts { margin: 0; }
  .parts { gap: 10px; }
  .parts li { font-size: 14px; line-height: 24px; gap: 10px; }
  .parts__num { width: 24px; height: 24px; font-size: 12px; }
  .parts__tag { font-size: 12px; line-height: 16px; padding: 3px 8px; border-radius: 6px; }
  .parts__tag--strong { margin-top: 16px; }

  .chapter .stats--points { margin-top: 24px; }
  .stat__title { font-size: 16px; }
  .chapter .rail.rail--states { margin-top: 24px; }
  .rail--states .rail__item { flex-basis: auto; }
  .rail--states .rail__item img { width: auto; height: 300px; max-width: none; border-radius: 10px; }
  .chapter__caption.body-text { width: auto; margin-top: 12px; font-size: 14px; line-height: 22px; }

  /* Team diagram: steps stack, arrows point down, the loop becomes a note at the end */
  .flow-panel { --q: 1.4px; height: auto; margin-top: 24px; border-radius: 16px; padding: 16px; }
  .flow { position: static; width: auto; height: auto; }
  .flow__steps { flex-direction: column; height: auto; }
  .step { flex: none; }
  .step__note { margin-top: 8px; }
  .step__callout { margin-top: 8px; }
  .flow__arrow { flex: none; height: 32px; transform: rotate(90deg); }
  .flow__loop { display: none; }
  .flow__loop-label { position: static; display: table; margin: 16px auto 0; white-space: normal; text-align: center; }

  .page-nyra .learnings__grid { grid-template-columns: 1fr; min-height: 0; }
  .page-nyra .lesson { padding: 24px 16px 8px; }
  .page-nyra .squiggle--number { left: 14px; }
}
