/* ==========================================================================
   PDP responsive fixes (desktop / laptop)
   Loaded after pdp-summary.css, product-gallery.css and pdp-mobile.css.
   The mobile layout (pdp-mobile.css) covers everything up to 1024px, so the
   rules here only adjust the desktop layout above that.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variant cards (desktop): grid that fits the summary column instead
   of fixed 220px cards inside a fixed 452px box (which fell to one card per
   row whenever the column was narrower than 452px).
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .ksq-pdp-variants {
    width: 100%;
    max-width: 560px;
  }

  .ksq-pdp-variants__options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }

  .ksq-pdp-variant__card {
    width: 100%;
    height: auto;
    min-height: 67px;
  }

  /* Short option names (lengths, sizes): compact chips, several per row */
  .ksq-pdp-variants__options--compact {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__card {
    min-height: 52px;
    padding: 8px 10px 8px 44px;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__check {
    left: 12px;
    width: 22px;
    height: 22px;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__check svg {
    width: 22px;
    height: 22px;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__name {
    font-size: 16px;
    line-height: 19px;
  }

  /* BNPL line: wrap inside its box instead of running past the column */
  .ksq-pdp-bnpl {
    /* box hugs the text, no empty space on the right */
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    height: auto;
    min-height: 32px;
    padding: 6px 12px;
  }

  .ksq-pdp-bnpl__text {
    white-space: normal;
    min-width: 0;
  }
}

/* --------------------------------------------------------------------------
   Mini review slider in the buy box: fixed 428px text column pushed the
   reviewer's location past the box on narrower columns.
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .ksq-pdp-review-slide__content {
    width: auto;
    min-width: 0;
    max-width: 428px;
  }

  .ksq-pdp-review-slide__header {
    gap: 8px;
    min-width: 0;
  }

  .ksq-pdp-review-slide__stars-name {
    flex-shrink: 0;
  }

  .ksq-pdp-review-slide__location {
    display: block;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ksq-pdp-review-slide__location .ksq-country-flag {
    display: inline-block;
    vertical-align: middle;
    margin: -2px 6px 0 0;
  }
}

/* --------------------------------------------------------------------------
   Small laptops (1200-1300): gallery 60% / buy box 40%
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) and (max-width: 1300px) {
  .single-product-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .single-product-layout__gallery {
    max-width: none;
  }

  .single-product-layout__summary {
    min-width: 0;
  }
}

/* --------------------------------------------------------------------------
   Tablets (769-1024): mobile layout, but keep the vertical thumbnails on the
   left of the main image like desktop (phones keep the full-width slider).
   Gallery block is max 600px wide: 80px thumbs + 12px gap + 508px image.
   -------------------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .ksq-gallery-wrapper {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .ksq-gallery-thumbs {
    display: flex;
    flex-direction: column;
    width: 80px;
    max-height: calc(min(600px, 100vw - 32px) - 92px); /* same height as the square image */
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 0;
  }

  .ksq-gallery-thumb {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 10px;
  }

  .ksq-product-gallery {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 12px;
  }
}

/* --------------------------------------------------------------------------
   Mobile / tablet (<=1024): other options (e.g. Quartz / Swiss Movement)
   side by side like desktop instead of one full-width button per row.
   Names may wrap to 2 lines; a subtitle sits under the name.
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .ksq-pdp-variants .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 8px !important;
  }

  /* equal height cards in the same row */
  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant {
    display: flex !important;
  }

  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__card {
    flex: 1 1 auto;
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    align-items: center !important;
    column-gap: 10px !important;
    height: auto !important;
    max-height: none !important;
    min-height: 50px !important;
    padding: 8px 12px !important;
  }

  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__check {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
  }

  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__check svg {
    width: 22px !important;
    height: 22px !important;
  }

  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__name {
    height: auto !important;
    line-height: 18px !important;
    white-space: normal !important;
  }

  /* only when there is a subtitle: tick spans both lines (name + subtitle) */
  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__card:has(.ksq-pdp-variant__sub) .ksq-pdp-variant__check {
    grid-row: 1 / span 2;
  }

  .ksq-pdp-variants__options:not(.ksq-pdp-variants__options--compact) .ksq-pdp-variant__sub {
    position: static !important;
    transform: none !important;
    grid-column: 2;
    justify-content: flex-start !important;
    margin-top: 2px !important;
  }
}

/* --------------------------------------------------------------------------
   Mobile / tablet (<=1024): short options (chain lengths) as small chips in a
   row like desktop, instead of one full-width button per option.
   (pdp-mobile.css uses !important on the variant cards, so these do too.)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .ksq-pdp-variants .ksq-pdp-variants__options--compact {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important;
    gap: 8px !important;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__card {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 10px !important;
    gap: 8px !important;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__check,
  .ksq-pdp-variants__options--compact .ksq-pdp-variant__check svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
  }

  .ksq-pdp-variants__options--compact .ksq-pdp-variant__name {
    height: 44px !important;
    line-height: 44px !important;
    font-size: 14px !important;
  }
}

/* --------------------------------------------------------------------------
   Footer bottom bar: keep phone numbers and "We Accept:" on one line
   -------------------------------------------------------------------------- */
.ksq-footer-bottom__contact-item,
.ksq-footer-bottom__payments-label {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Trustpilot + rating circles under the gallery: the row is ~670px wide and
   overlapped the buy box whenever the gallery column was narrower than that.
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) and (max-width: 1300px) {
  .ksq-trust-section {
    flex-wrap: wrap;
    gap: 16px 32px;
    max-width: calc(100% - var(--ksq-thumb-size, 100px) - 12px);
  }

  .ksq-trustpilot-bar {
    width: auto;
  }

  .ksq-rating-circles {
    flex-wrap: wrap;
    gap: 16px 24px;
  }
}

/* --------------------------------------------------------------------------
   Small phones (<=374px): long product names were cut to 2 lines with "..."
   -------------------------------------------------------------------------- */
@media (max-width: 374px) {
  .ksq-mobile-intro__title {
    -webkit-line-clamp: 3 !important;
  }
}
