/* Responsive system v2: shared site layout */
:root {
  --shell-max: 1160px;
  --shell-gutter: clamp(14px, 2.8vw, 32px);
  --header-logo-size: clamp(40px, 4.2vw, 56px);
  --header-brand-top-size: clamp(12px, 1.35vw, 16px);
  --header-brand-bottom-size: clamp(18px, 2vw, 24px);
  --header-cart-width: clamp(138px, 16vw, 176px);
  --header-cart-icon-size: clamp(26px, 2.3vw, 34px);
  --header-cart-title-size: clamp(13px, 1.45vw, 18px);
  --header-cart-sub-size: clamp(10px, 0.95vw, 13px);
  --header-nav-size: clamp(14px, 1.45vw, 18px);
  --section-space-y: clamp(28px, 4vw, 48px);
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

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

.container {
  width: min(var(--shell-max), calc(100vw - (var(--shell-gutter) * 2)));
}

.section {
  padding: var(--section-space-y) 0;
}

.section,
.hero,
.site-footer,
.why-strip,
.why-strip-inner,
.grid,
.card,
.home-product-card,
.tip-card,
.telegram,
.feedback-card,
.feedback-modal,
.feedback-form,
.feedback-message-grid,
.feedback-success,
.feedback-success-card {
  min-width: 0;
}

.site-header {
  position: fixed !important;
  top: var(--dev-banner-height);
  left: 0;
  right: 0;
  width: 100%;
  z-index: 2000;
}

.page-shell {
  padding-top: calc(var(--dev-banner-height) + var(--site-header-height));
}

.page-shell .site-header + main,
.page-shell > main {
  min-width: 0;
}

.site-header .container.header-row,
.header-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand actions"
    "nav nav";
  align-items: center;
  gap: 14px 18px;
  padding: 14px 0 12px;
}

.header-row > * {
  min-width: 0;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.brand img {
  width: var(--header-logo-size);
  height: var(--header-logo-size);
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  line-height: 1;
}

.brand-top,
.brand-bottom {
  display: block;
  white-space: nowrap;
}

.brand-top {
  font-size: var(--header-brand-top-size);
}

.brand-bottom {
  font-size: var(--header-brand-bottom-size);
}

.header-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: var(--header-cart-width);
  min-width: var(--header-cart-width);
  padding-right: clamp(0px, 0.5vw, 8px);
}

.cart {
  width: 100%;
  display: grid;
  grid-template-columns: var(--header-cart-icon-size) minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
}

.cart img {
  grid-row: 1 / span 2;
  width: var(--header-cart-icon-size);
  height: var(--header-cart-icon-size);
  object-fit: contain;
  align-self: center;
  justify-self: start;
}

.cart-label {
  display: grid;
  gap: 2px;
  align-content: center;
  justify-items: start;
  min-width: 0;
}

.cart-title {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  font-size: var(--header-cart-title-size);
  font-weight: 700;
  line-height: 1.05;
}

.cart-count {
  display: inline-block;
  font: inherit;
  line-height: inherit;
}

.cart-sub {
  white-space: nowrap;
  font-size: var(--header-cart-sub-size);
  line-height: 1.05;
  color: #4f5e4f;
  font-weight: 600;
}

.nav {
  grid-area: nav;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 18px);
  width: 100%;
  align-items: stretch;
  justify-items: stretch;
  font-size: var(--header-nav-size);
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  text-align: center;
  line-height: 1.15;
}

.hero {
  min-height: clamp(360px, 62vw, 520px);
}

.hero-content {
  padding: clamp(48px, 8vw, 72px) 0;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
}

.hero-sub,
.hero-tag {
  font-size: clamp(16px, 2vw, 22px);
}

