/* SplitStream mobile integration layer.
   This file is deliberately storefront-only and loaded after the shared theme.
   It must never be linked from the administrative panel. */

@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  /* The same real header order is used on every public route. */
  .storefront-header .mainhead {
    grid-template-columns: minmax(0, 1fr) auto 42px;
  }

  .storefront-header .mainhead > .logo {
    grid-column: 1;
    grid-row: 1;
  }

  .storefront-header .head-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .storefront-header .mobile-categories-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  /* One compact header on every public page. All customer controls remain
     available instead of disappearing at narrow widths. */
  .storefront-header {
    position: sticky !important;
    top: 8px !important;
    z-index: 50;
    margin: 8px 8px 20px !important;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--ss-header-bg, #f5faf5);
    box-shadow: 0 8px 24px #1e1e3010;
  }

  .storefront-header .mainhead {
    width: 100%;
    min-height: 68px;
    padding: 9px 10px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
  }

  .mobile-categories-toggle {
    grid-column: 1;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
  }

  .storefront-header .mainhead > .logo {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    justify-self: start;
  }

  .storefront-header .mainhead > .logo .splitstream-logo {
    display: block;
    width: clamp(122px, 35vw, 174px);
    max-width: 100%;
    height: auto;
  }

  .storefront-header .mainhead > .button.ink {
    display: none;
  }

  .storefront-header .head-actions {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
    min-width: 0;
  }

  .storefront-header .head-actions > a[href="/favorites"],
  .storefront-header .head-actions > a[href="/account"],
  .storefront-header .head-actions > a[href="/cart"] {
    display: inline-flex !important;
    width: 36px;
    min-width: 36px;
    height: 42px;
    padding: 7px;
  }

  .storefront-header .head-actions svg {
    width: 20px;
    height: 20px;
  }

  .storefront-header .cart-count {
    top: 2px;
    right: 0;
  }

  .storefront-header .primary-nav {
    grid-column: 1 / -1;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    max-height: min(65vh, 460px);
    overflow-y: auto;
  }

  /* Hero tabs stay three equal controls with centered labels at every mobile
     width. The copy remains readable over the approved owner image. */
  main > .hero-requested {
    margin-top: 0 !important;
  }

  .hero-requested .hero-offer-tabs {
    left: 14px;
    right: 14px;
    width: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
  }

  .hero-requested .hero-offer-tabs button {
    min-width: 0;
    width: 100%;
    min-height: 52px;
    padding: 7px 4px;
    display: grid;
    place-items: center;
    text-align: center;
    white-space: normal;
    overflow-wrap: normal;
    hyphens: none;
    font-size: clamp(9px, 2.7vw, 11.5px);
    line-height: 1.18;
  }

  .hero-requested .hero-copy-requested h1 {
    text-wrap: balance;
  }

  /* Installation offers and homepage product/blog shelves follow the mobile
     reference's one-card-plus-peek interaction. Catalog pages keep their own
     grid and are not converted into carousels here. */
  .install-deals-section .deal-carousel,
  body.figma-desktop-home main > [data-block-id="home_5"] .product-grid,
  body.figma-desktop-home main > [data-block-id="home_7"] .editorial-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 360px);
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
    padding: 2px 1px 14px;
  }

  body.figma-desktop-home main > [data-block-id="home_7"] .editorial-grid {
    align-items: start;
  }

  .install-deals-section .deal-carousel::-webkit-scrollbar,
  body.figma-desktop-home main > [data-block-id="home_5"] .product-grid::-webkit-scrollbar,
  body.figma-desktop-home main > [data-block-id="home_7"] .editorial-grid::-webkit-scrollbar {
    display: none;
  }

  .install-deals-section .install-deal-card,
  body.figma-desktop-home main > [data-block-id="home_5"] .product-card,
  body.figma-desktop-home main > [data-block-id="home_7"] .editorial-grid > a {
    scroll-snap-align: start;
  }

  /* Card internals use one vertical model. Price, cart and comparison sit at
     the same bottom levels even when titles have different line counts. */
  .product-card,
  .product-card .product-info {
    min-width: 0;
  }

  .product-card .product-info {
    display: flex;
    flex-direction: column;
  }

  .product-card .price-row {
    margin-top: auto;
  }

  .product-card .compare {
    min-height: 25px;
  }

  .product-card button,
  .product-card a,
  .catalog-pagination-links a,
  .catalog-pagination-links span {
    touch-action: manipulation;
  }

  footer .footergrid,
  footer .footline {
    min-width: 0;
  }

  footer a {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 580px) {
  .storefront-header {
    border-radius: 20px;
  }

  .storefront-header .mainhead {
    min-height: 62px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    padding: 8px;
    gap: 5px;
  }

  .mobile-categories-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .storefront-header .head-actions > a[href="/favorites"],
  .storefront-header .head-actions > a[href="/account"],
  .storefront-header .head-actions > a[href="/cart"] {
    width: 32px;
    min-width: 32px;
    height: 40px;
    padding: 6px;
  }

  .storefront-header .head-actions svg {
    width: 19px;
    height: 19px;
  }

  body.figma-desktop-home main > [data-block-id="home_5"] .product-card {
    min-height: 0;
  }

  body.figma-desktop-home main > [data-block-id="home_5"] .product-info h3 {
    min-height: 0;
  }
}

