/* PlateVit home page: hero, the pinned "How it works" phone, widgets, the draft you can change, body in 3D, coach
   mode and the last call. Shared parts (tokens, header, badges, pricing, FAQ, footer) are in site.css.
   Motion: the hero plays once in CSS; the pinned phone and the coach parallax are GSAP (home.js). With reduced motion
   or without script the page is complete and still. */

@property --draw {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

:root {
  --water: #3b82f6;
  --accent-text: var(--raspberry);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fs-display: clamp(3.25rem, 1.7rem + 6.2vw, 6rem);
  --fs-tag: clamp(1.6rem, 1.15rem + 2.1vw, 2.6rem);
  --section-space: clamp(80px, 9vw, 140px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --water: #60a5fa;
    --accent-text: var(--link);
  }
}

main h2 {
  font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem);
  letter-spacing: -0.03em;
  font-weight: 760;
}

/* ---------- the phone: flat, straight on ---------- */
.device {
  position: relative;
  width: var(--dw, 300px);
  aspect-ratio: 720 / 1564;
  border: calc(var(--dw, 300px) * 0.034) solid var(--bezel);
  border-radius: calc(var(--dw, 300px) * 0.155);
  box-shadow: var(--shadow-soft);
  background: transparent;
}
.device-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: calc(var(--dw, 300px) * 0.125);
  background: var(--screen);
}
.device-screen img,
.device-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* ---------- plate and day ring (the app icon's plate, the Today ring's four colours) ---------- */
.plate {
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 63%, var(--plate-ring) 63.4% 65.2%, transparent 65.6%),
    var(--plate);
  box-shadow: var(--shadow-plate);
}
.day-ring {
  overflow: visible;
  transform: rotate(-90deg);
}
.day-ring circle {
  fill: none;
  stroke-width: 3.4;
  stroke-linecap: round;
}
.ring-track {
  stroke: var(--track);
}
.ring-arc {
  --draw: 1;
  stroke-dasharray: calc(var(--len) * var(--draw)) 100;
  stroke-dashoffset: calc(-1 * var(--at));
}
.arc-kcal {
  stroke: var(--raspberry);
}
.arc-protein {
  stroke: var(--protein);
}
.arc-fat {
  stroke: var(--fat);
}
.arc-carbs {
  stroke: var(--carbs);
}

