/* ==========================================================================
   Home: "All your health data in one place" (Lumart, 16 Nov)
   Four cards that stack as you scroll: each is position: sticky a little
   lower than the one before, so the earlier cards peek out above it.
   Desktop: words left, picture right. Phones (<= 900px): picture on top.
   Cards stay shorter than the screen, so pin-guard.js leaves them alone.
   ========================================================================== */

.hdata {
  --hd-top: 96px;          /* clears the header pill */
  --hd-step: 26px;         /* how much of each earlier card peeks out */
  --hd-card: #f3f2ef;
  background: var(--bg);
  padding: 0 0 clamp(56px, 10vh, 120px); /* Lumart, 17 Nov: keep white space under the last card as the deck scrolls away */
  margin-top: calc(-1 * clamp(40px, 7vh, 110px)); /* pull up into the pricing section's tall bottom padding */
}

.hdata__head {
  width: min(1240px, 92vw);
  margin: 0 auto clamp(48px, 7vh, 80px);
  text-align: left; /* Lumart, 16 Nov: left on desktop */
}
.hdata__title {
  max-width: 16ch;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(32px, 4.2vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 18px;
  text-wrap: balance;
}
.hdata__sub {
  font-family: var(--sans);
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0;
  text-wrap: pretty;
}

.hdata__stack {
  width: min(1240px, 92vw);
  margin: 0 auto;
  /* Lumart, 16 Nov: the last card lands and the full deck holds for a moment
     before the section scrolls away (the sticky cards stay pinned through this). */
}
.hdata__stack::after { content: ""; display: block; height: max(0px, calc(38vh - clamp(56px, 10vh, 120px))); } /* inside the content box, so the cards stay stuck through it */

.hcard {
  position: sticky;
  top: calc(var(--hd-top) + var(--i) * var(--hd-step));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: clamp(24px, 4vw, 64px);
  height: min(600px, calc(100vh - var(--hd-top) - 4 * var(--hd-step) - 24px));
  min-height: 460px;
  padding: clamp(18px, 1.6vw, 24px);
  /* Lumart, 20 Nov: the gap above the picture matches the gap right of and below it. */
  padding-left: clamp(28px, 3.4vw, 56px);
  /* Lumart, 17 Nov: every card must let go at the same moment as the deck
     scrolls away, or the last (lowest) card moves first and the deck breaks.
     A sticky card lets go when its margin box meets the stack's bottom, so
     each card's bottom margin makes up for how much higher it is pinned. */
  --hd-gap: clamp(56px, 10vh, 120px);
  margin-bottom: calc(var(--hd-gap) + (var(--n, 4) - 1 - var(--i)) * var(--hd-step));
  box-sizing: border-box;
  background: var(--hd-card);
  border-radius: 28px;
  box-shadow: 0 -1px 0 rgba(12, 12, 13, 0.05), 0 -10px 30px -18px rgba(12, 12, 13, 0.18);
  /* Lumart, 16 Nov: cards underneath turn darker and shrink a little as the next one covers them (js/health-data.js sets --d). */
  --d: 0;
  background: color-mix(in srgb, #cfcdc8 calc(min(var(--d), 3) * 22%), var(--hd-card));
  transform: scale(calc(1 - min(var(--d), 3) * 0.025));
  transform-origin: 50% 0;
  will-change: transform;
}
.hcard__text, .hcard__media { opacity: calc(1 - min(var(--d), 1) * 0.9); }

.hcard__text { padding-top: clamp(30px, 3.2vw, 46px); max-width: 440px; }
.hcard__tag {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 clamp(22px, 3vh, 34px);
}
.hcard__tag span { width: 12px; height: 12px; background: var(--accent); flex: none; }
.hcard__title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(24px, 2.3vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: balance;
}
.hcard__copy {
  font-family: var(--sans);
  font-size: clamp(15.5px, 1.25vw, 18px);
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  text-wrap: pretty;
}

.hcard__media {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 28px;
  box-sizing: border-box;
}

/* ── The little app pictures ─────────────────────────────────────────── */
.hui { position: relative; z-index: 1; font-family: var(--sans); width: min(400px, 100%); box-sizing: border-box; }

.hui--chat {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 20px;
  padding: 14px 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.45);
}
.hui__bar { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink); padding: 2px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hui__dot { width: 8px; height: 8px; border-radius: 50%; background: #3fbf6a; }
.hui__msg { font-size: 14px; line-height: 1.4; padding: 9px 12px; border-radius: 14px; max-width: 86%; }
.hui__msg--me { align-self: flex-end; background: #e6f4e4; color: var(--ink); border-bottom-right-radius: 4px; }
.hui__msg--them { align-self: flex-start; background: #f1f0ed; color: var(--ink); border-bottom-left-radius: 4px; }
.hui__file { display: flex; align-items: center; gap: 10px; }
.hui__file b { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; color: #fff; background: var(--accent); border-radius: 5px; padding: 3px 5px; }
.hui__typing { display: flex; gap: 4px; padding: 12px 14px; }
.hui__typing i { width: 6px; height: 6px; border-radius: 50%; background: #9a9893; animation: hui-dot 1.2s infinite ease-in-out; }
.hui__typing i:nth-child(2) { animation-delay: 0.15s; }
.hui__typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes hui-dot { 0%, 60%, 100% { opacity: 0.35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .hui__typing i { animation: none; } }

.hui--chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hui--chips span { font-size: 13px; color: var(--ink); background: rgba(255, 255, 255, 0.75); border-radius: 999px; padding: 7px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.hui--card { background: #fff; border-radius: 20px; padding: 20px 22px; box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.45); }
.hui__k { font-size: 14px; color: var(--ink-soft); margin: 0 0 4px; }
.hui__v { font-size: 34px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 10px; }
.hui__v small { font-size: 14px; font-weight: 400; color: var(--ink-faint); }
.hui__h { font-size: 20px; font-weight: 500; color: var(--ink); margin: 0 0 12px; }
.hui__chart { width: 100%; height: 110px; display: block; overflow: visible; }
.hui__chart .hui__ref { stroke: rgba(12, 12, 13, 0.18); stroke-dasharray: 3 4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.hui__chart .hui__line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.hui__chart circle { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.hui__chart .hui__now { fill: var(--accent); }
.hui__axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); margin-top: 8px; }

.hui--summary ul { list-style: none; margin: 0; padding: 0; }
.hui--summary li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.hui--summary li b { font-weight: 500; color: var(--ink); }
.hui--summary li span { color: var(--ink-soft); }

.hui--pill { width: auto; font-size: 14px; color: #fff; background: rgba(12, 12, 13, 0.45); border-radius: 999px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hui__tick { width: 18px; height: 18px; border-radius: 50%; background: #fff; position: relative; flex: none; }
.hui__tick::after { content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* Upload (Lumart, 20 Nov): rows of cards drifting sideways, one for each kind of record you can add, fading out at the ends. */
.hcard--upload .hcard__media { padding: 28px 0; }
.hui--marquee {
  width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%);
}
.hui__row { overflow: hidden; }
.hui__track { display: flex; gap: 12px; width: max-content; animation: hui-marquee 38s linear infinite; }
.hui__row--rev .hui__track { animation-direction: reverse; animation-duration: 44s; }
.hui__row:nth-child(3) .hui__track { animation-duration: 34s; }
.hui__track span {
  flex: none;
  font-size: 17px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink);
  background: #fff; border-radius: 16px; padding: 18px 24px;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.5);
}
@keyframes hui-marquee { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 6px)); } }
@media (prefers-reduced-motion: reduce) { .hui__track { animation: none; transform: translateX(-12%); } }

/* Record: the dots are drawn outside the stretched chart so they stay round (Lumart, 20 Nov). */
.hui__plot { position: relative; height: 110px; }
.hui__plot .hui__chart { height: 100%; }
.hui__pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-sizing: border-box; }
.hui__pt--now { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--accent); }

/* Ollie: the little orange OUTLIV mark next to the name. */
.hui__logo { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.hui--ollie { width: min(430px, 100%); }

/* Care: "Your health summary is ready", one small icon per line, a share button at the bottom. */
.hui--summary .hui__h { margin-bottom: 14px; }
.hui--summary li { justify-content: flex-start; align-items: center; gap: 12px; font-weight: 500; color: var(--ink); border-top: 0; padding: 6px 0; font-size: 15px; }
.hui__ic { width: 34px; height: 34px; border-radius: 9px; background: #fbe9dd; display: grid; place-items: center; flex: none; }
.hui__ic svg, .hui__share svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hui__share { margin-top: 16px; display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 500; border-radius: 999px; padding: 11px 20px 11px 16px; }
.hui__share svg { stroke: #fff; }

/* ── Phones: picture on top, words below (Lumart's phone pictures) ──── */
@media (max-width: 900px) {
  .hdata { --hd-top: 84px; --hd-step: 22px; padding-bottom: 48px; }
  .hdata__head { margin-bottom: 40px; text-align: center; }
  .hdata__title { max-width: none; }
  .hdata__sub { margin: 0 auto; }
  .hcard {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    height: auto;
    min-height: 0;
    padding: 0;
    padding-top: 0;
    --hd-gap: 48px;
    border-radius: 24px;
  }
  .hcard__media {
    order: -1;
    height: min(330px, 44svh);
    border-radius: 24px;
    padding: 20px;
  }
  .hcard__text { padding: 26px 24px 34px; max-width: none; }
  .hcard__tag { margin-bottom: 18px; }
  .hui--chat { padding: 10px 10px 12px; gap: 6px; }
  .hui__msg { font-size: 13px; padding: 7px 10px; }
  .hui__bar { font-size: 12px; padding-bottom: 6px; }
  .hui--card { padding: 16px 18px; }
  .hui__v { font-size: 28px; margin-bottom: 6px; }
  .hui__plot { height: 80px; }
  .hui__track span { font-size: 14px; padding: 12px 16px; border-radius: 12px; }
  .hui--marquee, .hui__track { gap: 8px; }
  .hcard--upload .hcard__media { padding: 20px 0; }
  .hui__ic { width: 28px; height: 28px; border-radius: 8px; }
  .hui__ic svg { width: 15px; height: 15px; }
  .hui--summary li { padding: 4px 0; font-size: 14px; }
  .hui__share { margin-top: 10px; font-size: 13px; padding: 8px 14px 8px 12px; }
  /* Ollie on phones: the question, the half-marathon answer and the reply (the rest doesn't fit). */
  .hcard--ollie .hui__msg:nth-of-type(3), .hcard--ollie .hui__msg:nth-of-type(5) { display: none; }
  .hui--summary li { padding: 7px 0; font-size: 13px; }
  .hui__h { font-size: 17px; margin-bottom: 8px; }

}
