/* #pilot: Howick High pilot project (brief 7.8). Theme light, not pinned.
   Desktop: eyebrow and a two-line heading; the lead text on the left and the three stats on the right, each under
   a hairline; then the photos: howick2 (learners at their desks) large on the left, howick1 (the branded front
   panels) smaller on the right and set lower, so the pair never reads as a grid of boxes. One caption for both.
   The large photo is anchored at its bottom edge and carries a lighter parallax (0.04 in the html): the branded
   front panels (SmartStack, the tagline, Kingdom Furniture and the school crest) run along the bottom of
   howick2.jpg, and the frame keeps them in view through the whole parallax (only the crest's motto ribbon, on the
   file's very bottom edge, loses a few pixels late in the range).
   768 to 1099 px: the stats move to their own row under the text, and the photos split 7 and 5 columns (the small
   one square there) so it does not shrink to a thumbnail. Phones: one column, the small photo set to the right at
   two thirds of the width, the stats as rows (number, then label; the number column scales with the type).
   Percentage margins on grid items resolve against the grid area's width: that keeps the small photo's drop and
   the caption's place under the large photo in proportion at every width, with no measuring in JS. */

#pilot {
  --pilot-drop: 50%;                 /* how far the small photo sits below the large one, as a share of its own width */
}

/* ------------------------------------------------------------------ heading */
#pilot .pilot-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }
#pilot .pilot-head .eyebrow { grid-column: 1 / -1; justify-self: start; }
#pilot .pilot-title { grid-column: 1 / span 9; margin-top: clamp(22px, 2.2vw, 32px); }

/* ------------------------------------------------------------------ lead text and stats */
#pilot .pilot-intro {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap);
  align-items: start; margin-top: clamp(44px, 6.4vh, 72px);
}
#pilot .pilot-text { grid-column: 1 / span 5; color: var(--fg); }
#pilot .pilot-stats {
  grid-column: 7 / span 6;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--col-gap);
}
#pilot .pilot-stat { position: relative; padding-top: clamp(20px, 2vw, 28px); min-width: 0; }
/* the hairline grows from the left (js); a short yellow lead marks its start */
#pilot .pilot-stat__rule {
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
  transform-origin: 0 50%;
}
#pilot .pilot-stat__rule::before {
  content: ""; position: absolute; left: 0; top: 0; width: 28px; height: 2px; background: var(--yellow);
}
/* Display L, capped: three stats share six columns, and "2026" (about 2.2em) must stay inside its column at 1600px+ */
#pilot .pilot-stat__num { display: block; white-space: nowrap; font-size: min(var(--fs-l), 82px); }
#pilot .pilot-stat__label {
  display: block; margin-top: clamp(12px, 1.2vw, 16px); max-width: 26ch;
  color: var(--muted); line-height: 1.45; text-wrap: balance;
}

/* ------------------------------------------------------------------ photos */
#pilot .pilot-photos {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap);
  align-items: start; margin-top: clamp(72px, 12vh, 136px);
}
#pilot .pilot-photo { position: relative; min-width: 0; }
#pilot .pilot-photo--main { grid-column: 1 / span 8; grid-row: 1; }
#pilot .pilot-photo--detail { grid-column: 9 / span 4; grid-row: 1; margin-top: var(--pilot-drop); padding-left: var(--col-gap); }
#pilot .pilot-frame--main { aspect-ratio: 3 / 2; }
#pilot .pilot-frame--main img { object-position: 50% 100%; }   /* keeps the front panels and the crest in frame */
#pilot .pilot-frame--detail { aspect-ratio: 4 / 5; }
#pilot .pilot-frame--detail img { object-position: 61% 50%; }
/* under the large photo: its grid area is the large photo's, so 2/3 of that width is the photo's height (3:2) */
#pilot .pilot-caption {
  grid-column: 1 / span 8; grid-row: 1; align-self: start;
  margin-top: calc(200% / 3 + 18px);
  text-wrap: balance;
}
/* when the caption wraps, it breaks once, between the credit and the project: two unbreakable phrases (two spans,
   because Chrome's balancing finds no break right after a single nowrap span) */
#pilot .pilot-caption__keep { white-space: nowrap; }

/* ------------------------------------------------------------------ motion start state (js grows the hairlines) */
html.has-motion #pilot .pilot-stat__rule:not([data-rule-state="done"]) { transform: scaleX(0); }

/* ------------------------------------------------------------------ 768 to 1099 px: stats on their own row */
@media (max-width: 1099.98px) {
  #pilot .pilot-text { grid-column: 1 / span 8; }
  #pilot .pilot-stats { grid-column: 1 / -1; margin-top: clamp(40px, 6vh, 56px); }
  #pilot .pilot-title { grid-column: 1 / span 11; }
  /* photos 7 + 5 columns: the small one stays readable on a tablet; the caption follows the large photo's area */
  #pilot .pilot-photo--main, #pilot .pilot-caption { grid-column: 1 / span 7; }
  #pilot .pilot-photo--detail { grid-column: 8 / span 5; }
}
/* tablets only: at 4:5 the wider small photo would stand taller than the large one; square keeps it the smaller */
@media (min-width: 768px) and (max-width: 1099.98px) {
  #pilot .pilot-frame--detail { aspect-ratio: 1 / 1; }
}

/* ------------------------------------------------------------------ phones */
@media (max-width: 767.98px) {
  #pilot .pilot-head, #pilot .pilot-intro, #pilot .pilot-photos { display: block; }
  #pilot .pilot-title { margin-top: 20px; }
  #pilot .pilot-intro { margin-top: 28px; }
  #pilot .pilot-stats { display: block; margin-top: 36px; }
  /* the number column is sized from the type (about 2.35em of Display L), so "2026" keeps its gap at every width */
  #pilot .pilot-stat {
    display: grid; grid-template-columns: calc(var(--fs-l) * 2.35) minmax(0, 1fr); column-gap: 14px; align-items: baseline;
    padding: 18px 0 20px;
  }
  #pilot .pilot-stat__label { margin-top: 0; max-width: none; }
  #pilot .pilot-photos { margin-top: 44px; }
  #pilot .pilot-photo--detail { width: 66%; margin: 20px 0 0 auto; padding-left: 0; }
  #pilot .pilot-caption { margin-top: 18px; }
}

/* ------------------------------------------------------------------ very small phones (320 px) */
@media (max-width: 359.98px) {
  #pilot .pilot-title { font-size: 29px; }   /* "Howick High School." stays on one line */
}
