/*
 * Saiwenna Visual System 0.15.0 — V1G final polish.
 * Presentation only. No menu, tracking, form, content, SEO or Polylang logic.
 */

/* P0: keep the existing WhatsApp element and event/data hooks, compact its presentation. */
@media (max-width: 1599px) {
  .qlwapp__container.qlwapp__container--bottom-right {
    inset-inline-start: auto;
    inset-inline-end: max(14px, env(safe-area-inset-right));
    inset-block-end: max(16px, env(safe-area-inset-bottom));
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .qlwapp__container.qlwapp__container--bottom-right .qlwapp__button.qlwapp__button--button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 48px;
    min-inline-size: 48px;
    max-inline-size: 48px;
    block-size: 48px;
    min-block-size: 48px;
    margin: 0;
    padding: 0;
    border-radius: 999px;
  }

  html:not([dir="rtl"]) .qlwapp__container.qlwapp__container--bottom-right {
    left: auto !important;
    right: 14px !important;
  }

  html[dir="rtl"] .qlwapp__container.qlwapp__container--bottom-right {
    right: auto !important;
    left: 14px !important;
  }

  .qlwapp__container.qlwapp__container--bottom-right .qlwapp__text {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .qlwapp__container.qlwapp__container--bottom-right {
    inset-inline-end: max(12px, env(safe-area-inset-right));
    inset-block-end: max(12px, env(safe-area-inset-bottom));
  }
}

.qlwapp__button.qlwapp__button--button:focus-visible {
  outline: 3px solid rgba(15, 114, 135, .34);
  outline-offset: 3px;
}

/* P1: mobile Header and language controls use comfortable, consistent targets. */
@media (max-width: 921px) {
  .menu-toggle.main-header-menu-toggle,
  .saiwenna-language-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
  }

  .saiwenna-language-dropdown-menu a {
    display: flex;
    align-items: center;
    min-block-size: 44px;
    padding-block: 10px;
    line-height: 1.35;
    white-space: normal;
  }

  .ast-mobile-popup-content .menu-link,
  .ast-mobile-header-content .menu-link {
    min-block-size: 48px;
    line-height: 1.35;
    white-space: normal;
  }
}

/* P1: Arabic desktop navigation remains one controlled row; no CLS workaround. */
@media (min-width: 922px) {
  body.rtl #primary-site-navigation-desktop .menu-link {
    padding-inline: clamp(4px, .42vw, 7px);
    font-size: clamp(.76rem, .66vw, .86rem);
    white-space: nowrap;
  }

  body.rtl .ast-custom-button-link,
  body.rtl .ast-custom-button {
    display: inline-flex;
    align-items: center;
    align-self: center;
    inline-size: auto;
    min-block-size: 44px;
    block-size: 44px;
    max-block-size: 52px;
    padding-block: 10px;
    line-height: 1.25;
  }

  body.rtl :where(.ast-builder-button-wrap, .ast-header-button-1, .site-header-section) {
    align-items: center;
    align-self: center;
  }
}

