/* Ad slots (PLAN.md §5.2, §5.4). WP5 owns this file; prefix ad-, plus the §5.4 .ad / .ad--* / .ad__* names.
   Loaded by Layout on every page that passes `ads`.

   ── How it fits together ────────────────────────────────────────────────────────────────────────────────────
   .ad-slot      the reserved box. AdSlot writes the registry sizes as --ad-wm/--ad-hm (phone) and --ad-wd/--ad-hd
                 (≥768 px); min-height comes from them, so nothing shifts when images, fonts or AdSense arrive.
   .ad           the unit (sponsor | house | placeholder | network). One templated markup for every size:
                 data-fmt-m / data-fmt-d name the format per breakpoint, and each format only sets the --f-*
                 variables below, which the template parts consume (grid areas, sizes, which parts show).
   Motion: only transform and opacity transition (§3.6); none under reduced motion or Calm mode.
   Schemes: a sponsor's or a house unit is a night card in both (its brand colours are judged against that card, AdSlot.tsx AD_CARD),
   so it keeps the brand tokens, and its own hairline; what sits on the page itself (the focus ring, the AdSense label, the dev
   placeholder) takes tokens.css's semantic ones and follows the light or dark scheme. */

/* ─── The reserved box ───────────────────────────────────────────────────────────────────────────────────── */
.ad-slot {
  --ad-w: var(--ad-wm); --ad-h: var(--ad-hm);
  /* The reserved box is as wide as its container; the unit is centred in it at its registry width (min(), below). A slot that is a flex or grid
     item (the landing's .site-ad, /g's .g-after) took the width of its CONTENT instead: a "728×90" band was 599 px wide, a "300×250" rectangle
     232 px, and a unit's width followed the length of its copy, so shortening a line made the whole band narrower. */
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--ad-h);
  contain: layout style;
}
@media (min-width: 768px) {
  .ad-slot { --ad-w: var(--ad-wd); --ad-h: var(--ad-hd); }
}
@media (max-width: 767.98px) {
  .ad-slot[data-hide-m] { display: none; }
}
@media (max-width: 1599.98px) {
  .ad-slot[data-min-vw="1600"]:not(.ad-pv-force) { display: none; }
}
.ad-slot[data-placement="live-interlude"] { min-height: 0; width: 100%; }

/* ─── The unit ───────────────────────────────────────────────────────────────────────────────────────────── */
.ad {
  --ad-accent: var(--ad-brand, var(--candle));
  --ad-on-accent: var(--ad-brand-ink, var(--night-900));
  --ad-accent-text: var(--ad-brand-text, color-mix(in srgb, var(--ad-accent) 72%, var(--ink)));
  position: relative;
  /* min() keeps the unit's min-content contribution small, so a slot never forces horizontal scroll at 320 px;
     the small corner badges (below) use their fixed width, so an absolutely positioned corner never collapses. */
  width: min(var(--ad-w), 100%);
  height: var(--ad-h);
  border-radius: var(--f-radius, 16px);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.25;
  text-align: start;
}

.ad__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.ad__link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the card skin (sponsor and house): night in both schemes, with the night hairline (the page's --line is dark on the light one) */
.ad--sponsor, .ad--house { --line: color-mix(in srgb, var(--ink) 14%, transparent); }
.ad--sponsor .ad__link,
.ad--house .ad__link {
  background:
    radial-gradient(130% 150% at 0% 0%, color-mix(in srgb, var(--ad-accent) 22%, transparent) 0%, transparent 58%),
    radial-gradient(90% 120% at 100% 100%, color-mix(in srgb, var(--ad-accent) 10%, transparent) 0%, transparent 60%),
    var(--night-800);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ad-accent) 32%, var(--line)),
    inset 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent),
    var(--shadow-1);
}
/* hover ring: an overlay that only fades (opacity), never a re-layout */
.ad--sponsor .ad__link::after,
.ad--house .ad__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ad-accent) 75%, transparent), 0 0 32px color-mix(in srgb, var(--ad-accent) 18%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-out);
}
.ad__link:hover::after, .ad__link:focus-visible::after { opacity: 1; }

