/* ==========================================================================
   Shared front-end styles
   Loaded by every theme via application/views/partials/seo_meta.php, so
   anything defined here is available to all themes (present and future).
   Keep it small and theme-neutral — colours come from CSS variables so each
   theme's own palette wins.
   ========================================================================== */

:root {
  --ad-bg: #f4f5f7;
  --ad-border: #e3e6ea;
  --ad-label: #9aa2ad;
}

[data-theme="dark"] {
  --ad-bg: #131b2b;
  --ad-border: #24304a;
  --ad-label: #6b7689;
}

/* --------------------------------------------------------------------------
   Advertising slots
   The wrapper reserves height before the ad script resolves, so a late unit
   cannot shove the article down the page (cumulative layout shift).
   -------------------------------------------------------------------------- */
.ad-slot {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem auto;
  padding: .5rem;
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: 6px;
  text-align: center;
  overflow: hidden;          /* a too-wide unit must not widen the page */
  box-sizing: border-box;
}

.ad-slot__label {
  display: block;
  margin-bottom: .35rem;
  font-size: 10px;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ad-label);
}

.ad-slot__body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: inherit;
}

/* Ad markup is supplied by the network; force it to behave responsively. */
.ad-slot__body :is(img, iframe, ins, embed, object, video) {
  max-width: 100% !important;
  height: auto;
}
.ad-slot__body ins.adsbygoogle {
  display: block;
  width: 100%;
}

.ad-slot--header        { margin-top: 0; }
.ad-slot--sidebar       { margin: 0 0 1.5rem; }
.ad-slot--in-article    { margin: 2rem auto; }
.ad-slot--after-content { margin: 2rem auto 0; }

/* Leaderboards are the usual culprit for horizontal overflow on phones. */
@media (max-width: 767.98px) {
  .ad-slot {
    margin-left: 0;
    margin-right: 0;
    padding: .35rem;
  }
  .ad-slot--header { min-height: 100px !important; }
}

/* --------------------------------------------------------------------------
   Cross-theme safety net
   Long words, wide tables and oversized media are the three things that
   reliably break a responsive layout.
   -------------------------------------------------------------------------- */
img, video, iframe, embed, object {
  max-width: 100%;
}
img, video {
  height: auto;
}

.post-content table,
.entry-content table,
.page-content table {
  display: block;
  width: 100%;
  overflow-x: auto;          /* scroll the table, not the page */
  -webkit-overflow-scrolling: touch;
}

.post-content pre,
.entry-content pre,
.page-content pre {
  overflow-x: auto;
  max-width: 100%;
}

.post-content,
.entry-content,
.page-content {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

/* Keyboard users need to see where focus is; several themes removed outlines. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: .6rem 1rem;
  background: #111;
  color: #fff;
  text-decoration: none;
}
.skip-to-content:focus {
  left: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Empty states — shown by archive/search templates when there is nothing yet
   -------------------------------------------------------------------------- */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ad-label);
}
.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  opacity: .5;
}
.empty-state__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
