/*
 * ERATOOLS responsive layer 2026-09-21
 * Loaded last on the public storefront. It intentionally overrides older
 * breakpoint rules without changing the desktop visual language.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

img,
picture,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.main,
.site-header,
.header-main,
.header-main__grid,
.navbar,
.navbar__inner,
.section,
.product-grid,
.product-scroller,
.category-grid,
.footer,
.footer__grid {
  min-width: 0;
}

.container {
  width: min(var(--container, 1440px), calc(100% - 40px));
  max-width: 100%;
}

.mobile-menu-toggle,
.mobile-menu-head,
.mobile-menu-backdrop {
  display: none;
}

/* Tablet: keep the desktop identity, but stop squeezing the whole header. */
@media (max-width: 1180px) {
  .container {
    width: min(var(--container, 1440px), calc(100% - 32px));
  }

  .header-main__grid {
    grid-template-columns: 160px minmax(260px, 1fr) auto !important;
    gap: 16px !important;
  }

  .logo img {
    width: 154px !important;
  }

  .search__form {
    max-width: none !important;
  }

  .header-actions {
    gap: 8px !important;
    overflow: visible !important;
  }

  .header-action {
    min-width: 48px !important;
    width: 48px;
    min-height: 48px;
    justify-content: center;
    gap: 0 !important;
  }

  .header-action > span:not(.header-action__badge),
  .header-action > small {
    display: none !important;
  }

  .header-action svg {
    width: 25px !important;
    height: 25px !important;
  }

  .header-action__badge {
    right: 0 !important;
    top: 0 !important;
  }

  .navbar-mega__inner {
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
  }

  .usp-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .usp:nth-child(3n) {
    border-right: 0;
  }

  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .footer__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Mobile navigation and compact storefront header. */
@media (max-width: 900px) {
  :root {
    --mobile-side-gap: 16px;
  }

  body.mobile-menu-open {
    overflow: hidden;
    touch-action: none;
  }

  .container {
    width: calc(100% - (var(--mobile-side-gap) * 2)) !important;
  }

  .site-header {
    position: relative !important;
    top: auto !important;
    z-index: 300 !important;
    backdrop-filter: none !important;
  }

  .top-benefits__inner {
    min-height: 34px !important;
    grid-template-columns: repeat(4, max-content) !important;
    justify-content: start !important;
    gap: 22px !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding-block: 5px;
  }

  .top-benefits__inner::-webkit-scrollbar {
    display: none;
  }

  .top-benefits__item {
    display: inline-flex !important;
    font-size: 11px !important;
  }

  .top-benefits__item:nth-child(n+5) {
    display: none !important;
  }

  .promo-strip {
    padding: 8px 0 !important;
  }

  .promo-strip__box {
    min-height: 42px !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
  }

  .promo-strip__main {
    justify-content: flex-start !important;
    text-align: left !important;
    font-size: 11px !important;
    line-height: 1.35;
    letter-spacing: 0 !important;
  }

  .promo-strip__main svg {
    width: 19px !important;
    height: 19px !important;
  }

  .promo-strip__close {
    width: 34px !important;
    height: 34px !important;
  }

  .header-main {
    padding: 10px 0 12px !important;
    background: var(--card, #fff);
  }

  .header-main__grid {
    grid-template-columns: 44px minmax(0, 1fr) auto !important;
    grid-template-rows: 46px auto !important;
    align-items: center !important;
    gap: 10px 12px !important;
  }

  .mobile-menu-toggle {
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line, #e6e8eb);
    border-radius: 7px;
    background: var(--card, #fff);
    color: var(--text, #15191d);
  }

  .mobile-menu-toggle > span,
  .mobile-menu-toggle > span::before,
  .mobile-menu-toggle > span::after {
    width: 21px;
    height: 2px;
    display: block;
    content: "";
    position: relative;
    border-radius: 99px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
  }

  .mobile-menu-toggle > span::before,
  .mobile-menu-toggle > span::after {
    position: absolute;
    left: 0;
  }

  .mobile-menu-toggle > span::before { top: -7px; }
  .mobile-menu-toggle > span::after { top: 7px; }

  body.mobile-menu-open .mobile-menu-toggle > span {
    background: transparent;
  }

  body.mobile-menu-open .mobile-menu-toggle > span::before {
    top: 0;
    transform: rotate(45deg);
  }

  body.mobile-menu-open .mobile-menu-toggle > span::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .logo {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    justify-self: start;
  }

  .logo img {
    display: block;
    width: min(142px, 100%) !important;
    max-height: 42px;
    object-fit: contain;
    object-position: left center;
  }

  .header-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end !important;
    display: flex !important;
    gap: 4px !important;
    overflow: visible !important;
    width: auto !important;
  }

  .header-actions > .header-action[href="/kontakt"],
  .header-actions > .header-action--wishlist-v59 {
    display: none !important;
  }

  .header-account-menu {
    display: block;
  }

  .header-action,
  .header-action--account {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    display: inline-grid !important;
    place-items: center !important;
    padding: 0 !important;
    border: 1px solid transparent;
  }

  .header-action > span:not(.header-action__badge),
  .header-action > small {
    display: none !important;
  }

  .header-action svg {
    width: 24px !important;
    height: 24px !important;
  }

  .header-action__badge {
    top: -2px !important;
    right: -1px !important;
    min-width: 17px !important;
    height: 17px !important;
    font-size: 9px !important;
  }

  .header-account-dropdown {
    position: fixed !important;
    top: 72px !important;
    right: 12px !important;
    left: auto !important;
    width: min(320px, calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .search__form {
    width: 100% !important;
    max-width: none !important;
  }

  .search input {
    height: 46px !important;
    min-height: 46px;
    padding-left: 14px !important;
    padding-right: 52px !important;
    font-size: 16px !important;
  }

  .search button {
    right: 5px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 6px !important;
    background: var(--accent, #ffc400) !important;
  }

  .navbar.navbar-mega {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 340 !important;
    width: min(88vw, 380px) !important;
    height: 100dvh;
    display: block !important;
    padding: 0 0 24px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    border-right: 1px solid rgba(255,255,255,.1);
    background: #0c1114 !important;
    box-shadow: 20px 0 60px rgba(0,0,0,.36);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
  }

  body.mobile-menu-open .navbar.navbar-mega {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-menu-head {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,.09);
    background: #0c1114;
    color: #fff;
  }

  .mobile-menu-head strong {
    font-size: 18px;
    font-weight: 800;
  }

  .mobile-menu-close {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 7px;
    background: rgba(255,255,255,.05);
    color: #fff;
    font-size: 28px;
    line-height: 1;
  }

  .navbar-mega__inner {
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 8px 12px 18px !important;
    overflow: visible !important;
  }

  .navbar-mega__item {
    width: 100%;
    display: block !important;
    border-bottom: 1px solid rgba(255,255,255,.07);
  }

  .navbar-mega__trigger {
    width: 100%;
    min-height: 50px !important;
    display: flex !important;
    align-items: center;
    padding: 0 10px !important;
    border-bottom: 0 !important;
    color: #fff !important;
    white-space: normal !important;
    font-size: 14px;
    font-weight: 700 !important;
  }

  .navbar-mega__trigger:active,
  .navbar-mega__trigger:focus-visible {
    color: var(--accent, #ffc400) !important;
    background: rgba(255,196,0,.07) !important;
  }

  .navbar-mega__panel {
    display: none !important;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 330;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgba(0,0,0,.52);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  body.mobile-menu-open .mobile-menu-backdrop {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .main {
    width: 100%;
    overflow: visible !important;
  }

  .home-top-slider,
  .section,
  .newsletter,
  .promo-grid,
  .home-managed-products-v45,
  .home-brand-slider-v59,
  .home-category-slider-v59 {
    max-width: 100%;
  }

  .home-top-slider {
    margin-top: 16px !important;
  }

  .home-top-slider__viewport {
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }

  .usp-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    border-radius: 8px !important;
  }

  .usp {
    min-height: 74px !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    column-gap: 9px !important;
    padding: 12px !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line);
  }

  .usp:nth-child(2n) {
    border-right: 0 !important;
  }

  .usp:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
    border-right: 0 !important;
  }

  .usp svg {
    width: 28px !important;
    height: 28px !important;
  }

  .section {
    margin-top: 34px !important;
  }

  .section__head {
    align-items: flex-end !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
  }

  .section__head h2 {
    font-size: clamp(20px, 5.3vw, 24px) !important;
  }

  .section__head p {
    font-size: 12px;
  }

  .category-grid--scroll-v59,
  .brand-grid--scroll-v59 {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .category-grid--scroll-v59::-webkit-scrollbar,
  .brand-grid--scroll-v59::-webkit-scrollbar,
  .product-scroller::-webkit-scrollbar {
    display: none;
  }

  .category-grid--scroll-v59 {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, 24vw) !important;
    gap: 12px !important;
  }

  .category-grid--scroll-v59 .category-v59 {
    width: auto !important;
    min-width: 0 !important;
    scroll-snap-align: start;
  }

  .category-v59 .category__image,
  .category__image {
    width: 82px !important;
    height: 82px !important;
  }

  .category-v59 .category__image img,
  .category__image img,
  .category img {
    width: 66px !important;
    height: 60px !important;
    object-fit: contain !important;
  }

  .category strong {
    font-size: 12px !important;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .product-scroller {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(220px, 68vw) !important;
    gap: 12px !important;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 1px 1px 7px;
  }

  .product-scroller .product-card {
    width: auto !important;
    min-width: 0 !important;
    scroll-snap-align: start;
  }

  .product-card {
    grid-template-rows: 156px 1fr !important;
    border-radius: 8px !important;
  }

  .product-card__media {
    min-width: 0;
    padding: 12px !important;
  }

  .product-card__media img,
  .product-scroller .product-card__media img {
    width: 100% !important;
    height: 126px !important;
    max-width: 100%;
    object-fit: contain !important;
  }

  .product-card__body {
    min-width: 0;
    padding: 12px !important;
  }

  .product-card h3 {
    min-height: 38px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    overflow-wrap: anywhere;
  }

  .price strong {
    font-size: 18px !important;
  }

  .product-card__actions,
  .product-card__actions--v59,
  .product-actions-v59 {
    grid-template-columns: minmax(0, 1fr) 42px !important;
    gap: 7px !important;
  }

  .cart-btn,
  .cart-btn-v59,
  .cart-btn.cart-btn--v45 {
    min-width: 0 !important;
    min-height: 42px !important;
    height: 42px !important;
    padding-inline: 8px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  .wishlist-heart-v59,
  .wish-btn,
  .product-card__actions--v59 .wishlist-heart-v59,
  .product-actions-v59 .wishlist-heart-v59 {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
  }

  .promo-grid {
    grid-template-columns: 1fr !important;
  }

  .footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 28px 22px !important;
  }

  .footer__bottom {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .theme-switcher {
    right: 10px !important;
    bottom: 10px !important;
    top: auto !important;
    width: auto !important;
    display: flex !important;
    flex-direction: row !important;
    padding: 4px !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 28px rgba(0,0,0,.2) !important;
  }

  .theme-switcher button {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    font-size: 0 !important;
  }

  .theme-switcher button svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* Public subpages: allow existing page-specific layouts to collapse safely. */
  .product-page,
  .catalog-page,
  .category-page,
  .cart-page,
  .cart-pro-page,
  .checkout-page,
  .customer-page,
  .blog-page,
  .blog-post-page,
  .contact-page {
    width: min(100% - 32px, 100%) !important;
    max-width: 100% !important;
    margin-inline: auto !important;
  }

  .product-layout,
  .catalog-layout,
  .category-layout,
  .cart-layout,
  .cart-pro-layout,
  .checkout-layout,
  .customer-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .cart-summary,
  .cart-pro-summary,
  .checkout-summary,
  .product-purchase-card,
  .customer-sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  table {
    max-width: 100%;
  }

  .table-wrap,
  .table-responsive,
  [class*="table-wrap"] {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  input,
  select,
  textarea {
    max-width: 100%;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  :root {
    --mobile-side-gap: 12px;
  }

  .top-benefits__inner {
    grid-template-columns: max-content max-content !important;
    gap: 20px !important;
  }

  .top-benefits__item:nth-child(n+3) {
    display: none !important;
  }

  .promo-strip__main {
    font-size: 10px !important;
  }

  .promo-strip__main strong {
    font-weight: 800;
  }

  .header-main__grid {
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
    gap: 8px 9px !important;
  }

  .mobile-menu-toggle {
    width: 42px;
    height: 42px;
  }

  .logo img {
    width: min(126px, 100%) !important;
    max-height: 38px;
  }

  .header-action,
  .header-action--account {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  .search input {
    height: 44px !important;
    min-height: 44px;
  }

  .home-top-slider {
    margin: 12px 0 20px !important;
    border-radius: 10px !important;
  }

  .home-top-slider__viewport {
    aspect-ratio: 4 / 3 !important;
  }

  .home-top-slider__nav {
    width: 34px !important;
    height: 34px !important;
  }

  .home-top-slider__dots {
    bottom: 8px !important;
    padding: 6px 8px !important;
  }

  .usp-row {
    margin-top: 14px !important;
  }

  .usp strong {
    font-size: 12px !important;
  }

  .usp span {
    font-size: 10px !important;
  }

  .section {
    margin-top: 28px !important;
  }

  .section__head {
    align-items: flex-start !important;
  }

  .section__link {
    font-size: 11px !important;
    white-space: nowrap;
  }

  .category-grid--scroll-v59 {
    grid-auto-columns: 88px !important;
    gap: 10px !important;
  }

  .category-v59 .category__image,
  .category__image {
    width: 74px !important;
    height: 74px !important;
  }

  .category-v59 .category__image img,
  .category__image img,
  .category img {
    width: 58px !important;
    height: 54px !important;
  }

  .product-grid {
    gap: 9px !important;
  }

  .product-scroller {
    grid-auto-columns: minmax(210px, 76vw) !important;
    gap: 10px !important;
  }

  .product-card {
    grid-template-rows: 142px 1fr !important;
  }

  .product-card__media img,
  .product-scroller .product-card__media img {
    height: 114px !important;
  }

  .product-card__body {
    padding: 10px !important;
  }

  .product-card__category {
    font-size: 9px !important;
  }

  .product-card h3 {
    min-height: 36px !important;
    margin-bottom: 7px !important;
    font-size: 12px !important;
  }

  .rating {
    gap: 4px !important;
    margin-bottom: 8px !important;
    font-size: 11px !important;
  }

  .rating small {
    font-size: 10px !important;
  }

  .price {
    gap: 5px !important;
    margin-bottom: 10px !important;
  }

  .price strong {
    font-size: 16px !important;
  }

  .price del {
    font-size: 10px !important;
  }

  .cart-btn,
  .cart-btn-v59,
  .cart-btn.cart-btn--v45 {
    font-size: 11px !important;
  }

  .footer__grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .theme-switcher {
    opacity: .92;
  }
}

@media (max-width: 359px) {
  .logo img {
    width: 104px !important;
  }

  .header-actions > .header-account-menu,
  .header-actions > .header-action[href="/logowanie"] {
    display: none !important;
  }

  .product-grid {
    grid-template-columns: 1fr !important;
  }

  .product-card {
    grid-template-rows: 170px 1fr !important;
  }

  .product-card__media img {
    height: 140px !important;
  }

  .product-scroller {
    grid-auto-columns: 86vw !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .navbar.navbar-mega,
  .mobile-menu-backdrop,
  .mobile-menu-toggle > span,
  .mobile-menu-toggle > span::before,
  .mobile-menu-toggle > span::after {
    transition: none !important;
  }
}

/* Final homepage component guards loaded after all legacy files. */
@media (max-width: 900px) {
  .brands-strip--scroll-v59 {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .brands-strip--scroll-v59::-webkit-scrollbar {
    display: none;
  }

  .brands-strip--scroll-v59 .brand-item-v59 {
    scroll-snap-align: start;
  }

  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .newsletter,
  .newsletter__copy,
  .newsletter__form,
  .newsletter__row {
    min-width: 0;
    max-width: 100%;
  }

  .newsletter {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
}

@media (max-width: 640px) {
  .blog-grid {
    grid-template-columns: 1fr !important;
  }

  .newsletter__row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .newsletter__row input,
  .newsletter__row button {
    width: 100% !important;
  }
}