/* ---------- hero ---------- */
.top {
  position: relative;
  overflow: clip;
  padding-block: clamp(28px, 5vw, 72px) clamp(56px, 7vw, 110px);
}
.top-grid {
  display: grid;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
@media (min-width: 900px) {
  .top-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}
.top h1 {
  display: grid;
  gap: 0.18em;
}
.top-name {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.top-tag {
  font-size: var(--fs-tag);
  font-weight: 720;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--accent-text);
}
.top .lead {
  margin-top: 22px;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  color: var(--ink);
  max-width: 26em;
}
.top-actions {
  margin-top: 30px;
}
.top-note {
  margin-top: 12px;
  font-size: var(--fs-small);
  color: var(--ink-2);
}
.top-coach {
  display: inline-flex;
  margin-top: 28px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--tint-raspberry);
  color: var(--raspberry-lo);
  font-weight: 620;
  font-size: var(--fs-small);
  text-decoration: none;
  transition: background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.top-coach:hover {
  background: color-mix(in srgb, var(--tint-raspberry) 70%, var(--raspberry) 14%);
}
.top-coach:active {
  transform: scale(0.97);
}
@media (prefers-color-scheme: dark) {
  .top-coach {
    color: var(--link);
  }
}

.top-stage {
  --stage: min(560px, 88vw);
  position: relative;
  width: var(--stage);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.top-stage > .plate {
  position: absolute;
  inset: 6%;
}
.top-stage > .day-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.device-hero {
  --dw: calc(var(--stage) * 0.4);
  margin-top: 2%;
}
.chip {
  position: absolute;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--plate);
  box-shadow: 0 1px 2px rgba(80, 20, 40, 0.08), 0 14px 30px -14px rgba(120, 24, 60, 0.35);
  font-size: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  line-height: 1.2;
  white-space: nowrap;
}
.chip-meal {
  left: -2%;
  top: 24%;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.chip-meal .chip-kcal {
  color: var(--accent-text);
  font-weight: 720;
  font-size: 1.15em;
  font-variant-numeric: tabular-nums;
}
.chip-left {
  right: -2%;
  bottom: 20%;
  font-weight: 620;
}
.chip-left svg {
  width: 22px;
  height: 22px;
  transform: rotate(-90deg);
}
.chip-left circle {
  fill: none;
  stroke: var(--track);
  stroke-width: 3;
}
.chip-left .chip-arc {
  stroke: var(--raspberry);
  stroke-linecap: round;
  stroke-dasharray: 64 100;
}
@media (max-width: 899.98px) {
  .chip-meal {
    left: 0;
  }
  .chip-left {
    right: 0;
  }
}

/* The hero plays once: words rise, the plate settles, the ring draws, the two chips land. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(26px);
    }
  }
  @keyframes settle {
    from {
      opacity: 0;
      transform: scale(0.9);
    }
  }
  @keyframes lift {
    from {
      opacity: 0;
      transform: translateY(64px) scale(0.97);
    }
  }
  @keyframes draw {
    from {
      --draw: 0;
    }
  }
  @keyframes land {
    from {
      opacity: 0;
      transform: translateY(12px) scale(0.86);
    }
  }
  .top-name,
  .top-tag,
  .top .lead,
  .top-actions,
  .top-coach {
    animation: rise 0.9s var(--ease-out) both;
  }
  .top-tag {
    animation-delay: 0.08s;
  }
  .top .lead {
    animation-delay: 0.16s;
  }
  .top-actions {
    animation-delay: 0.24s;
  }
  .top-coach {
    animation-delay: 0.32s;
  }
  .top-stage > .plate {
    animation: settle 1.1s var(--ease-out) 0.05s both;
  }
  .top-stage .ring-arc {
    animation: draw 1.6s var(--ease-out) 0.35s both;
  }
  .top-stage .arc-protein {
    animation-delay: 0.5s;
  }
  .top-stage .arc-fat {
    animation-delay: 0.62s;
  }
  .top-stage .arc-carbs {
    animation-delay: 0.74s;
  }
  .device-hero {
    animation: lift 1.1s var(--ease-out) 0.15s both;
  }
  .chip {
    animation: land 0.8s var(--ease-out) both;
  }
  .chip-meal {
    animation-delay: 1s;
  }
  .chip-left {
    animation-delay: 1.25s;
  }
}

/* ---------- How it works ---------- */
.story {
  padding-top: var(--section-space);
}
.story > .wrap > h2 {
  margin-bottom: clamp(24px, 3vw, 40px);
}
.story-decor {
  display: none;
}
.story-progress {
  display: none;
}

/* Still version (no script, reduced motion): a row of screens to swipe. */
.story-steps {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78vw, 300px);
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.story-step {
  scroll-snap-align: start;
}
.story-shot {
  margin: 0 0 18px;
}
.story-shot .device {
  --dw: min(70vw, 260px);
}
.story-copy h3 {
  margin-bottom: 8px;
}
.story-copy p {
  color: var(--ink-2);
}

/* Pinned version: every step sits in the same place; home.js swaps them as the page scrolls. */
.story.is-pinned .story-stage {
  height: 100svh;
  padding-top: 64px;
  overflow: clip;
}
.story.is-pinned .story-frame {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.story.is-pinned .story-decor {
  display: block;
  position: absolute;
  pointer-events: none;
}
.story.is-pinned .story-decor .plate,
.story.is-pinned .story-decor .day-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.story.is-pinned .story-decor .plate {
  inset: 6%;
  width: auto;
  height: auto;
}
.story.is-pinned .story-steps {
  overflow: visible;
  padding: 0;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-areas: "stack";
  scroll-snap-type: none;
}
.story.is-pinned .story-step {
  grid-area: stack;
  display: grid;
  align-items: center;
}
.story.is-pinned .story-shot {
  margin: 0;
  justify-self: center;
}
.story.is-pinned .story-shot .device {
  box-shadow: none;
}
.story.is-pinned .story-progress {
  display: flex;
  gap: 6px;
  position: absolute;
}
.story-progress i {
  display: block;
  width: 26px;
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  transition: background-color 0.3s var(--ease-out), width 0.3s var(--ease-out);
}
.story-progress i.is-on {
  width: 44px;
  background: var(--raspberry);
}

@media (min-width: 900px) {
  .story.is-pinned .story-frame {
    --stage: min(76svh, 600px);
  }
  .story.is-pinned .story-decor {
    width: var(--stage);
    height: var(--stage);
    right: calc(var(--gutter) + (50% - var(--gutter) - var(--stage)) / 2);
    top: calc(50% - var(--stage) / 2);
  }
  .story.is-pinned .story-step {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 48px;
  }
  .story.is-pinned .story-shot {
    grid-column: 2;
    grid-row: 1;
  }
  .story.is-pinned .story-shot .device {
    --dw: calc(var(--stage) * 0.4);
  }
  .story.is-pinned .story-copy {
    grid-column: 1;
    grid-row: 1;
    max-width: 30rem;
  }
  .story.is-pinned .story-copy h3 {
    font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.75rem);
    letter-spacing: -0.028em;
    margin-bottom: 16px;
  }
  .story.is-pinned .story-copy p {
    font-size: var(--fs-lead);
  }
  .story.is-pinned .story-progress {
    left: var(--gutter);
    bottom: 12svh;
  }
}
@media (max-width: 899.98px) {
  .story.is-pinned .story-frame {
    --stage: min(60svh, 90vw);
  }
  .story.is-pinned .story-decor {
    width: var(--stage);
    height: var(--stage);
    left: calc(50% - var(--stage) / 2);
    top: 4px;
  }
  .story.is-pinned .story-step {
    grid-template-rows: auto 1fr;
    align-items: start;
    row-gap: 18px;
  }
  .story.is-pinned .story-shot {
    height: calc(var(--stage) + 4px);
    display: grid;
    place-items: center;
  }
  .story.is-pinned .story-shot .device {
    --dw: calc(var(--stage) * 0.36);
  }
  .story.is-pinned .story-copy h3 {
    font-size: 1.375rem;
  }
  .story.is-pinned .story-copy p {
    font-size: 1rem;
  }
  .story.is-pinned .story-progress {
    left: var(--gutter);
    bottom: 18px;
  }
}

/* ---------- widgets ---------- */
.widgets {
  padding-top: var(--section-space);
}
.widgets-grid {
  display: grid;
  gap: 40px;
  align-items: center;
}
@media (min-width: 900px) {
  .widgets-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}
.widgets .lead {
  margin-top: 18px;
}
.homescreen {
  margin: 0;
  border-radius: 36px;
  padding: clamp(22px, 4vw, 40px);
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--raspberry-hi) 70%, transparent), transparent 60%),
    radial-gradient(110% 100% at 100% 100%, color-mix(in srgb, var(--apricot) 80%, transparent), transparent 60%),
    var(--raspberry);
}
.homescreen-glass {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(12px, 2.4vw, 20px);
}
.wg {
  border-radius: 24px;
  background: var(--plate);
  color: var(--ink);
  padding: clamp(14px, 2.2vw, 20px);
  box-shadow: 0 10px 30px -16px rgba(40, 6, 20, 0.55);
  display: grid;
  align-content: space-between;
  gap: 12px;
  min-width: 0;
}
.wg p {
  margin: 0;
}
.wg-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.wg-big {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.wg-big small {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-2);
}
.wg-plus {
  width: clamp(34px, 4vw, 44px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--raspberry);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
}
.wg-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.wg-macros p,
.wg-bar {
  display: grid;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.wg-macros small {
  font-size: 0.75rem;
  color: var(--ink-2);
}
.wg-macros b {
  font-size: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
}
.wg-macros i,
.wg-bar i {
  display: block;
  height: 6px;
  margin-top: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--c) calc(var(--f) * 100%), var(--track) 0);
}
.wg-title {
  font-weight: 700;
  font-size: 0.9375rem;
}

