/* Phone layout frames. Type and spacing come from :root tokens in style.css.
   Rhythm follows the DE reference shops (fumot-shop.de, fumotde.de, szfumot):
   one-row chrome ~66px, search as icon, 2-col cards with name+price.

   Breakpoints:
     1200  hamburger + search icon
     1024  shop rail stacks
      768  phone tokens + these frames
*/

/* clip sideways overflow on body, not html — clip on html makes
   position:fixed hamburger panels stick to the document and freeze. */
body {
  overflow-x: clip;
}

@media (max-width: 1200px) {
  .header-main {
    flex-wrap: nowrap;
    align-items: center;
  }

  .search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 2;
    width: var(--tap);
    height: var(--tap);
    min-width: var(--tap);
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-charcoal);
    cursor: pointer;
  }

  .search-toggle .header-icon {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
  }

  .header-actions {
    order: 3;
    margin-left: 0;
    flex-wrap: nowrap;
    gap: 2px;
  }

  .nav-toggle {
    order: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: var(--c-charcoal);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-toggle .header-icon {
    width: 24px;
    height: 24px;
    display: block;
    pointer-events: none;
  }

  .header-search {
    display: none;
    order: 0;
    flex: 1 1 auto;
    max-width: none;
  }

  .site-header.is-search-open .header-search {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 61;
    max-width: none;
    margin: 0;
    padding: 8px var(--gutter) 10px;
    border-radius: 0;
    background: #fff;
    border-bottom: 1px solid var(--c-gray-200);
    box-shadow: 0 10px 24px rgba(17, 17, 17, .08);
  }

  .main-nav .nav-list > li > .sub-menu {
    display: none;
  }

  .main-nav .nav-list > li.is-sub-open > .sub-menu {
    display: block;
  }
}

@media (max-width: 768px) {
  .btn {
    min-height: var(--tap);
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    font-size: var(--text);
  }

  .header-main {
    gap: 4px;
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: center;
    position: relative;
    /* Flex item + margin:auto + logo out of flow otherwise shrinks to the icons. */
    width: 100%;
    box-sizing: border-box;
  }

  /* True bar-center, not the leftover gap between logo and the right cluster. */
  .site-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    /* Narrow phones: logo can kiss the search icon. Buttons must win the tap. */
    pointer-events: none;
  }

  .site-logo img,
  .site-logo-img {
    pointer-events: auto;
  }

  .site-logo img,
  .site-logo-img {
    height: 36px;
    max-width: 86px;
  }

  .nav-toggle {
    order: 1;
    margin-right: 0;
    position: relative;
    z-index: 2;
  }

  .search-toggle {
    order: 2;
    margin-left: auto;
    position: relative;
    z-index: 2;
  }

  .header-actions {
    order: 3;
    position: relative;
    z-index: 2;
  }

  /* Phone chrome: same bare icon language as search / hamburger.
     Black circular wells without labels looked like random dots. */
  .header-actions {
    flex-wrap: nowrap;
    gap: 0;
    margin-left: 0;
  }

  .header-action-contact {
    display: none;
  }

  .header-action {
    width: var(--tap);
    height: var(--tap);
    min-width: var(--tap);
    padding: 0;
    gap: 0;
    background: transparent;
    border-color: transparent;
    color: var(--c-charcoal);
    border-radius: 0;
  }

  .header-action:hover,
  .header-action:focus-visible {
    background: transparent;
    border-color: transparent;
    color: var(--c-charcoal);
  }

  .header-action .action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .header-action .action-icon {
    width: 22px;
    height: 22px;
    /* Source is already charcoal line PNG; do not invert on the light header. */
    filter: none;
    pointer-events: none;
  }

  .header-action:hover .action-icon,
  .header-action:focus-visible .action-icon {
    filter: none;
  }

  .header-action-cart .cart-count {
    position: absolute;
    top: 4px;
    right: 2px;
    background: var(--c-chrome);
    color: #fff;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0;
  }

  .header-search {
    min-height: var(--tap);
  }

  .header-search input[type="search"] {
    padding: 11px 4px 11px 14px;
    font-size: 16px;
  }

  .header-search button {
    min-width: var(--tap);
    min-height: var(--tap);
  }

  /* Specs stay visible. Average stays visible. Only the (n) count hides —
     169px cards cannot hold "4,7 (58)" plus the spec line. */
  .product-grid:not(.product-grid-lead) .pc-rating-n {
    display: none;
  }

  .product-card .pc-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .main-nav.open {
    max-height: calc(100dvh - var(--nav-panel-top, var(--site-header-h, 120px)));
  }

  .nav-list > li > a {
    min-height: 48px;
    font-size: var(--text-sm);
  }

  .main-nav .sub-menu li a {
    min-height: 48px;
    padding: 14px 16px;
    white-space: normal;
    font-size: var(--text-sm);
  }

  .product-card .pc-body {
    padding: 10px 10px 12px;
  }

  .product-card .pc-cta {
    margin-top: 8px;
    padding: 9px 10px;
    font-size: var(--text-sm);
  }

  .product-grid-lead .product-card .pc-body {
    padding: 14px 14px 16px;
  }

  .trust-grid,
  .spotlight-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .trust-item {
    padding: 16px 12px 18px;
  }

  .rooms-grid {
    grid-template-columns: 1fr;
  }

  .blog-grid,
  .blog-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .blog-grid .blog-card-body,
  .blog-grid-2 .blog-card-body {
    gap: 6px;
    padding: 12px 12px 14px;
  }

  .blog-grid .blog-card p,
  .blog-grid-2 .blog-card p {
    -webkit-line-clamp: 2;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-ctas .btn {
    width: 100%;
  }

  .crumb,
  .pdp-crumb {
    overflow-wrap: anywhere;
    font-size: var(--text-sm);
  }

  .woocommerce div.product div.images .flex-control-thumbs li {
    width: calc(33.333% - 6px) !important;
  }

  .woocommerce div.product div.images .flex-direction-nav a {
    width: 36px;
    height: 36px;
  }

  .woocommerce div.product form.cart .single_add_to_cart_button,
  .woocommerce div.product form.cart .quantity .qty {
    min-height: 48px;
  }

  .woocommerce div.product form.cart .quantity .qty {
    width: 64px;
    font-size: 16px;
  }

  .pdp-sticky-cart {
    gap: 10px;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .pdp-sticky-cart__btn {
    min-width: 0;
    flex: 1 1 auto;
    font-size: var(--text);
  }

  .pdp-sticky-cart__price {
    font-size: var(--card-price);
  }

  .model-table-wrap,
  .compare-wrap,
  .compare-scroll {
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  table.compare,
  .model-table {
    min-width: 560px;
  }

  .woocommerce table.shop_table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .woocommerce-cart .cart-collaterals,
  .woocommerce-cart .cart_totals {
    width: 100% !important;
    float: none !important;
  }

  .woocommerce-checkout .col2-set .col-1,
  .woocommerce-checkout .col2-set .col-2 {
    float: none;
    width: 100%;
  }

  .age-gate {
    padding: 28px 20px;
    margin: 0 8px;
  }

  .age-gate .age-actions {
    flex-direction: column;
  }

  .age-gate .age-actions .btn {
    width: 100%;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .bulk-banner {
    padding: 22px 18px;
  }
}

@media (max-width: 360px) {
  .container.header-main {
    padding-left: 8px;
    padding-right: 8px;
  }

  .site-logo img,
  .site-logo-img {
    height: 30px;
    max-width: 64px;
  }
}
