/*
 * Figma responsive layouts — catalogue and set-composition flows.
 * Source: oophelWtqvvRZ18vxjg6IN (796:52118, 796:53417,
 * 770:35966, 770:37698, 770:59648, 770:72556).
 *
 * This file intentionally changes layout only. Product actions, cart state,
 * menus and steppers keep the project’s real DOM/JS behaviour.
 */

@media (min-width: 431px) and (max-width: 860px) ,  (width > 430px) and (max-width: 860px) {
  /* Header in the tablet frames is a floating control group, not a bar. */
  body:has(.sets-page) .site-header,
  body:has(.set-composition-page) .site-header,
  body:has(.edit-set-page) .site-header {
    top: 20px;
    padding: 0 20px;
  }

  body:has(.sets-page) .header-inner,
  body:has(.set-composition-page) .header-inner,
  body:has(.edit-set-page) .header-inner {
    height: 45px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  body:has(.sets-page) .header-logo,
  body:has(.set-composition-page) .header-logo,
  body:has(.edit-set-page) .header-logo { display: none; }

  body:has(.sets-page) .header-right,
  body:has(.set-composition-page) .header-right,
  body:has(.edit-set-page) .header-right {
    margin-left: auto;
    gap: 8px;
  }

  body:has(.sets-page) .cart-btn,
  body:has(.set-composition-page) .cart-btn,
  body:has(.edit-set-page) .cart-btn {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    width: 155px;
    height: 45px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid #fff6eb;
    background: rgba(64, 28, 12, .6);
    -webkit-backdrop-filter: blur(4.5px);
    backdrop-filter: blur(4.5px);
    color: #fff6eb;
  }

  body:has(.sets-page) .cart-icon-wrap,
  body:has(.set-composition-page) .cart-icon-wrap,
  body:has(.edit-set-page) .cart-icon-wrap {
    width: 45px;
    height: 45px;
    background: linear-gradient(180deg, #fff6ed 0%, #f8eadc 100%);
  }

  body:has(.sets-page) .cart-price,
  body:has(.set-composition-page) .cart-price,
  body:has(.edit-set-page) .cart-price {
    display: block;
    flex: 1;
    font-size: 16px;
    text-align: center;
  }

  body:has(.sets-page) .cart-count,
  body:has(.set-composition-page) .cart-count,
  body:has(.edit-set-page) .cart-count {
    top: 26px;
    right: -8px;
    left: auto;
    width: 19px;
    height: 19px;
    border: 1px solid #fff6eb;
    background: linear-gradient(135deg, #da1b2c 0%, #9d1f2a 100%);
    color: #fff6eb;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .site-header {
    z-index: 1000;
    isolation: isolate;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .cart-icon-wrap svg {
    width: 25px;
    height: 19.117px;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .cart-icon-wrap svg path {
    fill: url(#paola-cart-icon-gradient);
    stroke: none;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) :is(.cart-btn, .nav-burger, .sv-back, .es-done, .es-stepper__btn, .es-add-btn) {
    touch-action: manipulation;
  }

  /* Ready sets — 796:52118 (860 × 6048). */
  .sets-page {
    min-height: 0;
    background: #fff6eb;
    overflow: hidden;
  }

  .sets-page .sets-header-outer,
  .sets-page .sets-page__header {
    height: 240px;
    padding: 100px 50px 0;
  }

  .sets-page .sets-page__header .container,
  .sets-page .sets > .container {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .sets-page .sets-header-row { display: block; }
  .sets-page .sets-decorative-badge { display: none; }

  .sets-page .section-title {
    margin: 0;
    font-size: 48px;
    line-height: 58px;
    letter-spacing: 2.88px;
  }

  .sets-page .sets-subtitle {
    gap: 18px;
    margin-top: 7px;
    font-size: 14px;
    line-height: 17px;
  }

  .sets-page .sets-subtitle .subtitle-star {
    width: 23px;
    height: 23px;
  }

  .sets-page .sets {
    height: auto;
    padding: 0 0 188px;
    background: #fff6eb !important;
  }

  .sets-page .sets-list {
    width: 760px;
    margin: 0 auto;
    gap: 32px;
  }

  .sets-page .set-card {
    flex: 0 0 354px;
    width: 760px;
    height: 354px;
    min-height: 0;
  }

  .sets-page .set-card::before {
    top: -8px;
    right: -22px;
    bottom: -22px;
    left: -8px;
  }

  .sets-page .set-card.theme-red-dark::before {
    background-image: url('../../img/figma-pages/catalog-home/set-card-red.svg');
  }

  .sets-page .set-card__content {
    top: 50px;
    left: 60px;
    width: 452px;
  }

  .sets-page .set-card__text { gap: 90px; }
  .sets-page .set-card__title { font-size: 34px; }
.sets-page .set-card__sostav { top: 105px; width: 170px; }

  .sets-page .set-card__group-bg {
    left: 430px;
    top: 0;
    width: 360px;
    height: 354px;
  }

  .sets-page .set-card:nth-child(-n+10) .set-card__product-img {
    left: 480px;
    top: 76px;
    width: 252px;
    height: 220px;
    object-fit: contain;
  }

  .sets-page .set-card:nth-child(1) .set-card__product-img { top: 78px; }
  .sets-page .set-card:nth-child(5) .set-card__product-img { top: 88px; }

  .sets-page .set-card__product-pair,
  .sets-page .set-card__product-composite {
    left: 480px;
    top: 74px;
    width: 252px;
    height: 220px;
  }

  .sets-page .set-card__product-pair { overflow: hidden; }
  .sets-page .set-card__product-pair span { width: 252px; }


  /* 770:37698 and 770:72556 — tablet set grids have four columns. */
  .set-composition-page,
  .edit-set-page { min-height: 0; overflow-x: hidden; }

  .set-composition-page .sv-head,
  .edit-set-page .es-sticky-head {
    height: 248px;
    border-radius: 0 0 32px 32px;
  }

  .set-composition-page .sv-back,
  .edit-set-page .sv-back {
    top: 36px;
    left: 50px;
    font-size: 14px;
  }

  .set-composition-page .sv-summary,
  .edit-set-page .sv-summary {
    top: 102px;
    right: 50px;
    bottom: auto;
    left: 50px;
    height: 84px;
    align-items: flex-start;
  }

  .set-composition-page .sv-ingredients,
  .edit-set-page .sv-ingredients {
    width: 417px;
    height: 112px;
    font-size: 10px;
    line-height: 14px;
  }

  .set-composition-page .sv-grid,
  .edit-set-page .es-grid {
    display: grid;
    grid-template-columns: repeat(4, 180px);
    grid-auto-rows: 130.5px;
    column-gap: 20px;
    row-gap: 10px;
    width: 780px;
    height: auto;
    min-height: 0;
    margin: 0 auto;
    padding: 40px 0 58px;
    overflow: visible;
    transform: none;
    zoom: 1;
  }

  .set-composition-page .sv-grid--figma,
  .edit-set-page .es-stage.is-figma-initial { background: none; }

  .set-composition-page .sv-grid--figma .sv-flavor,
  .edit-set-page .es-stage.is-figma-initial .es-grid,
  .edit-set-page .es-stage.is-figma-initial .es-done-bar { opacity: 1; }

  .edit-set-page .es-stage {
    width: 100%;
    height: auto;
    margin-top: 0;
  }

  .edit-set-page .es-grid .es-tile,
  .edit-set-page .es-grid .es-add-tile { width: 180px; height: 130.5px; }

  .edit-set-page .es-done-bar {
    height: 101px;
    margin-top: 0;
    padding: 28px 20px;
    border-radius: 32px 32px 0 0;
  }
}

@media (max-width: 430px) {
  /* 208:4719: the delivery photo triptychs intentionally bleed from one
     viewport edge to the other. The generic img max-width rule was shrinking
     those live images to their 382px card and shifting them 24px right. */
  body.home .dc-art--coffee-photos,
  body.home .dc-art--vending-photos,
  body.home .dc-art--door-photos {
    left: -24px;
    width: 430px;
    max-width: none;
  }

  /* These line breaks are editorial in the mobile Figma frame, rather than
     decorative spacing: retaining them preserves both copy hierarchy and
     the intended text geometry. */
  body.home .delivery-card__desc br { display: block; }

  body.home .cert-subtitle br { display: block; }

  /* The three pages share the native floating mobile header. */
  body:has(.sets-page) .site-header,
  body:has(.set-composition-page) .site-header,
  body:has(.edit-set-page) .site-header {
    top: 20px;
    padding: 0 12px 0 20px;
  }

  body:has(.sets-page) .header-inner,
  body:has(.set-composition-page) .header-inner,
  body:has(.edit-set-page) .header-inner {
    height: 45px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  body:has(.sets-page) .header-logo,
  body:has(.set-composition-page) .header-logo,
  body:has(.edit-set-page) .header-logo { display: none; }

  body:has(.sets-page) .header-right,
  body:has(.set-composition-page) .header-right,
  body:has(.edit-set-page) .header-right { margin-left: auto; gap: 8px; }

  body:has(.sets-page) .cart-btn,
  body:has(.set-composition-page) .cart-btn,
  body:has(.edit-set-page) .cart-btn {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    width: 155px;
    height: 45px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid #fff6eb;
    background: rgba(64, 28, 12, .6);
    -webkit-backdrop-filter: blur(4.5px);
    backdrop-filter: blur(4.5px);
    color: #fff6eb;
  }

  body:has(.sets-page) .cart-icon-wrap,
  body:has(.set-composition-page) .cart-icon-wrap,
  body:has(.edit-set-page) .cart-icon-wrap {
    width: 45px;
    height: 45px;
    background: linear-gradient(180deg, #fff6ed 0%, #f8eadc 100%);
  }

  body:has(.sets-page) .cart-price,
  body:has(.set-composition-page) .cart-price,
  body:has(.edit-set-page) .cart-price { display: block; flex: 1; font-size: 16px; text-align: center; }

  body:has(.sets-page) .cart-count,
  body:has(.set-composition-page) .cart-count,
  body:has(.edit-set-page) .cart-count {
    top: 26px;
    right: -8px;
    left: auto;
    width: 19px;
    height: 19px;
    border: 1px solid #fff6eb;
    background: linear-gradient(135deg, #da1b2c 0%, #9d1f2a 100%);
    color: #fff6eb;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .site-header {
    z-index: 1000;
    isolation: isolate;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .cart-icon-wrap svg {
    width: 25px;
    height: 19.117px;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) .cart-icon-wrap svg path {
    fill: url(#paola-cart-icon-gradient);
    stroke: none;
  }

  body:has(:is(.sets-page, .set-composition-page, .edit-set-page)) :is(.cart-btn, .nav-burger, .sv-back, .es-done, .es-stepper__btn, .es-add-btn) {
    touch-action: manipulation;
  }

  /* Ready sets — 796:53417 (430 × 6963). */
  /* The source had two card-background assets named incorrectly: keep the
     native card content and restore the red set from its actual theme. */
  .sets-page .set-card.theme-red-dark::before {
    background-image: url('../../img/figma-pages/catalog-home/set-card-red.svg');
  }

  /* 770:35966 — the composition head is 245px; the product card may extend
     below its rounded material, exactly as it does in Figma. */
  .set-composition-page .sv-head,
  .edit-set-page .es-sticky-head {
    height: 245px;
    overflow: visible;
    border-radius: 0 0 32px 32px;
  }

  .set-composition-page .sv-back,
  .edit-set-page .sv-back {
    top: 89px;
    left: 20px;
    font-size: 14px;
  }

  .set-composition-page .sv-summary,
  .edit-set-page .sv-summary {
    top: 141px;
    right: 20px;
    bottom: auto;
    left: 20px;
    display: block;
    height: 84px;
  }

  .set-composition-page .sv-product,
  .edit-set-page .sv-product { height: 84px; }

  .set-composition-page .sv-product__title,
  .edit-set-page .sv-product__title { font-size: 16px; white-space: nowrap; }

  .set-composition-page .sv-ingredients,
  .edit-set-page .sv-ingredients { display: none; }

  .set-composition-page .sv-mobile-hint,
  .edit-set-page .es-hint {
    position: relative;
    display: block;
    width: 390px;
    min-height: 34px;
    margin: 24px 20px 0;
    padding-left: 42px;
    box-sizing: border-box;
    color: #401c0c;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 16px;
  }

  .set-composition-page .sv-mobile-hint::before,
  .edit-set-page .es-hint::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    background: url('../../img/star.svg') center / contain no-repeat;
  }

  .edit-set-page .es-hint strong { font-weight: 500; }

  /* Figma uses overlapping 240px flavour cells (770:35966 / 770:59648),
     not the old compact 160px generic modal tiles. */
  .set-composition-page .sv-grid,
  .edit-set-page .es-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    width: 456px;
    min-height: 0;
    height: auto;
    margin: 24px 0 0 -13px;
    padding: 0;
    gap: 0;
    overflow: visible;
    transform: none;
  }

  .edit-set-page .es-stage,
  .edit-set-page .es-stage.is-figma-initial {
    width: 100%;
    height: auto;
    margin-top: 0;
    background: none;
  }

  .set-composition-page .sv-grid--figma { background: none; }
  .set-composition-page .sv-grid--figma .sv-flavor,
  .edit-set-page .es-stage.is-figma-initial .es-grid,
  .edit-set-page .es-stage.is-figma-initial .es-done-bar { opacity: 1; }

  .set-composition-page .sv-flavor,
  .edit-set-page .es-grid .es-tile {
    flex: 0 0 240px;
    width: 240px;
    height: 174px;
    margin-right: -33px;
    overflow: hidden;
  }

  .set-composition-page .sv-flavor__name,
  .edit-set-page .es-tile .sm-tile__name {
    top: 17px;
    left: 12px;
    width: 216px;
    font-family: var(--font-display);
    font-size: 18px;
    line-height: normal;
    letter-spacing: 1.08px;
    text-align: center;
    text-transform: uppercase;
  }

  .set-composition-page .sv-flavor__photo {
    top: calc(var(--photo-y, 32px) + 22px);
    left: calc(var(--photo-x, 15px) + 26px);
    width: var(--photo-w, 150px);
    height: var(--photo-h, 48px);
    transform: none;
  }

  .edit-set-page .es-tile .sm-tile__photo {
    top: 54px;
    left: 30px;
    width: 180px;
    height: 56px;
    transform: none;
  }

  .set-composition-page .sv-flavor__qty {
    top: 120px;
    left: 90px;
    width: 60px;
    height: 36px;
    font-size: 12px;
  }

  .edit-set-page .es-stepper {
    position: absolute;
    top: 120px;
    left: 68px;
  }

  .edit-set-page .es-stepper__btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .edit-set-page .es-stepper__val {
    width: 60px;
    min-width: 60px;
    height: 36px;
    margin: 0 -7px;
    padding: 10px 0 12px;
    font-size: 12px;
  }

  .edit-set-page .es-grid .es-add-tile {
    display: flex;
    flex: 0 0 430px;
    width: 430px;
    height: 92px;
    margin: 0;
    padding: 16px 22px 30px;
    align-items: flex-start;
  }

  .edit-set-page .es-add-btn {
    width: 390px;
    height: 46px;
    padding: 0;
  }

  .edit-set-page .es-done-bar {
    height: 118px;
    margin-top: 10px;
    padding: 30px 16px 32px;
    border-radius: 28px 28px 0 0;
  }

  .edit-set-page .es-done { width: 398px; height: 56px; }
}

@media (min-width: 861px) ,  (width > 860px) {
  body.home .set-card__title,
  .sets-page .set-card__title {
    width: fit-content;
    max-width: 100%;
    justify-self: start;
    text-align: right;
  }

  body.home .set-card__text,
  .sets-page .set-card__text { gap: 104px; }

  body.home .constructor-sticky-box { padding-inline: 28px; }
  body.home .constructor-sticky-panel #constructor-add { padding-left: 30px; }
  body.home .constructor-sticky-panel .constructor-add__label { text-align: left; }
  /* Наклейка «состав набора»: геометрия по экспортам Figma 188:1495
     (главная) и 796:50788 (каталог) — пятно 172x79 px, начинается в
     -28.6 px от левого края карточки и +100.7 px от её верха.

     Поворот здесь НЕ задаём. Раньше стояло общее rotate(-4.5deg) на обе
     наклейки сразу, и это и был баг: картинки нарисованы по-разному, а
     поворот им добавлялся одинаковый. Замер самих файлов на контрастном
     фоне:

       sets-sticker-home-red-fw10.svg        -11,44°  наклон внутри файла
       catalog/.../phone-sticker-red-fw10    -11,44°  наклон внутри файла
       sets-sticker-catalog-cream-fw10.svg   -11,43°  наклон внутри файла
       sets-sticker-home-cream-fw10.svg       -1,29°  нарисована почти прямо

     То есть у трёх из четырёх угол уже свой, и общие -4.5° их только
     доворачивали: красная уезжала до -15,9°, а белая на главной
     оставалась почти ровной — ровно то, что видно на сайте. Поэтому
     поворот снят, а добирает его отдельным правилом ниже только та
     единственная наклейка, которая нарисована прямо. */
  body.home .set-card__sostav,
  .sets-page .set-card__sostav {
    left: -38px;
    top: 98px;
    width: 200px;
    height: auto;
    transform: none;
  }
  /* Единственная прямая картинка — белая наклейка на главной. Докручиваем
     её до тех же -11,4°, что запечены в остальных трёх: -11,44 + 1,29.
     Точка вращения — левый край: наклейка свисает за край карточки, и
     поворот вокруг центра увёл бы видимую часть вбок. */
  body.home .set-card__sostav--cream,
  body.home .set-card__phone-sostav--cream {
    transform: rotate(-10.15deg);
    transform-origin: left center;
  }
}
