/* ==========================================================================
   BLENDZ — "high quality imported fruits" section
   --------------------------------------------------------------------------
   Every number below is traced from assets/references/reference 2.png.
   Reference poster = 687 x 647 px (the purple canvas inside the mock-up's
   white bezel). Inside it the framed group sits at x 40, y 205, 629 x 372.

   Scaling model
   -------------
   Unlike the hero, this section has no fixed canvas — the *artwork* is the
   ruler. .quality__inner is a size container sized to the framed group, so
   1cqw = 1% of that group's width. The top sparkle and the heading stack
   above it in normal flow (gaps expressed in cqw); the two big sparkles and
   the supporting text are absolutely positioned inside .quality__art as
   percentages of it. The whole block therefore scales as one piece, and the
   reference's own breathing room (73px above the sparkle, 70px below the
   frames) falls out of simply centring the block in the section.

   Colours come from hero.css (--purple, --cream); only the coral used by the
   pixel decorations is new. hero.css itself is untouched.
   ========================================================================== */

:root {
  --coral: #ff7a7a;  /* pixel decorations — same coral as the hero's star art */
}

/* The <symbol> holder at the top of <body>. Pulled out of flow rather than
   display:none — a zero-sized *inline* svg would still open a line box and
   push the hero down, and display:none breaks <use> in some engines. */
.pxdefs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ==========================================================================
   Section shell
   ========================================================================== */
.quality {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;      /* fallback for browsers without svh */
  min-height: 100svh;
  /* The inline padding has to clear the left sparkle, which hangs 5.246% of
     the artwork width outside .quality__inner. Solving P >= .05246(V - 2P)
     for the worst case (the inner filling the row, i.e. narrow tablets) gives
     P >= 4.75vw; 4.8vw keeps the sparkle whole all the way down to 701px. On
     wide viewports the 1010px cap makes the padding academic. */
  padding: clamp(10px, 2.5vw, 32px) max(32px, 4.8vw);
  background: var(--purple);
  overflow: hidden;       /* lets the left sparkle bleed off narrow viewports */
}

/* Size container, sized to the framed group. The three caps are, in order:
   never wider than the section box, never wider than the artwork should get,
   and never so wide that the stack (0.80 x artwork width, plus padding)
   outgrows the viewport. */
.quality__inner {
  width: min(100%, 1010px, 106vh);   /* svh fallback */
  width: min(100%, 1010px, 106svh);
  container-type: inline-size;
}

.quality__composition {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Coral pixel sparkle — a 5 x 5 pixel grid read straight off the reference
   (the reference cells measure exactly 18.4px across a 92px shape)
   ========================================================================== */
.quality__spark {
  display: block;
  aspect-ratio: 1;
  fill: var(--coral);
  shape-rendering: crispEdges;   /* sharp pixel corners at any scale */
}

/* 1 — small sparkle above the heading  (ref x 338–379, y 73–115) */
.quality__spark--top {
  width: 6.518cqw;
  /* The reference hangs it 15px (2.385cqw) right of the heading's centre —
     that offset is the visible relationship, since the two sit one above the
     other. In a centre-aligned column a left margin shifts by half itself. */
  margin-left: 4.77cqw;
}

/* ==========================================================================
   Heading  (ref ink x 39–648, y 130–166 — optically centred on the canvas)
   --------------------------------------------------------------------------
   Partita1990 is 1000upm with a 1350/400 ascent/descent, so at line-height:1
   the half-leading is -0.375em. For this string the ink then starts .2656em
   below the line box's top edge and ends .2031em below its bottom edge — the
   two corrections in the margin shorthand put the *ink* on the reference's
   15px and 39px gaps rather than the invisible line box.
   ========================================================================== */
.quality__title {
  max-width: 100%;
  margin: calc(2.385cqw - .2656em) 0 calc(6.201cqw + .2031em);
  font-family: var(--font-label);
  /* ref ink is 609px wide over a 629px artwork; 6.417cqw is the size at which
     the browser actually rasterises that width (measured, not derived — the
     face's side bearings make the nominal size run ~3% narrow). */
  font-size: 6.417cqw;
  font-weight: 400;       /* the face has no bold — stops synthetic bolding */
  line-height: 1;
  text-align: center;
  /* uppercase in the markup, lowercase on screen: the reference sets this
     line in Partita1990's lowercase forms. */
  text-transform: lowercase;
  color: var(--cream);
  white-space: nowrap;
}

/* ==========================================================================
   Framed group  (ref x 40–669, y 205–577)
   ========================================================================== */
.quality__art {
  position: relative;
  width: 100%;
  aspect-ratio: 1028 / 608;   /* the artwork's own bounds, see below */
}

/* blendz 2.png is a 1080 x 1350 canvas with the three framed photographs
   floating in transparent padding at x 26, y 372, 1028 x 608. This is the
   same crop trick the hero uses for its sprites: the box is sized to the
   *artwork*, and the image is pulled into place behind it. That keeps the
   transparent padding from inventing overlap or dead click area, and makes
   every offset below a percentage of the visible frames.
     width      = 100% / (1028/1080)
     translateX = -(26/1080) of the scaled image
     translateY = -(372/1350) of the scaled image
   No image-rendering override — these are photographs, not pixel art. */
.quality__art-crop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.quality__art-crop > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 105.0583%;
  height: auto;
  transform: translate(-2.40741%, -27.55556%);
}

