/* ==========================================================================
   Section: brand-story  →  assets/section-brand-story.css
   Figma 1171-2471 ("auto play video"): #f6f6f6, 1440×820, 64px below Product Of The Week.
   Text block 658 wide at (60, 64): Display/L title (2 lines, 154) → 8px → Body/L (2 lines, 52)
   → 32px → primary button. Photo box 327×184 on the page edge, 64px off the bottom.
   The section is a scroll track and the frame is sticky, as tall as the room under the header
   (820px on a 1440×877 window). assets/js/sections/brand-story.js sizes the track and drives the
   photo box through --media-top/right/bottom/left (px) and --grow / --tint (0–1); the CSS on its
   own is the still layout.
   Settings — custom properties on .brand-story
     --grow-runway   1     scroll spent growing the photo, × the frame height
     --hold-runway   0.5   scroll after the photo fills the frame, × the frame height
     --media-start-w 327px resting photo width (16:9 box); --media-inset-y 64px its bottom inset
   ========================================================================== */
.brand-story {
  --sticky-top: calc(var(--header-height) + 1px);
  --grow-runway: 1;
  --hold-runway: 0.5;
  --media-start-w: clamp(160px, calc(327 / 1440 * 100cqw), 327px);
  --media-inset-y: 64px;
  --intro-top: 64px;
  --intro-bottom: 48px; /* where the text block lands (Figma 1195-2247) */

  container-type: inline-size;
  margin-top: 64px;
  background: var(--color-surface-tertiary);
}

.brand-story__track {
  display: block;
}

/* Photo box, at rest: on the page edge (the gutter at 1440, the page width beyond), 16:9.
   Percentages resolve where the values are used — the frame for the box's inset, the overlay
   (same size as the frame) for its clip — so both always describe the same rectangle. */
.brand-story__frame {
  --media-inset-x: max(var(--page-gutter), (100% - var(--page-width)) / 2);
  --media-top: calc(100% - var(--media-inset-y) - var(--media-start-w) * 184 / 327);
  --media-right: var(--media-inset-x);
  --media-bottom: var(--media-inset-y);
  --media-left: calc(100% - var(--media-inset-x) - var(--media-start-w));

  position: sticky;
  top: var(--sticky-top);
  height: calc(100svh - var(--sticky-top));
  min-height: 560px;
  overflow: clip;
}

/* ---------------------------------------------------------------- photo */
.brand-story__media {
  position: absolute;
  z-index: 1;
  inset: var(--media-top) var(--media-right) var(--media-bottom) var(--media-left);
  overflow: hidden;
  background: #d5d5d5;
}

/* Figma's crop at rest (333×187 at −3, −1 in the 327×184 box) easing into its crop at full bleed
   (1465×824, 3.5px right of centre), so both ends match the frames exactly */
.brand-story__media img,
.brand-story__media video {
  --zoom: calc(1.018 - 0.013 * var(--grow, 0));
  --focal-x: calc(50% - 14% * var(--grow, 0));
  --focal-y: calc(30% + 20% * var(--grow, 0));

  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focal-x) var(--focal-y);
  transform: scale(var(--zoom));
  transform-origin: var(--focal-x) var(--focal-y);
}

/* ---------------------------------------------------------------- content
   Two identical layers: the dark one under the photo, the white one above it clipped to the photo's
   box, so text is white exactly where the photo is behind it (Figma 1194-2233 splits "Disco|ver"). */
.brand-story__layer {
  position: absolute;
  inset: 0;
}

.brand-story__layer--inverse {
  z-index: 2;
  clip-path: inset(var(--media-top) var(--media-right) var(--media-bottom) var(--media-left));
}

.brand-story__intro {
  position: absolute;
  top: var(--intro-top);
  left: var(--media-inset-x);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  width: min(658px, 100% - 2 * var(--media-inset-x));
  will-change: transform;
}

.brand-story__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Display/L: EB Garamond 500 64 / 1.2, in Figma's whole-pixel 77px lines. While the photo grows
   (--tint), the title greys out except "Ochoa," and the body darkens to black (Figma 1194-2233). */
.brand-story__title {
  font-family: var(--font-display);
  font-size: var(--text-display-xl-size);
  font-weight: 500;
  line-height: 77px;
  color: color-mix(in srgb, var(--color-text-tertiary) calc(var(--tint, 0) * 100%), var(--color-text-primary));
}

.brand-story__accent {
  color: var(--color-text-primary);
}

/* Body/L in 26px lines */
.brand-story__body {
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  color: color-mix(in srgb, var(--color-text-primary) calc(var(--tint, 0) * 100%), var(--color-text-secondary));
}

/* Button/M tracking; the shared .button otherwise */
.brand-story__cta {
  letter-spacing: 0.04em;
}

.brand-story__layer--inverse .brand-story__title,
.brand-story__layer--inverse .brand-story__accent,
.brand-story__layer--inverse .brand-story__body {
  color: var(--color-text-inverse);
}

@media (max-width: 749px) {
  .brand-story {
    --media-inset-y: 40px;
    --intro-top: 40px;
    --intro-bottom: 40px;

    margin-top: 48px;
  }

  .brand-story__intro {
    gap: 24px;
  }

  .brand-story__title {
    font-size: 40px;
    line-height: 48px;
  }

  .brand-story__body {
    font-size: 14px;
    line-height: 22px;
  }
}