/* banner images (sponsor): data-img says at which breakpoint the uploaded image fits; elsewhere the template shows */
.ad__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ad[data-img="d"] .ad__img, .ad[data-img="m"] .ad__tpl { display: none; }
@media (min-width: 768px) {
  .ad[data-img="d"] .ad__img { display: block; }
  .ad[data-img="d"] .ad__tpl { display: none; }
  .ad[data-img="m"] .ad__img { display: none; }
  .ad[data-img="m"] .ad__tpl { display: grid; }
}

/* ─── The template: parts placed by the format's grid areas ──────────────────────────────────────────────── */
.ad__tpl {
  display: grid;
  grid-template-areas: var(--f-areas, "logo eyebrow cta" "logo headline cta" "logo body cta");
  grid-template-columns: var(--f-cols, auto minmax(0, 1fr) auto);
  grid-template-rows: var(--f-rows, auto);
  align-content: var(--f-align, center);
  justify-items: var(--f-justify, start);
  column-gap: var(--f-gap, 16px);
  row-gap: var(--f-rgap, 2px);
  width: 100%;
  height: 100%;
  padding: var(--f-pad, 12px 16px);
  text-align: var(--f-text, start);
}
.ad__copy { display: contents; }

.ad__logo, .ad__mark { grid-area: logo; display: var(--f-logo, flex); align-self: var(--f-logo-self, center); }
.ad__logo {
  width: var(--f-logo-w, 112px);
  height: var(--f-logo-h, 56px);
  align-items: center;
  justify-content: center;
  padding: var(--f-logo-pad, 7px 10px);
  border-radius: var(--f-logo-r, 10px);
  background: #FFFFFF;
  box-shadow: 0 1px 0 rgb(255 255 255 / .5) inset, 0 6px 18px rgb(0 0 0 / .28);
  overflow: hidden;
}
.ad__logo img { width: 100%; height: 100%; object-fit: contain; }
.ad__wordmark {
  font: 800 var(--f-word, 1rem)/1.05 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--night-900);
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* house emblem: the creative's icon in its accent, inside a ringed burst of rays (one accent per house id, below) */
.ad__mark {
  position: relative;
  width: var(--f-logo-h, 56px);
  height: var(--f-logo-h, 56px);
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ad-accent);
  background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--ad-accent) 30%, transparent), transparent 72%), var(--night-700);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ad-accent) 38%, transparent), 0 0 24px color-mix(in srgb, var(--ad-accent) 22%, transparent);
}
.ad__mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--ad-accent) 60%, transparent) 0 4deg, transparent 4deg 22.5deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 78%, #000 79%, #000 94%, transparent 95%);
  mask: radial-gradient(circle closest-side, transparent 78%, #000 79%, #000 94%, transparent 95%);
}
.ad__emblem { position: relative; width: 50%; height: auto; }
/* each house creative has its own accent (§3.3: one accent per unit); all four take night-900 ink on the CTA */
.ad--house-book { --ad-brand: var(--candle); }
.ad--house-reserve { --ad-brand: var(--party); }
.ad--house-watch { --ad-brand: var(--volt); }
.ad--house-presenter-pitch { --ad-brand: var(--lime); }
.ad--house { --ad-brand-ink: var(--night-900); }

