/* Shared responsive layout. Keep the original large desktop design intact. */

/* A quote dialog must stay inside the available screen at any browser zoom. */
.hero-quote-modal {
  overflow-y: auto;
}
.hero-quote-dialog {
  max-height: calc(100vh - 32px) !important;
  max-height: calc(100dvh - 32px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

/* Notebook displays and shorter desktop windows need content-driven height. */
@media (min-width: 851px) and (max-width: 1600px),
       (min-width: 851px) and (max-height: 900px) {
  body:not(.support-page) .hero {
    height: auto !important;
    min-height: 0 !important;
    padding: clamp(24px, 3.5vh, 44px) 0 !important;
  }
  body:not(.support-page) .hero-grid {
    height: auto !important;
    min-height: 245px !important;
  }
  body:not(.support-page) .hero-copy {
    min-width: 0;
  }
  body:not(.support-page) .hero-desktop-actions {
    flex-wrap: wrap !important;
  }
  body:not(.support-page) .home-categories {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 30px 0 58px !important;
  }
  body:not(.support-page) .home-categories > .wrap {
    height: auto !important;
    display: block !important;
  }
  body:not(.support-page) .category-grid {
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
  }
  body:not(.support-page) .category-card {
    height: auto !important;
    min-width: 0;
  }
  body:not(.support-page) .category-media {
    flex: none !important;
    height: clamp(175px, 16vw, 230px) !important;
    min-height: 0 !important;
  }
  body:not(.support-page) .category-copy {
    min-width: 0;
  }
}

/* Keep the same cards and colors while giving their text enough room. */
@media (min-width: 851px) and (max-width: 1199px) {
  body:not(.support-page) .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .contact-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 32px !important;
  }
  .contact-grid > * {
    min-width: 0;
  }
}

/* Product cards use a full row before their two-column contents get cramped. */
@media (min-width: 851px) and (max-width: 1100px) {
  .support-page .cards {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .support-page .card {
    min-width: 0;
  }
  .support-page .card-body,
  .support-page .card-media {
    min-width: 0;
  }
}

/* The already compact tablet and phone designs keep their own columns. */
@media (max-width: 850px) {
  .hero-quote-modal {
    padding: 12px !important;
    align-items: center;
  }
  .hero-quote-dialog {
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }
  .contact-grid,
  .about-grid,
  .bundle-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .contact-grid > *,
  .about-grid > *,
  .bundle-grid > * {
    min-width: 0;
  }
}

/* Desktop category inventory: one complete product per horizontal row. */
@media (min-width: 851px) {
  .support-page .sound-system-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }
  .support-page .sound-system-card,
  .support-page .sound-system-card:last-child {
    display: grid !important;
    grid-template-columns: clamp(195px, 22vw, 260px) minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    grid-column: auto !important;
    justify-self: stretch !important;
    border-radius: 18px !important;
    overflow: hidden !important;
  }
  .support-page .sound-system-media {
    height: 100% !important;
    min-height: 210px !important;
    border-bottom: 0 !important;
    border-right: 1px solid var(--line) !important;
    padding: 10px !important;
  }
  .support-page .sound-system-media > .img-link {
    width: 100%;
    height: 100%;
  }
  .support-page .sound-system-media > .img-link img {
    object-fit: contain !important;
    padding: 6px !important;
  }
  .support-page .mic-media-combo {
    height: 100% !important;
    min-height: 0 !important;
    padding: 8px !important;
  }
  .support-page .mic-media-combo .mic-product-link img {
    max-height: 220px !important;
  }
  .support-page .sound-system-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) clamp(165px, 18vw, 210px) !important;
    grid-template-rows: auto auto auto 1fr;
    column-gap: 24px;
    align-content: start;
    min-width: 0;
    padding: 18px 22px !important;
  }
  .support-page .sound-system-body > h3 {
    grid-column: 1;
    grid-row: 1;
    margin: 0 0 7px !important;
    font-size: clamp(1.18rem, 1.6vw, 1.48rem) !important;
    line-height: 1.12;
  }
  .support-page .sound-best {
    grid-column: 1;
    grid-row: 2;
    min-height: 0 !important;
    margin: 0 0 8px !important;
    font-size: .86rem !important;
    line-height: 1.38;
  }
  .support-page .sound-specs {
    grid-column: 1;
    grid-row: 3;
    gap: 4px !important;
    margin: 0 0 10px !important;
  }
  .support-page .sound-specs li {
    font-size: .8rem !important;
    line-height: 1.35;
  }
  .support-page .sound-dimensions {
    grid-column: 1;
    grid-row: 4;
    align-self: end;
    margin: 0 !important;
    padding-top: 8px !important;
    gap: 3px !important;
    font-size: .72rem !important;
  }
  .support-page .sound-price {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
    margin: 0 0 10px !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .support-page .sound-price-value {
    font-size: clamp(1.7rem, 2.6vw, 2.3rem) !important;
    line-height: 1.05;
  }
  .support-page .sound-system-card .support-add {
    grid-column: 2;
    grid-row: 3 / span 2;
    align-self: start;
    width: 100% !important;
    min-height: 50px !important;
    margin: 0 !important;
    padding: 12px 14px !important;
    border-radius: 10px !important;
  }
}