.why-strip-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.products-home {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.footer-row {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

@media (max-width: 1024px) {
  :root {
    --shell-gutter: 16px;
    --header-logo-size: 46px;
    --header-brand-top-size: 13px;
    --header-brand-bottom-size: 20px;
    --header-cart-width: 150px;
    --header-cart-icon-size: 30px;
    --header-cart-title-size: 15px;
    --header-cart-sub-size: 11px;
    --header-nav-size: 15px;
  }

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

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

  .footer-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 900px) {
  .page-shell {
    padding-top: calc(var(--dev-banner-height) + var(--site-header-height));
  }

  :root {
    --shell-gutter: 14px;
    --header-logo-size: 38px;
    --header-brand-top-size: 11px;
    --header-brand-bottom-size: 16px;
    --header-cart-width: 126px;
    --header-cart-icon-size: 24px;
    --header-cart-title-size: 12px;
    --header-cart-sub-size: 9px;
    --header-nav-size: 13px;
  }

  .site-header .container.header-row,
  .header-row {
    gap: 10px 12px;
    padding: 10px 0 8px;
  }

  .brand {
    max-width: calc(100% - var(--header-cart-width) - 10px);
    gap: 10px;
  }

  .header-actions {
    width: var(--header-cart-width);
    min-width: var(--header-cart-width);
    padding-right: 0;
  }

  .cart {
    column-gap: 7px;
  }

  .nav a {
    min-height: 34px;
    padding: 0 4px;
  }

  .hero {
    min-height: 300px;
  }

  .media-grid,
  .footer-row,
  .cookie-notice,
  .feedback-message-grid {
    grid-template-columns: 1fr;
  }

  .footer-row {
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .page-shell {
    padding-top: calc(var(--dev-banner-height) + var(--site-header-height));
  }

  :root {
    --shell-gutter: 10px;
    --header-logo-size: 34px;
    --header-brand-top-size: 10px;
    --header-brand-bottom-size: 13px;
    --header-cart-width: 110px;
    --header-cart-icon-size: 22px;
    --header-cart-title-size: 11px;
    --header-cart-sub-size: 9px;
  }

  .site-header .container.header-row,
  .header-row {
    gap: 8px;
    padding: 8px 0 6px;
  }

  .brand {
    gap: 8px;
    max-width: calc(100% - var(--header-cart-width) - 8px);
  }

  .header-actions {
    align-self: start;
  }

  .cart {
    grid-template-columns: var(--header-cart-icon-size) minmax(0, 1fr);
    column-gap: 6px;
    row-gap: 1px;
  }

  .nav {
    gap: 4px;
  }

  .nav a {
    font-size: 0;
    min-height: 30px;
    padding: 0 2px;
  }

  .nav a::before {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .nav a:nth-child(1)::before { content: "Каталог"; }
  .nav a:nth-child(2)::before { content: "Советы"; }
  .nav a:nth-child(3)::before { content: "Вопросы"; }
  .nav a:nth-child(4)::before { content: "Контакты"; }

  .hero-content {
    padding: 32px 0 38px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero-sub,
  .hero-tag {
    font-size: 15px;
  }

  .why-strip-grid,
  .products-home,
  .footer-row {
    grid-template-columns: 1fr;
  }
}

/* Cart page: coherent row layout */
.cart-card,
.cart-item-row,
.cart-table-head,
.checkout-box,
.promo-block,
.promo-row,
.checkout-form,
.checkout-actions {
  min-width: 0;
}

.cart-table-head,
.cart-item-row {
  grid-template-columns: minmax(260px, 1.6fr) 140px 132px 138px 42px;
  gap: 12px;
}

.cart-item-row {
  align-items: center;
}

.cart-item-name strong {
  font-size: clamp(20px, 2vw, 22px);
}

.cart-item-unit-price,
.cart-item-line-sum {
  justify-self: end;
  text-align: right;
}

.qty-inline {
  justify-self: start;
  grid-template-columns: 34px 48px 34px;
  gap: 6px;
}

.qty-inline button,
.qty-inline input,
.remove-btn {
  height: 34px;
}

.qty-inline button {
  width: 34px;
  padding: 0;
  border-radius: 10px;
}

.qty-inline input {
  width: 48px;
  font-size: 16px;
  border-radius: 10px;
}

.remove-btn {
  width: 34px;
  justify-self: end;
}

@media (max-width: 900px) {
  .cart-table-head {
    display: none;
  }

  .cart-item-row {
    grid-template-columns: 34px max-content 1fr;
    grid-template-areas:
      "name name unit"
      "remove qty sum";
    gap: 10px 10px;
    align-items: start;
    padding: 12px 10px;
    border: 1px solid #e7ece3;
    border-radius: 14px;
    margin: 10px 0;
  }

  .cart-item-name {
    grid-area: name;
  }

  .cart-item-unit-price {
    grid-area: unit;
    justify-self: end;
    align-self: start;
  }

  .qty-inline {
    grid-area: qty;
    justify-self: start;
    grid-template-columns: 32px 44px 32px;
    gap: 4px;
  }

  .cart-item-line-sum {
    grid-area: sum;
    justify-self: end;
    align-self: center;
    font-size: 20px;
    line-height: 1.08;
  }

  .remove-btn {
    grid-area: remove;
    justify-self: start;
    align-self: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .qty-inline button,
  .qty-inline input {
    height: 32px;
  }

  .qty-inline button {
    width: 32px;
    border-radius: 9px;
    font-size: 18px;
  }

  .qty-inline input {
    width: 44px;
    border-radius: 9px;
    font-size: 15px;
  }

  .cart-bottom {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .promo-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 600px) {
  .cart-section {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .cart-top h1 {
    font-size: 26px;
  }

  .cart-item-name strong {
    font-size: 18px;
  }

  .cart-item-name span {
    font-size: 14px;
  }

  .cart-item-line-sum {
    font-size: 17px;
  }

  .price-new-inline {
    font-size: 18px;
  }

  .price-old-inline {
    font-size: 11px;
  }

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

  .promo-row input,
  .promo-row button,
  .checkout-box button,
  .checkout-actions button {
    width: 100%;
  }

  .checkout-form {
    grid-template-columns: 1fr;
  }

  .checkout-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
