/* =========================================================
   Phone styles: yanq
   Loaded after css/style.css, only at max-width 768px (the link carries the
   media query), so everything here wins over the desktop and old narrow rules
   by order. Written for phones first: carousels, sheets, thumb reach, not
   desktop layouts stacked into a column.

   1. Intro photo band   shorter than a screen, copy anchored bottom-left
   2. What is YanQ       display type, the Q watermark back, full-width CTA
   3. How YanQ Works     four compact boxes in one column, a down arrow
                         between them, each drawing played when it enters view
   4. What YanQ Delivers a 2x2 grid of compact cards that settle in by scroll
   5. What to expect     four short items in a stacked list

   Sizes come from the type tokens (css/m/base.css sets the phone scale);
   the scroll touches here are custom properties the script writes as a pure
   function of scroll. The How YanQ Works boxes are the one timed play.
   ========================================================= */


/* =========================================================
   1. INTRO PHOTO BAND
   A band rather than a full screen, so the first thing under the bar is a
   picture and a headline, with the next section already peeking in. The
   script eases the photo a few px as it scrolls out (--yq-band).
   ========================================================= */
.yanq-hero-intro {
  min-height: 0;
  text-align: left;
}

.yanq-hero-intro .header-placeholder {
  height: clamp(420px, 74svh, 640px);
  min-height: 0;
  align-items: flex-end;
}

.yanq-hero-intro .header-placeholder img {
  /* The analyser sits left of centre in the shot */
  object-position: 34% 50%;
  transform: translate3d(0, calc(var(--yq-band, 0) * 48px), 0) scale(1.08);
  will-change: transform;
}

.yanq-hero-intro .header-placeholder__overlay {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  padding: 0 var(--gutter, 20px) clamp(32px, 6svh, 48px);
}

/* Heavier at the foot, where the type sits; the top of the photo stays clear */
.yanq-hero-intro .header-placeholder__overlay::before {
  background: linear-gradient(
    180deg,
    rgba(4, 25, 23, 0.08) 0%,
    rgba(4, 25, 23, 0.18) 38%,
    rgba(4, 25, 23, 0.78) 100%
  );
}

.yanq-hero-intro .header-placeholder__overlay > * {
  max-width: 34ch;
}

.yanq-hero-intro .header-placeholder__overlay h1 {
  line-height: var(--lh-heading, 1.14);
  margin-bottom: 12px;
}

.yanq-hero-intro .header-placeholder__overlay p {
  color: rgba(255, 255, 255, 0.86);
  max-width: 30ch;
  margin-left: 0;
  margin-right: 0;
}


/* =========================================================
   2. WHAT IS YANQ
   ========================================================= */
.yanq-hero {
  padding: clamp(56px, 9svh, 80px) var(--gutter, 20px) clamp(64px, 10svh, 88px);
}

/* The big Q comes back (style.css hides it below 900px), cropped off the
   right edge behind the copy, and drifts up a little as the section passes */
.yanq-hero__watermark {
  display: block;
  top: 0;
  right: -22vw;
  width: min(78vw, 420px);
  opacity: 0.38;
  transform: translate3d(0, calc(-6% + var(--yq-hero, 0) * -40px), 0);
  will-change: transform;
}

.yanq-hero__label {
  margin-bottom: 8px;
}

.yanq-hero h2 {
  line-height: var(--lh-display, 1.04);
  letter-spacing: -1.2px;
  margin-bottom: 20px;
  max-width: 11ch;
}

.yanq-hero__body {
  margin-bottom: 32px;
}

/* A thumb-wide call to action */
.yanq-hero__content .btn {
  display: flex;
  width: 100%;
  max-width: 420px;
  min-height: var(--tap, 48px);
}


/* =========================================================
   3. HOW YANQ WORKS
   One column of four compact boxes with a down arrow between them. Each box
   plays its own drawing as it comes into view (initYanqWorks in
   js/script.js); under reduced motion, or without JS, they are finished.
   The same centred column as What YanQ Delivers below it.
   ========================================================= */
.yanq-works {
  padding: var(--section-pad-y, 64px) max(var(--gutter, 20px), calc((100% - 560px) / 2));
}

.yanq-works h2 {
  margin-bottom: 12px;
}

.yanq-works__lead {
  margin-bottom: 32px;
}

.yanq-works__row {
  --works-gap: 36px;
  grid-template-columns: minmax(0, 1fr);
}

/* Drawing on the left, the step beside it: a box is about 150px tall, so
   four of them and their arrows stay under a screen and a half */
.yanq-step {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto auto auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 14px;
}

.yanq-step__art {
  grid-column: 1;
  grid-row: 1 / -1;
  aspect-ratio: 6 / 5;
  margin: 0;
}

.yanq-step__num {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin-bottom: 10px;
}

.yanq-step h3 {
  grid-column: 2;
  grid-row: 3;
  margin-bottom: 4px;
}