@media (max-width: 340px) {
  .storefront-header .mainhead > .logo .splitstream-logo {
    width: 112px;
  }

  .storefront-header .head-actions > a[href="/favorites"],
  .storefront-header .head-actions > a[href="/account"],
  .storefront-header .head-actions > a[href="/cart"] {
    width: 29px;
    min-width: 29px;
    padding-inline: 4px;
  }

  /* A two-column catalog leaves less than 140px per card at 320px and forces
     destructive title wrapping. Use one readable column only at this edge. */
  .catalog-products {
    grid-template-columns: 1fr;
  }

  .catalog-products .product-card h3 {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .install-deals-section .deal-carousel,
  body.figma-desktop-home main > [data-block-id="home_5"] .product-grid,
  body.figma-desktop-home main > [data-block-id="home_7"] .editorial-grid {
    scroll-behavior: auto;
  }
}

/* Second and final mobile composition pass: reproduce the approved mobile
   reference without changing desktop markup or administrative interfaces. */
.mobile-reference-only {
  display: none;
}

@media (max-width: 768px) {
  body.figma-desktop-home .storefront-header {
    position: absolute !important;
    top: 24px !important;
    left: 22px;
    right: 22px;
    width: auto;
    margin: 0 !important;
    border: 0;
    border-radius: 10px;
    background: #f5faf5;
    box-shadow: none;
  }

  body.figma-desktop-home .storefront-header .mainhead {
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 4px;
    padding: 5px 7px;
  }

  body.figma-desktop-home .storefront-header .mainhead > .logo {
    grid-column: 1;
    grid-row: 1;
  }

  body.figma-desktop-home .storefront-header .head-actions {
    grid-column: 2;
    grid-row: 1;
  }

  body.figma-desktop-home .mobile-categories-toggle {
    grid-column: 3;
    grid-row: 1;
    width: 42px;
    min-width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
  }

  body.figma-desktop-home .storefront-header .primary-nav {
    grid-column: 1 / -1;
  }

  body.figma-desktop-home main > .hero-requested {
    width: 100%;
    min-height: 790px;
    margin: 0 !important;
    border-radius: 0;
    background: #151724;
    color: #f5faf5;
    overflow: hidden;
  }

  body.figma-desktop-home .hero-requested .hero-image {
    position: absolute;
    inset: 0 0 auto;
    width: 100%;
    height: 360px;
    object-fit: cover;
    object-position: 62% center;
  }

  body.figma-desktop-home .hero-requested::after,
  html[data-theme=dark] body.figma-desktop-home .hero-requested::after {
    content: "";
    position: absolute;
    inset: 360px 0 0;
    background: #151724 !important;
    pointer-events: none;
  }

  body.figma-desktop-home .hero-requested .hero-offer-tabs {
    top: 396px;
    left: 30px;
    right: 30px;
    gap: 18px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }

  body.figma-desktop-home .hero-requested .hero-offer-tabs button {
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid #f5faf5;
    border-radius: 999px;
    background: transparent;
    color: #f5faf5 !important;
    font-size: clamp(8px, 2.35vw, 11px);
  }

  body.figma-desktop-home .hero-requested .hero-offer-tabs button.active {
    background: #f5faf5;
    color: #151724 !important;
  }

  body.figma-desktop-home .hero-requested .hero-copy-requested {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 474px 30px 88px;
    color: #f5faf5;
  }

  body.figma-desktop-home .hero-requested .hero-copy-requested .eyebrow {
    display: none;
  }

  body.figma-desktop-home .hero-requested .hero-copy-requested h1 {
    margin: 0 0 24px;
    max-width: 13ch;
    color: #f5faf5 !important;
    font-size: clamp(30px, 8vw, 43px);
    line-height: 1.05;
    letter-spacing: -1.4px;
  }

  body.figma-desktop-home .hero-requested .hero-copy-requested p {
    max-width: 36ch;
    margin-bottom: 30px;
    color: #f5faf5 !important;
    font-size: 13px;
    line-height: 1.45;
  }

  body.figma-desktop-home .hero-requested .button.primary {
    min-height: 58px;
    padding-inline: 28px;
    border-radius: 999px;
    background: #f4613f !important;
    color: #fff !important;
  }

  body.figma-desktop-home .hero-requested .hero-index {
    left: 30px;
    right: 30px;
    bottom: 30px;
    color: #f5faf5;
  }

  body.figma-desktop-home .hero-requested .hero-index .index-line {
    flex: 1;
    max-width: 140px;
    background: #f4613f;
  }

  .mobile-reference-only {
    display: block;
  }

  .mobile-legacy {
    width: min(100% - 60px, 708px);
    margin: 72px auto;
    font-family: Montserrat, Arial, sans-serif;
  }

  .mobile-legacy-years {
    position: relative;
    overflow: hidden;
    min-height: 760px;
    padding: 38px 32px 0;
    border-radius: 22px;
    background: linear-gradient(145deg, #b49c86, #8e7b6d);
    color: #fff;
  }

  .mobile-legacy-years-copy {
    position: relative;
    z-index: 2;
  }

  .mobile-legacy-years h2 {
    margin: 0 0 34px;
    color: #fff;
    font-size: clamp(34px, 9.2vw, 54px);
    line-height: 1.08;
    letter-spacing: -1.5px;
    white-space: pre-line;
  }

  .mobile-legacy-years h2 span,
  .mobile-legacy-expertise h2 span {
    color: #f4613f;
  }

  .mobile-legacy-years h3 {
    max-width: 23ch;
    font-size: 15px;
    line-height: 1.35;
  }

  .mobile-legacy-years p,
  .mobile-legacy-years li {
    font-size: 12px;
    line-height: 1.45;
  }

  .mobile-legacy-years p {
    max-width: 34ch;
  }

  .mobile-legacy-years ul {
    margin: 20px 0 0;
    padding-left: 18px;
  }

  .mobile-legacy-years > img {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 355px;
    object-fit: cover;
    object-position: center bottom;
  }

  .mobile-legacy-expertise {
    margin-bottom: 82px;
  }

  .mobile-legacy-expertise-intro h2 {
    margin-bottom: 26px;
    font-size: clamp(34px, 9vw, 52px);
    line-height: 1.08;
  }

  .mobile-legacy-expertise-intro > p {
    white-space: pre-line;
    font-size: 13px;
    line-height: 1.55;
  }

  .mobile-legacy-more {
    margin-top: 16px;
    border-radius: 999px;
    background: #1e1e30;
    color: #fff;
  }

  .mobile-legacy-expertise-title {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin: 38px 0 24px;
    border: 1px solid #b5b5b5;
    border-radius: 999px;
    font-size: 15px;
  }

  .mobile-legacy-expertise-cards {
    display: grid;
    gap: 18px;
  }

  .mobile-legacy-expertise-card {
    min-height: 220px;
    padding: 25px;
    border-radius: 22px;
    background: linear-gradient(145deg, #151724, #34455d 68%, #76add1);
    color: #fff;
  }

  .mobile-legacy-expertise-card img {
    width: 82px;
    height: 72px;
    object-fit: contain;
    object-position: left center;
  }

  .mobile-legacy-expertise-card h3 {
    margin: 16px 0 10px;
    font-size: 24px;
  }

  .mobile-legacy-expertise-card p {
    max-width: 34ch;
    margin: 0;
    color: #e4e9ee;
    font-size: 12px;
    line-height: 1.4;
  }

  body > footer {
    margin-top: 0;
    padding-bottom: 32px;
    border-color: #343848;
    background: #151724 !important;
    color: #f5faf5 !important;
  }

  body > footer .splitstream-logo {
    content: url('/assets/figma/layers/5-111.svg');
    filter: none;
  }

  body > footer .logo {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body > footer .footergrid b,
  body > footer .footergrid a,
  body > footer .footline,
  body > footer .footline a {
    color: #f5faf5 !important;
  }

  body > footer .footergrid a,
  body > footer .footline,
  body > footer .footline a {
    color: #c7e0dd !important;
    opacity: .78;
  }

  .storefront-header .mainhead {
    grid-template-columns: minmax(0, 1fr) auto 42px;
  }

  .storefront-header .mainhead > .logo {
    grid-column: 1;
    grid-row: 1;
  }

  .storefront-header .head-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .storefront-header .mobile-categories-toggle {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 420px) {
  body.figma-desktop-home .storefront-header {
    left: 16px;
    right: 16px;
  }

  body.figma-desktop-home .storefront-header .mainhead > .logo .splitstream-logo {
    width: clamp(104px, 29vw, 128px);
  }

  body.figma-desktop-home .hero-requested .hero-offer-tabs {
    left: 24px;
    right: 24px;
    gap: 10px;
  }

  body.figma-desktop-home .hero-requested .hero-copy-requested {
    padding-inline: 24px;
  }

  .mobile-legacy {
    width: calc(100% - 32px);
  }

  .mobile-legacy-years {
    min-height: 740px;
    padding: 32px 24px 0;
  }
}
