/* Мобильная версия (<1024), эталон Figma 402px (761-32019). Подключается последним; всё внутри @media — десктоп не затронут.
   Ширина колонки = 100vw − 2·--mx (на 402 это 354, поля 24); на 600…1023 колонка центрируется с max 552. */
@media (max-width: 1023.98px) {
  :root { --mx: max(24px, calc(50vw - 276px)); --sand: #ffd7a6;
    --tl: radial-gradient(circle at 100% 100%, #0000 32.2px, var(--sand) 32.8px);
    --tr: radial-gradient(circle at 0 100%, #0000 32.2px, var(--sand) 32.8px);
    --br: radial-gradient(circle at 0 0, #0000 32.2px, var(--sand) 32.8px);
    --bl: radial-gradient(circle at 100% 0, #0000 32.2px, var(--sand) 32.8px); }
  html { zoom: 1 !important; }
  body { min-width: 0; }
  section, footer { scroll-margin-top: 54px; }
  .m-only, .m-br { display: revert; }
  .d-br { display: none; }
  .frame, .frame--fluid { left: 0; width: auto; height: auto; margin: 0 var(--mx); }
  picture { display: contents; }

  /* шапка + бургер */
  .header { height: 54px; }
  .header .frame { height: 54px; }
  .header__logo { left: 0; width: 96px; height: 22.018px; }
  .header__menu, .header__cta { display: none; }
  .header__burger { display: flex; align-items: center; justify-content: center; position: absolute; right: -6px; top: 50%; width: 44px; height: 44px; transform: translateY(-50%); padding: 0; border: 0; background: none; cursor: pointer; }
  .header__burger img { transition: opacity .2s; }
  .header__burger::before, .header__burger::after { content: ""; position: absolute; left: 50%; top: 50%; width: 21px; height: 3.33px; margin: -1.67px 0 0 -10.5px; border-radius: 2px; background: var(--sand); opacity: 0; transition: opacity .2s; }
  .header__burger::before { transform: rotate(45deg); }
  .header__burger::after { transform: rotate(-45deg); }
  .header__burger.is-open img { opacity: 0; }
  .header__burger.is-open::before, .header__burger.is-open::after { opacity: 1; }
  .header__burger:focus-visible { outline: 2px solid var(--sand); outline-offset: -4px; border-radius: 12px; }
  .m-menu { display: flex; flex-direction: column; position: fixed; z-index: 99; top: 54px; left: 0; right: 0; max-height: calc(100vh - 54px); overflow-y: auto; padding: 8px var(--mx) 24px; border-radius: 0 0 24px 24px; background: rgba(30, 16, 13, .96); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .25s, transform .25s, visibility 0s .25s; }
  .m-menu.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s; }
  .m-menu a:not(.btn) { display: flex; align-items: center; min-height: 52px; color: #fff; font-weight: 500; font-size: 18px; line-height: 1.2; border-bottom: 1px solid rgba(255, 255, 255, .12); transition: color .25s; }
  .m-menu a:not(.btn):hover, .m-menu a:not(.btn):focus-visible { color: var(--sand); }
  .m-menu .btn { margin-top: 20px; }

  /* 0 — главный экран */
  #hero { height: auto; }
  #hero .frame { padding-top: 54px; }
  .hero__card { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: 354 / 506; border-radius: 24px; }
  .hero__photo { left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; object-position: bottom; }
  .hero__text { display: contents; }
  .hero__head { position: absolute; top: 91px; left: 0; right: 0; width: auto; max-width: 347px; margin: 0 auto; gap: 12px; align-items: center; text-align: center; }
  .hero__title { font-size: 32px; max-width: 319px; }
  .hero__lead { width: auto; font-size: 14px; line-height: 1.2; }
  .hero__buttons { flex-direction: column; align-items: stretch; gap: 12px; width: 100%; margin-top: 24px; }
  .hero__buttons .btn { flex: none; width: 100%; }

  /* 1 — миссия */
  #mission { height: auto; min-height: 852px; padding: 262px 8px 120px; background: #1e100d; }
  #mission::before, #cta::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
  #mission::before {
    -webkit-mask-image: linear-gradient(#0000 80px, #000 130px, #000 calc(100% - 116px), #0000 calc(100% - 66px)); mask-image: linear-gradient(#0000 80px, #000 130px, #000 calc(100% - 116px), #0000 calc(100% - 66px));
    background:
      radial-gradient(circle at calc(50% - .5px) 425.5px, #0000 269px, rgba(255, 215, 166, .1) 269.5px, rgba(255, 215, 166, .1) 271.5px, #0000 272px),
      radial-gradient(circle at calc(50% + 271.5px) 775.5px, #0000 269px, rgba(255, 215, 166, .1) 269.5px, rgba(255, 215, 166, .1) 271.5px, #0000 272px),
      radial-gradient(circle at calc(50% - 259.5px) 42.5px, #0000 269px, rgba(255, 215, 166, .1) 269.5px, rgba(255, 215, 166, .1) 271.5px, #0000 272px),
      linear-gradient(rgba(255, 215, 166, .1), rgba(255, 215, 166, .1)) calc(var(--mx) - 1px) 0 / 2px 100% no-repeat,
      linear-gradient(rgba(255, 215, 166, .1), rgba(255, 215, 166, .1)) calc(100% - var(--mx) + 1px) 0 / 2px 100% no-repeat,
      linear-gradient(rgba(255, 215, 166, .1), rgba(255, 215, 166, .1)) 0 153px / 100% 2px no-repeat,
      linear-gradient(rgba(255, 215, 166, .1), rgba(255, 215, 166, .1)) 0 696px / 100% 2px no-repeat,
      var(--tl) calc(var(--mx) + 1px) 155px / 32.62px 32.92px no-repeat,
      var(--br) calc(var(--mx) - 31.6px) 122px / 32.62px 32.92px no-repeat,
      var(--tr) calc(100% - var(--mx) + 1px) 698px / 32.62px 32.92px no-repeat,
      var(--bl) calc(100% - var(--mx) + 33.6px) 665px / 32.62px 32.92px no-repeat,
      var(--tr) calc(100% - var(--mx) + 1px) 155px / 32.62px 32.92px no-repeat,
      var(--bl) calc(var(--mx) + 1px) 665px / 32.62px 32.92px no-repeat;
  }
  .mission__stack { position: relative; z-index: 1; left: auto; top: auto; transform: none; width: min(385px, 100%); margin: 0 auto; gap: 47px; }
  .mission__label { gap: 11px; }
  .mission__star { width: 24px; height: 24px; }
  .mission__label-text { font-size: 14px; }
  .mission__body { gap: 24px; align-items: center; }
  .mission__title { width: 100%; max-width: 344px; font-size: 20px; }
  .mission__text { width: 100%; max-width: 344px; font-size: 14px; }

  /* 2 — «Поможем сделать…» */
  #for-whom { height: auto; padding: 60px 0; }
  .for-whom__title { position: static; width: auto; font-size: 28px; margin-bottom: 32px; }
  .for-whom__cards { position: static; width: auto; height: auto; flex-direction: column; gap: 16px; }
  .card { flex: none; width: 100%; height: auto; aspect-ratio: 354 / 510; padding: 19.398px; border-radius: 25.864px; gap: 8.082px; }
  .card__title { font-size: 24px; }
  .card__text { font-size: 14px; }
  .card--memories .card__text { width: auto; }
  .card__shade { top: 62.47%; width: 199.5%; height: 59.5%; filter: blur(101px); }
  .card--past .card__photo { left: -8.76%; top: -5.88%; width: 113.84%; height: 105.88%; object-fit: cover; }
  .card--memories .card__photo { left: -11.58%; top: -13.33%; width: 121.75%; height: 113.33%; object-fit: cover; }
  .card--children .card__photo { left: -17.51%; top: -22.35%; width: 131.62%; height: 122.35%; object-fit: cover; }

  /* 3 — шаги: сетка [значок | заголовок] / текст / картинка; inline-стили десктопа перебиваются !important */
  #how { height: auto; padding: 60px 0 40px; }
  #how .frame { display: grid; grid-template-columns: 40px 1fr; column-gap: 16px; align-content: start; }
  .how__abs { position: static; }
  .how__title { grid-column: 1 / -1; font-size: 28px; white-space: normal; margin-bottom: 41px; }
  .how__badge { width: 40px !important; height: 40px !important; align-self: center; }
  .how__step { align-self: center; font-size: 20px; line-height: 1.2; white-space: normal; }
  .how__text { grid-column: 1 / -1; width: auto !important; margin-top: 16px; font-size: 14px; line-height: 1.3; }
  .how__shot { grid-column: 1 / -1; width: var(--w) !important; height: auto; margin: 24px calc((100vw - 2 * var(--mx) - var(--w)) / 2) 64px; }
  .how__anim { position: relative; left: auto !important; top: auto !important; }
  #how-shot-1 { --w: min(100vw, 370.5px); }
  #how-shot-2 { --w: min(100vw, 372.5px); }
  #how-shot-3 { --w: min(100vw, 354px); margin-bottom: 0; }

  /* 4 — книга: порядок заголовок → обложка → список → кнопка */
  #book { height: auto; padding: 61px 0 57px; }
  .book__row { position: static; width: auto; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 24px; }
  .book__col { display: contents; }
  .book__head { order: 1; gap: 16px; }
  .book__cover { order: 2; width: 100%; height: auto; aspect-ratio: 354 / 472; border-radius: 18.115px; }
  .book__cover img { object-fit: cover; }
  .book__list { order: 3; gap: 17px; }
  .book__btn { order: 4; width: 100%; }
  .book__title { font-size: 28px; }
  .book__lead { font-size: 14px; line-height: 1.3; }
  .book__item { gap: 8px; font-size: 14px; line-height: 1.3; }
  .book__item img { width: 24px; height: 24px; }
  .book__item span { width: auto; }

  /* 5 — призыв */
  #cta { height: auto; min-height: 808px; display: flex; background: #1e100d url("../assets/img/m-cta-bg.png") -121px 0 / 711px 952px no-repeat; }
  @media (min-width: 592px) { #cta { background-position: center; background-size: cover; } }
  #cta::before {
    background:
      radial-gradient(circle at calc(50% + 80px) 541px, #0000 284.5px, rgba(255, 215, 166, .2) 285px, rgba(255, 215, 166, .2) 287px, #0000 287.5px),
      radial-gradient(circle at calc(50% - 57.5px) 360.5px, #0000 333px, rgba(255, 215, 166, .2) 333.5px, rgba(255, 215, 166, .2) 335.5px, #0000 336px),
      linear-gradient(rgba(255, 215, 166, .22), rgba(255, 215, 166, .22)) calc(var(--mx) - 1px) 0 / 2px 100% no-repeat,
      linear-gradient(rgba(255, 215, 166, .22), rgba(255, 215, 166, .22)) calc(100% - var(--mx) + 1px) 0 / 2px 100% no-repeat,
      linear-gradient(rgba(255, 215, 166, .22), rgba(255, 215, 166, .22)) 0 271px / 100% 2px no-repeat,
      linear-gradient(rgba(255, 215, 166, .22), rgba(255, 215, 166, .22)) 0 673px / 100% 2px no-repeat,
      var(--tr) calc(100% - var(--mx) + 1px) 273px / 32.62px 32.92px no-repeat,
      var(--tl) calc(var(--mx) + 1px) 273px / 32.62px 32.92px no-repeat,
      var(--br) calc(100% - var(--mx) + 1px) 637px / 32.62px 32.92px no-repeat,
      var(--bl) calc(100% - var(--mx) + 33.6px) 236px / 32.62px 32.92px no-repeat,
      var(--tr) calc(var(--mx) - 31.6px) 674px / 32.62px 32.92px no-repeat,
      var(--bl) calc(var(--mx) + 1px) 637px / 32.62px 32.92px no-repeat;
  }
  #cta .frame { position: relative; z-index: 1; flex: 1; display: flex; padding: 60px 0 71px; }
  .cta__text { position: static; width: 100%; justify-content: space-between; gap: 24px; }
  .cta__head { gap: 16px; }
  .cta__title { font-size: 28px; }
  .cta__lead { width: auto; font-weight: 500; font-size: 14px; line-height: 1.3; }
  .cta__btn { width: 100%; height: 52px; background: #ec642a; color: #fff; }
  .cta__btn:hover, .cta__btn:focus-visible { background: #d4521b; }

  /* 6 — вопросы и ответы */
  #faq { height: auto; padding: 60px 0; }
  .faq__col { position: static; left: auto; width: auto; align-items: stretch; gap: 32px; }
  .faq__title { font-size: 28px; text-align: left; color: #1e100d; }
  .faq__list { width: 100%; }
  .faq__item { padding-bottom: 24px; }
  .faq__item:not(:first-child) { padding-top: 24px; }
  .faq__item:last-child { padding-bottom: 0; }
  .faq__q, .faq__item.is-open .faq__q { padding: 13px 40px 13px 0; margin: -13px 0; font-size: 14px; line-height: 1.208; }
  .faq__q::before, .faq__q::after { left: auto; right: 0; top: calc(50% - .75px); width: 19px; height: 1.5px; }
  .faq__a p { width: auto; max-width: 305px; padding: 4px 0 0; font-size: 14px; line-height: 1.208; }
  .faq__a > div::after { height: 0; }

  /* 7 — подписка */
  #subscribe { height: auto; min-height: 952px; }
  .sub__bg { left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; }
  #subscribe .frame { position: relative; height: auto; padding: 60px 0 24px; }
  .sub__group { position: static; width: auto; height: auto; }
  .sub__group > .sub__phones { display: none; }
  .sub__text { position: static; width: auto; gap: 40px; }
  .sub__head { gap: 16px; }
  .sub__title { font-size: 28px; }
  .sub__lead { font-size: 14px; line-height: 1.3; }
  .sub__form { flex-direction: column; align-items: stretch; gap: 20px; width: 100%; }
  .sub__input { width: 100%; }
  .sub__btn { width: 100%; height: 52px; font-size: 18px; }
  .sub__stage { display: block; position: relative; width: min(100vw, 402px); margin: 35px 0 0 calc(50% - min(100vw, 402px) / 2); aspect-ratio: 402 / 527; }
  .sub__stage .sub__phone--back { left: 41.79%; top: 0; width: 53.76%; }
  .sub__phone--back { clip-path: inset(0.52% 0.92% 0.52% 0.92% round 18% / 8.7%); } /* экспорт Figma 761:32504 приходит с углами #ffeeda — срезаем по контуру корпуса */
  .sub__stage .sub__phone--front { left: 4.23%; top: 14.42%; width: 53.76%; }

  /* 8 — подвал */
  #footer { height: auto; }
  #footer .frame { display: flex; justify-content: center; padding: 50px 0 48px; }
  .footer__socials { position: static; transform: none; gap: 20.8px; }

  .toast { top: 70px; width: max-content; max-width: calc(100vw - 48px); padding: 14px 20px; font-size: 16px; text-align: center; }
}