.yanq-step__tag {
  grid-column: 2;
  grid-row: 4;
  align-self: start;
}

/* The arrow points down through the gap below its box, centred on it */
.yanq-arrow {
  top: calc(100% + var(--works-gap) / 2);
  left: 50%;
  width: calc(var(--works-gap) - 8px);
  margin: -8px 0 0 calc((var(--works-gap) - 8px) / -2);
  transform: rotate(90deg);
}


/* =========================================================
   4. WHAT YANQ DELIVERS
   A 2x2 grid of compact cards: icon tile, numeral, teal bar, title, copy.
   Each card settles in as it scrolls up the screen (--yq-p, 0 to 1, from
   the script): it rises a few px, its bar draws and its numeral counts up
   to its number. Without the script --yq-p is 1 (finished).
   ========================================================= */
/* The same centred column as the scene above it, so the pinned heading
   lands on this section's edge */
.yanq-delivers {
  padding: var(--section-pad-y, 64px) max(var(--gutter, 20px), calc((100% - 560px) / 2));
}

.yanq-delivers h2 {
  margin-bottom: 24px;
}

.yanq-delivers__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.deliver-stat {
  --yq-p: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 14px 18px;
  background: var(--ivory-card, #fffefa);
  border: 1px solid rgba(188, 201, 199, 0.55);
  border-radius: var(--radius-card, 16px);
  opacity: calc(0.2 + 0.8 * var(--yq-p));
  transform: translate3d(0, calc((1 - var(--yq-p)) * 28px), 0);
}

.deliver-stat:active {
  background: #fbf9ef;
}

.deliver-stat__icon {
  width: 64px;
  padding: 8px;
  border-radius: 12px;
  background: var(--cream, #fafaef);
}

.deliver-stat__num {
  color: var(--teal-brand, #007f7f);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.deliver-stat__num::after {
  width: 28px;
  margin: 6px 0 10px;
  transform-origin: 0 50%;
  transform: scaleX(var(--yq-p));
}

/* Sized so the longest title ("Recommendation") holds on one line in a
   half-width card */
.deliver-stat h3 {
  font-size: calc(var(--fs-lead, 17px) * var(--fs-scale, 1));
  line-height: 1.25;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
}

@media (max-width: 374px) {
  .deliver-stat {
    padding-left: 12px;
    padding-right: 10px;
  }

  .deliver-stat h3 {
    --fs-scale: 0.94;
  }
}

.deliver-stat p {
  font-size: calc(var(--fs-small, 14px) * var(--fs-scale, 1));
  line-height: 1.5;
}

/* Tablet portrait: room for the tile beside the title */
@media (min-width: 600px) {
  .yanq-delivers__grid {
    gap: 16px;
  }

  .deliver-stat {
    padding: 20px 20px 24px;
  }

  .deliver-stat__icon {
    width: 88px;
  }
}


/* =========================================================
   5. WHAT TO EXPECT
   Four short items in a stacked list, kept tight (the section stays under
   about 520px).
   ========================================================= */
.yanq-expect {
  padding: 32px max(var(--gutter, 20px), calc((100% - 560px) / 2));
}

.yanq-expect__label {
  margin-bottom: 14px;
}

.yanq-expect__list {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.yanq-expect__list li {
  padding: 10px 0 12px;
}

.yanq-expect__title {
  margin-bottom: 2px;
}


/* =========================================================
   S15 phone scale (<= 599px only)
   Hero title H1, section headings H2, no leftover multipliers, 64/64
   rhythm (the ivory "expect" band sits between petrol and cream, so 64),
   Delivers cards with a 48px tile and 16px padding in two columns.
   ========================================================= */
@media (max-width: 599px) {
  /* Eyebrow over the H1-tier title: H4, so it reads as a lead-in, not a second heading */
  .yanq-hero__label {
    font-size: var(--fs-h4);
  }

  .yanq-hero h2 {
    font-size: var(--fs-h1);
    line-height: 1.12;
  }

  .yanq-works h2,
  .yanq-delivers h2 {
    font-size: var(--fs-h2);
    line-height: 1.15;
  }

  /* Step titles were 0.8 x H4 on the narrowest phones: Body tier instead */
  .yanq-step h3 {
    --fs-scale: 1;
  }

  .deliver-stat {
    padding: 16px;
  }

  .deliver-stat__icon {
    width: 48px;
    padding: 6px;
  }

  /* Longest title ("Recommendation") still holds one line in the half card */
  .deliver-stat h3 {
    --fs-scale: 1;
    font-size: var(--fs-body);
  }

  .yanq-expect {
    padding-top: var(--section-pad-y, 64px);
    padding-bottom: var(--section-pad-y, 64px);
  }
}

/* Narrowest phones: "Recommendation" needs the room inside a 146 px delivers card */
@media (max-width: 380px) {
  .deliver-stat {
    padding: 16px 12px;
  }

  .deliver-stat h3 {
    font-size: calc(var(--fs-body) - 1px);
  }
}
