/* Cyberfrog Web Tools - shared shell.
   Layout + unified header + ad-slot styling for every free web tool.
   Dark editorial brand, single green accent, Montserrat with a system
   fallback so no font CDN is required. Serve this from the shared path
   /shared/tool-shell.css so all tools reference one copy. */

:root {
  --bg-deep: #07090b;
  --bg-dark: #0d0f12;
  --surface-dark: #14181d;
  --border-dark: #232930;
  --text-light: #e5e7eb;
  --muted: #8b9199;
  --accent: #19c37d;
  --accent-dark: #13a06a;
  --accent-soft: rgba(25, 195, 125, 0.12);
  --accent-focus: rgba(25, 195, 125, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --maxw: 1100px;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; overflow-x: clip; }

body {
  font-family: var(--font);
  color: var(--text-light);
  background: var(--bg-dark);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* ─── Topnav (standard Web Tools header) ──────────────────────────────── */

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(7, 9, 11, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-dark);
}
.topnav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.topnav__brand img { width: 28px; height: 28px; }
.topnav__brand:hover { color: var(--accent); }
.topnav__back {
  color: rgba(229, 231, 235, 0.72);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}
.topnav__back:hover { color: var(--accent); }

/* ─── Page hero ───────────────────────────────────────────────────────── */

.page-hero {
  background: var(--bg-deep);
  padding: 2.25rem 1.5rem 1.75rem;
  text-align: center;
  border-bottom: 1px solid var(--border-dark);
}
.page-hero__content { max-width: 720px; margin: 0 auto; }
.page-hero h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-hero__lead {
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.5;
  color: rgba(229, 231, 235, 0.78);
  margin: 0 auto;
  max-width: 620px;
}

/* ─── Privacy bar (trust badge under the hero, shared across tools) ────── */

.privacy-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1.5rem 0;
}
.privacy-bar__inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 780px;
  margin: 0 auto;
  padding: 0.7rem 1.05rem;
  background: var(--accent-soft);
  border: 1px solid rgba(25, 195, 125, 0.3);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(229, 231, 235, 0.92);
}
.privacy-bar__icon { color: var(--accent); flex: 0 0 auto; }
.privacy-bar strong { color: var(--accent); font-weight: 700; }

/* ─── Tool layout (content + optional desktop rail) ───────────────────── */

.tool-layout {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: grid;
  /* Content + rail. The rail column auto-collapses to 0 when its only
     child (the rail ad-slot) is hidden, so there is no empty gutter. */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: start;
}
/* Below the desktop rail breakpoint, always single column. */
@media (max-width: 1024px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

.tool-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Tool footer ─────────────────────────────────────────────────────── */

.tool-footer {
  border-top: 1px solid var(--border-dark);
  padding: 1.75rem 1.5rem;
  text-align: center;
  color: rgba(229, 231, 235, 0.45);
  font-size: 0.85rem;
  background: var(--bg-deep);
}
.tool-footer p { margin: 0; }
.tool-footer a { color: rgba(229, 231, 235, 0.6); font-weight: 600; }
.tool-footer a:hover { color: var(--accent); }

/* ─── Ad slots ────────────────────────────────────────────────────────── */
/* CONTRACT: every slot is <div class="ad-slot" data-ad-slot="<type>" hidden>.
   OFF (default) = the `hidden` attribute keeps it display:none with zero
   footprint. The rule below beats any `display` an ad provider might set
   on the element itself, so a slot is visually nothing until ads.js
   un-hides it. No border, no min-height, no layout shift when off. */

.ad-slot[hidden] { display: none !important; }

/* When shown, a slot is a centered, labelled container. The label is a
   tiny "Advertisement" disclosure stamped by ads.js (data-ad-active). */
.ad-slot {
  display: block;
  margin: 0 auto;
  text-align: center;
}
.ad-slot[data-ad-active]::before {
  content: 'Advertisement';
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* top-banner: responsive leaderboard under the hero. */
.ad-slot[data-ad-slot="top-banner"] {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

/* in-content: in-article rectangle inside .tool-content flow. */
.ad-slot[data-ad-slot="in-content"] {
  width: 100%;
  max-width: 336px;
  min-height: 280px;
}

/* rail: desktop-only sticky skyscraper beside the content. Hidden below
   the rail breakpoint regardless of config, so the layout reflows to a
   single column with no gutter. */
.ad-slot[data-ad-slot="rail"] {
  width: 160px;
  min-height: 600px;
  position: sticky;
  top: 5.5rem;
}
@media (max-width: 1024px) {
  .ad-slot[data-ad-slot="rail"] { display: none !important; }
}

/* footer: anchor / banner above the tool footer. */
.ad-slot[data-ad-slot="footer"] {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

/* video: in-content video-ad container (16:9). */
.ad-slot[data-ad-slot="video"] {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
}

/* interstitial: full-screen overlay. Centered card on a dark scrim.
   Stays display:none via [hidden] until a tool trigger un-hides it. */
.ad-slot[data-ad-slot="interstitial"] {
  position: fixed;
  inset: 0;
  z-index: 100;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 11, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 1.5rem;
}
.ad-slot[data-ad-slot="interstitial"][hidden] { display: none !important; }
/* The interstitial close affordance is injected by ads.js as
   .ad-slot__close; tools may also render their own dismiss control. */
.ad-slot__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface-dark);
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.ad-slot__close:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Button + panel system (canonical) ─────────────────────────────────────
   Token-driven shared controls. Per-tool tool.css no longer carries local
   copies - every tool inherits these, and --accent drives the primary button
   so a green-palette tool gets green buttons without a local override. */
.panel {
  background: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease, border-color 150ms ease;
  line-height: 1;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #07140d; }
.btn--primary:hover:not(:disabled) { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid rgba(229, 231, 235, 0.35);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: rgba(25, 195, 125, 0.06); }
.btn--sm { padding: 0.5rem 0.9rem; font-size: 0.82rem; }
.btn--block { width: 100%; }
/* Mobile touch target (previously a per-tool .btn--sm rule; now shared). */
@media (max-width: 640px) {
  .btn { min-height: 44px; }
}

/* ─── Mobile: tighten hero + stack the privacy bar for more above the fold ─ */

@media (max-width: 560px) {
  .page-hero { padding: 1.75rem 1.25rem 1.4rem; }
  .page-hero h1 { font-size: clamp(1.7rem, 8vw, 2.1rem); }
  .page-hero__lead { font-size: 0.92rem; }
  .privacy-bar { padding-top: 0.9rem; }
  .privacy-bar__inner { align-items: flex-start; font-size: 0.82rem; }
  .tool-layout { padding: 1.5rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
