/* ============================================================
   Витрина: большие нажимаемые части (дизайн-сессия, 03.10.2026).

   По просьбе владельца: «пользователь не любит читать, он любит
   тыкать». Две вещи:

   1. «Собери заказ» (.asm, вместо маленькой картинки «пять мест») —
      пять крупных кусков: переписка, блокнот, галерея, таблица, срок в
      голове. Нажатый кусок перелетает в карточку заказа и заполняет её
      строку; есть «Собрать всё сразу» и «Разбросать снова».
   2. «Как это устроено» (.story-on) — прежняя шахматка: слева текст,
      справа живой рисунок, и наоборот (владельцу так нравится). Номера
      01…06 убраны — вместо них значок части; текста — заголовок и
      строка, факты свёрнуты в «Подробнее» (весь текст остаётся в
      странице).

   Скрипт — js/story.js. Без скрипта страница остаётся прежней: шесть
   частей друг под другом, куски и строки карточки видны сразу.
   ============================================================ */

/* ---------- «Собери заказ» ---------- */

.scatter-head {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.scatter-head .lead {
  margin: 18px auto 0;
}

.asm {
  margin-top: clamp(28px, 4vw, 52px);
}
.asm-cap {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 clamp(18px, 2.4vw, 30px);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}
.js-asm .asm-cap {
  display: flex;
}
.asm-cap i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--app-accent);
  animation: fx-hint 2.6s ease-in-out infinite;
}
.asm.full .asm-cap i {
  background: var(--app-ok);
  animation: none;
}

.asm-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(16px, 2.6vw, 40px);
  align-items: center;
}
.asm-col {
  display: grid;
  gap: clamp(14px, 1.8vw, 24px);
}
.asm-right {
  align-content: center;
}

/* куски: каждый — «приложение», в котором заказ живёт сейчас */
.src {
  position: relative;
  display: block;
  width: 100%;
  min-height: 136px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 34px -18px rgba(15, 23, 42, 0.38);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transform: translateX(var(--dx, 0px)) rotate(var(--r, 0deg));
  transition:
    transform 0.4s var(--ease),
    box-shadow 0.3s,
    border-color 0.3s;
}
.src:hover {
  border-color: rgba(58, 86, 212, 0.4);
  box-shadow: 0 24px 46px -20px rgba(58, 86, 212, 0.45);
  transform: translateX(0) rotate(0deg) translateY(-4px) scale(1.02);
}
.src:active {
  transform: translateX(0) rotate(0deg) scale(0.98);
}
.src:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 3px;
}
.src-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.src-tag::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--app-accent));
}
.src-body {
  display: block;
}

/* переписка */
.src-chat {
  --c: #2d9d62;
}
.src-chat .src-body {
  display: grid;
  gap: 6px;
}
.bub {
  display: block;
  max-width: 86%;
  padding: 6px 11px;
  border-radius: 13px 13px 13px 4px;
  background: #eef0f4;
  font-size: 12.5px;
  font-style: normal;
  line-height: 1.35;
}
.bub.out {
  justify-self: end;
  border-radius: 13px 13px 4px 13px;
  background: var(--app-accent);
  color: #fff;
}

/* блокнот */
.src-note {
  --c: #c99a1c;
  background-color: #fffdf3;
  background-image: repeating-linear-gradient(to bottom, transparent 0 21px, rgba(201, 154, 28, 0.28) 21px 22px);
  background-position: 0 38px;
}
.src-note .scr {
  display: block;
  font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
  font-size: 13.5px;
  line-height: 22px;
  color: #3d3524;
  white-space: nowrap;
}
.src-note .scr:nth-child(2) {
  margin-left: 14px;
}

/* галерея */
.src-gal {
  --c: #7a55d8;
}
.gal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.gal i {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #dfe3ec url(/static/img/landing2/kitchen-showcase.jpg) center / 340%;
}

