/* КОФЕ² v4 — one measured rhythm between the rounded page panels.
   Load after v3.css and catalog-v3.css. Widths, radii and artwork stay in v3.
   The old .page-width { margin: 0 auto } outranked main > section, which
   removed the space between most home sections. These scoped selectors
   deliberately outrank that utility; only the following panel owns a gap. */
:root {
  --section-space-v4: clamp(72px, 6.5vw, 96px);
  --route-space-v4: clamp(48px, 4.7vw, 64px);
  --panel-start-v4: clamp(56px, 5.2vw, 76px);
  --panel-end-v4: clamp(40px, 4vw, 56px);
}

/* Keep the boxed 1440px shell and the existing flow-root containment.
   A 28px entrance below the header is distinct from the chapter spacing. */
body > main {
  margin-block: 28px 0;
}

body:not(.interior-page) > main > section {
  margin-block: 0;
}

body:not(.interior-page) > main > section + section {
  margin-block-start: var(--section-space-v4);
}

/* In particular, the aroma section receives only an outside margin.
   Its height, sticky stage, top offset and overflow remain untouched so
   the scroll scene continues to measure its actual, unchanged geometry. */
body > main + .site-footer {
  margin-block-start: var(--section-space-v4);
}

/* Add room within content panels without stacking outside and inside
   spacers. Horizontal gutters and every panel's rounded shape are retained. */
body > main > :is(
  .menu-section,
  .subscription-section,
  .gift-section,
  .pause-section,
  .reviews-section,
  .places-section
) {
  padding-block: var(--panel-start-v4) var(--panel-end-v4);
}

body > main > .pair-section {
  padding: clamp(26px, 2.8vw, 40px);
  column-gap: clamp(32px, 4.3vw, 62px);
  row-gap: 32px;
}

/* The carousel's horizontal gap and card widths are not changed: its
   looping geometry and the review carousel's stepping remain consistent. */
.menu-section .menu-tools {
  margin-block-start: 36px;
}

.menu-section .product-card {
  padding-block: 16px 26px;
}

.menu-section .product-card .product-info {
  padding-block-start: 14px;
}

.menu-section .menu-foot {
  margin-block-start: 20px;
}

.subscription-section {
  row-gap: 40px;
}

.subscription-section .subscription-plans {
  gap: 20px;
}

.subscription-section .subscription-plan {
  padding: clamp(26px, 2.5vw, 34px) clamp(20px, 2vw, 28px);
}

.pause-section .pause-heading {
  margin-block-end: 40px;
}

.pause-section .pause-layout {
  row-gap: 32px;
}

.reviews-section .review-grid {
  margin-block: 40px 28px;
}

.reviews-section .review-item {
  padding: clamp(24px, 2.3vw, 32px);
}

.places-section .places-layout {
  margin-block-start: 40px;
  row-gap: 32px;
}

.places-section .branch-list {
  row-gap: 14px;
}

.places-section .branch-item {
  padding-block: 26px;
}

/* Interior routes use a quieter rhythm. Subscription has three sibling
   panels; catalog and contacts each have one. Reset every old bottom
   margin first, including the catalog's legacy !important declaration. */
body.interior-page > main > :is(section, article, div) {
  margin-block: 0;
}

body.interior-page > main > :is(section, article, div) + :is(section, article, div) {
  margin-block-start: var(--route-space-v4);
}

body.interior-page > main > .catalog-page {
  margin-block-end: 0 !important;
}

body.interior-page > main + .site-footer {
  margin-block-start: var(--route-space-v4);
}

body.interior-page :is(.document-page, .subscription-page-intro) {
  padding-block: clamp(44px, 4.7vw, 68px);
}

body.interior-page .document-page {
  min-height: 0;
}

.catalog-page .catalog-grid {
  row-gap: 28px;
}

.catalog-page .catalog-grid .product-card-v2 {
  padding-block: 14px 24px;
}

.catalog-page .catalog-endnote {
  margin-block-start: 48px;
  padding-block-start: 28px;
}

/* Tablet keeps generous outside space, while paired content can breathe
   vertically after v3 changes its columns. No viewport-height spacers. */
@media (max-width: 980px) {
  :root {
    --section-space-v4: 72px;
    --route-space-v4: 48px;
    --panel-start-v4: 52px;
    --panel-end-v4: 40px;
  }

  .subscription-section {
    row-gap: 36px;
  }
}

/* Compact screens: real 40–56px separation, comfortable 44px top inset,
   and restrained card padding so the menu still fits two columns. */
@media (max-width: 650px) {
  :root {
    --section-space-v4: clamp(40px, 8.6vw, 56px);
    --route-space-v4: clamp(36px, 7vw, 44px);
    --panel-start-v4: 44px;
    --panel-end-v4: 32px;
  }

  body > main > .pair-section {
    padding: 20px;
    gap: 30px;
  }

  .menu-section .menu-tools {
    margin-block-start: 28px;
  }

  .menu-section .product-card {
    padding-block: 14px 24px;
  }

  .menu-section .product-card .product-info {
    padding-block-start: 12px;
  }

  .menu-section .menu-foot {
    margin-block-start: 16px;
  }

  .subscription-section {
    row-gap: 32px;
  }

  .subscription-section .subscription-plans {
    gap: 18px;
  }

  .subscription-section .subscription-plan {
    padding: 28px 24px;
  }

  .pause-section .pause-heading {
    margin-block-end: 28px;
  }

  .pause-section .pause-layout {
    row-gap: 28px;
  }

  .reviews-section .review-grid {
    margin-block: 28px 22px;
  }

  .reviews-section .review-item {
    padding: 24px;
  }

  .places-section .places-layout {
    margin-block-start: 28px;
    row-gap: 24px;
  }

  .places-section .branch-list {
    row-gap: 12px;
  }

  .places-section .branch-item {
    padding-block: 24px;
  }

  body.interior-page :is(.document-page, .subscription-page-intro) {
    padding-block: 40px;
  }

  .catalog-page .catalog-grid {
    row-gap: 24px;
  }

  .catalog-page .catalog-grid .product-card-v2 {
    padding-block: 12px 20px;
  }

  .catalog-page .catalog-endnote {
    margin-block-start: 36px;
    padding-block-start: 24px;
  }
}
