/* ==========================================================================
   Breakfast - Quaker x Eggland's Best microsite
   Built from Figma "Quaker x Eggland's Best Microsite v6" (node 154:3384),
   1728px frame.

   Layout note
   -----------
   The hero is art-directed (overlapping photos, tilted packs) so above 820px
   it is laid out exactly as designed, in Figma pixels: the header is a
   container query context exposing `--u`, one design pixel, and every `.ab`
   box is placed with calc(<figma value> * var(--u)). Below 820px the same
   elements re-flow into a stacked mobile hero.

   The SHOP / EMAIL / GET columns use the same idea one level down: each
   column is a container whose design width is `--cw`, and every `.sv` child
   is placed with its Figma ink bounds in cqw. The columns therefore scale as
   one piece at any width and simply stack on phones.

   Type: all display lettering is the design's own "Quaker" face, exported
   from Figma as outlined SVG (images/text/*.svg) and placed at its ink
   bounds. Body copy is Avenir LT Pro Roman and the T&Cs Avenir Next
   Condensed, both self-hosted in fonts/. Only the ® marks use a live
   display-ish face (Poppins, as in the design).
   ========================================================================== */

@font-face {
  font-family: "Avenir LT Pro";
  src: url("fonts/avenir-roman.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Avenir Next Condensed";
  src: url("fonts/avenir-next-condensed.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --blue:   #006ab7;   /* base of the background texture */
  --tab:    #0080d7;   /* SHOP / EMAIL / GET tabs */
  --yellow: #ffaa00;
  --navy:   #0e4f89;
  --white:  #ffffff;

  --font-body: "Avenir LT Pro", "Avenir", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-cond: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --font-reg:  "Poppins", var(--font-body);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--blue) url("images/bg-pattern.svg") 44% 0 / 149% auto repeat-y;   /* vector leaves over the original colour fields: crisp at any scale (see images/bg-pattern.jpg for the raster original) */
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, p, ul, ol { margin: 0; }
a { color: inherit; }

/* Registered marks: separate Poppins glyphs in the design, overlaid on the
   lettering artwork at their Figma offsets. */
.reg { position: absolute; font-family: var(--font-reg); font-weight: 400; line-height: 1; color: var(--white); }

/* Figma-placed box (hero) ----------------------------------------------- */
.ab {
  position: absolute;
  left:   calc(var(--x) * var(--u));
  top:    calc(var(--y) * var(--u));
  width:  calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
}
.shape {
  position: absolute;
  left: 50%; top: 50%;
  width:  calc(var(--sw) * var(--u));
  height: calc(var(--sh) * var(--u));
  transform: translate(-50%, -50%) rotate(var(--rot));
}

/* ==========================================================================
   HERO (desktop poster)
   ========================================================================== */
.hero {
  position: relative;
  container-type: inline-size;
  --u: calc(100cqw / 1728);
  aspect-ratio: 1728 / 1395;   /* cqw on the container itself resolves against
                                  its ancestor, so the height is an aspect ratio */
  z-index: 0;
}
.hero__photos, .hero__logos, .hero__title, .hero__packs { display: contents; }

/* Photos */
.bowl { --x: -228; --y: -70; --w: 624; --h: 610; z-index: 4; }
.bowl__img { width: 100%; height: 100%; object-fit: cover; }
.bowl__note {
  position: absolute;
  left: 58.2%; top: 89.2%;
  width: 24.3%; height: auto;
  transform: rotate(-2.31deg);
}
.eggs { --x: 1266; --y: 18; --w: 777; --h: 767; z-index: 3; }
.eggs img { width: 100%; height: 100%; object-fit: cover; }

/* Tagline and headline: boxes are the Figma ink bounds of each text block */
.tagline   { --x: 555.88; --y: 60.95;  --w: 645.92; --h: 24.45;  z-index: 8; }
.hl        { z-index: 6; }
.hl--spend { --x: 706.35; --y: 443.22; --w: 303.94; --h: 58.56; }
.hl--get   { --x: 477.41; --y: 524.03; --w: 775.29; --h: 185.44; }
.hl--card  { --x: 476.41; --y: 724.75; --w: 781.11; --h: 63.45; }
.tagline img, .hl img { width: 100%; height: 100%; }

/* Quaker logo: portrait + wordmark + registered mark, placed in % of its box */
.qlogo { --x: 527; --y: 133; --w: 255; --h: 243; z-index: 7; container-type: inline-size; }
.qlogo__man  { position: absolute; left: 11.8%; top: 0;     width: 80.6%; height: 79.7%; object-fit: cover; }
.qlogo__word { position: absolute; left: 4.07%; top: 69.6%; width: 95.9%; height: 30.4%; }
.qlogo__reg  {
  left: 100.5%; right: auto; top: 86%;            /* baseline right of the R, as on pack */
  font-size: 0.985vw;   /* = badge ® size (457.57 * 3.72% of a 1728 design px); not var(--u):
                           cqw inside .qlogo would resolve against the logo box, not the hero */
}
.eblogo { --x: 793; --y: 155; --w: 441.56; --h: 197.93; z-index: 7; }
.eblogo img { width: 100%; height: 100%; object-fit: contain; }

/* Yellow badge: 457.57 x 133.16 design px, children in % of the box */
.badge {
  --x: 616; --y: 833; --w: 457.57; --h: 133.16;
  z-index: 5;
  background: var(--yellow);
  container-type: inline-size;
}
.badge__sub  { position: absolute; left: 11.82%; top: 13.9%; width: 76.1%; }
.badge__main { position: absolute; left: 6.71%;  top: 34.7%; width: 86.53%; }
.badge__reg  { color: var(--navy); font-size: 3.72cqw; }
.badge__reg--1 { left: 83.05%; top: 30.0%; }
.badge__reg--2 { left: 46.53%; top: 58.3%; }

/* Tilted packs */
.box { --x: -80; --y: 558; --w: 619.82; --h: 814.98; z-index: 2; }
.box .shape { --sw: 490.5; --sh: 736.07; --rot: -10.81deg; }
.box img {
  width: 100%; height: 100%;
  filter: drop-shadow(calc(27.2 * var(--u)) calc(23.5 * var(--u)) calc(5.9 * var(--u)) rgba(0, 0, 0, 0.34));
}
.carton { --x: 709.2; --y: 905; --w: 1045.08; --h: 532.81; z-index: 1; }
.carton .shape { --sw: 997.63; --sh: 380.52; --rot: -9.06deg; }
.carton img {
  position: absolute;
  left: 4.46%; top: 4.2%; width: 91.3%; height: auto;
  filter: drop-shadow(calc(25 * var(--u)) calc(22.6 * var(--u)) calc(3.7 * var(--u)) rgba(0, 0, 0, 0.25));
}

/* ==========================================================================
   STEPS: SHOP / EMAIL / GET
   Grid columns reproduce the Figma column widths and gaps (388 | 151 | 479 |
   129 | 379) across the 1526px design span. Each step is a container; `.sv`
   children sit at their Figma ink bounds relative to the column origin.
   ========================================================================== */
.steps { padding: 14px 20px 0; }
.steps__grid {
  max-width: 1526px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 388fr 151fr 479fr 129fr 379fr;
  align-items: start;
}
.step {
  position: relative;
  container-type: inline-size;
  aspect-ratio: var(--cw) / var(--ch);   /* see .hero: no cqw on the container itself */
}
.step--shop  { grid-column: 1; --cw: 388; --ch: 292.4; }
.step--email { grid-column: 3; --cw: 479; --ch: 413.4; }
.step--get   { grid-column: 5; --cw: 379; --ch: 282.7; }

.sv {
  position: absolute;
  left:  calc(100cqw * var(--x) / var(--cw));
  top:   calc(100cqw * (var(--y) + var(--dy, 0)) / var(--cw));   /* --dy: mobile shift, see the 820px block */
  width: calc(100cqw * var(--w) / var(--cw));
  height: auto;
}

/* Blue tabs: 315.49 x 105.16 with the label centred (matches the ink bounds) */
.tab {
  --y: 0; --dy: 0; --w: 315.49;
  aspect-ratio: 315.49 / 105.16;
  display: grid; place-items: center;
  background: var(--tab);
  box-shadow: calc(100cqw * 8.5 / var(--cw)) calc(100cqw * 8.5 / var(--cw)) calc(100cqw * 5.3 / var(--cw)) calc(100cqw * -4.2 / var(--cw)) rgba(0, 0, 0, 0.27);
}
.step--shop  .tab { --x: 50; }  .step--shop  .tab img { width: 60.3%; }
.step--email .tab { --x: 81; }  .step--email .tab img { width: 72.5%; }
.step--get   .tab { --x: 32; }  .step--get   .tab img { width: 43.2%; }

.sv--spend    { --x: 62.24;  --y: 132.86; --w: 264.98; }
.sv--onany    { --x: 24.33;  --y: 197.11; --w: 339.9; }
.sv--products { --x: 4.07;   --y: 235.74; --w: 380.06; container-type: inline-size; }
.sv--products img { width: 100%; }
.sv__reg { font-size: 2.42cqw; }
.sv__reg--1 { left: 42.3%; top: -7%; }
.sv__reg--2 { left: 70.5%; top: -7%; }

.sv--photo    { --x: 13.6;   --y: 128.09; --w: 449.24; }
.emailbox {
  --x: 7; --y: 244; --w: 461;
  aspect-ratio: 461 / 127;
  display: grid; place-items: center;
  background: var(--white);
  border-radius: calc(100cqw * 22.2 / var(--cw));
  box-shadow: calc(100cqw * 7.4 / var(--cw)) calc(100cqw * 7.4 / var(--cw)) calc(100cqw * 4.6 / var(--cw)) calc(100cqw * -3.7 / var(--cw)) rgba(0, 0, 0, 0.27);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.emailbox img { width: 79.2%; }
.emailbox:hover, .emailbox:focus-visible {
  transform: translateY(-2px);
  box-shadow: 9px 11px 10px -4px rgba(0, 0, 0, 0.3);
  outline: none;
}
.emailbox:focus-visible { box-shadow: 0 0 0 4px var(--yellow); }
.sv--nolater  { --x: 124.37; --y: 395.6;  --w: 230.76; }

.sv--getcopy  { --x: 18.42;  --y: 132.86; --w: 340.32; container-type: inline-size; }
.sv--getcopy img { width: 100%; }
.sv__reg--visa { font-size: 4.24cqw; left: 42.5%; top: 69.5%; }

/* ==========================================================================
   DETAILS: Program Terms / Submission Instructions / Tips
   ========================================================================== */
.details { padding: clamp(60px, 5.9vw, 102px) 20px 0; }
.details__grid {
  max-width: 1478px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: clamp(32px, 5.6vw, 98px);
  row-gap: 48px;
}
.details__col h2 { margin-bottom: clamp(24px, 2.1vw, 36px); }
.details__col h2 img { height: clamp(44px, 4.05vw, 70px); width: auto; }
.details__col p, .details__col li {
  font-size: clamp(16px, 1.31vw, 22.64px);
  line-height: 1.37;
}
.details__col p + p, .details__col p + ul, .details__col ul + p { margin-top: 1.37em; }
.details__col ol, .details__col ul { padding-left: 1.5em; }
.details__col li { padding-left: 0.2em; }
.details__col li::marker { color: var(--white); }

/* ==========================================================================
   MORE PRODUCTS
   Two overlapping clusters, each laid out in its own design pixels (cqw) so
   the arrangement scales as one piece and the clusters stack on mobile.
   ========================================================================== */
.products { padding: clamp(60px, 5.5vw, 96px) 20px 0; }
.products__heading { display: flex; justify-content: center; }
.products__heading img { width: min(100%, clamp(420px, 39vw, 675px)); height: auto; }
.products__row {
  max-width: 1446px;
  margin: clamp(28px, 3vw, 52px) auto 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.3%;
}
.cluster { position: relative; container-type: inline-size; flex: 0 0 auto; }
.pa { position: absolute; height: auto; }

/* Eggland's Best cluster: 783 x 390 design px, origin (153, 2572) */
.cluster--eb { width: 54.15%; aspect-ratio: 783 / 390; }
.pa--omelets { left: calc(100cqw * 33.9 / 783); top: calc(100cqw * 64.1 / 783); width: calc(100cqw * 262.9 / 783); z-index: 1; }
.pa--whites  { left: calc(100cqw * 269.7 / 783); top: calc(100cqw * 7.9 / 783);  width: calc(100cqw * 113.8 / 783); z-index: 2; }
.pa--organic { left: calc(100cqw * 306 / 783);   top: calc(100cqw * 210.7 / 783); width: calc(100cqw * 463.3 / 783); z-index: 3; }

/* Quaker cluster: 629 x 333 design px, origin (970, 2593) */
.cluster--quaker { width: 43.5%; aspect-ratio: 629 / 333; }
.pa--apples  { left: calc(100cqw * 50.3 / 629);  top: 0;                           width: calc(100cqw * 212.4 / 629); z-index: 1; }
.pa--banana  { left: calc(100cqw * 212 / 629);   top: calc(100cqw * 17 / 629);     width: calc(100cqw * 208.6 / 629); z-index: 2; }
.pa--granola { left: calc(100cqw * 374 / 629);   top: calc(100cqw * 39 / 629);     width: calc(100cqw * 215.8 / 629); z-index: 3; }

/* ==========================================================================
   TERMS
   ========================================================================== */
.legal {
  max-width: 1474px;
  margin: 0 auto;
  padding: clamp(28px, 1.5vw, 24px) 20px clamp(40px, 3.5vw, 60px);
}
.legal p {
  font-family: var(--font-cond);
  font-size: clamp(12px, 1.04vw, 18px);
  line-height: 1.2;
  text-align: justify;
  hyphens: auto;
}
.legal__link { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; white-space: nowrap; }
.legal__link:hover, .legal__link:focus-visible { color: var(--yellow); outline: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 820px) {
  /* ---- Hero re-flows: photos band, tagline, logos, headline, badge, packs.
     Every rule is prefixed with .hero so it outranks the `.hero .ab` reset. */
  .hero { height: auto; padding-bottom: 4vw; }
  .hero .ab { position: static; left: auto; top: auto; right: auto; width: auto; height: auto; }
  .hero__photos, .hero__logos, .hero__title, .hero__packs { display: block; }

  /* Plate reads larger than the bowl (as on desktop, 777 vs 624 design px)
     and the band is tall enough that the tagline clears the plate. */
  .hero .hero__photos { position: relative; height: 52vw; }
  .hero .bowl { position: absolute; left: -11vw; top: -7vw; width: 48vw; height: 47vw; }
  .hero .eggs { position: absolute; right: -17vw; top: -8vw; width: 63vw; height: 62vw; left: auto; }

  .hero .tagline { margin: 9vw auto 0; width: min(84vw, 460px); }
  .hero .tagline img { height: auto; }

  .hero .hero__logos {
    display: flex; align-items: center; justify-content: center;
    gap: 6vw; margin-top: 4vw; padding: 0 16px;
  }
  .hero .qlogo  { position: relative; width: 27vw; height: 25.7vw; flex: 0 0 auto; }
  .hero .qlogo__reg { font-size: calc(min(92vw, 440px) * 0.0372); }   /* tracks the badge ® on mobile */
  .hero .eblogo { width: 46vw; height: auto; flex: 0 0 auto; }
  .hero .eblogo img { height: auto; }

  .hero .hero__title { margin-top: 6vw; display: flex; flex-direction: column; align-items: center; gap: 3.5vw; }
  .hero .hl img { height: auto; }
  .hero .hl--spend { width: min(40vw, 210px); }
  .hero .hl--get   { width: min(88vw, 480px); }
  .hero .hl--card  { width: min(86vw, 470px); }

  .hero .badge { position: relative; width: min(92vw, 440px); aspect-ratio: 457.57 / 133.16; margin: 6vw auto 0; }

  /* Box and carton sit side by side: box on the left, carton to its right,
     vertically centred on the box. The carton is in front so the Eggland's
     Best logo on its lid is never covered, and its right end runs off screen. */
  .hero .hero__packs { position: relative; height: 88vw; margin-top: 4vw; }
  .hero .box    { position: absolute; left: -2vw; top: 0; width: 56vw; height: 86vw; }
  .hero .carton { position: absolute; left: 50vw; right: auto; top: 18vw; width: 90vw; height: 50vw; z-index: 3; }
  .hero .box .shape    { width: 44vw; height: 66vw; }
  .hero .carton .shape { width: 84vw; height: 32.1vw; }
  .hero .box img    { filter: drop-shadow(10px 9px 3px rgba(0, 0, 0, 0.34)); }
  .hero .carton img { filter: drop-shadow(9px 8px 2px rgba(0, 0, 0, 0.25)); }

  /* ---- Flow sections stack */
  .steps { padding-top: 6vw; }
  .steps__grid { grid-template-columns: 1fr; row-gap: 10vw; }
  /* One scale for all three steps: each column is sized against the widest
     (Email, 479 design px), so the lettering reads at the same size in every
     step. The tabs, which are equal on desktop only because the columns
     differ, are then narrowed to --tw and centred, and the copy below moves
     up by the height the tab lost (--dy) so the gap under the tab is kept. */
  .step {
    grid-column: 1;
    width: calc(min(100%, 440px) * var(--cw) / 479);
    margin: 0 auto;
    --tw: 220;
    --dy: calc((var(--tw) - 315.49) * 105.16 / 315.49);
    aspect-ratio: var(--cw) / calc(var(--ch) + var(--dy));
  }
  .steps__grid .tab { --w: var(--tw); --x: calc((var(--cw) - var(--tw)) / 2); }

  .details__grid { grid-template-columns: 1fr; max-width: 560px; }
  .details__col h2 img { height: clamp(40px, 11vw, 56px); }
  .details__col p, .details__col li { font-size: clamp(16px, 4.3vw, 19px); }

  .products__heading img { width: min(100%, 560px); }
  .products__row { flex-direction: column; align-items: center; gap: 6vw; max-width: 560px; }
  .cluster--eb, .cluster--quaker { width: 100%; }

  .legal p { font-size: 13px; text-align: left; }
}

@media (max-width: 400px) {
  .hero .hero__logos { gap: 4vw; }
}

/* ==========================================================================
   SCROLL REVEAL (progressive enhancement)
   The hidden state is scoped to .js, which an inline head script adds, so
   with scripting off the content is simply visible. That script also arms a
   timed fallback reveal in case script.js never loads. Never move the hidden
   state onto a bare [data-reveal] selector.
   ========================================================================== */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .emailbox { transition: none; }
}
