/**
 * WhaleKub Appstream — header + pricing responsive fixes
 * Loaded via templates/appstream/index.php with ?v=filemtime cache-bust
 */

/* ========== Header: logo | centered pill | CTA ========== */
#sp-header.full-header-center {
  overflow: visible;
  margin-top: 16px !important;
  height: auto !important;
  min-height: 56px !important;
  display: flex !important;
  align-items: center !important;
}

#sp-header.full-header-center > .container {
  max-width: 100%;
}

#sp-header.full-header-center > .container > .container-inner {
  position: relative;
  min-height: 56px;
  display: flex;
  align-items: center;
}

#sp-header.full-header-center > .container > .container-inner > .row.align-items-center {
  flex-wrap: nowrap !important;
  align-items: center !important;
  column-gap: 12px;
  min-height: 56px;
  width: 100%;
  /* stay static so pill absolute-centers on .container-inner */
  position: static !important;
}

/* --- Logo --- */
#sp-header #sp-logo {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  position: relative;
  z-index: 3;
}

#sp-header #sp-logo .logo,
#sp-header #sp-logo .sp-column {
  display: flex;
  align-items: center;
  height: 56px;
}

#sp-header #sp-logo .logo a {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

#sp-header #sp-logo img.logo-image,
#sp-header #sp-logo img.logo-image-phone {
  height: 36px !important;
  width: auto !important;
  max-width: min(240px, 28vw) !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: left center;
}

/* Respect Helix desktop/phone logo visibility (do not force display:block) */
@media (min-width: 992px) {
  #sp-header #sp-logo img.logo-image {
    display: inline-block !important;
  }

  #sp-header #sp-logo img.logo-image-phone {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  #sp-header #sp-logo img.logo-image {
    display: none !important;
  }

  #sp-header #sp-logo img.logo-image-phone {
    display: inline-block !important;
  }
}

/* --- Menu column fills remaining; hosts centered pill + right CTA --- */
#sp-header #sp-menu {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  z-index: 2;
  /* Helix sets position:relative here — override so pill centers on page */
  position: static !important;
}

#sp-header #sp-menu > .sp-column {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px;
  min-width: 0;
  width: 100%;
  height: auto !important;
  min-height: 56px;
  /* keep static so absolute pill anchors to .container-inner (page center) */
  position: static !important;
}

/* CTA lives inside this flex row with the nav — do not stretch the nav */
#sp-header #sp-menu .menu-with-offcanvas {
  flex: 1 1 auto;
  min-width: 0;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px;
  position: static !important;
}

/* True page-center pill relative to .container-inner */
#sp-header.full-header-center #sp-menu .sp-megamenu-wrapper {
  position: absolute !important;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none;
  justify-content: center !important;
  z-index: 1;
  pointer-events: none; /* empty sides click through; links re-enabled below */
}

#sp-header.full-header-center #sp-menu .sp-megamenu-wrapper .sp-megamenu-parent,
#sp-header.full-header-center #sp-menu .sp-megamenu-wrapper a,
#sp-header.full-header-center #sp-menu .sp-megamenu-wrapper button {
  pointer-events: auto;
}

#sp-header .sp-megamenu-wrapper .sp-megamenu-parent {
  display: inline-flex !important;
  flex-wrap: nowrap;
  align-items: center;
  float: none !important;
  margin: 0 !important;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
}

#sp-header .sp-megamenu-parent > li > a,
#sp-header .sp-megamenu-parent > li > span {
  white-space: nowrap;
  line-height: 48px !important;
  height: 48px;
  display: inline-flex !important;
  align-items: center;
}

/* CTA + modules stay on the right, above the absolute pill */
#sp-header #sp-menu .sp-module,
#sp-header #sp-menu .mod-sppagebuilder,
#sp-header #sp-menu .sppb-addon-wrapper.addon-root-button,
#sp-header #sp-menu .header-modules {
  flex: 0 0 auto;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  position: relative;
  z-index: 3;
}

#sp-header #sp-menu .sppb-addon-button,
#sp-header #sp-menu .sppb-button-wrapper {
  margin: 0 !important;
}

#sp-header #sp-menu .sppb-btn {
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.2 !important;
}

#sp-header #sp-menu .social-wrap {
  flex: 0 0 auto;
  padding-left: 12px !important;
  position: relative;
  z-index: 3;
}

#sp-header #sp-menu .social-wrap:after {
  display: none !important;
}

