/* ============================================================================
   ragazzi-expert.css — CARRIED from ragazzi-site/css/sections/expert.css.

   Host section is DAWN'S OWN `image-with-text`, restyled. Its data model is
   already this section's: one image plus a text column built from `heading` and
   `text` blocks. What the design adds is a second image (a mobile crop of the
   same bitmap, so a <picture>) and the byline — name, credentials, affiliation —
   which is ONE person's identity, not a repeatable list, so it arrives as a
   single `expert_byline` block rather than three loose blocks.

   RENAME: root-only, `\.expert(?![_a-zA-Z0-9-])` -> `.ragazzi-expert`. Three
   selectors and one comment reference; the 28 `.expert__*` children are
   untouched, and there are no url() references to rewrite. A blunt replace would
   have renamed every child (`.expert` is a prefix of `.expert__inner`) and the
   section would render with no layout at all — that shipped once, on
   shop-banner.

   The 1920 cap is NATIVE here: `.ragazzi-expert` carries `max-width: 1920px;
   margin-inline: auto` itself, so this section does NOT take `container
   container--bleed`. Adding it would put `.container--bleed`'s `padding-inline:
   0` in a tie with the 768+ rule's `padding-inline: var(--container-pad)`, which
   only order decides — a fight worth not starting.

   Dawn's own geometry is DROPPED rather than overridden in Ragazzi mode:
   `page-width` (the design's photo is full-bleed on mobile), the
   `grid grid--gapless grid--Ncol-tablet` classes (this is a two-item flex row
   with percentage tracks, not Dawn's grid), `global-media-settings` and
   `content-container` (theme border, radius and shadow the design has none of),
   and `section-{id}-padding` (the carried file owns the vertical rhythm through
   `--section-py`). See §8.5 of the playbook.

   ADAPTATION rules, if any, are at the END of this file under their own banner.
   Everything above it is the static's, verbatim except the rename — edit the
   static and re-carry.
============================================================================ */
/* stitched from part3/css/sections/expert.css — unchanged except the token renames
   listed in css/tokens.css. Edit the PART, not this copy. */
/* ============================================================================
   css/sections/expert.css — ragazzs-home Part 3, section 9 "Experts Backed".
   Scoped rules ONLY: .expert__* . No global selector, no :root, no .container,
   no template @import. Section-local custom properties are declared on `.ragazzi-expert`
   itself (never on :root) so they cannot leak into another section.

   Figma: desktop 3080:13774 · mobile 3080:14317 (JSON oracle, 2026-08-09).

   THREE things a default build gets wrong here, all measured:
   1. The split switches column -> row at 768, NOT 1024. At 1024 the 898x762
      image at width:100% would be ~855px tall across 768-1023 and snap to
      ~480px on a 1px viewport change.
   2. The split is exact PERCENTAGES, not clamps and not 50/50:
      898.03 + 100 + 621.97 + 100 = 1720. A clamp is unusable because the media
      has NO mobile px analogue (it is 100vw there) to interpolate from.
   3. NO `.container` on the <section>. The portrait is full-bleed on mobile
      (x = 0, 375 wide) and inside the 100px gutter on desktop (x = 100).
      Below 768 the gutter + vertical padding live on .expert__body; from 768
      they move onto the <section>. Never the `padding` shorthand on the
      gutter-bearing element.
============================================================================ */

/* ----------------------------------------------------------------------------
   MOBILE BASE (0-767) — stacked, everything centred.
   Section root 3080:14317: vertical, gap 0, alignItems CENTER, padding 0.
---------------------------------------------------------------------------- */
.ragazzi-expert {
  /* QA-FIX P1-1 (2026-08-09). This section deliberately carries NO `.container`
     (the portrait is full-bleed below 768), which also meant it inherited no
     1920 cap — so above the drawn frame it kept growing while every other
     section froze. Measured at 2560: this content stayed at x=100 while
     reviews/athletes/blog/footer moved to 420, a 320px de-alignment; at 3440 it
     was 760px, with the portrait at 1691.64 instead of 898.03.
     `.container` gives the other five exactly this pair, so this restates it
     rather than inventing a rule. No effect at or below 1920. */
  max-width: 1920px;
  margin-inline: auto;

  /* --- Section-local spacing tokens (slice §2; they occur ONCE on the page,
         so per brief-page.md §4.4 they must NOT go into css/tokens.css). --- */
  --expert-body-gap: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 82px);
  --expert-intro-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 41px);
  --expert-byline-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 20px);
  --expert-name-gap: clamp(4px, calc(5px + (var(--max-vw) - 375px) * 0.015), 10px);

  /* --- Section-local TYPE row: the doctor's name (slice §5 / D-EXPERT-8).
         Onest 16/700 mobile -> 25/500 desktop. It matches NO page token:
         --text-h3 is 20/500 -> 25/600, --text-body-lg is 400/400. The weight
         genuinely flips across layers, measured on both. Do not normalise. --- */
  --text-expert-name: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 33px);
  --weight-expert-name: 700;

  background: var(--color-white); /* 3080:14317 / 3080:13774 fill #ffffff */
  /* No padding on the section at mobile width — see the header note. */
}