/* ---------- 1.4: the AI read of the week ---------- */
.weekread-card {
  margin: 0;
}
.weekread-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.weekread-points li {
  position: relative;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--tint-raspberry);
}
.weekread-points li.is-locked {
  padding-right: 72px;
}
.weekread-points li.is-locked span {
  filter: blur(5px);
  user-select: none;
}
.weekread-points b {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--plate);
  font-size: var(--fs-small);
}

/* ---------- honest AI: a draft line you can change ---------- */
.draft {
  padding-top: var(--section-space);
}
.draft-grid {
  display: grid;
  gap: 48px;
  align-items: start;
}
@media (min-width: 900px) {
  .draft-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 72px;
  }
  .draft-card {
    position: sticky;
    top: 120px;
    margin-top: 12px;
  }
}
.draft .lead {
  margin-top: 18px;
}
.draft-points {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: grid;
  gap: 26px;
}
.draft-points h3 {
  margin-bottom: 6px;
}
.draft-points p {
  color: var(--ink-2);
  max-width: 34em;
}
.draft-card {
  border-radius: 28px;
  background: var(--plate);
  box-shadow: var(--shadow-plate);
  padding: clamp(20px, 3vw, 32px);
}
.draft-label {
  margin: 0 0 16px;
  font-size: var(--fs-small);
  color: var(--ink-2);
}
.draft-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: var(--tint-raspberry);
}
.draft-item {
  margin: 0;
  display: grid;
}
.draft-item b {
  font-size: 1.125rem;
}
.draft-item small {
  font-size: var(--fs-small);
  color: var(--ink-2);
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--plate);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stepper output {
  min-width: 2.6ch;
  text-align: right;
}
.stepper button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--raspberry);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}
.stepper button:hover {
  background: var(--tint-raspberry);
}
.stepper button:active {
  transform: scale(0.9);
}
.stepper button:disabled {
  color: var(--ink-2);
  opacity: 0.4;
  cursor: default;
}
.stepper svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.draft-kcal {
  grid-column: 1 / -1;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.draft-kcal s {
  color: var(--ink-2);
}
.draft-kcal b {
  font-size: 1.25rem;
}
.draft-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  padding: 16px 4px 0;
  border-top: 1px solid var(--line);
  font-weight: 620;
}
.draft-total b {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.draft-hint {
  margin: 14px 4px 0;
  font-size: var(--fs-small);
  color: var(--ink-2);
}

/* ---------- body in 3D ---------- */
.layers3d {
  padding-top: var(--section-space);
}
.layers3d-grid {
  display: grid;
  gap: 40px;
  align-items: center;
  justify-items: start;
}
.layers3d .device {
  --dw: min(64vw, 290px);
  justify-self: center;
}
@media (min-width: 900px) {
  .layers3d-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
.layers3d .lead {
  margin-top: 18px;
}
.layers3d .layers {
  margin: 28px 0 14px;
}
.layers3d .small {
  color: var(--ink-2);
}

/* ---------- coach mode ---------- */
.coachband {
  margin-top: var(--section-space);
  padding-block: var(--section-space);
  background: var(--raspberry);
  color: #fff;
  overflow: clip;
}
.coachband h2,
.coachband h3 {
  color: #fff;
}
.coachband .lead {
  margin-top: 18px;
  color: #fff;
}
.coachband-top {
  display: grid;
  gap: 40px;
  align-items: center;
}
@media (min-width: 900px) {
  .coachband-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
.coachband-shots {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 28px);
}
.coachband .device {
  --dw: min(40vw, 236px);
  --bezel: #2a0a17;
  box-shadow: 0 30px 60px -30px rgba(40, 0, 15, 0.7);
}
.coachband .device:nth-child(2) {
  margin-top: 56px;
}
.coachband-cols {
  display: grid;
  gap: 32px;
  margin-top: 56px;
}
@media (min-width: 900px) {
  .coachband-cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
  }
}
.coachband h3 {
  margin-bottom: 14px;
}
.coachband .ticks li {
  color: #fff;
}
.coachband-steps {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
  counter-reset: step;
}
@media (min-width: 900px) {
  .coachband-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.coachband-steps li {
  counter-increment: step;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 22px;
  border-radius: 22px;
  background: rgba(60, 0, 22, 0.22);
  color: #fff;
}
.coachband-steps li::before {
  content: counter(step);
  width: 30px;
  height: 30px;
  margin-bottom: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--raspberry);
  font-weight: 760;
  font-size: 0.9375rem;
}
.coachband-steps b {
  color: #fff;
  font-size: 1.0625rem;
}
.coachband-seats {
  margin: 28px 0 0;
  font-weight: 600;
  max-width: 44em;
}
.coachband ::selection {
  background: #fff;
  color: var(--raspberry);
}
.coachband :focus-visible {
  outline-color: #fff;
}

/* ---------- last call ---------- */
.finale {
  padding-block: var(--section-space);
  overflow: clip;
}
.finale-inner {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 26px;
  padding-block: clamp(40px, 6vw, 80px);
}
.finale .plate {
  position: absolute;
  width: min(620px, 120vw);
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
}
.finale h2 {
  font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
  max-width: 12em;
}
.finale .badges {
  justify-content: center;
}
.finale .top-note {
  margin: 0;
}

/* Store screenshots: a row to swipe, snapping to each shot */
.shots {
  padding-block: clamp(40px, 7vw, 88px) 0;
}
.shots > .wrap > h2 {
  margin-bottom: clamp(20px, 3vw, 36px);
}
.shots-row {
  display: flex;
  gap: clamp(12px, 1.6vw, 20px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 8px max(16px, calc((100vw - 1180px) / 2)) 28px;
  scrollbar-width: none;
}
.shots-row::-webkit-scrollbar {
  display: none;
}
.shots-row img {
  flex: 0 0 auto;
  width: clamp(190px, 21vw, 250px);
  height: auto;
  border-radius: clamp(16px, 1.8vw, 24px);
  scroll-snap-align: center;
  box-shadow: var(--shadow-soft);
}
.shots-row:focus-visible {
  outline: 2px solid var(--raspberry);
  outline-offset: 4px;
}