/* ----- ≤1600: slightly tighter logo / pill ----- */
@media (max-width: 1599.98px) {
  #sp-header #sp-logo img.logo-image {
    height: 34px !important;
    max-width: min(220px, 24vw) !important;
  }

  #sp-header .sp-megamenu-wrapper .sp-megamenu-parent {
    height: 46px;
    padding: 0 14px;
  }

  #sp-header .sp-megamenu-parent > li > a,
  #sp-header .sp-megamenu-parent > li > span {
    line-height: 46px !important;
    height: 46px;
    padding: 0 10px;
  }
}

/* ----- lg–xl: prevent pill colliding with logo/CTA ----- */
@media (min-width: 992px) and (max-width: 1399.98px) {
  #sp-header #sp-logo img.logo-image {
    height: 32px !important;
    max-width: min(200px, 22vw) !important;
  }

  #sp-header .sp-megamenu-wrapper .sp-megamenu-parent {
    height: 44px;
    padding: 0 10px;
  }

  #sp-header .sp-megamenu-parent > li > a,
  #sp-header .sp-megamenu-parent > li > span {
    padding: 0 7px;
    font-size: 14px;
    line-height: 44px !important;
    height: 44px;
  }

  #sp-header #sp-menu .sppb-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  #sp-header #sp-menu .social-wrap {
    padding-left: 8px !important;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  #sp-header #sp-logo img.logo-image {
    height: 30px !important;
    max-width: min(170px, 20vw) !important;
  }

  #sp-header .sp-megamenu-parent > li > a,
  #sp-header .sp-megamenu-parent > li > span {
    padding: 0 5px;
    font-size: 13px;
  }

  /* hide social so CTA + pill have room */
  #sp-header #sp-menu .social-wrap {
    display: none !important;
  }
}

/* Mid desktop: keep absolute center; tighten pill further to avoid logo/CTA collision */
@media (min-width: 992px) and (max-width: 1099.98px) {
  #sp-header #sp-logo img.logo-image {
    height: 28px !important;
    max-width: min(150px, 18vw) !important;
  }

  #sp-header .sp-megamenu-wrapper .sp-megamenu-parent {
    height: 40px;
    padding: 0 8px;
  }

  #sp-header .sp-megamenu-parent > li > a,
  #sp-header .sp-megamenu-parent > li > span {
    padding: 0 4px;
    font-size: 12.5px;
    line-height: 40px !important;
    height: 40px;
  }

  #sp-header #sp-menu .sppb-btn {
    padding: 7px 12px !important;
    font-size: 12px !important;
  }
}

/* ----- tablet / mobile: logo + CTA + burger ----- */
@media (max-width: 991.98px) {
  #sp-header.full-header-center {
    margin-top: 10px !important;
  }

  #sp-header.full-header-center > .container > .container-inner > .row.align-items-center {
    flex-wrap: nowrap !important;
    min-height: 50px;
  }

  #sp-header #sp-logo .logo,
  #sp-header #sp-logo .sp-column {
    height: 50px;
  }

  #sp-header #sp-logo img.logo-image,
  #sp-header #sp-logo img.logo-image-phone {
    height: 28px !important;
    max-width: min(160px, 42vw) !important;
  }

  #sp-header #sp-menu {
    flex: 1 1 auto;
  }

  #sp-header #sp-menu > .sp-column {
    justify-content: flex-end !important;
    min-height: 50px;
  }

  /* desktop megamenu hidden on mobile — don't keep absolute wrapper */
  #sp-header.full-header-center #sp-menu .sp-megamenu-wrapper {
    position: static !important;
    left: auto;
    top: auto;
    transform: none;
    pointer-events: auto;
  }

  #sp-header .sp-megamenu-wrapper > .sp-megamenu-parent {
    display: none !important;
  }

  /* Hide duplicate burger rendered inside megamenu; keep the trailing .mega one */
  #sp-header.full-header-center .menu-with-offcanvas #offcanvas-toggler,
  #sp-header.full-header-center nav.sp-megamenu-wrapper #offcanvas-toggler {
    display: none !important;
  }

  #sp-header.full-header-center .sp-column > a#offcanvas-toggler,
  #sp-header.full-header-center .sp-column > a#offcanvas-toggler.mega,
  #sp-header.full-header-center .sp-column > a.offcanvas-toggler-secondary {
    display: flex !important;
    align-items: center !important;
    margin-left: 4px;
    height: 50px;
    line-height: 50px;
    position: relative;
    z-index: 3;
  }

  #sp-header #sp-menu .menu-with-offcanvas {
    flex: 0 0 auto;
    justify-content: flex-end !important;
    gap: 8px;
  }

  #sp-header #sp-menu .social-wrap {
    display: none !important;
  }

  #sp-header #sp-menu .sppb-hidden-xs {
    display: flex !important;
  }

  #sp-header #sp-menu .sppb-btn {
    padding: 7px 12px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 575.98px) {
  #sp-header #sp-logo img.logo-image,
  #sp-header #sp-logo img.logo-image-phone {
    height: 24px !important;
    max-width: min(140px, 48vw) !important;
  }

  #sp-header #sp-menu .sppb-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
  }
}

