/* Banner space and page layout, shared by every page of the site:
   the calculator (index.html), its Q&A page (faq.html) and the landing page
   (which loads it from /heatingcalculator/banners.css).
   Needs early.js (sets data-device / data-orientation / data-banner-layout on <html>)
   and banners.js (fills <aside id="banners" class="banner-area">).
   Page structure:  <div class="layout"> <aside id="banners" class="banner-area"></aside>
                    <main> or <div class="layout-main"> ...page... </div> </div>
   - desktop, and phones/tablets held sideways: left 30% for banners, the page in the right 70%
   - phones/tablets held upright: top 25% for banners, the page below at full width
   Each page sets its own padding for the main column, and --bg for the banner strip's background. */
/* Dark mode switch (top right of every page; code in theme.js). Uses each page's --muted,
   --border and --accent colors. Markup:
   <div class="topbar"><label class="switch" title="Switch between light and dark mode">
     <span>Dark mode</span><input type="checkbox" id="darkMode" role="switch">
     <span class="track" aria-hidden="true"></span></label></div> */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: .9rem; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 44px; height: 24px; border-radius: 12px;
  background: var(--border); transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.layout { display: flex; align-items: flex-start; min-height: 100vh; }
.banner-area {
  flex: 0 0 30%; max-width: 30%; box-sizing: border-box;
  position: sticky; top: 0; align-self: flex-start; height: 100vh; padding: 24px 16px;
}
.layout > main, .layout > .layout-main {
  flex: 0 0 70%; max-width: 70%; box-sizing: border-box; margin-left: auto;
}
html[data-device="phone"][data-orientation="portrait"] .layout,
html[data-device="tablet"][data-orientation="portrait"] .layout { flex-direction: column; }
html[data-device="phone"][data-orientation="portrait"] .banner-area,
html[data-device="tablet"][data-orientation="portrait"] .banner-area {
  flex: 0 0 25vh; height: 25vh; max-width: none; width: 100%;
  z-index: 5; background: var(--bg);  /* stays at the top; the page scrolls beneath it */
}
html[data-device="phone"][data-orientation="portrait"] .layout > main,
html[data-device="tablet"][data-orientation="portrait"] .layout > main,
html[data-device="phone"][data-orientation="portrait"] .layout > .layout-main,
html[data-device="tablet"][data-orientation="portrait"] .layout > .layout-main {
  flex: none; max-width: none; width: 100%;
}

/* Banners (content comes from the BANNERS list in banners.js). */
.banner {
  box-sizing: border-box; width: 100%; height: 100%; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  color: #fff; background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 55%, #f97316 130%);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
.banner-test { flex-direction: column; gap: 14px; padding: 24px 16px; text-align: center; }
.banner-test .banner-logo { width: clamp(48px, 30%, 120px); height: auto; flex: none; }
.banner-test .banner-text { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.banner-test .banner-name { font-size: clamp(1.1rem, 2vw, 1.75rem); font-weight: 800; line-height: 1.15; letter-spacing: .01em; }
.banner-test .banner-tag {
  font-size: clamp(.85rem, 1.2vw, 1.1rem); font-weight: 600; padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
}
/* Top banner (upright phones/tablets): one horizontal strip. */
html[data-banner-layout="top"] .banner-area { padding: 10px 12px; }
html[data-banner-layout="top"] .banner-test { flex-direction: row; gap: 16px; padding: 12px 18px; text-align: left; }
html[data-banner-layout="top"] .banner-test .banner-logo { width: auto; height: min(70%, 110px); }
html[data-banner-layout="top"] .banner-test .banner-text { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
html[data-banner-layout="top"] .banner-test .banner-name { font-size: clamp(1rem, 5vw, 1.8rem); }
html[data-banner-layout="top"] .banner-test .banner-tag { font-size: clamp(.75rem, 3vw, 1rem); }
/* Image house banners (type "image" in ads.json): the picture fills the banner box. */
.banner-image { padding: 0; background: none; box-shadow: none; }
.banner-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Google AdSense unit (provider "adsense" in ads.json): a small "Advertisement" label above it,
   the unit fills the rest of the slot (a fixed-size slot means no layout shift when the ad arrives). */
.banner-area[data-provider="adsense"] { display: flex; flex-direction: column; }
.ad-label {
  flex: none; margin: 0 0 4px; text-align: center; color: var(--muted, #6b7280);
  font: 600 .7rem/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .06em; text-transform: uppercase;
}
.banner-area ins.adsbygoogle { display: block; flex: 1 1 auto; width: 100%; min-height: 0; }
/* Side banner on a phone held sideways: little height, so tighten it. */
html[data-device="phone"][data-banner-layout="side"] .banner-area { padding: 10px; }
html[data-device="phone"][data-banner-layout="side"] .banner-test { gap: 8px; padding: 12px 10px; }
html[data-device="phone"][data-banner-layout="side"] .banner-test .banner-logo { width: clamp(36px, 25%, 64px); }
