/* =========================================================================
   The Water Treatments — mobile responsiveness & clean small-screen UI.
   Loaded on all pages after the main stylesheet.
   ========================================================================= */

/* ---- Base: safe areas + root tweaks ---- */
@media (max-width: 900px) {
  @supports (padding: max(0px)) {
    .wt-wrap,
    .wt-lp-wrap,
    .home .wt-header .wt-wrap,
    .home .wt-topbar .wt-wrap,
    .home .wt-footer__top,
    .home .wt-footer__bar .wt-wrap {
      padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
    }
  }
}

/* Slightly tighter measure on narrow screens so text doesn't feel cramped. */
@media (max-width: 480px) {
  :root { --measure: 66ch; }
  body { font-size: 1rem; line-height: 1.65; }
}

/* ---- Header: compact, breathable, thumb-friendly ---- */
@media (max-width: 900px) {
  .wt-header__inner { min-height: 64px; gap: 0.5rem; }
  .wt-brand__logo { height: 54px !important; }
  .wt-iconbtn { width: 40px; height: 40px; }
  /* Push the search + burger buttons to the far right when the desktop nav hides. */
  .wt-search-toggle { margin-left: auto; }
}

@media (max-width: 480px) {
  .wt-header__inner { min-height: 58px; }
  .wt-brand__logo { height: 46px !important; }
}

/* Hide the category strip on very small screens; it duplicates the drawer
   topics and the horizontal scroll can feel cramped. */
@media (max-width: 420px) {
  .wt-catbar { display: none; }
}

/* ---- Search panel: stack + readable ---- */
@media (max-width: 560px) {
  .wt-search form { flex-direction: column; gap: 0.5rem; }
  .wt-search input[type="search"],
  .wt-search button { width: 100%; }
}

/* ---- Mobile drawer: cleaner, full-width feel ---- */
@media (max-width: 980px) {
  .wt-drawer {
    width: min(88vw, 340px);
    padding: 1rem;
    border-radius: 1rem 0 0 1rem;
  }
  .wt-drawer__head { margin-bottom: 0.8rem; }
  .wt-drawer h3 { margin: 1rem 0 0.35rem; }
  .wt-drawer a { padding: 0.75rem 0.5rem; font-size: 1rem; }
  .wt-drawer ul { display: grid; gap: 0.1rem; }
}

/* ---- Hero (global home/blog hero) ---- */
@media (max-width: 820px) {
  .wt-hero { margin-top: 1rem; }
  .wt-feature { min-height: 280px; }
  .wt-feature__title { font-size: clamp(1.25rem, 1rem + 1.4vw, 1.7rem); }
}

@media (max-width: 560px) {
  .wt-mini { grid-template-columns: 72px 1fr; gap: 0.75rem; padding: 0.6rem; }
  .wt-mini__thumb { width: 72px; height: 72px; }
}

/* ---- Cards ---- */
@media (max-width: 520px) {
  .wt-card { padding: 0.9rem; gap: 0.9rem; }
  .wt-card__thumb { height: 150px; }
  .wt-card h3 { font-size: 1.05rem; }
  .wt-card__excerpt { font-size: 0.92rem; }
}

/* ---- Article / page typography ---- */
@media (max-width: 700px) {
  .wt-article__header { margin-bottom: 1rem; }
  .wt-article__title { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.1rem); }
  .wt-meta { gap: 0.4rem 0.75rem; }
  .wt-prose { font-size: 1rem; line-height: 1.7; }
  /* Justified text creates ugly rivers on narrow screens; force left alignment. */
  .wt-prose [style*="text-align: justify"],
  .wt-prose .has-text-align-justify { text-align: left !important; }
  .wt-prose h2 { font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem); }
  .wt-prose h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); }
  .wt-prose h2, .wt-prose h3 { scroll-margin-top: 90px; }
  .wt-prose pre { padding: 0.9rem 1rem; font-size: 0.85rem; }
  .wt-prose img.alignleft,
  .wt-prose img.alignright,
  .wt-prose .alignleft,
  .wt-prose .alignright {
    float: none;
    display: block;
    margin: 1rem auto;
    max-width: 100%;
  }
}

/* ---- Comments form ---- */
@media (max-width: 620px) {
  .wt-respond { padding: 1rem; }
  .commentlist li.comment { padding: 0.9rem 1rem; }
}

/* ---- Pagination ---- */
@media (max-width: 420px) {
  .wt-pagination .page-numbers {
    min-width: 38px;
    height: 38px;
    font-size: 0.92rem;
  }
}

/* ---- Footer ---- */
@media (max-width: 720px) {
  .wt-footer__top { grid-template-columns: 1fr; gap: 1.8rem; }
  .wt-footer__col:not(:last-child) { border-bottom: 1px solid oklch(1 0 0 / 0.08); padding-bottom: 1.2rem; }
  .wt-footer__bar .wt-wrap { flex-direction: column; text-align: center; gap: 0.8rem; }
}

@media (max-width: 420px) {
  .wt-social { justify-content: center; }
}

/* =========================================================================
   Landing page (front-page.php) mobile polish
   ========================================================================= */

/* Compact the enormous front-page hero. On tablet/small desktop the visual
   drops below the text so the headline stays readable. */
@media (max-width: 919px) {
  .wt-lp-hero { padding-block: clamp(2.5rem, 7vw, 4rem) 0; }
  .wt-lp-hero__grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-bottom: clamp(3rem, 8vw, 5rem);
  }
  .wt-lp-hero__visual { min-height: 240px; }
  .wt-lp-hero__title { font-size: clamp(1.9rem, 1.2rem + 3vw, 2.8rem); }
  .wt-lp-hero__lead { font-size: 1rem; }
  .wt-lp-search { padding: 0.35rem 0.35rem 0.35rem 0.9rem; }
  .wt-lp-search .wt-btn { padding: 0.6rem 1.1rem; }
}

