/* ---------------------------------------------------------------------------
   Words on photos, one system (2026-10-26).

   Every line of text that sits on a photo, a film or the brand gradient has
   to read comfortably at 390x844, 1440x900 and 1920x1080, and the photo has
   to stay beautiful. Measured, not guessed: the run in
   ~/Developer/wedge-app-audit/magicbox-react/legibility-run/ samples the
   photo under every line of text (glyphs hidden) and takes the ratio that 90%
   of those pixels meet. Targets 4.5:1 for body and small text, 3:1 for
   headlines 24px and up.

   How it works
   - A scrim is a soft shadow behind the words, never a box. It is a gradient
     from the text side (the foot or the left edge) that fades out past the
     text block, so the rest of the photo keeps its colour. No blur, no glass,
     no flat wash over the whole picture.
   - The inner page heroes keep their one .mbh-scrim layer (css/hero.css);
     its stops now come from the tokens below.
   - Cards and other blocks get the scrim on the text block itself:
     add class="mb-scrim" (rises from the foot) or data-mb-scrim="left" (from
     the left edge and the foot) to the element that holds the words. The
     element needs a position of its own (an absolute card body already has
     one; otherwise :where() below gives it position:relative). Existing
     blocks are listed by selector further down instead of in markup.
   - Pills and outlined buttons on photos get a filled, slightly opaque dark
     ground (--mb-pill-bg), so their label never depends on the photo.
   - A one pixel text shadow (--mb-text-shadow) is only a backup; the
     numbers above are met without it.
   - Grain (grain.css) sits under the words. The scrim is drawn inside the
     text block's own layer, so it is above the grain and the photo and below
     the glyphs; nothing here changes the grain.

   Load after the page's own sheets and hero.css, before grain.css.
   --------------------------------------------------------------------------- */
:root{
  --mb-scrim-rgb:14,10,16;   /* the hero ink, same as --mbh-scrim */
  --mb-scrim-deep:.86;       /* at the text edge (the foot or the left side) */
  --mb-scrim-mid:.7;         /* across the text block */
  --mb-scrim-soft:.46;       /* where the shadow starts to let go */
  --mb-scrim-reach:88px;     /* how far the fade runs past the text block */
  --mb-scrim-nav:.38;        /* the band under the floating nav */
  --mb-pill-bg:rgba(14,10,16,.56);
  --mb-pill-bg-hover:rgba(14,10,16,.74);
  --mb-pill-line:rgba(255,250,240,.44);
  --mb-text-shadow:0 1px 2px rgba(14,10,16,.5);
  --mb-on-photo:#FFFAF0;
  --mb-on-photo-2:rgba(255,250,240,.94);
}

/* ---- the utility ----------------------------------------------------------- */
:where(.mb-scrim,[data-mb-scrim]){position:relative}
/* :where() keeps these at the lowest specificity, so the left variant below
   and any page rule can change the box (an :is() list takes its strongest
   member's weight, which once pinned the left variant to the block's own
   left edge and drew a hard vertical seam there) */
:where(
  .mb-scrim,
  [data-mb-scrim],
  .hm .spotlight-card .sc-body,
  .hm-kt-body
){isolation:isolate}
:where(
  .mb-scrim,
  [data-mb-scrim],
  .hm .spotlight-card .sc-body,
  .hm-kt-body
)::before{
  content:"";
  position:absolute;
  z-index:-1;
  inset:calc(var(--mb-scrim-reach) * -1) 0 calc(var(--mb-scrim-foot,0px) * -1) 0;
  pointer-events:none;
  background:linear-gradient(0deg,
    rgba(var(--mb-scrim-rgb),var(--mb-scrim-deep)) 0,
    rgba(var(--mb-scrim-rgb),var(--mb-scrim-mid)) calc(100% - var(--mb-scrim-reach) * 1.25),
    rgba(var(--mb-scrim-rgb),var(--mb-scrim-soft)) calc(100% - var(--mb-scrim-reach) * .7),
    rgba(var(--mb-scrim-rgb),0) 100%);
}
/* from the left edge: the same shadow, faded out to the right past the words
   (--mb-scrim-w is the width of the words, the block's own width by default) */
