/* Конструктор книги для гостя: только то, чего нет в стилях кабинета (/portal.css).
   Только свойства, которые понимают и старые Safari и Chrome. */
.book-builder-layout {
  display: grid;
  grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: 40px;
}

/* Сцена: книга и цена. Единственное место страницы с тёплым светом — взгляд начинает отсюда. */
.book-builder-stage {
  position: -webkit-sticky;
  position: sticky;
  top: 88px;
  min-width: 0;
  padding: 28px 28px 24px;
  border: 1px solid var(--external-border);
  border-radius: 28px;
  background-color: var(--external-surface);
  background-image: radial-gradient(120% 70% at 50% 0%, rgba(255, 90, 31, .2), rgba(255, 90, 31, 0) 62%);
}
.book-builder-stage > * { margin: 0; }
.book-builder-stage .external-overline { text-align: center; }
/* Объёмная книга с лендинга (`.book3d` в welcome.css), без cqw, inset и aspect-ratio: размеры заданы числами. */
.book-stage-book { --t: 20px; --w: 232px; position: relative; width: var(--w); height: calc(var(--w) * 1.25); margin: 34px auto 46px; perspective: 1400px; }
@keyframes book-stage-bob { 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: no-preference) { .book-stage-book { animation: book-stage-bob 6s ease-in-out infinite; } }
.book-stage-book.is-size-0 { --t: 11px; }
.book-stage-book.is-size-2 { --t: 30px; }
.book-stage-book::after { content: ''; position: absolute; right: -8%; bottom: -9%; left: 4%; height: 12%; background: radial-gradient(closest-side, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0)); filter: blur(4px); pointer-events: none; }
.book-stage-b3 { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform-style: preserve-3d; transform: rotateY(18deg) rotateX(6deg); }
.book-stage-b3 > div { position: absolute; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.book-stage-cov { top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; padding: 7% 7% 8%; background: #F2ECE1; color: #15120E; box-shadow: inset 0 0 0 1px rgba(21, 18, 14, .08), inset -1px 0 0 rgba(255, 255, 255, .6); transform: translateZ(calc(var(--t) / 2)); }
/* Картинка дизайна вписана по ширине целиком; над ней и под ней — чистая обложка. */
.book-stage-ph { display: flex; flex: 1; align-items: center; min-height: 0; margin-bottom: 6%; overflow: hidden; }
.book-stage-cover { display: block; flex: none; width: 100%; height: auto; }
.book-stage-label { display: flex; align-items: baseline; justify-content: space-between; }
.book-stage-label strong { min-width: 0; max-height: 2.1em; overflow: hidden; font-family: "Unbounded", "Arial Black", system-ui, sans-serif; font-size: 19px; font-weight: 500; line-height: 1.04; letter-spacing: -.04em; overflow-wrap: anywhere; word-wrap: break-word; }
.book-stage-label strong.is-empty { opacity: .4; }
.book-stage-label small { flex: 0 1 42%; min-width: 0; margin-left: 8px; overflow: hidden; color: #6B645A; font-family: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace; font-size: 9px; font-weight: 500; line-height: 1.3; letter-spacing: .08em; text-align: right; text-transform: uppercase; overflow-wrap: anywhere; word-wrap: break-word; }
.book-stage-label small:empty { display: none; }
.book-stage-bk { top: 0; right: 0; bottom: 0; left: 0; background: #E6DED0; transform: translateZ(calc(var(--t) / -2)) rotateY(180deg); }
.book-stage-sp { top: 0; bottom: 0; left: calc(var(--t) / -2); width: var(--t); background: #E2D8C7; box-shadow: inset 1px 0 0 rgba(255, 255, 255, .5), inset -1px 0 0 rgba(21, 18, 14, .18); transform: rotateY(-90deg); transition: width .5s cubic-bezier(.16, 1, .3, 1), left .5s cubic-bezier(.16, 1, .3, 1); }
.book-stage-pg { top: 1.2%; right: calc(var(--t) / -2 + 1px); bottom: 1.2%; width: calc(var(--t) - 2px); background: repeating-linear-gradient(90deg, #F7F3EA 0, #F7F3EA 1px, #D9D1C2 1px, #D9D1C2 2px); transform: rotateY(90deg); transition: width .5s cubic-bezier(.16, 1, .3, 1), right .5s cubic-bezier(.16, 1, .3, 1); }
.book-stage-tp { top: calc(var(--t) / -2 + 1px); right: 1px; left: 0; height: calc(var(--t) - 2px); background: repeating-linear-gradient(0deg, #F7F3EA 0, #F7F3EA 1px, #DCD4C5 1px, #DCD4C5 2px); transform: rotateX(90deg); transition: height .5s cubic-bezier(.16, 1, .3, 1), top .5s cubic-bezier(.16, 1, .3, 1); }
.book-stage-bt { right: 1px; bottom: calc(var(--t) / -2 + 1px); left: 0; height: calc(var(--t) - 2px); background: #CFC6B6; transform: rotateX(-90deg); transition: height .5s cubic-bezier(.16, 1, .3, 1), bottom .5s cubic-bezier(.16, 1, .3, 1); }
.book-stage-facts { color: var(--external-muted); font-size: var(--type-control-label-size); text-align: center; }

.book-builder-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-gap: 8px 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--external-border); line-height: var(--leading-body); }
.book-builder-lines dt { min-width: 0; color: var(--external-muted); overflow-wrap: anywhere; }
.book-builder-lines dd { margin: 0; font-weight: var(--weight-semibold); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.book-builder-total-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 16px; font-weight: var(--weight-semibold); }
/* Прежняя цена рядом с новой (решение владельца 12.11.2026): приглушённо, без нового цвета и шрифта. */
.book-builder-was { font-weight: var(--weight-regular, 400); opacity: .6; text-decoration-thickness: 1px; white-space: nowrap; }
.book-builder-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.book-builder-total { font-size: 40px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.book-builder-split { margin-top: 12px; color: var(--external-muted); font-size: var(--type-control-label-size); line-height: var(--leading-body); }

/* Шаги: открыт один. Пройденные сжаты в строку с ответом, следующие приглушены. */
.book-builder-steps { min-width: 0; }
.book-builder-steps > * + * { margin-top: 12px; }
.book-step { border: 1px solid var(--external-border); border-radius: 22px; background: var(--external-surface); transition: border-color 200ms ease, opacity 200ms ease; }
.book-step.is-open { border-color: var(--external-primary-border); }
.book-step.is-todo { opacity: .5; }
.book-step-head { width: 100%; min-height: 68px; display: flex; align-items: center; padding: 12px 20px; border: 0; border-radius: 22px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.book-step-head:disabled, .book-step.is-open .book-step-head { cursor: default; }
.book-step-head:focus-visible { outline: 2px solid var(--external-primary); outline-offset: 2px; }
.book-step-num { flex: 0 0 36px; width: 36px; height: 36px; margin-right: 16px; border: 1px solid var(--external-border-strong); border-radius: 50%; font-weight: var(--weight-semibold); line-height: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.book-step.is-open .book-step-num { border-color: var(--external-primary); background: var(--external-primary); color: #120E0C; }
.book-step.is-done .book-step-num { border-color: var(--external-primary-border); color: var(--external-primary); }
.book-step-name { flex: 1 1 auto; min-width: 0; }
.book-step-name strong { display: block; font-size: var(--type-body-size); }
.book-step-value { display: block; overflow: hidden; color: var(--external-muted); font-size: var(--type-control-label-size); text-overflow: ellipsis; white-space: nowrap; }
.book-step-value:empty { display: none; }
.book-step-edit { display: none; flex: 0 0 auto; margin-left: 16px; color: var(--external-primary); font-size: var(--type-control-label-size); font-weight: var(--weight-semibold); }
.book-step.is-done .book-step-edit { display: block; }
.book-step.is-done .book-step-head:hover { background: var(--external-surface-soft); }
.book-step-body { padding: 4px 24px 24px 72px; }
.book-step-body[hidden] { display: none; }
.book-step-body > * + * { margin-top: 20px; }
.book-step-ask { margin: 0; font-size: 26px; font-weight: var(--weight-semibold); line-height: 1.15; }
.book-step-ask:focus { outline: none; }
.book-step-body > .book-step-lead { max-width: 560px; margin-top: 8px; color: var(--external-muted); line-height: var(--leading-body); }
.book-step-fields > * + * { margin-top: 16px; }
.book-step-foot { padding-top: 4px; }
.book-step-foot > * + * { margin-top: 12px; }
.book-step-next { min-width: 260px; min-height: 52px; padding: 0 28px; font-size: var(--type-body-size); }
.book-builder-next { max-width: 520px; margin-bottom: 0; color: var(--external-muted); font-size: var(--type-control-label-size); line-height: var(--leading-body); }
.book-builder-next[hidden] { display: none; }
.book-builder-steps .memory-package > span { min-height: 150px; }
.book-builder-steps .memory-package b .book-builder-was { display: block; font-size: var(--type-control-label-size); }
.book-builder-steps .memory-design-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
.book-builder-steps [aria-invalid="true"] { border-color: var(--external-danger); }

.book-builder-row { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; border-top: 1px solid var(--external-border); }
.book-builder-row > div:first-child { min-width: 0; margin-right: 16px; }
.book-builder-row strong, .book-builder-print strong { display: block; }
.book-builder-row small, .book-builder-print small { display: block; margin-top: 4px; color: var(--external-muted); line-height: var(--leading-body); }
.book-builder-stepper { flex: 0 0 auto; display: inline-flex; align-items: center; border: 1px solid var(--external-border-strong); border-radius: 12px; background: var(--external-surface); }
.book-builder-stepper button { width: 44px; height: 44px; border: 0; border-radius: 11px; background: transparent; color: var(--external-text); font: inherit; font-size: 20px; cursor: pointer; }
.book-builder-stepper button:hover:not(:disabled) { background: var(--external-surface-muted); }
.book-builder-stepper button:disabled { color: var(--external-soft); cursor: not-allowed; }
.book-builder-stepper button:focus-visible, .book-builder-chip:focus-visible { outline: 2px solid var(--external-primary); outline-offset: 2px; }
.book-builder-stepper output { min-width: 36px; font-weight: var(--weight-semibold); text-align: center; font-variant-numeric: tabular-nums; }
.book-builder-print { padding-top: 20px; border-top: 1px solid var(--external-border); }
.book-builder-chips { display: flex; flex-wrap: wrap; margin: 8px -4px 0; }
.book-builder-chips[hidden] { display: none; }
.book-builder-chip { min-height: 44px; margin: 4px; padding: 0 16px; border: 1px solid var(--external-border-strong); border-radius: 999px; background: var(--external-surface); color: var(--external-text); font: inherit; font-size: var(--type-control-label-size); font-weight: var(--weight-semibold); cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease; }
.book-builder-chip:hover { border-color: var(--external-primary-border); }
.book-builder-chip[aria-pressed="true"] { border-color: var(--external-primary); background: var(--external-primary-soft); color: var(--external-primary); }
.book-builder-chip:active, .book-builder-stepper button:active:not(:disabled) { transform: scale(.97); }

/* Шапка гостя: те же места, что в кабинете; вместо профиля — вход. */
.book-builder-page .external-brand, .book-builder-login, .book-builder-page .external-menu-item { text-decoration: none; }
.book-builder-page .book-builder-login { width: auto; min-width: 0; white-space: nowrap; padding: 0 16px; font-size: var(--type-control-label-size); font-weight: var(--weight-semibold); }
.book-builder-mark::before { content: ''; display: block; width: 8px; height: 8px; margin: auto; background: var(--external-primary); }

.book-builder-bar { display: none; }

@media (max-width: 1020px) {
  .book-builder-layout { display: block; }
  .book-builder-stage { position: static; margin-bottom: 16px; padding: 20px 20px 16px; }
  .book-stage-book { --w: 150px; margin: 22px auto 34px; }
  .book-stage-book.is-size-0 { --t: 8px; }
  .book-stage-book.is-size-1 { --t: 14px; }
  .book-stage-book.is-size-2 { --t: 20px; }
  .book-stage-label strong { font-size: 13px; }
  .book-stage-label small { display: none; }
  /* Итог и главная кнопка на телефоне живут в нижней полосе — в сцене остаётся книга. */
  .book-builder-lines, .book-builder-total-row, .book-builder-split, .book-step-next { display: none; }
  .book-builder-page .memory-page { padding-bottom: 112px; }
  .book-builder-bar {
    position: fixed; z-index: 30; right: 0; bottom: 0; left: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--external-border); background: var(--external-surface);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .28);
  }
  .book-builder-bar > span { min-width: 0; margin-right: 16px; }
  .book-builder-bar small { display: block; color: var(--external-muted); }
  .book-builder-bar strong { display: block; font-size: 22px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .book-builder-bar .external-action { width: auto; min-width: 150px; min-height: 52px; flex: 0 0 auto; padding: 0 24px; }
}
@media (max-width: 620px) {
  .book-step-head { padding: 12px 16px; }
  .book-step-num { margin-right: 12px; }
  .book-step-body { padding: 4px 16px 20px; }
  .book-step-ask { font-size: 22px; }
  .book-builder-steps .memory-package > span { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .book-stage-b3 > div, .book-step, .book-builder-chip { transition: none; }
  .book-builder-chip:active, .book-builder-stepper button:active:not(:disabled) { transform: none; }
}