@media (min-width: 851px) and (max-width: 1050px) {
  .support-page .sound-system-card,
  .support-page .sound-system-card:last-child {
    grid-template-columns: 185px minmax(0, 1fr) !important;
  }
  .support-page .sound-system-body {
    grid-template-columns: minmax(0, 1fr) 150px !important;
    column-gap: 15px;
    padding: 15px !important;
  }
  .support-page .sound-system-media {
    min-height: 190px !important;
  }
}

/* The portrait Totem photo should not determine the entire Lighting row height. */
@media (min-width: 851px) {
  .support-page .sound-system-card.totem-card {
    grid-column: auto !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
  }
  .support-page .totem-card .sound-system-media {
    height: auto !important;
    min-height: 0 !important;
  }
  .support-page .totem-card .sound-system-media > .img-link img {
    display: block;
    width: auto !important;
    height: 210px !important;
    max-width: 100% !important;
    max-height: 210px !important;
    padding: 0 !important;
    object-fit: contain !important;
  }
}


/* MOBILE CATEGORY TAB AFFORDANCE
   A small red chevron is always visible on phones so the five category labels
   read as tappable navigation rather than static text. */
@media(max-width:650px){
  .mobile-category-nav a,
  .mobile-category-switcher a{
    cursor:pointer !important;
    touch-action:manipulation;
    -webkit-tap-highlight-color:rgba(255,79,79,.12);
  }

  .mobile-category-nav a::after,
  .mobile-category-switcher a::after{
    content:"›" !important;
    display:inline-block !important;
    position:static !important;
    width:auto !important;
    height:auto !important;
    margin-left:3px !important;
    border:0 !important;
    background:none !important;
    color:var(--red) !important;
    font-size:.88em !important;
    font-weight:900 !important;
    line-height:1 !important;
    transform:none !important;
    opacity:.95 !important;
  }

  .mobile-category-nav a:active,
  .mobile-category-switcher a:active{
    color:var(--red) !important;
    background:rgba(255,79,79,.07) !important;
    border-radius:7px !important;
  }
}


/* CONTACT navigation intentionally begins at the ABOUT section.
   Extra scroll margin leaves a little breathing room above ABOUT. */
#about{
  scroll-margin-top:152px !important;
}
@media(max-width:850px){
  #about{
    scroll-margin-top:122px !important;
  }
}


/* Category labels are visibly tappable/clickable on every device. */
.mobile-category-nav .category-nav-arrow,
.mobile-category-switcher .category-nav-arrow{
  display:inline-block;
  margin-left:4px;
  color:var(--red) !important;
  font-size:.92em;
  font-weight:900;
  line-height:1;
  transform:translateY(-.02em);
  pointer-events:none;
}

