/* Patternbook custom styles */

/* Improve readability for non-technical audience */
/* Override mdbook's :root { font-size: 62.5% } which sets 1rem = 10px.
   We set the content area directly in px to avoid the rem trap. */

.content main {
  max-width: 680px;
  font-size: 18px;
  line-height: 1.6;
}

/* Override mdbook's .content p { line-height: 1.45em } which is more specific
   than our .content main rule and wins the cascade. */
.content main p {
  line-height: 1.6;
}

/* Softer code block styling */
pre > code {
  font-size: 0.9em;
}

/* Admonition tweaks */
.admonition {
  border-radius: 6px;
}

/* Highlight table rows that use bold (e.g., "this is us" in comparison tables) */
.content table tbody tr:has(strong) {
  background: rgba(50, 150, 220, 0.25);
}

/* Ad placement — single, tasteful, non-intrusive */
.patternbook-ad {
  margin: 1.5em 0;
  padding: 0.75em 1em;
  border: 1px solid var(--sidebar-bg);
  border-radius: 6px;
  background: var(--sidebar-bg);
  font-size: 0.85rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.patternbook-ad.loaded {
  opacity: 1;
}

/* EthicalAds overrides — keep their styling minimal */
.patternbook-ad [data-ea-publisher] {
  margin: 0 auto;
}

/* Carbon Ads overrides */
.patternbook-ad #carbonads {
  max-width: 330px;
  margin: 0 auto;
  font-family: inherit;
}

.patternbook-ad #carbonads a {
  color: var(--links);
  text-decoration: none;
}

.patternbook-ad #carbonads .carbon-poweredby {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Hide ad container entirely when empty (no ad served) */
.patternbook-ad:empty {
  display: none;
}

/* Mobile: ad takes full width */
@media (max-width: 768px) {
  .patternbook-ad {
    margin: 1em -0.5em;
    border-radius: 0;
  }
}