@media (max-width: 600px) {
  .wt-lp-hero__grid { padding-bottom: clamp(2.5rem, 7vw, 4rem); }
  .wt-lp-hero__title { font-size: clamp(1.7rem, 1.1rem + 2.8vw, 2.2rem); line-height: 1.1; }
  .wt-lp-hero__lead { margin-top: 1rem; }
  /* Keep the water/molecule visual on mobile, full-width and uncropped. */
  .wt-lp-hero__visual {
    width: 100%;
    max-width: none;
    min-height: 260px;
    margin-inline: auto;
  }
  .wt-lp-hero3d,
  .wt-hero3d-canvas { width: 100%; height: 100%; }
  .wt-lp-search {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius);
    padding: 0.6rem;
    gap: 0.5rem;
    margin-top: 1.5rem;
  }
  .wt-lp-search__icon { display: none; }
  .wt-lp-search input { width: 100%; padding: 0.65rem 0.5rem; }
  .wt-lp-search .wt-btn { width: 100%; justify-content: center; }
  .wt-lp-hero__cta { margin-top: 1.2rem; gap: 1rem; }
  .wt-lp-trust {
    gap: 1rem 1.8rem;
    padding-top: 1.2rem;
    justify-content: center;
  }
  .wt-lp-trust div { text-align: center; }
  .wt-lp-trust dt { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem); }
}

/* Marquee: slow it down a touch on small screens so it isn't a blur. */
@media (max-width: 600px) {
  .wt-marquee__track { animation-duration: 56s; gap: 1rem; }
  .wt-marquee span { font-size: 0.85rem; }
}

/* Topic bento: always single-column on narrow screens for cleanliness. */
@media (max-width: 680px) {
  .wt-lp-bento { grid-template-columns: 1fr; }
  .wt-lp-topic--lg,
  .wt-lp-topic--md { grid-column: auto; grid-row: auto; }
  .wt-lp-topic { padding: 1.1rem; }
  .wt-lp-topic__name { font-size: 1.15rem; }
}

/* Random articles grid: single column below a reasonable width. */
@media (max-width: 560px) {
  .wt-lp-articles-grid { grid-template-columns: 1fr; }
  .wt-lp-article-card { padding: 1.2rem; }
}

/* Featured band: lead card shorter, side list compact. */
@media (max-width: 880px) {
  .wt-lp-lead { min-height: 300px; }
  .wt-lp-feature-side { gap: 0.7rem; }
}

@media (max-width: 600px) {
  .wt-lp-lead { min-height: 260px; }
  .wt-lp-lead__body { padding: 1.1rem; }
  .wt-lp-mini { padding: 0.9rem 1rem; }
}

/* Authority section: badge doesn't overlap edge on small screens. */
@media (max-width: 820px) {
  .wt-lp-authority { grid-template-columns: 1fr; }
  .wt-lp-authority__media { max-width: 420px; margin-inline: auto; }
  .wt-lp-authority__badge {
    left: auto;
    right: 12px;
    bottom: 16px;
    padding: 0.55rem 0.85rem;
  }
}

/* Resources: single column on narrow screens. */
@media (max-width: 620px) {
  .wt-lp-resources { grid-template-columns: 1fr; }
  .wt-lp-resource { padding: 1.2rem; }
}

/* Closing CTA: comfortable vertical stacking. */
@media (max-width: 560px) {
  .wt-lp-cta__inner { padding-block: clamp(2.5rem, 6vw, 4rem); }
  .wt-lp-cta h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2rem); }
  .wt-lp-cta__actions { flex-direction: column; gap: 0.9rem; }
}

/* Section heads: keep headings and "more" link from fighting. */
@media (max-width: 560px) {
  .wt-lp-sectionhead--row { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .wt-lp-sectionhead h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); }
}

/* =========================================================================
   Blog index (home.php) mobile polish
   ========================================================================= */
@media (max-width: 700px) {
  .wt-blog-head { padding-block: 1.6rem 1.2rem; }
  .wt-blog-head__title { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.2rem); }
  .wt-blog-head__lead { font-size: 1rem; }
  .wt-blog-head__topics { margin-top: 1rem; }
  .wt-blog-head__topics a { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
}

@media (max-width: 420px) {
  .wt-blog-head__topics a { width: 100%; justify-content: space-between; }
}

/* =========================================================================
   Layout: sidebar stacking earlier for a cleaner reading view
   ========================================================================= */
@media (max-width: 900px) {
  .wt-layout.has-sidebar {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .wt-sidebar {
    position: static;
    order: 1;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .wt-content { order: 0; }
}

@media (max-width: 580px) {
  .wt-sidebar { grid-template-columns: 1fr; }
}

/* =========================================================================
   Ads: never overflow the viewport
   ========================================================================= */
.wt-ad,
.wt-card--ad,
.wt-lp-adwrap,
.wt-card-ad,
.wt-widget .wt-ad {
  max-width: 100%;
  box-sizing: border-box;
}

ins.adsbygoogle {
  max-width: 100% !important;
  overflow: hidden;
}

/* =========================================================================
   Utilities / accessibility
   ========================================================================= */
/* Increase touch targets for any small inline links in content. */
.wt-prose a { display: inline; }

/* Never let preformatted blocks blow out the viewport. */
pre { white-space: pre; word-wrap: normal; overflow-x: auto; }

/* Respect reduced motion globally on mobile. */
@media (prefers-reduced-motion: reduce) {
  .wt-lp-hero__visual,
  .wt-water,
  .wt-hero3d-canvas { display: none !important; }
}