/* The mobile version previously drew its arrow with ::after.
   Suppress that duplicate now that the real arrow span is present. */
@media(max-width:650px){
  .mobile-category-nav a::after,
  .mobile-category-switcher a::after{
    content:none !important;
  }
}


/* ===== FIXED DESKTOP PRODUCT IMAGE PANEL HEIGHT =====
   Collapsing/expanding MORE DETAILS must only change the text side.
   The product image panel stays the same height at all times. */
@media (min-width: 851px) {
  .support-page .sound-system-card .sound-system-media,
  .support-page .sound-system-card.totem-card .sound-system-media {
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    align-self: start !important;
  }

  .support-page .sound-system-card .sound-system-media > .img-link,
  .support-page .sound-system-card .mic-media-combo {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }

  .support-page .sound-system-card .sound-system-media > .img-link img {
    max-height: 100% !important;
  }

  .support-page .sound-system-card.totem-card .sound-system-media > .img-link img {
    height: 250px !important;
    max-height: 250px !important;
  }
}

/* Slightly shorter fixed panel on narrow desktop/laptop windows. */
@media (min-width: 851px) and (max-width: 1050px) {
  .support-page .sound-system-card .sound-system-media,
  .support-page .sound-system-card.totem-card .sound-system-media {
    height: 260px !important;
    min-height: 260px !important;
    max-height: 260px !important;
  }

  .support-page .sound-system-card.totem-card .sound-system-media > .img-link img {
    height: 220px !important;
    max-height: 220px !important;
  }
}


/* ===== STABLE CATEGORY PAGE SCROLLING =====
   Product and FAQ content must never depend on the dynamic mobile viewport
   height. Mobile browser chrome changes 100dvh while scrolling; using it for
   card/section height makes cards visibly grow/shrink during normal scrolling.
   These final rules make category content purely content-sized and stable. */
@media (max-width:650px) {
  .support-page .sound-system-card,
  .support-page .sound-system-card:last-child,
  .support-page .sound-system-card.totem-card {
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    display:flex !important;
    flex-direction:column !important;
    align-self:stretch !important;
  }

  .support-page .sound-system-body {
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    flex:0 0 auto !important;
    display:flex !important;
    flex-direction:column !important;
  }

  /* Product image area is fixed in pixels, so MORE DETAILS and scrolling
     never resize the visual. */
  .support-page .sound-system-media,
  .support-page .sound-system-card.totem-card .sound-system-media {
    flex:0 0 170px !important;
    height:170px !important;
    min-height:170px !important;
    max-height:170px !important;
    align-self:stretch !important;
  }

  .support-page .mic-media-combo {
    height:160px !important;
    min-height:160px !important;
    max-height:160px !important;
  }

  .support-page .sound-system-card .support-add {
    margin-top:10px !important;
  }

  .support-page .speaker-faq-section {
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
  }
}

@media (max-width:390px) {
  .support-page .sound-system-card,
  .support-page .sound-system-card:last-child,
  .support-page .sound-system-card.totem-card {
    min-height:0 !important;
  }

  .support-page .sound-system-media,
  .support-page .sound-system-card.totem-card .sound-system-media {
    flex-basis:158px !important;
    height:158px !important;
    min-height:158px !important;
    max-height:158px !important;
  }

  .support-page .mic-media-combo {
    height:150px !important;
    min-height:150px !important;
    max-height:150px !important;
  }
}

/* Desktop/laptop product media also stays independent from expanded text. */
@media (min-width:851px) {
  .support-page .sound-system-card,
  .support-page .sound-system-card:last-child,
  .support-page .sound-system-card.totem-card {
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    align-items:start !important;
  }

  .support-page .sound-system-media,
  .support-page .sound-system-card.totem-card .sound-system-media {
    align-self:start !important;
  }
}