.expert__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* gap 0: the 40px breathing room below the portrait is .expert__body's own
     padding-top, not a gap (3080:14317 gap = 0). */
}

/* --- Portrait ------------------------------------------------------------ */
/* 3080:14318 — 375 x 330 at x = 0, i.e. edge to edge. The frame's 10px
   auto-layout padding is Figma residue on a CHILDLESS frame (D-EXPERT-7) and
   must not become CSS. */
.expert__media {
  width: 100%;
  aspect-ratio: 375 / 330;
}

/* <picture> does NOT propagate height:100% from its <img> to the wrapper —
   without this the image collapses to its natural ratio inside the fixed-ratio
   box (build-pitfalls #1). */
.expert__picture {
  display: block;
  width: 100%;
  height: 100%;
}

.expert__img {
  width: 100%;
  height: 100%;
  /* One source bitmap, two crops; both reduce to exactly this (D-EXPERT-6). */
  object-fit: cover;
  object-position: center top;
}

/* --- Text body ----------------------------------------------------------- */
/* 3080:14319 — padding [40,20,40,20], gap 40, alignItems CENTER. The gutter and
   the vertical padding live HERE on mobile, not on the <section>. */
.expert__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--expert-body-gap);
  width: 100%;
  padding-block: var(--section-py);
  padding-inline: var(--container-pad);
}

/* 3080:14320 — 335 x 245, gap 20, centred. */
.expert__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--expert-intro-gap);
  width: 100%;
}

/* 3080:14321 — Onest 32/500, lh 110%, ls 0%, centred, #000000. */
.expert__title {
  font-family: var(--font-body);
  font-size: var(--text-h2);
  font-weight: 500;
  line-height: 1.1;
  color: var(--color-black);
  text-align: center;
}

/* 3080:14322 — Onest 16/400, lh 120%, ls 0%, centred, #000000, wraps. */
.expert__bio {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-black);
  text-align: center;
}

/* 3080:14323 — 180 x 63, gap 10, shrink-to-fit and centred (x = 97.5). The
   shrink-to-fit comes from the parent's align-items:center; no width needed. */
.expert__byline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--expert-byline-gap);
}

/* 3080:14324 — 128 x 38, gap 5, centred. */
.expert__name-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--expert-name-gap);
}

/* 3080:14325 — Onest 16/700, lh 110%, textCase UPPER, centred, #000000. */
.expert__name {
  font-family: var(--font-body);
  font-size: var(--text-expert-name);
  font-weight: var(--weight-expert-name);
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--color-black);
  text-align: center;
}

/* 3080:14326 — Onest 14/500, lh 110%, centred, #000000. */
.expert__credentials {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 500;
  line-height: 1.1;
  color: var(--color-black);
  text-align: center;
}

/* 3080:14327 — Onest 14/400, lh 110%, centred, #000000. One text node with a
   literal `|` (D-EXPERT-9). */
.expert__affiliation {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 400;
  line-height: 1.1;
  color: var(--color-black);
  text-align: center;
}