/* таблица */
.src-sheet {
  --c: #1f8a54;
}
.xl {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  border: 1px solid #cfe3d6;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.xl b,
.xl span {
  padding: 4px 8px;
  border-bottom: 1px solid #e3efe7;
}
.xl b {
  background: #e6f3ec;
  font-weight: 600;
  color: #1c5a3c;
}
.xl span:nth-child(odd) {
  border-right: 1px solid #e3efe7;
}
.xl span:nth-last-child(-n + 2) {
  border-bottom: 0;
}

/* голова */
.src-head {
  --c: #d4493a;
  background: linear-gradient(180deg, #fff, #fff7f5);
}
.think {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.think i {
  position: relative;
  padding: 7px 14px;
  border-radius: 100px;
  background: #fff;
  border: 1.5px solid #f0c9c3;
  font-size: 13px;
  font-style: normal;
  color: #7a3a32;
}
.think i:nth-child(2) {
  margin-left: 22px;
}
.think i::after {
  content: '';
  position: absolute;
  left: 14px;
  bottom: -7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #f0c9c3;
}
.think i:nth-child(2)::after {
  display: none;
}

/* кусок уже в карточке: на его месте — пустое «гнездо» */
.src.gone {
  background: transparent;
  border: 1.5px dashed var(--line);
  box-shadow: none;
  transform: none;
  pointer-events: none;
  cursor: default;
}
.src.gone > * {
  opacity: 0;
}
.src.gone::after {
  content: 'уже в карточке ✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.src.back {
  animation: fx-pop 0.5s var(--slow);
}

/* летящая копия куска */
.src-fly {
  position: absolute;
  z-index: 40;
  margin: 0;
  pointer-events: none;
  transform-origin: center;
  transition:
    transform 0.78s cubic-bezier(0.5, 0, 0.2, 1),
    opacity 0.78s ease-in;
}

/* карточка заказа */
.asm-card {
  position: relative;
  padding: 18px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--lift);
  transition:
    box-shadow 0.6s,
    border-color 0.6s;
}
.asm-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 8px;
}
.asm-top em {
  font-style: normal;
  font-weight: 600;
  color: var(--app-muted);
  font-variant-numeric: tabular-nums;
}
.asm-top b {
  flex: 1;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.asm-who {
  margin: 2px 8px 0;
  font-size: 13px;
  color: var(--ink-2);
}
.asm-prog {
  height: 6px;
  margin: 14px 8px 10px;
  border-radius: 6px;
  background: var(--app-ground);
  overflow: hidden;
}
.asm-prog i {
  display: block;
  height: 100%;
  width: calc(var(--n, 5) * 20%);
  border-radius: 6px;
  background: var(--fx-grad);
  transition: width 0.6s var(--slow);
}
.asm-rows {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.asm-rows li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 14px;
  border: 1.5px solid transparent;
  border-radius: 13px;
  background: var(--app-wash);
}
.asm-rows .rk {
  font-size: 14px;
  font-weight: 600;
}
.asm-rows .rv {
  margin-left: auto;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--app-accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* пустая строка: ждёт свой кусок */
.js-asm .asm-rows li:not(.on) {
  background: transparent;
  border: 1.5px dashed var(--app-line);
}
.js-asm .asm-rows li:not(.on) .rk {
  color: var(--ink-3);
}
.js-asm .asm-rows li:not(.on) .rv {
  visibility: hidden;
}
.asm-rows li.on {
  animation: fx-pop 0.5s var(--slow);
}
.asm-rows li.on .rk::before {
  content: '✓';
  margin-right: 8px;
  color: var(--app-ok);
}
.asm-done {
  display: none;
  margin: 12px 8px 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
}
.asm-done b {
  color: var(--app-ok);
}
.asm.full .asm-done,
.asm:not(.js-on) .asm-done {
  display: block;
}
.asm.full .asm-card {
  border-color: rgba(36, 103, 76, 0.45);
  box-shadow:
    0 0 0 5px rgba(36, 103, 76, 0.12),
    var(--lift);
}

.asm-actions {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 4px;
}
.asm-all,
.asm-reset {
  min-height: 46px;
}
.asm-reset[hidden],
.asm-all[hidden] {
  display: none;
}
.asm:not(.js-on) .asm-actions {
  display: none;
}

@media (max-width: 860px) {
  .asm-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      'a b'
      'c d'
      'e e'
      'card card'
      'act act';
    gap: 12px;
    align-items: stretch;
  }
  .asm-col {
    display: contents;
  }
  .src-chat {
    grid-area: a;
  }
  .src-note {
    grid-area: b;
  }
  .src-gal {
    grid-area: c;
  }
  .src-sheet {
    grid-area: d;
  }
  .src-head {
    grid-area: e;
  }
  .asm-card {
    grid-area: card;
    margin-top: 10px;
  }
  .asm-actions {
    grid-area: act;
    grid-auto-flow: column;
    justify-content: center;
    justify-items: stretch;
  }
  .src {
    min-height: 0;
    padding: 12px 12px 13px;
    transform: rotate(var(--r, 0deg));
  }
  .src-tag {
    margin-bottom: 8px;
    font-size: 12px;
  }
  .bub {
    font-size: 11.5px;
    padding: 5px 9px;
  }
  .src-note .scr {
    font-size: 11.5px;
    white-space: normal;
    line-height: 20px;
  }
  .src-note .scr:nth-child(3) {
    display: none;
  }
  .xl {
    font-size: 11px;
  }
  .xl span:nth-last-child(-n + 4) {
    display: none;
  }
  .xl span:nth-last-child(5),
  .xl span:nth-last-child(6) {
    border-bottom: 0;
  }
  .think i {
    font-size: 12.5px;
  }
  .src-head .think {
    grid-auto-flow: column;
    justify-content: start;
    gap: 10px;
  }
  .think i:nth-child(2) {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .asm-cap i {
    animation: none;
  }
  .src-fly {
    transition: none;
  }
}

/* ---------- «Как это устроено»: шахматка с маршрутом ---------- */

.story-on .pillars-head {
  margin-bottom: clamp(20px, 3vw, 40px);
}
.story-on .pillar {
  position: relative;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(36px, 6vw, 96px);
  padding-block: clamp(36px, 4.4vw, 72px);
  border-top: 0;
}
.story-on .pillar + .pillar {
  border-top: 0;
}
/* у перевёрнутых блоков колонки меняются местами: рисунок всегда крупнее текста */
.story-on .pillar.flip {
  grid-template-columns: minmax(0, 1.28fr) minmax(0, 0.72fr);
}
.story-on .pillar-no {
  display: none;
}
.story-on .pillar .h2 {
  margin-top: 0;
  font-size: clamp(25px, 2.6vw, 34px);
  line-height: 1.12;
}
.story-on .pillar .lead {
  margin-top: 14px;
  font-size: 16.5px;
  line-height: 1.5;
}
.story-on .pillar-demo,
.story-on .store-row {
  margin-top: 18px;
}
.story-on .pillar-vis {
  width: 100%;
  max-width: 760px;
  justify-self: center;
}

/* значок части вместо номера «01 · …»: без цифр и без слов, просто узнаваемый знак */
.pillar-ic {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--app-wash);
  color: var(--app-accent);
  box-shadow: inset 0 0 0 1px rgba(58, 86, 212, 0.12);
}
.pillar-ic svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* факты — под «Подробнее» */
.more {
  margin-top: 18px;
}
.more summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.more summary::-webkit-details-marker {
  display: none;
}
.more summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.3s var(--slow);
}
.more[open] summary::after {
  transform: rotate(-135deg) translate(-1px, -1px);
}
.more summary:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}
.more .facts {
  margin-top: 14px;
}

@media (max-width: 900px) {
  /* на телефоне колонки в одну: сначала рисунок (его нажимают), потом текст */
  .story-on .pillar,
  .story-on .pillar.flip {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .story-on .pillar-vis {
    order: -1;
  }
  .story-on .pillar.flip .pillar-txt {
    order: 0;
  }
}
