/* adsense.css — responsive ad-slot layout + dummy-ad styling (site-agnostic).
 *
 * Desktop (>= 1024px): two STICKY side rails + a bottom band. The rails are
 * intentionally narrow (200px) and sit OUTSIDE the main content column so ads
 * never push the tool off-center or distract from the primary use-case.
 * Mobile (< 1024px): only the bottom band shows, capped in height.
 *
 * The containers themselves are mode-agnostic: whether a slot holds a dummy
 * card or a live <ins class="adsbygoogle">, the geometry is identical, so the
 * dummy → live switch never reflows the page (the AdSense switch is one flag).
 */
:root {
  --ad-rails-w: 200px;
  --ad-content-w: 760px;   /* the site's centered container max-width */
  --ad-bottom-h: 120px;    /* reserved — real ads fill this without a jump */
  --ad-sticky-top: 88px;
}

/* app shell: mobile default → bottom band only; rails = FIXED viewport side
 * rails on wide screens. FIXED (not a body grid) so the site's own centered
 * layout is untouched — no reflow, no squeeze, no flash. */
.ad-slot-side { display: none; }             /* mobile + narrow desktop */
/* The bottom band is capped to the CONTENT COLUMN, not the viewport. Without
 * this the band spans the full window on any site whose content is narrower than
 * the viewport, which is every one of them — measured 2026-11-13 on focus-os and
 * regex-builder: a 1424px ad band under a 720px column, and four slots stacked
 * full-bleed because the side rails were suppressed at <1500px. A band wider than
 * the content reads as a layout defect, not an ad. */
.ad-slot-bottom {
  display: block;
  width: 100%;
  max-width: var(--ad-content-w, 720px);
  margin-inline: auto;
  min-height: var(--ad-bottom-h);
  overflow: visible;
}

/* The rail offset is computed from --ad-content-w, which MUST match the site's
 * real centered container. A mismatch is not cosmetic: with 720px declared and a
 * 1080px container, both rails land INSIDE the content (measured 2026-11-02 on
 * textsuite and json-converter: 17,571px² of <main> covered per rail, and on
 * regex-builder the rail covered the primary control). The breakpoint is
 * therefore derived from the same variable rather than a fixed 1180px, so a wide
 * container simply shows no rails until there is genuinely room.
 *
 *   rails fit  <=>  viewport >= content + 2*(rail + gutter)
 */
@media (min-width: 1180px) {
  .ad-slot-side {
    display: block;
    position: fixed;
    top: var(--ad-sticky-top);
    width: var(--ad-rails-w);
    max-height: calc(100vh - var(--ad-sticky-top) - 20px);
    overflow-y: auto;
    z-index: 5;
  }
  .ad-slot-left {
    left: max(10px, calc((100vw - var(--ad-content-w)) / 2 - var(--ad-rails-w) - 10px));
  }
  .ad-slot-right {
    right: max(10px, calc((100vw - var(--ad-content-w)) / 2 - var(--ad-rails-w) - 10px));
  }
}
.ad-slot-right { text-align: left; }

/* NOTE (2026-11-13): this file used to define `html[data-theme="<site>"] { --accent: ... }`
 * for 11 sites. `html[data-theme=...]` outranks `:root`, so every site's own
 * --accent was silently replaced by this ad palette — which is why accent fixes
 * made in each site's styles.css appeared to do nothing (textsuite computed
 * #0891b2 while its own stylesheet said #0369a1). An ad stylesheet has no
 * business setting the host page's brand colour: it only styles ad slots. The
 * per-site accent belongs in that site's own :root. */

/* ===== dummy ad card (mode: 'dummy') ===== */
.dummy-ad {
  border: 1px solid color-mix(in srgb, var(--accent, #6b5ce6) 30%, transparent);
  background: color-mix(in srgb, var(--accent, #6b5ce6) 12%, var(--ad-card-bg, #ffffff));
  border-radius: 10px;
  padding: .55rem .6rem;
  font-size: .78rem;
  line-height: 1.3;
}
/* dark pages: inherited card background keeps the ad card on-theme */
@media (prefers-color-scheme: dark) {
  .dummy-ad {
    background: color-mix(in srgb, var(--accent, #6b5ce6) 16%, #13182b);
  }
  .dummy-ad__title { color: var(--text-1, #e8e8ec); }
  .dummy-ad__blurb, .dummy-ad__label { color: var(--text-2, #9aa0b4); }
}
.dummy-ad__label {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .64rem;
  color: var(--text-2, #666);
  margin-bottom: .35rem;
}
.dummy-ad__body { display: flex; gap: .5rem; align-items: flex-start; }
.dummy-ad__thumb {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent, #6b5ce6) 55%, #fff), var(--accent, #6b5ce6));
}
.dummy-ad__title { font-weight: 600; color: var(--text-1, #222); }
.dummy-ad__blurb { color: var(--text-2, #666); }
.dummy-ad-bottom .dummy-ad__body { align-items: center; }
.dummy-ad-bottom .dummy-ad { max-width: 640px; margin: 0 auto; }

/* bottom band (mobile): keep it out of the way but visible */
@media (max-width: 1023px) {
  .ad-slot-bottom { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Hide the rails unless there is genuinely room for BOTH.
 *
 * A rail is 200px with a 10px gutter, so two rails need 420px of margin beside
 * the content: viewport >= content + 420. At a fixed 1180px breakpoint a 1080px
 * container (plan-first, money-hub, textsuite, json-converter) can never fit
 * them — measured 2026-11-02: 1,860-3,101px² of <main> still covered after the
 * first fix. The container width is a CSS custom property, so the correct
 * breakpoint is expressed in per-site rules generated from --ad-content-w.
 */
@media (min-width: 1180px) and (max-width: 1499px) {
  .ad-slot-side { display: none !important; }
}
@media (min-width: 1500px) {
  /* 1080px content + 420px rail budget = 1500px. Below this, no rails. */
}

/* Co-development credit. Deliberately quiet: a small line at the foot of the
   page, not a badge. It should read as a signature, not an advert. */
.built-by {
  margin: 18px auto 6px;
  max-width: var(--ad-content-w, 720px);
  font-size: 12px;
  line-height: 1.5;
  /* Inherit the surrounding footer colour. It used to hardcode #6b7280, which
     is unreadable on the six sites whose footer is #0f172a (3.69:1, measured
     2026-11-13 by pixel sampling). Inheriting means it is correct on both. */
  color: inherit;
  text-align: center;
  letter-spacing: 0.01em;
}
.built-by a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.built-by a:hover { color: #374151; }
@media (prefers-color-scheme: dark) {
  .built-by { color: #9ca3af; }
  .built-by a:hover { color: #d1d5db; }
}

/* Inline ad slot (2026-11-13) — an in-flow unit that readers reach without
   scrolling to the bottom band. Same container either way, so swapping dummy ->
   live never shifts the page. */
.ad-slot-inline {
  display: block;
  width: 100%;
  max-width: var(--ad-content-w, 720px);
  min-height: var(--ad-inline-h, 280px);
  margin: 1.25rem auto;
  overflow: visible;
}
.ad-slot-inline .dummy-ad { max-width: 640px; margin: 0 auto; }