/* ============================================================================
   PSEUDO-TABLET 768-1023 + DESKTOP — THE SPLIT FIRES AT 768 (D-EXPERT-2).
   has-tablet-layer: false, so this band is mandatory; and because the row
   layout starts here, the band IS the two-column layout, not a stacked
   in-between. Everything below holds unchanged up to 1920 — only the token
   VALUES change at 1024.
============================================================================ */
@media (min-width: 768px) {
  .ragazzi-expert {
    /* Descending tokens (mobile value > desktop value). Written the same way
       the page scaffold writes the descending --text-logo: clamp(D-base, calc(
       M-base + ...), M-base) so the clamp bounds stay ordered. Numerically the
       band holds M-base and steps to D-base at 1024 — identical to a literal
       reading of the §4.1 pseudo-tablet formula with M-base > D-base, which
       CSS would otherwise resolve as "min wins". No new coefficient invented. */
    --expert-body-gap: clamp(25px, calc(40px + (var(--max-vw) - 768px) * 0.025), 40px);
    --expert-byline-gap: clamp(5.08px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    /* Ascending tokens — the plain §4.1 pseudo-tablet formula. */
    --expert-intro-gap: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 25px);
    --expert-name-gap: clamp(5px, calc(5px + (var(--max-vw) - 768px) * 0.025), 5.08px);
    --text-expert-name: clamp(16px, calc(16px + (var(--max-vw) - 768px) * 0.025), 25px);
    /* The desktop layer is in force from 768 here (the layout switches at 768),
       so the measured per-layer weight flip 700 -> 500 happens at 768 too. */
    --weight-expert-name: 500;

    /* 3080:13774 padding [100,100,100,100] — the gutter and the vertical
       padding move from .expert__body onto the <section>. padding-block /
       padding-inline, never the shorthand. */
    padding-block: var(--section-py);
    padding-inline: var(--container-pad);
  }

  /* 3080:13775 — horizontal, gap 100, alignItems CENTER, padding [0,100,0,0].
     Percentages, not clamps (D-EXPERT-3): they are exact at EVERY width >= 768.
       padding-right 100 / 1720 = 5.81395%  (resolves against the section content box)
       column-gap    100 / 1620 = 6.17284%  (resolves against the flex content box)
     Check at 1920: 1620 - 898.03 - 100 = 621.97 for the text column. */
  .expert__inner {
    flex-direction: row;
    align-items: center; /* text column centred against the tall portrait (D-EXPERT-5) */
    column-gap: 6.17284%;
    padding-right: 5.81395%;
  }

  /* 3080:13776 — 898.03 x 761.90; 898.03 / 1620 = 55.434%.
     The frame's 12.698px auto-layout padding is residue (D-EXPERT-7). */
  .expert__media {
    flex: 0 0 55.434%;
    aspect-ratio: 898.03 / 761.9;
  }

  /* 3080:13777 — 621.97 wide, gap 25, left-aligned. Each level keeps its OWN
     token; at 1024+ --expert-body-gap and --expert-intro-gap both resolve to 25
     and --expert-byline-gap and --expert-name-gap both resolve to 5.08, which is
     exactly how ONE DOM reproduces Figma's FLAT desktop stacks (D-EXPERT-4):
       h2 -> bio 25 · bio -> byline 25 · name -> credentials 5.08 -> affiliation.
     The gutter/vertical padding have moved to the <section>, so zero here. */
  .expert__body {
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-start;
    padding-block: 0;
    padding-inline: 0;
  }

  .expert__intro,
  .expert__byline,
  .expert__name-group {
    align-items: flex-start;
  }

  .expert__title,
  .expert__bio,
  .expert__name,
  .expert__credentials,
  .expert__affiliation {
    text-align: left;
  }
}

/* ============================================================================
   DESKTOP 1024+ — token values only; the layout above is unchanged.
   D-min = round(D-base * 1024 / 1920), D-max = D-base (because --vw-base ==
   --max-vw == 1920 for this file; brief-page.md §4.1 says this is correct here
   and is NOT fluid-formulas "Common mistake #1").
============================================================================ */
@media (min-width: 1024px) {
  .ragazzi-expert {
    --expert-body-gap: clamp(13px, calc(25px * (var(--max-vw) / var(--vw-base))), 25px);
    --expert-intro-gap: clamp(13px, calc(25px * (var(--max-vw) / var(--vw-base))), 25px);
    --expert-byline-gap: clamp(3px, calc(5.08px * (var(--max-vw) / var(--vw-base))), 5.08px);
    --expert-name-gap: clamp(3px, calc(5.08px * (var(--max-vw) / var(--vw-base))), 5.08px);
    --text-expert-name: clamp(13px, calc(25px * (var(--max-vw) / var(--vw-base))), 25px);
  }
}
