:root {
  --nameki-content-width: 1346px;
  --nameki-content-gutter: clamp(20px, 4vw, 56px);
}

html,
body {
  overflow-x: clip;
}

/* Desktop header: the white/pink row backgrounds remain full-bleed, while
 * links and controls line up with the product catalog. */
@media (min-width: 901px) {
  .nameki-topline,
  .nameki-header-desktop,
  .nameki-catalog-nav {
    width: min(calc(100% - 40px), var(--nameki-content-width));
    max-width: var(--nameki-content-width);
    margin-inline: auto;
    box-sizing: border-box;
  }

  .nameki-topline {
    box-shadow: 0 0 0 100vmax #f7dedf;
    clip-path: inset(0 -100vmax);
  }

  /* Every direct homepage section uses the catalog width. Its own colour is
   * continued into the side gutters, so wide screens do not stretch content. */
  .nameki-home {
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
  }

  .nameki-home > * {
    width: min(100%, var(--nameki-content-width)) !important;
    max-width: var(--nameki-content-width) !important;
    margin-inline: auto !important;
    box-sizing: border-box;
  }

  .nameki-home > .nameki-promos {
    width: 100vw !important;
    max-width: none !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: 0 !important;
    background: var(--active-promo-bg, #e94d76);
    box-shadow: none;
    clip-path: none;
  }

  /* The full-bleed slide owns both side areas. The existing track moves its
   * photograph and background together, while copy follows the catalog grid. */
  .nameki-promos .nameki-promo-slide {
    grid-template-columns: minmax(0, calc((100vw - min(100vw, var(--nameki-content-width))) / 2 + min(58vw, 780.68px))) minmax(0, 1fr);
  }

  .nameki-promos .nameki-promo-slide__copy {
    padding-left: max(var(--nameki-content-gutter), calc((100vw - var(--nameki-content-width)) / 2 + var(--nameki-content-gutter))) !important;
  }

  .nameki-promos .nameki-promo-slide__image img {
    object-fit: contain;
    object-position: right center;
  }

  .nameki-home > .nameki-yandex-trust,
  .nameki-home > .nameki-section {
    box-shadow: 0 0 0 100vmax #fff;
    clip-path: inset(0 -100vmax);
  }

  .nameki-home > .nameki-benefits,
  .nameki-home > .nameki-wedding,
  .nameki-home > .nameki-contact {
    box-shadow: 0 0 0 100vmax #181818;
    clip-path: inset(0 -100vmax);
  }

  /* Only the wedding photograph reaches the viewport edge. Keep the text
   * column in its original position on the shared content grid. */
  .nameki-home > .nameki-wedding {
    position: relative;
    min-height: 620px;
  }

  .nameki-home > .nameki-wedding > .nameki-wedding__image {
    position: absolute;
    top: 0;
    bottom: 0;
    left: min(0px, calc((var(--nameki-content-width) - 100vw) / 2));
    width: calc(52% + max(0px, (100vw - var(--nameki-content-width)) / 2));
    height: 100%;
  }

  .nameki-home > .nameki-wedding > div + div {
    grid-column: 2;
  }

  .nameki-home > .nameki-cats {
    box-shadow: 0 0 0 100vmax #233a32;
    clip-path: inset(0 -100vmax);
  }

  .nameki-home > .nameki-delivery {
    box-shadow: 0 0 0 100vmax #fff8f2;
    clip-path: inset(0 -100vmax);
  }

  .nameki-home > .nameki-social {
    position: relative;
    isolation: isolate;
  }

  .nameki-home > .nameki-social::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffead7, #ffd3df);
  }

  .nameki-promo-slide__copy,
  .nameki-hero__content,
  .nameki-section,
  .nameki-delivery,
  .nameki-contact,
  .nameki-social {
    padding-left: var(--nameki-content-gutter) !important;
    padding-right: var(--nameki-content-gutter) !important;
  }
}

/* Catalog: the photograph remains edge-to-edge. Text, bubbles, filters and
 * products share one vertical grid. */
.nameki-catalog-hero__content {
  left: 50% !important;
  right: auto !important;
  width: min(calc(100% - 40px), var(--nameki-content-width));
  max-width: var(--nameki-content-width);
  padding-inline: 0 !important;
  transform: translateX(-50%);
  box-sizing: border-box;
}

.nameki-flower-nav__track,
body.tax-product_cat #primary,
body.post-type-archive-product #primary {
  width: min(calc(100% - 40px), var(--nameki-content-width)) !important;
  max-width: var(--nameki-content-width) !important;
  margin-inline: auto !important;
  box-sizing: border-box;
}

.nameki-flower-nav__track {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Wedding landing: remove the accidental pink side rails. The landing itself
 * uses the same width as the catalog; intentional dark/green bands keep their
 * full-width backgrounds. */
body.nameki-wedding-page {
  overflow-x: clip;
  background: #fcfaf7 !important;
}

body.nameki-wedding-page #nw-preview {
  width: min(100%, var(--nameki-content-width)) !important;
  max-width: var(--nameki-content-width) !important;
  margin-inline: auto !important;
}

body.nameki-wedding-page #nw-preview > .nw-page-nav,
body.nameki-wedding-page #nw-preview > .nw-hero,
body.nameki-wedding-page #nw-preview > .nw-section,
body.nameki-wedding-page #nw-preview > .nw-price {
  background: #fcfaf7 !important;
  box-shadow: 0 0 0 100vmax #fcfaf7 !important;
  clip-path: inset(0 -100vmax);
}

body.nameki-wedding-page #nw-preview > .nw-strip {
  box-shadow: 0 0 0 100vmax #f1dfd9;
  clip-path: inset(0 -100vmax);
}

body.nameki-wedding-page #nw-preview > .nw-about {
  box-shadow: 0 0 0 100vmax #edf0e9;
  clip-path: inset(0 -100vmax);
}

body.nameki-wedding-page #nw-preview > .nw-final {
  box-shadow: 0 0 0 100vmax #193d33;
  clip-path: inset(0 -100vmax);
}

.nameki-global-footer__main,
.nameki-global-footer__bottom {
  max-width: var(--nameki-content-width) !important;
}

@media (max-width: 900px) {
  .nameki-catalog-hero__content {
    left: 20px !important;
    right: 20px !important;
    width: auto !important;
    transform: none !important;
  }

  .nameki-flower-nav__track,
  body.tax-product_cat #primary,
  body.post-type-archive-product #primary {
    width: calc(100% - 32px) !important;
  }
}
