/* ============================================================
   SpectrumAnalyzer.app - ad slots (plan 16.5 - 16.7)
   No label, own background, clear gap. A slot shows (and reserves
   its height) ONLY when the head script has put ads-on + adN on <html>,
   so an empty slot never flashes or shifts the page.
   ============================================================ */
:root{
  /* Reserved heights (16.6), phone first. If a slot's real ad is always shorter, lower it here (one place). */
  --ad-h1:340px; --ad-h2:340px; --ad-h3:340px; --ad-h4:340px; --ad-h5:340px;
  --ad3-side-h:600px;
  /* 1 = slot 3 sits in the sticky right sidebar on >= 1280 px; 0 = always inline (16.10 point 5). */
  --ad3-sidebar:1;
}
@media (min-width:768px){:root{--ad-h1:300px;--ad-h2:300px;--ad-h3:300px;--ad-h4:300px;--ad-h5:300px}}
@media (min-width:1280px){:root{--ad-h1:280px;--ad-h2:260px;--ad-h3:260px;--ad-h4:260px;--ad-h5:260px}}

.ad-slot{display:none}
html.ads-on.ad1 .ad-slot[data-slot="1"],
html.ads-on.ad2 .ad-slot[data-slot="2"],
html.ads-on.ad3 .ad-slot[data-slot="3"],
html.ads-on.ad4 .ad-slot[data-slot="4"],
html.ads-on.ad5 .ad-slot[data-slot="5"]{
  display:block; box-sizing:border-box; width:100%; max-width:760px; margin:32px auto; padding:16px;
  background:var(--ad-bg); border-top:1px solid var(--line); border-radius:12px; overflow:hidden; text-align:center;
}
/* reserved height; --ad-bN is set by the head script for a banner code (its height + 32 px padding + 1 px top border) */
html.ads-on.ad1 .ad-slot[data-slot="1"]{min-height:var(--ad-b1,var(--ad-h1))}
html.ads-on.ad2 .ad-slot[data-slot="2"]{min-height:var(--ad-b2,var(--ad-h2))}
html.ads-on.ad3 .ad-slot[data-slot="3"]{min-height:var(--ad-b3,var(--ad-h3))}
html.ads-on.ad4 .ad-slot[data-slot="4"]{min-height:var(--ad-b4,var(--ad-h4))}
html.ads-on.ad5 .ad-slot[data-slot="5"]{min-height:var(--ad-b5,var(--ad-h5))}
/* slot 1 sits under the tool: 32 px gap plus a divider line above it (16.5) */
html.ads-on.ad1 .ad-slot[data-slot="1"]{margin-top:32px; box-shadow:0 -33px 0 -32px var(--line-2)}
.ad-slot > *{max-width:100%; margin-inline:auto}
.ad-slot iframe{display:block; max-width:100%; margin-inline:auto; border:0}

/* In the article (>= 768 px) a slot starts at the column's left edge like the text around it (layout pass 22 Nov). */
@media (min-width:768px){
  html.ads-on .page .ad-slot[data-slot]{margin-left:0; margin-right:auto}
  /* slots between full-width blocks (under the tool, between home sections): same left edge as the content */
  /* (owner, 22 Nov: "not aligned") these sit between full-width blocks, so the box takes the same width as the blocks
     above and below it (cards, tool), and the ad itself is centred inside, at most 960 px wide */
  html.ads-on .tool-page>.ad-slot[data-slot],html.ads-on .home>.ad-slot[data-slot],html.ads-on .dir-page>.ad-slot[data-slot]{margin-left:max(var(--gl),calc((100% - 1240px) / 2)); margin-right:auto; max-width:min(1240px,calc(100% - var(--gl) - var(--gr)))}
  html.ads-on .tool-page>.ad-slot[data-slot]>*,html.ads-on .home>.ad-slot[data-slot]>*,html.ads-on .dir-page>.ad-slot[data-slot]>*{max-width:960px}
}

/* slot 3 in the sticky right sidebar on >= 1280 px (16.7). The page wraps the range from "How to read the result"
   down to the content before slot 4 in <div class="with-aside">; slot 3 is ONE element in it (inline under 1280 px).
   The sidebar is the page's right-hand rail (site.css .has-toc, 300 px): .with-aside reaches into the rail and puts
   the slot in its third column, so the ad lines up with the "On this page" box above it. That box stops being
   sticky while a sidebar ad is on, so the two never overlap. */
@media (min-width:1280px){
  html.ads-on.ad3.ad3-side .has-toc .toc-in{position:static; max-height:none}
  html.ads-on.ad3.ad3-side .has-toc .with-aside{
    display:grid; grid-template-columns:minmax(0,var(--measure)) minmax(0,1fr) var(--rail); gap:0; align-items:start;
    margin-right:calc(-1 * (var(--rail) + var(--rail-gap)));
  }
  html.ads-on.ad3.ad3-side .has-toc .with-aside>*{grid-column:1}
  html.ads-on.ad3.ad3-side .has-toc .with-aside>section:first-child{margin-top:0}  /* its H2 keeps its own gap: level with the ad */
  html.ads-on.ad3.ad3-side .has-toc .with-aside>.ad-slot[data-slot="3"]{
    grid-column:3; grid-row:1 / span 60; position:sticky; top:88px; align-self:start;
    width:300px; max-width:300px; margin:var(--sec) 0 0; min-height:var(--ad-b3,var(--ad3-side-h));
  }
}

/* an ad that failed or was blocked collapses only while it is off screen (ads-loader.js), so nothing visible moves */
.ad-slot.ad-gone{display:none!important}
@media print{.ad-slot{display:none!important}}
