/**
 * Mobile / tablet overrides for all pages.
 * Loaded last from styles.css / base template.
 */

html {
  overflow-x: clip;
}

body {
  max-width: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Tablet (≤992px) ---------- */
@media (max-width: 992px) {
  .container {
    padding: 0 20px;
    max-width: 100%;
  }

  .founders {
    padding: 64px 0;
  }

  .founders__title {
    margin-bottom: 24px;
    padding: 0 8px;
  }

  .founders__desc {
    font-size: var(--fs-body-lg);
    padding: 0 12px;
  }

  .models {
    padding: 64px 0;
  }

  .models__title {
    margin-bottom: 40px;
    padding: 0 8px;
  }

  .models__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    justify-items: stretch;
  }

  .models__card {
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .models__card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: none;
    padding: 20px;
    box-sizing: border-box;
    margin-bottom: 20px;
    flex-shrink: 0;
  }

  .models__card-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .models__card-title {
    flex-shrink: 0;
  }

  .models__card-desc {
    font-size: var(--fs-body);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .brands__container {
    flex-wrap: nowrap;
    align-items: center;
    gap: 24px;
  }

  .brands__container-left {
    flex: 0 1 42%;
    min-width: 0;
    max-width: 360px;
    padding: 24px 0 24px 20px;
  }

  .brands__container-right {
    flex: 1 1 0;
    min-width: 0;
    padding: 24px 20px 24px 0;
  }

  .brands__img {
    max-width: 100%;
    width: 100%;
    min-width: 0;
  }

  .brands__title {
    margin-bottom: 16px;
  }

  .brands__desc {
    font-size: var(--fs-body);
  }

  .category {
    padding: 64px 0;
  }

  .category__title {
    margin-bottom: 40px;
    padding: 0 8px;
  }

  .category__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
  }

  .category__cards > a {
    min-width: 0;
    width: 100%;
  }

  .category__card {
    width: 100%;
  }

  .category__card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: none;
    padding: 20px;
    box-sizing: border-box;
  }

  .category__card-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .products__card {
    width: 100%;
    min-width: 0;
    min-height: 0;
  }

  .products__card-img img {
    height: 100%;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .products .simple-button {
    width: auto;
    min-width: 140px;
  }

  .filters__row {
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 12px 16px;
  }

  .price-form .simple-button,
  .brand-form .simple-button,
  .material-form .simple-button {
    width: 100%;
    max-width: 270px;
  }

  .product__info {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }

  .product__image {
    width: 42%;
    max-width: 340px;
    flex-shrink: 0;
    height: auto;
    aspect-ratio: 1;
  }

  .product__desc {
    width: auto;
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .profile__info {
    flex-direction: column;
    align-items: stretch;
    gap: 32px;
  }

  .profile__info-update {
    padding: 24px;
  }

  .login__form {
    width: 100%;
    max-width: 480px;
  }

  .login .primary-button,
  .register .primary-button,
  .place-order__form .primary-button,
  .my__cart-buttons .primary-button,
  .my__cart-buttons .simple-button {
    width: 100%;
    max-width: 320px;
  }

  .header-images.height-798,
  .header-images.height-600,
  .header-images.height-500 {
    max-height: none;
  }

  .header-images__container {
    flex-direction: column;
  }

  .header-images__container .header-images__image:first-child {
    display: none;
  }

  .header-images__container .header-images__image:last-child {
    width: 100%;
    max-height: 420px;
  }

  .header-images__container .header-images__image:last-child img {
    max-height: 420px;
    width: 100%;
    object-fit: cover;
  }
}

/* ---------- Mobile / small tablet (≤768px) ---------- */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .title {
    overflow-wrap: anywhere;
  }

  .header {
    padding-bottom: 12px;
  }

  .header.scrolled {
    padding: 12px 0;
  }

  .header__title {
    display: none;
  }

  .sidebar-nav {
    display: none !important;
  }

  .menu {
    display: block;
    position: relative;
    z-index: 1100;
    padding: 16px;
  }

  .header:not(.scrolled) .burger {
    --burger-color: #fff;
  }

  .header.scrolled .burger {
    --burger-color: #000;
  }

  .burger-checkbox:checked + .burger {
    --burger-color: #fff;
  }

  .menu-list {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    padding: 72px 0 32px;
    background: #000;
    z-index: 1150;
    overflow-y: auto;
    box-shadow: none;
  }

  .burger-checkbox:checked ~ .menu-list {
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  .menu-item {
    font-size: var(--fs-body-lg);
    padding: 16px 28px;
    text-align: left;
  }

  .founders,
  .models,
  .category {
    padding: 48px 0;
  }

  .founders__title,
  .models__title,
  .category__title {
    margin-bottom: 28px;
  }

  .founders__desc {
    font-size: var(--fs-body);
  }

  .models__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .models__card-img {
    padding: 12px;
    margin-bottom: 12px;
  }

  .models__card-title {
    margin-bottom: 6px;
  }

  .models__card-desc {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    -webkit-line-clamp: 5;
  }

  .brands__container {
    gap: 16px;
  }

  .brands__container-left {
    flex-basis: 38%;
    max-width: 240px;
    padding: 16px 0 16px 16px;
  }

  .brands__container-right {
    padding: 16px 16px 16px 0;
  }

  .brands__title {
    margin-bottom: 12px;
  }

  .brands__desc {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
  }

  .category__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: none;
    margin: 0;
  }

  .category__card-title {
    font-size: var(--fs-body);
    height: 56px;
  }

  .products {
    padding-bottom: 24px;
  }

  .products__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    justify-content: stretch;
  }

  .products__card {
    width: 100%;
    min-width: 0;
    padding: 12px;
    gap: 12px;
  }

  .products__card-img img {
    height: 100%;
    max-height: none;
  }

  .products a,
  .products__card-article,
  .products__card-desc {
    font-size: var(--fs-body);
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .filters__row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filters-content {
    flex-direction: column;
  }

  .product {
    margin: 40px 0;
  }

  .product__desc {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    padding: 16px;
  }

  .related-products .title {
    margin: 40px 0 24px;
  }

  .related-products__slider {
    padding-bottom: 56px;
  }

  .related-products__card-img img {
    height: 100%;
    max-height: none;
    object-fit: contain;
  }

  .related-products__slider .related-products__card {
    padding: 16px;
    font-size: var(--fs-body);
  }

  .related-products__article,
  .related-products__card {
    font-size: var(--fs-body);
    overflow-wrap: anywhere;
  }

  .related-products__slider .related-arrow {
    width: 36px;
    height: 36px;
  }

  .related-products__slider .related-arrow--prev {
    left: calc(50% - 48px);
  }

  .related-products__slider .related-arrow--next {
    left: calc(50% + 12px);
  }

  .my-cart,
  .orders,
  .place-order,
  .profile,
  .login,
  .register,
  .get-order,
  .products.favorites {
    padding: 48px 0;
  }

  .my-cart__table,
  .orders__table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-width: 8px;
  }

  .my-cart__table th,
  .my-cart__table td,
  .orders__table th,
  .orders__table td {
    font-size: var(--fs-small);
    padding: 8px 6px;
    white-space: nowrap;
  }

  .product-image {
    width: 72px;
    height: 72px;
  }

  .my__cart-buttons {
    flex-direction: column;
  }

  .my__cart-buttons .primary-button,
  .my__cart-buttons .simple-button {
    width: 100%;
    max-width: none;
  }

  .rights__content {
    gap: 12px;
    font-size: var(--fs-small);
    text-align: left;
    padding: 0 8px;
  }

  .rights__nav {
    justify-content: flex-start;
  }

  .rights__content p {
    overflow-wrap: anywhere;
  }

  footer {
    padding: 16px 12px;
  }

  .pagination {
    padding: 20px 12px;
  }

  .primary-button,
  .simple-button {
    padding: 12px 16px;
    font-size: var(--fs-body);
  }
}

/* ---------- Narrow phones (≤480px) ---------- */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .product__info {
    flex-direction: column;
  }

  .product__image,
  .product__desc {
    width: 100%;
    max-width: 100%;
  }

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

  .products__card {
    max-width: 100%;
  }

  .products__card-img img {
    max-height: none;
  }

  .category__cards {
    max-width: none;
  }

  .header-images__image,
  .header-images__image img {
    max-height: 280px;
  }

  .models__cards {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
  }

  .models__card {
    width: 100%;
    max-width: none;
  }

  .models__card-img {
    aspect-ratio: 4 / 3;
    max-height: 220px;
    padding: 16px;
    margin-bottom: 16px;
  }

  .models__card-title {
    font-size: var(--fs-h3);
  }

  .models__card-desc {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }

  .brands__container {
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0;
  }

  .brands__container-left,
  .brands__container-right {
    width: 100%;
    max-width: 100%;
    flex: none;
    padding: 20px 12px;
  }

  .brands__container-left {
    max-width: 100%;
  }

  .brands__img {
    max-height: 220px;
    width: 100%;
    object-fit: cover;
  }

  .brands__title {
    margin-bottom: 12px;
  }

  .brands__desc {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
  }
}