:where([data-mb-scrim="left"], .hm-kt-body)::before{
  left:-100vw;   /* runs out to the photo's edge, which clips it */
  right:auto;
  width:calc(100vw + var(--mb-scrim-w,100%) + var(--mb-scrim-reach) * 2);
  -webkit-mask-image:linear-gradient(90deg,#000 0,#000 calc(100% - var(--mb-scrim-reach) * 2.2),transparent 100%);
          mask-image:linear-gradient(90deg,#000 0,#000 calc(100% - var(--mb-scrim-reach) * 2.2),transparent 100%);
}

/* ---- pills and outlined buttons on photos ---------------------------------- */
html body .mbh.mbh--photo .mbh-links a:not(.mbh-primary),
html body .mbh.mbh--brand .mbh-links a:not(.mbh-primary),
.hm-hero .btn-ghost,
.contact-hero--grad .btn-ghost{
  background:var(--mb-pill-bg);
  border-color:var(--mb-pill-line);
}
.hm-hero .btn-ghost{box-shadow:inset 0 0 0 1.5px var(--mb-pill-line)}
html body .mbh.mbh--photo .mbh-links a:not(.mbh-primary):is(:hover,:focus-visible),
html body .mbh.mbh--brand .mbh-links a:not(.mbh-primary):is(:hover,:focus-visible),
.hm-hero .btn-ghost:is(:hover,:focus-visible){background:var(--mb-pill-bg-hover)}

/* ---- hero words -------------------------------------------------------------
   Labels were cream at 85%; full strength costs nothing and lifts the thin
   12px caps over the bright top of the photos. Small words get the backup
   shadow. */
html body .mbh.mbh--photo .mbh-content .eyebrow,
html body .mbh.mbh--brand .mbh-content .eyebrow{color:var(--mb-on-photo-2)}
html body .mbh.mbh--photo .mbh-content :is(.eyebrow,.mbh-facts li,.cs-stats span),
html body .mbh.mbh--brand .mbh-content .eyebrow{text-shadow:var(--mb-text-shadow)}
html body .mbh.mbh--photo .mbh-content h1 em,
html body .mbh.mbh--brand .mbh-content h1 em{text-shadow:0 1px 2px rgba(var(--mb-scrim-rgb),.45),0 0 22px rgba(var(--mb-scrim-rgb),.4)}

/* the supporting line: no wider than about 56 characters on a laptop, so it
   runs three lines instead of five and stays on the shaded side */
@media (min-width:1024px){
  html body .mbh.mbh--photo .mbh-content .mbh-lede{max-width:54ch}
}

/* ---- homepage: the first screen ---------------------------------------------
   The film plays at full brightness. Its one shade layer (.hero-vignette) is
   drawn here and nowhere else (no tint, no filter on the video): a soft
   oval behind the words only, centred on the text block (lower left on a
   laptop), gone by about half the width so the right of the film is
   untouched. On a phone the words fill the width, so the shade rises from
   the foot to just above them. Gradients only, so there is no edge
   anywhere, and nothing is bounded by the content column. */
.hm-hero .hero-vignette{
  --hm-text-x:max(var(--hm-g,20px), (100% - var(--hm-w,1280px)) / 2);
  background:linear-gradient(0deg,
    rgba(var(--mb-scrim-rgb),.76) 0%,
    rgba(var(--mb-scrim-rgb),.68) 36%,
    rgba(var(--mb-scrim-rgb),.56) 56%,
    rgba(var(--mb-scrim-rgb),.2) 72%,
    rgba(var(--mb-scrim-rgb),0) 84%);
}
@media (min-width:1024px){
  .hm-hero .hero-vignette{
    background:radial-gradient(ellipse 660px 540px at calc(var(--hm-text-x) + 280px) 72%,
      rgba(var(--mb-scrim-rgb),.72) 0%,
      rgba(var(--mb-scrim-rgb),.64) 48%,
      rgba(var(--mb-scrim-rgb),.36) 74%,
      rgba(var(--mb-scrim-rgb),.1) 90%,
      rgba(var(--mb-scrim-rgb),0) 100%);
  }
}
.hm-hero .hero-tint{display:none}
.hm-hero .hm-kicker{color:var(--mb-on-photo-2);text-shadow:var(--mb-text-shadow)}
.hm-hero-title em{text-shadow:0 1px 2px rgba(var(--mb-scrim-rgb),.45),0 0 22px rgba(var(--mb-scrim-rgb),.4)}

/* ---- homepage: the four spotlight cards -------------------------------------
   The card's own shade starts at 40% of its height, but the gold label and
   the title sit above that on the shorter cards. The text block now carries
   its own shadow. */
.hm .spotlight-card .sc-body{--mb-scrim-reach:72px}
.hm .spotlight-card :is(.eyebrow,.sc-sub,.sc-stat,.sc-link){text-shadow:var(--mb-text-shadow)}

/* ---- homepage: Magic Box Koreatown ------------------------------------------
   Words lower left over the neon, the planters and the lit pavement. The
   shadow comes from the left and the foot, sized to the words, so the
   arriving guests and the violet room on the right keep their colour. */
.hm-kt-body{--mb-scrim-w:min(100%,600px);--mb-scrim-reach:96px;--mb-scrim-deep:.88;--mb-scrim-mid:.78;--mb-scrim-soft:.5}
.hm-kt-d{color:var(--mb-on-photo-2)}
.hm-kt-body :is(.hm-kt-d,.hm-kt-go){text-shadow:var(--mb-text-shadow)}
.hm-kt-title em{text-shadow:0 1px 2px rgba(var(--mb-scrim-rgb),.45),0 0 22px rgba(var(--mb-scrim-rgb),.4)}
@media (min-width:1100px){
  .hm-kt-body{--mb-scrim-w:min(100%,640px)}
}

/* ---- about: the three explore cards -----------------------------------------
   The gold label sits mid card, where the card's shade was down to 38%. */
.explore-card::after{
  background:linear-gradient(0deg,
    rgba(var(--mb-scrim-rgb),.92) 0%,
    rgba(var(--mb-scrim-rgb),.76) 42%,
    rgba(var(--mb-scrim-rgb),.5) 66%,
    rgba(var(--mb-scrim-rgb),.22) 100%);
}
.explore-card :is(.eyebrow,p,.cta-link){text-shadow:var(--mb-text-shadow)}
/* one column on a phone: the words fill most of the card, label near the
   top, so the shade holds higher up */
@media (max-width:900px){
  .explore-card::after{
    background:linear-gradient(0deg,
      rgba(var(--mb-scrim-rgb),.92) 0%,
      rgba(var(--mb-scrim-rgb),.8) 45%,
      rgba(var(--mb-scrim-rgb),.7) 75%,
      rgba(var(--mb-scrim-rgb),.52) 100%);
  }
}

/* ---- experiential and exhibitor: the case study cards -----------------------
   Title on top, a long serif line at the foot; the shade thinned to 34% in
   the middle, where the line starts on a phone. */
.spotlights-grid .spotlight-card:not(.hm .spotlight-card) .scrim{
  background:linear-gradient(0deg,
    rgba(var(--mb-scrim-rgb),.94) 0%,
    rgba(var(--mb-scrim-rgb),.62) 50%,
    rgba(var(--mb-scrim-rgb),.5) 100%);
}
.spotlights-grid .spotlight-card:not(.hm .spotlight-card) :is(.eyebrow,.sc-sub,.sc-stat,.sc-link){text-shadow:var(--mb-text-shadow)}