/* ========== SPPB titles: mid-screen typography (site-wide) ==========
   SPPB stores large font-size + negative letter-spacing + tight px line-height.
   On mid widths text wraps → lines collide. Desktop (single line) & mobile
   (SPPB already shrinks) look fine; fix the Bootstrap md–xl band. */
@media (max-width: 1399.98px) {
  #sp-page-builder .sppb-addon-header .sppb-addon-title,
  #sp-page-builder .sppb-addon-title {
    letter-spacing: -0.02em !important;
    line-height: 1.35 !important;
    overflow-wrap: break-word;
    word-break: normal;
  }
}

@media (max-width: 1199.98px) {
  #sp-page-builder .sppb-addon-header .sppb-addon-title,
  #sp-page-builder .sppb-addon-title {
    letter-spacing: -0.015em !important;
    line-height: 1.4 !important;
  }

  /* Soften huge display headings (inline 48–64px) */
  #sp-page-builder h1.sppb-addon-title,
  #sp-page-builder h2.sppb-addon-title {
    font-size: clamp(28px, 4.6vw, 48px) !important;
  }

  /* Card / column titles: readable wrapping, no collision */
  #sp-page-builder .sppb-row-column .sppb-addon-header .sppb-addon-title {
    letter-spacing: -0.01em !important;
    line-height: 1.35 !important;
  }

  /* Features section display titles (h3 with huge SPPB inline size) */
  #section-id-26e0a026-260d-4065-a917-2ce12f3f1a93 .sppb-addon-title,
  #section-id-baeaed1a-43d4-4755-99d4-4f217dd53290 .sppb-addon-title {
    font-size: clamp(28px, 4.2vw, 44px) !important;
  }
}

@media (max-width: 991.98px) {
  #sp-page-builder .sppb-addon-header .sppb-addon-title,
  #sp-page-builder .sppb-addon-title {
    letter-spacing: -0.01em !important;
    line-height: 1.4 !important;
  }

  #sp-page-builder h1.sppb-addon-title,
  #sp-page-builder h2.sppb-addon-title {
    font-size: clamp(26px, 6vw, 40px) !important;
  }
}

/* Features: 3-up service cards → stack on mid (too narrow for Thai titles) */
@media (max-width: 1199.98px) {
  #section-id-87e02af0-b454-4963-bf51-4150be6b85b1 .sppb-row > .sppb-row-column,
  #section-id-0dbdbe98-14e1-44da-bbba-84469ba24543 .sppb-row > .sppb-row-column {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* Carousel “สิ่งที่ WhaleKub ทำ”: keep card text readable on mid widths */
@media (max-width: 1199.98px) {
  #sp-page-builder .sppb-carousel-extended-item {
    height: auto !important;
    min-height: 0 !important;
  }

  #sp-page-builder .sppb-carousel-extended-item .sppb-addon-title,
  #sp-page-builder .sppb-carousel-extended-item .sppb-addon-text,
  #sp-page-builder .sppb-carousel-extended-item p {
    overflow: visible !important;
    white-space: normal !important;
    line-height: 1.45 !important;
    letter-spacing: -0.01em !important;
  }

  #sp-page-builder .sppb-carousel-extended-list {
    overflow: hidden !important; /* clip side clones; avoid page-wide spill */
  }
}

/* ========== Pricing cards: responsive polish ========== */
@media (max-width: 1199.98px) {
  #sp-page-builder .wk-pf-col .sppb-addon-single-image img,
  #sp-page-builder .wk-pf-col .wk-pf-img img {
    height: 120px !important;
  }
}

@media (max-width: 991.98px) {
  /* 2-up pricing cards on tablet (instead of crushed 4-up) */
  #sp-page-builder .sppb-row.sppb-nested-row > .sppb-row-column:has(.wk-pf-col) {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }

  #sp-page-builder .wk-pf-col .sppb-addon-single-image img,
  #sp-page-builder .wk-pf-col .wk-pf-img img {
    height: 140px !important;
  }

  #sp-page-builder .wk-pf-col .pricing-item .sppb-addon-header .sppb-addon-title {
    font-size: clamp(28px, 5vw, 40px) !important;
  }
}

@media (max-width: 575.98px) {
  #sp-page-builder .sppb-row.sppb-nested-row > .sppb-row-column:has(.wk-pf-col) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  #sp-page-builder .wk-pf-col .sppb-addon-single-image img,
  #sp-page-builder .wk-pf-col .wk-pf-img img {
    height: 110px !important;
  }
}