/* P1: bounded non-English mobile title tiers; English remains unchanged. */
@media (max-width: 560px) {
  html:not([lang^="en"]) :where(
    .swv1-homepage,
    .swv1-completed-case,
    .swv1-quotation,
    .swv1-control,
    .swv1-technical,
    .swv1-outdoor
  ) h1 {
    max-inline-size: 100%;
    font-size: clamp(1.82rem, 7.6vw, 2rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  html:not([lang^="en"]) :where(
    .swv1-guide,
    .swv1-resource,
    .swv1-dealer,
    .swv1-trust,
    .swv1-products-hub,
    .swv1-product-detail,
    .swv1-application,
    .swv1-projects-hub,
    .swv1-legal
  ) h1 {
    max-inline-size: 100%;
    font-size: clamp(1.86rem, 7.8vw, 2.06rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  html[lang^="ar"] :where([class*="swv1-"]) h1 {
    letter-spacing: 0;
    line-height: 1.18;
    hyphens: none;
  }

  html:where([lang^="de"], [lang^="fr"], [lang^="pt"], [lang^="es"], [lang^="tr"])
  :where([class*="swv1-"]) h1 {
    hyphens: auto;
  }
}

/* Dealer Support: preserve content while reducing equal card/CTA weight. */
.swv1-dealer--support .swv1-dealer-section {
  margin-block: clamp(30px, 4vw, 52px);
}

.swv1-dealer--support .swv1-dealer-card {
  box-shadow: none;
  border-color: #dde7eb;
}

.swv1-dealer--support .swv1-dealer-section:nth-of-type(n + 4):not(:last-of-type) .swv1-dealer-card {
  padding: clamp(17px, 2vw, 22px);
  background: #fbfcfd;
}

.swv1-dealer--support .swv1-dealer-section:not(:first-of-type):not(:last-of-type)
  .swv1-action:not(.swv1-download-link) {
  min-block-size: 44px;
  padding-inline: 0;
  border-radius: 0;
  background: transparent;
  color: #0f7287;
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

.swv1-dealer--support .swv1-dealer-final {
  margin-block-start: clamp(42px, 6vw, 72px);
}

.swv1-dealer--support .saiwenna-entry-audit .swv1-action {
  padding-inline: 16px;
  border-radius: 999px;
  background: #0f7287;
  color: #fff !important;
  text-decoration: none;
}

body .swv1-dealer.swv1-dealer--support a.wp-block-button__link.wp-element-button.swv1-action[href$="/products/"],
body .swv1-dealer.swv1-dealer--support a.wp-block-button__link.wp-element-button.swv1-action[href$="/products/"]:visited {
  background: #fff !important;
  border-color: #fff !important;
  color: #173b63 !important;
  text-decoration: none;
}

.swv1-dealer--support .swv1-dealer-final .swv1-action,
.swv1-dealer--support .swv1-dealer-final .swv1-action:visited {
  background: #0f7287 !important;
  background-color: #0f7287 !important;
  border-color: #0f7287 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  text-decoration: none;
}

/* About and Trust: fewer visual boxes, stronger narrative whitespace. */
.swv1-trust--about .swv1-trust-card,
.swv1-trust--delivery .swv1-trust-card {
  padding-inline: 0;
  border: 0;
  border-block-start: 1px solid #dbe6ea;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.swv1-trust--about .swv1-trust-section,
.swv1-trust--delivery .swv1-trust-section {
  margin-block: clamp(38px, 5.6vw, 72px);
}

.swv1-trust--about .swv1-trust-section:first-of-type,
.swv1-trust--delivery .swv1-trust-section:first-of-type {
  max-inline-size: 1040px;
}

/* Certifications: clarify evidence sequence without changing ownership language. */
.swv1-trust--certifications .swv1-trust-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 28px);
}

.swv1-trust--certifications .swv1-trust-card {
  min-inline-size: 0;
  box-shadow: none;
  background: #fff;
}

.swv1-trust--certifications .swv1-trust-media {
  border: 1px solid #d7e3e8;
  background: #f8fbfc;
}

@media (max-width: 720px) {
  .swv1-trust--certifications .swv1-trust-grid {
    grid-template-columns: 1fr;
  }
}

/* Dealer Matcher: improve contrast and selected/focus state only. */
.swv1-dealer--matcher .hero {
  background: #173b63;
  color: #fff;
}

.swv1-dealer--matcher .hero :where(h1, h2, h3, p, li) {
  color: inherit;
}

.swv1-dealer--matcher .hero .sub {
  color: #e5f0f4;
}

.swv1-dealer--matcher .card,
.swv1-dealer--matcher .gate {
  border-color: #c9d9e0;
  background: #f8fbfc;
  color: #203b4b;
}

.swv1-dealer--matcher :where(.opt, .chk) {
  min-block-size: 48px;
  border: 1px solid #b8ccd4;
  border-radius: 12px;
  background: #fff;
  color: #203b4b;
}

.swv1-dealer--matcher .hint,
.swv1-dealer--matcher .odesc {
  color: #3f5967;
}

.swv1-dealer--matcher :where(.opt, .chk) .odesc {
  color: #3f5967 !important;
  font-size: max(.875rem, 1em);
}

.swv1-dealer--matcher :where(#gate, .ok-msg) p[style*="color"] {
  color: #3f5967 !important;
  font-size: max(.875rem, 1em) !important;
}

.swv1-dealer--matcher :where(.opt, .chk):has(input:checked) {
  border-color: #0f7287;
  background: #eaf5f7;
  box-shadow: 0 0 0 2px rgba(15, 114, 135, .14);
}

.swv1-dealer--matcher :where(.opt, .chk):focus-within,
.swv1-dealer--matcher .bt:focus-visible {
  outline: 3px solid rgba(15, 114, 135, .26);
  outline-offset: 2px;
}

.swv1-dealer--matcher .bt {
  min-block-size: 48px;
  border-radius: 999px;
  font-weight: 750;
}

/* Projects Hub: secondary links become lighter; evidence/status hierarchy stays intact. */
.swv1-projects-hub :where(.swv1-application-grid, .swv1-resource-grid) .swv1-link-card {
  padding: 18px 0;
  border: 0;
  border-block-start: 1px solid #dbe6ea;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.swv1-projects-hub .swv1-portfolio-grid .swv1-card-compact {
  border-color: #dce7eb;
  background: #fbfcfd;
  box-shadow: none;
}

.swv1-projects-hub .swv1-process-item {
  border-inline-start: 3px solid #0f7287;
  background: #f4f9fa;
  box-shadow: none;
}

.swv1-projects-hub .swv1-stage-grid {
  gap: clamp(18px, 2.4vw, 28px);
}

/* Common final-layer focus treatment; no wording or tracking changes. */
:where(
  .swv1-dealer--support,
  .swv1-dealer--matcher,
  .swv1-trust--about,
  .swv1-trust--delivery,
  .swv1-trust--certifications,
  .swv1-projects-hub
) :where(a, button, [tabindex="0"]):focus-visible {
  outline: 3px solid rgba(15, 114, 135, .28);
  outline-offset: 3px;
}

/* V1G final H1 gate: two bounded language/family tiers, never page-ID hacks. */
@media (max-width: 560px) {
  html:not([lang^="en"]) .swv1-completed-case .swv1-case-hero .swv1-h1 {
    font-size: clamp(1.72rem, 7vw, 1.9rem);
    line-height: 1.08;
  }

  html[lang^="pt"] .swv1-control .swv1-control-hero h1 {
    font-size: clamp(1.5rem, 6.2vw, 1.65rem);
    line-height: 1.08;
  }
}
