/*
 * Tablet layout layer
 * Covers iPad mini / Air / Pro in portrait and compact landscape widths.
 * Loaded after page-specific styles so 700-1199px is a real layout tier,
 * rather than an accidental mix of phone and desktop rules.
 */

@media (min-width: 700px) and (max-width: 1199px) {
  body {
    padding-top: 82px;
  }

  .page-section,
  .site-footer__inner,
  .cg-hero__inner,
  .cg-tasks__inner,
  .cg-story__inner,
  .cg-gallery__inner,
  .cg-range__inner,
  .cg-quality__inner,
  .cg-numbers__inner,
  .cg-cta__inner {
    width: min(calc(100% - 48px), 1040px);
  }

  .page-section {
    padding-top: 44px;
    padding-bottom: 44px;
  }

  /* A compact header is more robust than squeezing the full desktop nav. */
  body.gw-menu-open {
    overflow: hidden;
  }

  .gw-header {
    top: 12px;
    left: 24px;
    right: 24px;
    width: auto;
    transform: none;
    grid-template-columns: minmax(0, 1fr) 50px;
    gap: 10px;
    pointer-events: none;
  }

  .gw-header__brand {
    position: relative;
    z-index: 3;
    justify-content: flex-start;
    width: 100%;
    min-height: 50px;
    padding: 0 22px;
    font-size: 19px;
    pointer-events: auto;
  }

  .gw-header__menu {
    position: relative;
    z-index: 3;
    display: grid;
    place-content: center;
    gap: 4px;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 1px solid rgba(23, 23, 23, 0.08);
    border-radius: 50%;
    color: var(--gw-text);
    background: var(--gw-header-surface);
    box-shadow: 0 10px 26px rgba(23, 23, 23, 0.12);
    pointer-events: auto;
    cursor: pointer;
  }

  .gw-header__menu span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 220ms ease, opacity 180ms ease;
  }

  .gw-header.is-menu-open .gw-header__menu span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .gw-header.is-menu-open .gw-header__menu span:nth-child(2) {
    opacity: 0;
  }

  .gw-header.is-menu-open .gw-header__menu span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .gw-header__backdrop {
    position: fixed;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(17, 17, 17, 0.46);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
  }

  .gw-header.is-menu-open .gw-header__backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .gw-header__navwrap {
    position: fixed;
    z-index: 2;
    top: 72px;
    left: 24px;
    right: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-height: 0;
    max-height: calc(100dvh - 92px);
    padding: 18px;
    overflow: auto;
    border: 1px solid rgba(23, 23, 23, 0.08);
    border-radius: 24px;
    background: var(--gw-header-surface);
    box-shadow: 0 24px 60px rgba(23, 23, 23, 0.2);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 200ms ease, transform 220ms ease, visibility 220ms ease;
  }

  .gw-header.is-menu-open .gw-header__navwrap {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .gw-header__nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .gw-header__nav a {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 18px;
    border-radius: 14px;
    color: var(--gw-text);
    font-size: 16px;
    font-weight: 800;
  }

  .gw-header__nav a.is-active {
    color: var(--gw-orange-dark);
    background: var(--gw-soft);
  }

  .gw-header__phone {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    margin: 2px 0 0;
    border-radius: 14px;
    color: #fff;
    background: var(--gw-orange);
    font-size: 15px;
    font-weight: 850;
  }

  .gw-header__icon {
    display: grid !important;
    width: 100%;
    height: 50px;
    place-items: center;
    border: 1px solid var(--gw-line);
    border-radius: 14px;
    background: #f5f5f4;
  }

  .gw-header__icon img {
    width: 32px;
    height: 32px;
  }

  /* Homepage: use the tablet canvas instead of phone carousels. */
  .home-page .hm-main > .hm-section > .page-section,
  .home-page .hm-main > .how-order {
    padding-block: 32px;
  }

  .hm-hero__grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hm-hero__card {
    min-height: 0;
    padding: 38px 42px;
  }

  .hm-hero__title {
    font-size: clamp(44px, 6.4vw, 62px);
  }

  .hm-hero__photo {
    aspect-ratio: 16 / 7;
  }

  .hm-popular__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    padding: 0;
    overflow: visible;
  }

  .hm-product {
    min-width: 0;
    padding: 20px;
  }

  .hm-product__photo {
    aspect-ratio: 4 / 3;
  }

  .hm-reliability__grid {
    grid-template-columns: 1fr;
  }

  .hm-reliability__stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .hm-engineering-card--landscape,
  .hm-engineering-card--portrait {
    min-height: 430px;
  }

  .hm-instruction__layout {
    grid-template-columns: 1fr;
  }

  .hm-instruction__aside {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    grid-template-rows: none;
  }

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

  .hm-instruction__step {
    grid-template-columns: minmax(0, 1fr) 44%;
  }

  .hm-benefits__head {
    align-items: flex-start;
  }

  .hm-benefits__rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
    padding: 0;
    overflow: visible;
  }

  .hm-benefits__strap,
  .hm-benefit__node,
  .hm-benefit__card::after {
    display: none;
  }

  .hm-benefit {
    display: block;
    min-width: 0;
  }

  .hm-benefit--left .hm-benefit__card,
  .hm-benefit--right .hm-benefit__card {
    width: 100%;
    height: 100%;
    min-height: 250px;
    padding: 22px;
  }

  .how-order--shared .order-steps,
  .home-page .order-steps,
  .product-page .order-steps,
  .catalog-page .order-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Catalog: collapse filters and keep cards readable. */
  .catalog-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
  }

  .catalog-head h1,
  .catalog-head p {
    max-width: 760px;
  }

  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .catalog-sidebar {
    position: static;
  }

  .filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 0 18px;
    color: var(--gw-text);
    background: #fff;
    border: 1.5px solid var(--gw-line);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
  }

  .filter-toggle__arrow {
    display: flex;
    margin-left: auto;
    transition: transform 220ms ease;
  }

  .filter-toggle.is-open .filter-toggle__arrow {
    transform: rotate(180deg);
  }

  .catalog-filter-panel {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
    margin-top: 10px;
    padding: 18px;
    background: #fff;
    border: 1.5px solid var(--gw-line);
    border-radius: 12px;
  }

  .catalog-filter-panel.is-open {
    display: grid;
  }

  .filter-reset-wrap {
    grid-column: 1 / -1;
  }

  .catalog-page .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .catalog-page .product-card__name {
    min-height: 2.45em;
    font-size: 19px;
  }

  /* Product detail gets a full readable row instead of two cramped columns. */
  .product-page .product-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 900px;
    margin-right: auto;
    margin-left: auto;
  }

  .product-page .product-detail__gallery {
    aspect-ratio: 16 / 9;
  }

  .product-page .product-detail__info {
    padding-top: 0;
  }

  .product-page .product-detail__name {
    max-width: 760px;
    font-size: clamp(38px, 5vw, 50px);
  }

  .product-page .product-detail__attrs.product-card__attrs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-page .product-reliability__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-page .product-reliability__card:last-child {
    grid-column: 1 / -1;
  }

  /* Shared content pages. */
  .hero__grid,
  .contacts-layout {
    grid-template-columns: 1fr;
  }

  .hero__media {
    max-width: 820px;
  }

  .contacts-layout {
    gap: 40px;
  }

  .tips-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1100px) and (max-width: 1199px) {
  .hm-hero__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  }

  .hm-hero__card {
    padding: 34px;
  }

  .hm-hero__title {
    font-size: clamp(42px, 4.6vw, 54px);
  }

  .hm-hero__photo {
    aspect-ratio: 1.2 / 1;
  }
}
