/* Google Ad Manager slots. Markup is fixed (see docs/data-mapping.md); the CMS fills .ad-slot__frame.
   Desktop sizes are served from 1024px (the loader's size mapping), so reserved heights switch at 64em too. */
@layer components {
  .ad-slot { display: grid; justify-items: center; gap: var(--space-1); width: 100%; margin-inline: auto; margin-block: var(--ad-gap); }
  .ad-slot__label { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: var(--lh-snug); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
  .ad-slot__frame { width: 100%; min-height: var(--ad-min-h-mobile, var(--ad-rect-h)); display: grid; place-items: center; overflow: clip; background: var(--surface-alt); border-radius: var(--radius-md); }
  .ad-slot.is-empty:not(.ad-slot--placeholder) { display: none; }

  /* Ads never outnumber content on a screen (Google publisher policy): a slot that directly follows another slot,
     with no editorial block between them, is not shown — except in the side rail on wide screens, where the
     content sits beside it. The loader does not request slots hidden here. */
  @media (width < 64em) { .ad-slot + .ad-slot { display: none; } }
  @media (min-width: 64em) { :not(.l-sidebar) > .ad-slot + .ad-slot { display: none; } }

  .ad-slot[data-slot="top_billboard"], .ad-slot[data-slot^="home_row"] { max-width: var(--ad-billboard-w); }
  .ad-slot[data-slot^="sidebar"] { max-width: var(--ad-rect-w); margin-block: var(--space-4); }

  /* In the article and in article lists (listing_row, after the 3rd card): a band across the column, the frame centred.
     In a list the grid gap already spaces the band from the cards.
     In the article: between the lead and the table of contents. No inline padding:
     a 750px creative must fit the 47.5rem column. On phones the band bleeds into the gutter so 300px fits 320px. */
  .ad-slot[data-slot^="in_article"], .ad-slot[data-slot="listing_row"] { width: auto; max-width: none; justify-items: center; background: var(--surface-alt); border-radius: var(--radius-md); margin-inline: calc(-1 * var(--gutter)); padding-block: var(--space-2) var(--space-3); }
  .ad-slot[data-slot^="in_article"] .ad-slot__label, .ad-slot[data-slot="listing_row"] .ad-slot__label { justify-self: start; padding-inline: var(--space-3); }
  .ad-slot[data-slot^="in_article"] .ad-slot__frame, .ad-slot[data-slot="listing_row"] .ad-slot__frame { max-width: none; background: none; }

  .l-stack > .ad-slot[data-slot="listing_row"] { margin-block: 0; }

  /* Placeholder ("wydmuszka"): static grey box with the slot's size; never an ad. The box is a size container
     with definite px dimensions, so its text can adapt to the box height. */
  .ad-slot__ph {
    --ph-w: var(--ph-w-m); --ph-h: var(--ph-h-m);
    container-type: size;
    box-sizing: border-box;
    inline-size: min(100%, var(--ph-w)); block-size: var(--ph-h);
    display: flex; flex-flow: row wrap; align-content: center; justify-content: center; gap: 0.125rem 0.75rem;
    padding: var(--space-1) var(--space-2);
    text-align: center; font-family: var(--font-sans); line-height: var(--lh-snug); color: var(--ad-ph-ink);
    border: 2px dashed var(--ad-ph-border); border-radius: var(--radius-md);
    background: repeating-linear-gradient(135deg, var(--ad-ph-bg) 0 10px, var(--ad-ph-hatch) 10px 11px);
  }
  .ad-slot__ph > * { flex: 0 0 100%; overflow-wrap: anywhere; }
  .ad-slot__ph-size { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
  .ad-slot__ph-name { font-size: var(--fs-sm); }
  .ad-slot__ph-code, .ad-slot__ph-alt { font-size: var(--fs-xs); color: var(--ad-ph-ink-muted); }
  .ad-slot__ph-name:not(:has(:not(:empty))) { display: none; }
  .ad-slot__ph-d { display: none; }

  /* Short boxes (320x50, 90px bands): size and name side by side, no code / alternatives. */
  @container (height < 120px) {
    .ad-slot__ph-code, .ad-slot__ph-alt { display: none; }
    .ad-slot__ph-size, .ad-slot__ph-name { flex: 0 1 auto; }
    .ad-slot__ph-size { font-size: var(--fs-md); }
    .ad-slot__ph-name { font-size: var(--fs-xs); align-self: center; }
  }

  @media (min-width: 48em) {
    .ad-slot[data-slot^="in_article"], .ad-slot[data-slot="listing_row"] { margin-inline: 0; }
  }

  @media (min-width: 64em) {
    .ad-slot__frame { min-height: var(--ad-min-h-desktop, var(--ad-rect-h)); }
    .ad-slot__ph { --ph-w: var(--ph-w-d); --ph-h: var(--ph-h-d); }
    .ad-slot__ph-m { display: none; }
    .ad-slot__ph-d { display: inline; }
  }
}