.ad__eyebrow, .ad__headline, .ad__body, .ad__short { align-self: var(--f-self, start); }
.ad__short {
  grid-area: short;
  display: var(--f-short, none);
  justify-self: stretch;   /* nowrap lines make its min-content the full line: fill the column and let the lines clip */
  min-width: 0;
  max-width: 100%;
  font: 500 .75rem/1.25 var(--font-ui);
  color: var(--ink-2);
}
.ad__short > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad__short strong { font: 700 .8125rem/1.2 var(--font-display); color: var(--ink); }
.ad__eyebrow {
  grid-area: eyebrow;
  display: var(--f-eyebrow, block);
  max-width: 100%;
  font: 700 var(--f-eb-size, .6875rem)/1.3 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ad-accent-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ad__headline {
  grid-area: headline;
  display: var(--f-headline, -webkit-box);
  max-width: 100%;
  font: 700 var(--f-hl-size, 1.125rem)/var(--f-hl-lh, 1.18) var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  -webkit-line-clamp: var(--f-hl-lines, 1);
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;   /* a 60-character word wraps inside the unit instead of being cut off */
  text-wrap: balance;
}
/* a long brand in the headline: a step smaller, so the brand (first in the line) still fits the format's two or three lines */
.ad__headline[data-long] { font-size: calc(var(--f-hl-size, 1.125rem) * .84); }
/* the tail of a presenter's headline ("today’s 100 free birthdays"): on a line of its own where the format has the room, gone where it has not */
.ad__tail { display: var(--f-tail, none); font-size: .8em; font-weight: 600; letter-spacing: 0; color: var(--ink-2); }
.ad__body {
  grid-area: body;
  display: var(--f-body, -webkit-box);
  max-width: 100%;
  font-size: var(--f-bd-size, .8125rem);
  line-height: 1.35;
  color: var(--ink-2);
  -webkit-line-clamp: var(--f-bd-lines, 1);
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.ad__cta {
  grid-area: cta;
  display: var(--f-cta, inline-flex);
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: var(--f-cta-self, center);
  justify-self: var(--f-cta-justify, end);
  width: var(--f-cta-w, auto);
  min-height: var(--f-cta-h, 36px);
  padding: 0 var(--f-cta-px, 16px);
  border-radius: var(--radius-pill);
  background: var(--ad-accent);
  color: var(--ad-on-accent);
  font: 650 var(--f-cta-size, .875rem)/1 var(--font-ui);
  white-space: nowrap;
  /* the inner ring keeps a dark brand colour's button visible on the dark card */
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent), 0 6px 18px color-mix(in srgb, var(--ad-accent) 30%, transparent);
}
.ad__cta > span { display: var(--f-cta-text, inline); }
.ad__arrow { flex: none; transition: translate var(--dur-2) var(--ease-out); }
.ad__link:hover .ad__arrow, .ad__link:focus-visible .ad__arrow { translate: 3px 0; }
/* an Arabic or Hebrew label (dir="auto" on the button) puts the arrow first and points it left */
.ad__cta:dir(rtl) .ad__arrow { transform: scaleX(-1); }
.ad__link:hover .ad__cta:dir(rtl) .ad__arrow, .ad__link:focus-visible .ad__cta:dir(rtl) .ad__arrow { translate: -3px 0; }

/* ─── Label, ⓘ and the "why" tooltip (sponsor units) ─────────────────────────────────────────────────────── */
.ad__meta {
  position: absolute;
  top: var(--f-meta-top, 6px);
  inset-inline-end: var(--f-meta-right, 6px);
  bottom: var(--f-meta-bottom, auto);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ad__chip {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgb(7 6 26 / .72);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font: 700 .625rem/1.4 var(--font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ad__info {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--f-info, 20px);
  height: var(--f-info, 20px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(7 6 26 / .6);
  color: var(--ink-3);
  cursor: help;
}
/* the tap target grows to at least 24×24 px (WCAG 2.5.8) without growing the glyph */
.ad__info::before { content: ""; position: absolute; inset: -5px; }
.ad__info:hover, .ad__info:focus-visible { color: var(--ink); }
.ad__info:focus-visible { outline-offset: 1px; }
.ad__why {
  position: absolute;
  inset-inline-end: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(260px, 80vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--night-950);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1);
  color: var(--ink-2);
  font: 400 .75rem/1.45 var(--font-ui);
  text-align: start;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.ad__info:hover + .ad__why, .ad__info:focus + .ad__why, .ad__info[aria-expanded="true"] + .ad__why { opacity: 1; transform: none; }
/* Esc dismissed it (WCAG 1.4.13): stays hidden while the pointer or focus is still on the button */
.ad__info[data-esc]:hover + .ad__why, .ad__info[data-esc]:focus + .ad__why { opacity: 0; transform: translateY(4px); }
.ad__info[aria-expanded="true"] + .ad__why { pointer-events: auto; }

/* ─── Formats ────────────────────────────────────────────────────────────────────────────────────────────────
   Phone formats (< 768 px, data-fmt-m), then desktop formats (≥ 768 px, data-fmt-d). Each sets --f-* variables. */

/* Phone formats (< 768 px): only data-fmt-m matters here, so nothing leaks into the desktop layout. */
@media (max-width: 767.98px) {
  /* rectangle · 300×250 (home-mid / greeting-below on phones, book-aside on desktop). The rows add up to at most
     238 px with every field at its limit (logo 44+6, eyebrow 14, headline 2×24, body 2×19, CTA 40, gaps and padding),
     so whole lines are clamped; the body row is minmax(0, 1fr) and clips, so the CTA can never cover text. */
  .ad[data-fmt-m="rectangle"] {
    --f-areas: "logo" "eyebrow" "headline" "body" "cta";
    --f-cols: minmax(0, 1fr); --f-rows: auto auto auto minmax(0, 1fr) auto; --f-align: stretch;
    --f-pad: 16px; --f-rgap: 4px;
    --f-logo-w: 112px; --f-logo-h: 44px; --f-logo-self: start;
    --f-eb-size: .6875rem; --f-hl-size: 1.25rem; --f-hl-lines: 2; --f-bd-size: .875rem; --f-bd-lines: 2;
    --f-cta-w: 100%; --f-cta-self: end; --f-cta-justify: stretch; --f-cta-h: 40px;
    --f-radius: 20px;
  }
  /* a presenter: the brand (up to two lines) and "today’s 100 free birthdays" under it; the tagline keeps one line (the rows still add up to 242 px) */
  .ad--presenter[data-fmt-m="rectangle"] { --f-hl-lines: 3; --f-bd-lines: 1; --f-tail: inline; }
  .ad[data-fmt-m="rectangle"] .ad__logo, .ad[data-fmt-m="rectangle"] .ad__mark { margin-bottom: 6px; }
  .ad[data-fmt-m="rectangle"] .ad__body { max-height: 100%; }
  .ad[data-fmt-m="rectangle"] .ad__cta { justify-content: space-between; }

  /* large mobile banner · 320×100 (home-foot on phones). The rows are explicit: the first one is the label's (the eyebrow
     may be missing, and then the headline must still start below the Sponsored label), and the headline row takes the
     clamped headline's height (a line-clamped box counts as 0 for an auto row, so the tall logo would otherwise
     squeeze it and the headline would run into the button). 14 + 35.4 + 24 + 2 × 3 gaps + 20 padding fit the 100 px. */
  .ad[data-fmt-m="large-mobile"] {
    --f-areas: "logo eyebrow" "logo headline" "logo cta";
    --f-cols: auto minmax(0, 1fr); --f-rows: minmax(14px, auto) minmax(min-content, auto) auto;
    --f-pad: 10px 12px; --f-gap: 12px; --f-rgap: 3px;
    --f-logo-w: 78px; --f-logo-h: 78px; --f-logo-pad: 8px; --f-word: .8125rem;
    --f-eb-size: .625rem; --f-hl-size: .9375rem; --f-hl-lines: 2; --f-body: none;
    --f-cta-h: 24px; --f-cta-px: 0; --f-cta-size: .8125rem; --f-cta-justify: start;
    --f-radius: 16px; --f-info: 18px; --f-meta-top: 6px; --f-meta-right: 6px;
  }
  .ad[data-fmt-m="large-mobile"] .ad__cta { background: none; box-shadow: none; color: var(--ad-accent-text); }
  /* the "Sponsored ⓘ" label shares the eyebrow row (top, inline-end): the eyebrow gets its ellipsis before it. A presenter has no
     "Sponsored" chip (its "Presented by" is the label), only the ⓘ: 106 px of room for a chip that is not there cut its own eyebrow to "PRE…" */
  .ad--sponsor[data-fmt-m="large-mobile"] .ad__eyebrow { padding-right: 106px; }
  .ad--presenter[data-fmt-m="large-mobile"] .ad__eyebrow { padding-right: 26px; }
  /* a long brand there takes a third line in the row the "Order a cake" text would have had (the whole unit is the link; 14 + 3 × 15 + gaps + padding = 82 of 100 px) */
  .ad--presenter[data-fmt-m="large-mobile"] .ad__headline[data-long] { -webkit-line-clamp: 3; }
  .ad--presenter[data-fmt-m="large-mobile"]:has(.ad__headline[data-long]) .ad__cta { display: none; }
  /* a text wordmark in the 78 px plate: "Candlelight" is 75 px at 13 px and broke as "Candlelig-ht"; at 11 px in a plate with less side padding it is one word */
  .ad[data-fmt-m="large-mobile"] .ad__logo--text { --f-word: .6875rem; padding-inline: 4px; }
  .ad--house[data-fmt-m="large-mobile"] { --f-logo-w: 56px; --f-logo-h: 56px; }

  /* presenter lockup, compact · 320×50 (home-presenter on phones) */
  .ad[data-fmt-m="lockup-sm"] {
    --f-areas: "short logo cta";
    --f-cols: minmax(0, 1fr) auto auto; --f-rows: auto; --f-self: center;
    --f-pad: 6px 26px 6px 14px; --f-gap: 10px; --f-rgap: 0;
    --f-logo-w: 96px; --f-logo-h: 38px; --f-logo-pad: 4px 8px; --f-logo-r: 8px; --f-word: .75rem;
    --f-short: block; --f-eyebrow: none; --f-headline: none; --f-body: none;
    --f-cta-h: 28px; --f-cta-px: 7px; --f-cta-text: none;
    --f-radius: 14px; --f-info: 16px; --f-meta-top: 3px; --f-meta-right: 3px;
  }
  /* the band's plate is the only place the brand is written (a text wordmark, for a sponsor with no logo yet): a long one is set at 9 px on three lines
     in the 96×38 plate instead of being cut at two */
  .ad[data-fmt-m="lockup-sm"] .ad__wordmark[data-long] { font-size: .5625rem; -webkit-line-clamp: 3; line-height: 1.02; }
  .ad[data-fmt-m="lockup-sm"] .ad__cta .ad__arrow { transform: none; }
  .ad[data-fmt-m="lockup-sm"] .ad__link:hover .ad__cta .ad__arrow { translate: 3px 0; }
  .ad--house[data-fmt-m="lockup-sm"] {
    --f-areas: "logo eyebrow cta" "logo headline cta"; --f-cols: auto minmax(0, 1fr) auto; --f-rows: auto auto; --f-self: start;
    --f-pad: 5px 10px 5px 6px; --f-logo-h: 38px; --f-eyebrow: block; --f-headline: -webkit-box; --f-eb-size: .5625rem; --f-hl-size: .8125rem;
    --f-hl-lines: 1; --f-short: none;
  }

  /* presenter badge, compact · 160×50 (live-presenter on phones) */
  .ad[data-fmt-m="badge-sm"] {
    --f-areas: "eyebrow" "logo"; --f-cols: minmax(0, 1fr); --f-rows: auto 1fr;
    --f-pad: 5px 7px 6px; --f-rgap: 3px; --f-justify: stretch;
    --f-logo-w: 100%; --f-logo-h: 26px; --f-logo-pad: 3px 6px; --f-logo-r: 6px; --f-word: .6875rem;
    --f-eb-size: .5rem; --f-headline: none; --f-body: none; --f-cta: none;
    --f-radius: 12px; --f-info: 14px; --f-meta-top: 3px; --f-meta-right: 3px;
    width: var(--ad-w); max-width: 100%;
  }
  /* the ⓘ sits in the eyebrow row's corner: the eyebrow ends before it */
  .ad--sponsor[data-fmt-m="badge-sm"] .ad__eyebrow { padding-right: 14px; }
  .ad--house[data-fmt-m="badge-sm"] {
    --f-areas: "logo eyebrow" "logo headline"; --f-cols: auto minmax(0, 1fr); --f-rows: auto auto; --f-gap: 6px;
    --f-logo-w: 26px; --f-logo-h: 26px; --f-headline: -webkit-box; --f-hl-size: .6875rem; --f-hl-lines: 2;
  }

  /* interlude card, portrait · 360×450 (live-interlude on phones) */
  .ad[data-fmt-m="interlude-portrait"] {
    --f-areas: "eyebrow" "logo" "headline" "body" "cta";
    --f-cols: minmax(0, 1fr); --f-rows: auto auto auto auto auto; --f-align: center; --f-justify: center; --f-text: center;
    --f-pad: 28px 24px; --f-rgap: 10px;
    --f-logo-w: 200px; --f-logo-h: 84px; --f-logo-pad: 10px 16px; --f-logo-r: 14px; --f-word: 1.375rem;
    --f-eb-size: .6875rem; --f-hl-size: 1.625rem; --f-hl-lines: 3; --f-bd-size: .9375rem; --f-bd-lines: 3;
    --f-cta-justify: center; --f-cta-h: 42px;
    --f-radius: 24px;
    height: auto;
    aspect-ratio: 4 / 5;
  }

}
@media (max-width: 359.98px) {
  .ad[data-fmt-m="interlude-portrait"] { --f-pad: 20px 18px; --f-rgap: 8px; --f-logo-w: 170px; --f-logo-h: 72px; --f-hl-lines: 2; --f-bd-lines: 2; }
}

/* presenter line · 234×60 (greeting-presenter, every width): "Presented by [logo]" over the tagline, with the ⓘ
   beside it. It is the registry's box at every width: a compact lockup centred under the greeting card. */
.ad[data-fmt-m="line"] {
  --f-areas: "eyebrow logo" "headline headline"; --f-cols: auto auto; --f-rows: auto auto; --f-align: center; --f-justify: center;
  --f-pad: 0; --f-gap: 10px; --f-rgap: 4px; --f-self: center; --f-text: center;
  --f-logo-w: 96px; --f-logo-h: 36px; --f-logo-pad: 4px 8px; --f-logo-r: 8px; --f-word: .75rem;
  --f-eb-size: .625rem; --f-hl-size: .8125rem; --f-hl-lines: 1; --f-body: none; --f-cta: none; --f-info: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad[data-fmt-m="line"] .ad__link { flex: 1 1 auto; min-width: 0; width: auto; background: none; box-shadow: none; overflow: visible; }
.ad[data-fmt-m="line"] .ad__link::after { display: none; }
.ad[data-fmt-m="line"] .ad__tpl { justify-content: center; }
.ad[data-fmt-m="line"] .ad__headline { justify-self: center; font-family: var(--font-ui); font-weight: 500; color: var(--ink-2); }
.ad[data-fmt-m="line"] .ad__eyebrow { color: var(--ink-3); overflow: visible; text-overflow: clip; }
.ad[data-fmt-m="line"] .ad__meta { position: static; flex: none; margin-inline-start: 6px; }

@media (min-width: 768px) {
  /* leaderboard · 728×90 (home-mid, home-foot, greeting-below, greeting-foot) */
  .ad[data-fmt-d="leaderboard"] {
    --f-areas: "logo eyebrow cta" "logo headline cta" "logo body cta";
    --f-cols: auto minmax(0, 1fr) auto; --f-rows: auto auto auto; --f-align: center; --f-justify: start; --f-text: start;
    --f-pad: 11px 18px 11px 11px; --f-gap: 18px; --f-rgap: 2px;
    --f-logo-w: 124px; --f-logo-h: 68px; --f-logo-pad: 8px 12px; --f-logo-r: 10px; --f-word: 1rem; --f-logo-self: center;
    --f-eb-size: .6875rem; --f-hl-size: 1.1875rem; --f-hl-lh: 1.18; --f-hl-lines: 1; --f-bd-size: .8125rem; --f-bd-lines: 1;
    --f-cta-w: auto; --f-cta-h: 38px; --f-cta-px: 18px; --f-cta-size: .875rem; --f-cta-self: center; --f-cta-justify: end;
    --f-radius: 18px; --f-info: 20px; --f-meta-top: 6px; --f-meta-right: 6px;
    height: var(--ad-h); aspect-ratio: auto;
  }
  .ad--house[data-fmt-d="leaderboard"] { --f-logo-w: 68px; }
  .ad[data-fmt-d="leaderboard"] .ad__cta { margin-top: 12px; }
  /* a presenter: the brand and "today’s 100 free birthdays" under it take both headline lines, so the tagline gives its row up (the
     eyebrow, two lines and the tagline are 81 px in a 68 px box); it is the one line a banner this small can lose */
  .ad--presenter[data-fmt-d="leaderboard"] { --f-hl-lines: 2; --f-body: none; --f-tail: inline; }

  /* rectangle · 300×250 (book-aside): the same deterministic rows as the phone rectangle above */
  .ad[data-fmt-d="rectangle"] {
    --f-areas: "logo" "eyebrow" "headline" "body" "cta";
    --f-cols: minmax(0, 1fr); --f-rows: auto auto auto minmax(0, 1fr) auto; --f-align: stretch; --f-justify: start; --f-text: start;
    --f-pad: 16px; --f-gap: 0; --f-rgap: 4px;
    --f-logo-w: 112px; --f-logo-h: 44px; --f-logo-pad: 7px 10px; --f-logo-r: 10px; --f-word: 1rem; --f-logo-self: start;
    --f-eb-size: .6875rem; --f-hl-size: 1.25rem; --f-hl-lh: 1.18; --f-hl-lines: 2; --f-bd-size: .875rem; --f-bd-lines: 2;
    --f-cta-w: 100%; --f-cta-self: end; --f-cta-justify: stretch; --f-cta-h: 40px; --f-cta-px: 16px;
    --f-radius: 20px;
  }
  .ad--presenter[data-fmt-d="rectangle"] { --f-hl-lines: 3; --f-bd-lines: 1; --f-tail: inline; }
  .ad[data-fmt-d="rectangle"] .ad__logo, .ad[data-fmt-d="rectangle"] .ad__mark { margin-bottom: 6px; }
  .ad[data-fmt-d="rectangle"] .ad__body { max-height: 100%; }
  .ad[data-fmt-d="rectangle"] .ad__cta { justify-content: space-between; }

  /* presenter lockup · 728×90 (home-presenter) */
  .ad[data-fmt-d="lockup"] {
    --f-areas: "logo eyebrow cta" "logo headline cta";
    --f-cols: auto minmax(0, 1fr) auto; --f-rows: auto auto; --f-align: center; --f-justify: start; --f-text: start;
    --f-pad: 11px 18px 11px 11px; --f-gap: 18px; --f-rgap: 3px;
    --f-logo-w: 148px; --f-logo-h: 68px; --f-logo-pad: 8px 14px; --f-logo-r: 10px; --f-word: 1.0625rem; --f-logo-self: center;
    --f-eb-size: .6875rem; --f-hl-size: 1.125rem; --f-hl-lh: 1.22; --f-hl-lines: 2; --f-body: none; --f-tail: inline;
    --f-cta-w: auto; --f-cta-h: 38px; --f-cta-px: 18px; --f-cta-text: inline; --f-cta-self: center; --f-cta-justify: end;
    --f-radius: 18px; --f-info: 20px; --f-meta-top: 6px; --f-meta-right: 6px;
  }
  .ad--house[data-fmt-d="lockup"] { --f-logo-w: 68px; --f-areas: "logo eyebrow cta" "logo headline cta" "logo body cta"; --f-rows: auto auto auto; --f-body: -webkit-box; --f-hl-lines: 1; }

  /* presenter badge · 240×80 (live-presenter) */
  .ad[data-fmt-d="badge"] {
    --f-areas: "eyebrow" "logo"; --f-cols: minmax(0, 1fr); --f-rows: auto 1fr; --f-align: stretch; --f-justify: stretch;
    --f-pad: 9px 12px 11px; --f-rgap: 5px;
    --f-logo-w: 100%; --f-logo-h: 44px; --f-logo-pad: 5px 10px; --f-logo-r: 9px; --f-word: .9375rem; --f-logo-self: stretch;
    --f-eb-size: .625rem; --f-headline: none; --f-body: none; --f-cta: none;
    --f-radius: 16px; --f-info: 18px; --f-meta-top: 5px; --f-meta-right: 5px;
    width: var(--ad-w); max-width: 100%;
  }
  .ad--sponsor[data-fmt-d="badge"] .ad__eyebrow { padding-right: 18px; }
  .ad--house[data-fmt-d="badge"] {
    --f-areas: "logo eyebrow" "logo headline"; --f-cols: auto minmax(0, 1fr); --f-rows: auto auto; --f-align: center; --f-gap: 10px;
    --f-logo-w: 44px; --f-logo-h: 44px; --f-logo-self: center; --f-headline: -webkit-box; --f-hl-size: .875rem; --f-hl-lines: 2;
  }

  /* interlude card · 16:9 (live-interlude) */
  .ad[data-fmt-d="interlude"] {
    --f-areas: "eyebrow" "logo" "headline" "body" "cta";
    --f-cols: minmax(0, 1fr); --f-rows: auto auto auto auto auto; --f-align: center; --f-justify: center; --f-text: center;
    --f-pad: 6% 10%; --f-rgap: clamp(8px, 1.6vw, 18px);
    --f-logo-w: clamp(180px, 26vw, 300px); --f-logo-h: clamp(72px, 10vw, 120px); --f-logo-pad: 12px 22px; --f-logo-r: 16px;
    --f-word: clamp(1.25rem, 2.6vw, 2rem); --f-logo-self: center;
    --f-eb-size: clamp(.6875rem, 1vw, .875rem); --f-hl-size: clamp(1.5rem, 3.4vw, 2.75rem); --f-hl-lh: 1.08; --f-hl-lines: 2;
    --f-bd-size: clamp(.9375rem, 1.4vw, 1.25rem); --f-bd-lines: 2;
    --f-cta-w: auto; --f-cta-justify: center; --f-cta-h: clamp(40px, 4vw, 52px); --f-cta-px: 24px; --f-cta-size: clamp(.875rem, 1.2vw, 1.0625rem);
    --f-radius: 28px;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  /* rail · 300×600 (live-rail, 1600 px and up): one centred block, so short house copy never leaves a hole */
  .ad[data-fmt-d="skyscraper"] {
    --f-areas: "logo" "eyebrow" "headline" "body" "cta";
    --f-cols: minmax(0, 1fr); --f-rows: auto auto auto auto auto; --f-align: center; --f-justify: start; --f-text: start;
    --f-pad: 28px 24px; --f-rgap: 8px;
    --f-logo-w: 100%; --f-logo-h: 96px; --f-logo-pad: 12px 18px; --f-logo-r: 14px; --f-word: 1.5rem; --f-logo-self: stretch;
    --f-eb-size: .75rem; --f-hl-size: 1.75rem; --f-hl-lh: 1.08; --f-hl-lines: 4; --f-bd-size: 1rem; --f-bd-lines: 4;
    --f-cta-w: 100%; --f-cta-justify: stretch; --f-cta-h: 46px; --f-cta-size: 1rem; --f-cta-self: center;
    --f-radius: 24px;
  }
  /* a presenter: the brand (up to three lines at this size) and "today’s 100 free birthdays" under it; the rail has the room */
  .ad--presenter[data-fmt-d="skyscraper"] { --f-hl-lines: 6; --f-tail: inline; }
  .ad[data-fmt-d="skyscraper"] .ad__logo, .ad[data-fmt-d="skyscraper"] .ad__mark { margin-bottom: 14px; }
  .ad--house[data-fmt-d="skyscraper"] { --f-logo-w: 112px; --f-logo-h: 112px; --f-logo-self: start; }
  .ad[data-fmt-d="skyscraper"] .ad__cta { justify-content: space-between; margin-top: 12px; }
}

/* ─── Placeholder (dev only) ─────────────────────────────────────────────────────────────────────────────── */
.ad--placeholder {
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--text) 4%, transparent) 0 8px, transparent 8px 16px),
    color-mix(in srgb, var(--surface) 70%, transparent);
  outline: 1.5px dashed color-mix(in srgb, var(--text) 34%, transparent);
  outline-offset: -1.5px;
  color: var(--text-2);
  text-align: center;
}
.ad--placeholder[data-fmt-m="interlude-portrait"] { height: auto; aspect-ratio: 4 / 5; }
@media (min-width: 768px) { .ad--placeholder[data-fmt-d="interlude"] { height: auto; aspect-ratio: 16 / 9; } }
.ad__ph { display: grid; justify-items: center; gap: 4px; }
.ad__ph-tag {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--volt) 16%, transparent);
  color: var(--volt-ink);
  font: 700 .625rem/1.6 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ad__ph-label { font: 600 .8125rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -0.01em; }
.ad [data-bp="d"] { display: none; }
@media (min-width: 768px) {
  .ad [data-bp="d"] { display: inline; }
  .ad [data-bp="m"] { display: none; }
}

/* ─── Network (AdSense; live mode only) ──────────────────────────────────────────────────────────────────── */
.ad--network {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: auto;
  min-height: var(--ad-h);
}
.ad__net-label {
  font: 700 .625rem/1.4 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ad--network .adsbygoogle { flex: 1; width: 100%; min-height: calc(var(--ad-h) - 18px); }

/* ─── Dev tag on house units (ADS_MODE=placeholder only) ─────────────────────────────────────────────────── */
.ad__dev {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  z-index: 3;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--night-950);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--volt) 40%, transparent);
  color: var(--volt);
  font: 600 .625rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
  white-space: nowrap;
}

/* ─── Motion and accessibility ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ad *, .ad *::after { transition: none !important; }
  .ad__link:hover .ad__arrow, .ad__link:focus-visible .ad__arrow { translate: none; }
}
html[data-calm] .ad *, html[data-calm] .ad *::after { transition: none !important; }
html[data-calm] .ad__link:hover .ad__arrow { translate: none; }
@media (forced-colors: active) {
  .ad--sponsor .ad__link, .ad--house .ad__link, .ad--placeholder { border: 1px solid CanvasText; }
  .ad__cta { border: 1px solid ButtonText; }
  .ad__mark::before { display: none; }
}
@media print {
  .ad-slot { display: none; }
}
