/* =====================================================================
   Waitrose case study (waitrose.html) — page-only styles.
   Loaded after css/project.css; same scale: 1 Figma px = calc(N * var(--p)).
   Phones (≤767px) at the bottom.
   ===================================================================== */

/* ---------- Overview: image card + text, vertically centred (also used for "A moment that stayed with me") ---------- */
.overview--card { margin-top: calc(120 * var(--p)); height: calc(458 * var(--p)); align-items: center; }
.overview--card .overview__image { flex: 0 0 calc(632 * var(--p)); height: calc(462 * var(--p)); border-radius: calc(16 * var(--p)); overflow: hidden; }
.overview--card .overview__text { margin-top: 0; }
/* "Featured as App of the Day" badge: once the section is in, it rises, fades in and turns into place, after a short pause.
   Position/size are the badge's place in the original 1264×924 image. */
.aotd { position: relative; }
.overview__image .aotd__badge {
  position: absolute; left: 66.456%; top: .649%; width: 18.829%; height: auto; object-fit: initial;
}
.js .aotd__badge {
  opacity: 0; transform: translateY(24px) rotate(-30deg) scale(.92);
  transition: opacity .8s ease .7s, transform 1.1s cubic-bezier(.22,1,.36,1) .7s;
}
.js .is-in .aotd__badge { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .aotd__badge { transform: none; transition: opacity .6s ease .3s; } }

/* ---------- At a glance (stat cards) ---------- */
.glance { margin-top: calc(90 * var(--p)); }
.glance .stat { height: calc(161 * var(--p)); }
.squiggle--glance { left: calc(28.5 * var(--p)); top: calc(58.5 * var(--p)); width: calc(214 * var(--p)); height: calc(34 * var(--p)); }
.glance__star {
  display: inline-block; vertical-align: top;
  width: calc(39.25 * var(--p)); height: calc(37.53 * var(--p));
  margin: calc(4.5 * var(--p)) 0 0 calc(6 * var(--p));
}

/* ---------- Chapters: spacing from Figma ---------- */
.chapters { margin-top: calc(140 * var(--p)); }
.chapter--app      { --after: calc(272.5 * var(--p)); --ticker-top: calc(87 * var(--p)); }
.chapter--a11y     { --ticker-top: calc(87 * var(--p)); }
.chapter--strategy { --after: calc(271 * var(--p)); }
.chapter--ways     { --after: calc(184 * var(--p)); }

/* Smaller caption text (14/24) used under gallery panels and as a note */
.caption { font-size: calc(14 * var(--p)); line-height: calc(24 * var(--p)); color: var(--body); width: calc(524 * var(--p)); }

/* 01: photo strip */
.chapter__figure--photos { border-radius: calc(20 * var(--p)); }


/* ---------- 03: product strategy ---------- */
.chapter--strategy .rail { --rail-gap: calc(28 * var(--p)); margin-top: calc(20 * var(--p)); }
/* 03: the home screen group. 1 Figma px = --s; it is the page scale, but never so big that the 1508px group
   wouldn't fit the screen (16px clear each side), so nothing gets cut. Centred on the column. */
.screens {
  --s: min(var(--p), calc((100vw - 32px) / 1508.56));
  position: relative; width: calc(1508.56 * var(--s)); height: calc(634.62 * var(--s));
  margin-top: calc(193 * var(--p)); margin-left: calc(50% - 754.28 * var(--s));
}
.screens__item {
  position: absolute; max-width: none;
  left: calc(var(--x) * var(--s)); top: calc(var(--y) * var(--s));
  width: calc(var(--w) * var(--s)); height: calc(var(--h) * var(--s));
}
.screens__item--float { z-index: 2; }   /* above the phone, whose image has a white background */
.screens__item--phone { z-index: 1; }
/* Entrance when the section scrolls in: the phone fades in first, then the side screens fade in and rise,
   in pairs from the centre outwards (--in). The group itself doesn't move. */
.js .screens[data-reveal] { opacity: 1; transform: none; transition: none; }
.js .screens__item { opacity: 0; transition: opacity .9s ease, transform 1.1s cubic-bezier(.22,1,.36,1); transition-delay: var(--in, 0s); }
.js .screens__item--float { transform: translateY(calc(60 * var(--s))); }
.js .screens.is-in .screens__item { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .screens__item { transform: none; transition: opacity .6s ease; } }
/* the side screens drift up and down a few pixels, each at its own pace */
.screens__item--float {
  border-radius: calc(16 * var(--s));   /* the exports have square corners filled in; round them as in Figma */
  animation: screens-float var(--dur) ease-in-out var(--delay) infinite alternate;
}
@keyframes screens-float {
  from { translate: 0 calc(var(--amp) * var(--s) * -1); }
  to   { translate: 0 calc(var(--amp) * var(--s)); }
}
@media (prefers-reduced-motion: reduce) { .screens__item--float { animation: none; } }
.strategy__note { margin-top: calc(85 * var(--p)); }

/* ---------- 04: accessibility — "a moment that stayed with me" ---------- */
.moment { margin-top: calc(130.5 * var(--p)); }
.moment .overview__image { height: calc(408 * var(--p)); }

/* ---------- 05: ways of working ---------- */
.chapter--ways .rail { --rail-gap: calc(28 * var(--p)); margin-top: calc(20 * var(--p)); }
.chapter--ways .rail__item img { height: calc(550 * var(--p)); }

/* ---------- What stayed with me: three columns ---------- */
.learnings--three .learnings__grid { grid-template-columns: repeat(3, 1fr); column-gap: calc(32 * var(--p)); }
.learnings--three .lesson { padding: calc(32 * var(--p)) 0; }
.learnings--three .squiggle--number { left: calc(2.86 * var(--p)); }

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

  .glance { margin-top: 80px; }
  .glance .stat { height: auto; }
  .squiggle--glance { left: 18px; top: 46px; width: 175px; height: 28px; }
  .glance__star { width: 32px; height: 30.6px; margin: 5px 0 0 5px; }

  .chapters { margin-top: 96px; }
  .chapter--app, .chapter--strategy, .chapter--ways { --after: 96px; }
  .caption { width: auto; font-size: 14px; line-height: 22px; }
  .chapter__figure--photos { border-radius: 12px; }


  .chapter--strategy .rail, .chapter--ways .rail { --rail-gap: 12px; margin-top: 24px; }
  .chapter--ways .rail__item img { height: auto; aspect-ratio: 942 / 550; }
  .screens { margin-top: 40px; }
  .strategy__note { margin-top: 24px; }

  .moment { margin-top: 56px; }
  .moment .overview__image { height: auto; aspect-ratio: 632 / 408; }

  .learnings--three .learnings__grid { grid-template-columns: 1fr; }
  .learnings--three .lesson { padding: 24px 16px 8px; }
  .learnings--three .squiggle--number { left: 14px; }
}