/* 2 — big sparkle biting into the orange frame's top-left corner
       (ref x 7–99, y 181–273; negative offsets are measured off the frames) */
.quality__spark--left {
  position: absolute;
  left: -5.246%;
  top: -6.452%;
  width: 14.626%;
  z-index: 2;
}

/* 3 — big sparkle in the open purple below the grape frame
       (ref x 502–594, y 431–523 — sits over fully transparent artwork) */
.quality__spark--br {
  position: absolute;
  left: 73.45%;
  top: 60.753%;
  width: 14.626%;
  z-index: 2;
}

/* ==========================================================================
   Supporting text  (ref ink x 465–632, y 537–568)
   The -.1875em is the same ink-top correction as the heading, recomputed for
   this string's ascender ("t" and the bracket sit higher than "h").
   ========================================================================== */
.quality__told {
  position: absolute;
  /* the .0994em backs out the "t"'s left side bearing, so the reference
     measurement lands on the ink rather than on the text box */
  left: calc(67.568% - .0994em);
  top: 89.247%;
  margin: -.1875em 0 0;
  font-family: var(--font-label);
  font-size: 4.879cqw;    /* ref ink 167px / 629px artwork, measured as above */
  line-height: 1;
  text-transform: lowercase;
  color: var(--cream);
  white-space: nowrap;
  z-index: 2;
}

/* ==========================================================================
   Narrow viewports
   --------------------------------------------------------------------------
   The art direction is kept — the frames stay one overlapping group, the left
   sparkle still bites the orange frame, the supporting text still trails off
   the bottom right. Only the type grows (the heading takes two lines) and the
   decorations are re-seated so nothing leaves the viewport. Height is left to
   the content: forcing 100svh here would only add empty purple.
   ========================================================================== */
@media (max-width: 700px) {
  .quality {
    min-height: 0;
    padding: clamp(64px, 18vw, 120px) clamp(6px, 2vw, 14px);
  }

  .quality__inner { width: 100%; }

  .quality__spark--top { width: 9cqw; }

  /* 10.4cqw is bounded on both sides: above 8.25cqw the line can only break
     after "quality", below 11.64cqw "imported fruits" still fits the width —
     so the heading always lands as exactly two balanced lines. */
  .quality__title {
    margin: calc(3.4cqw - .2656em) 0 calc(7.5cqw + .2031em);
    font-size: 10.4cqw;
    white-space: normal;
  }

  /* pulled in from -5.246%: at this scale the reference offset would eat the
     sparkle's whole outer column against the viewport edge */
  .quality__spark--left {
    left: -3%;
    top: -7.5%;
    width: 17%;
  }

  /* both lower elements are anchored to the right edge so that growing the
     type pushes them inwards instead of off-screen */
  .quality__spark--br {
    left: auto;
    right: 6.5%;
    top: 55%;
    width: 17%;
  }

  .quality__told {
    left: auto;
    right: 5.88%;
    top: 88%;
    font-size: 6.4cqw;
  }
}
