/* Страница «Оформить заказ» (order.html). Та же ночь, лёд и золото, что в site.css: токены, кнопки, поля,
   плитки тарифов, образы героев и счётчик берутся оттуда. Здесь только раскладка страницы и анкета сказки.
   Анимации: полоска загрузки фото (feedback), смена рамки полей и плиток (state). Больше ничего не движется. */

[hidden] { display: none !important; }

.order-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.order-page .footer { margin-top: auto; }

/* Небо с главной вверху страницы: связь с лэндингом, под формой уже чистая ночь */
.order-sky { position: absolute; inset: 0 0 auto 0; height: 460px; overflow: hidden; z-index: 0; pointer-events: none; }
.order-sky img { width: 100%; height: 100%; object-fit: cover; object-position: 78% 22%; opacity: .5; }
.order-sky::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, oklch(0.17 0.07 266 / .92) 0%, oklch(0.17 0.07 266 / .55) 55%, oklch(0.17 0.07 266 / .2) 100%),
              linear-gradient(180deg, transparent 30%, var(--night-950) 96%); }

/* Упрощённая шапка: не липнет, чтобы на телефоне не съедать высоту над клавиатурой */
.order-page .topbar { position: relative; inset: auto; z-index: var(--z-header); }
.back-link { transition: color 150ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .back-link:hover { color: var(--ice); } }

.order-main { position: relative; z-index: var(--z-content); padding-top: clamp(20px, 4vw, 48px); padding-bottom: clamp(56px, 8vw, 96px); }
.order-head h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem); line-height: 1.1; letter-spacing: -0.03em; }
.order-head .lead { margin-top: 12px; }
.draft-note { max-width: 68ch; margin: 16px 0 0; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--r-field); background: rgb(214 225 247 / .06); color: var(--ice-2); font-size: 15px; line-height: 1.55; }

.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 392px); gap: 0 clamp(32px, 5vw, 80px); align-items: start; margin-top: clamp(28px, 4vw, 48px); }

/* ---------- Разделы формы: без панелей, только линия и заголовок ---------- */
.osec { padding-block: clamp(28px, 3.4vw, 40px) clamp(10px, 1.6vw, 20px); border-top: 1px solid var(--line); }
.osec:first-child { border-top: 0; padding-top: 0; }
.osec-title, .fs legend.osec-title { margin: 0 0 20px; padding: 0; font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.65rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; color: var(--ice); }
.osec-lead { margin-top: -8px; font-size: 15.5px; line-height: 1.55; color: var(--ice-2); max-width: 52ch; }
.osec .field { margin-bottom: 24px; }

/* образы героев не раздуваются на широкой колонке */
#fld-character .seg { max-width: 540px; }
/* Образы плиткой по 2 в ряд и на телефоне, и на компьютере (12.11.2026, Антон): лица крупнее */
#fld-character .looks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; }   /* ряд образов не зажимаем: на компьютере плитки крупнее (12.11.2026) */

.tale-intro { display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: center; margin-bottom: 26px; }
.tale-intro img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-field); box-shadow: 0 0 0 1px oklch(0.96 0.015 266 / .12); }
.tale-intro .osec-title { margin-bottom: 14px; }

/* ---------- Поля ---------- */
.field .lbl { margin: 0 0 8px; font-size: 14.5px; font-weight: 600; color: var(--ice); }
.field .lbl .opt, .field label .opt { font-weight: 400; color: var(--ice-3); margin-left: 8px; }
.field .sub { margin: -2px 0 14px; font-size: 14px; line-height: 1.5; color: var(--ice-2); max-width: 60ch; }
.field input[type=tel] {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: var(--r-field);
  font: inherit; font-size: 16px; line-height: 1.4; color: var(--ice);
  background: oklch(0.15 0.07 266 / .75); border: 1px solid oklch(0.96 0.015 266 / .28);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.field input[type=tel]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgb(236 201 120 / .22); }
.field.has-err input[type=tel], .field input.is-bad { border-color: var(--danger); }
.field.has-err .seg { box-shadow: inset 0 0 0 1px var(--danger); }
/* в группе фото красным отмечается только пустая подпись, а не все подряд */
#fld-photos.has-err .ph-cap:not(.is-bad) { border-color: oklch(0.96 0.015 266 / .28); }
#fld-photos.has-err .ph-cap:not(.is-bad):focus { border-color: var(--gold); }
.field textarea { min-height: 148px; }
/* подпись к фото и достижение: одна строка на десктопе, две на телефоне, чтобы длинный текст не прятался за край */
.field textarea.one-line { display: block; height: 52px; min-height: 52px; resize: none; overflow: hidden; }
.field { scroll-margin-block: 24px; }
.err { line-height: 1.45; }
.count-hint { flex: 1 1 200px; line-height: 1.45; }
/* лимит выбран: спокойное золото, не ошибка. Красный только когда текст длиннее лимита */
.count.is-full { color: var(--gold); }

.duo { display: grid; grid-template-columns: minmax(144px, 0.42fr) 1fr; gap: 0 14px; align-items: start; }
.duo--even { grid-template-columns: 1fr 1fr; gap: 0 18px; }
.duo .seg-opt span { min-height: 44px; }

/* ---------- Фото ---------- */
.photos, .achs { display: grid; gap: 14px; }
.photos:not(:empty), .achs:not(:empty) { margin-bottom: 14px; }
.ph { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: start; }
.ph-thumb { position: relative; display: grid; place-items: center; width: 76px; height: 76px; border-radius: var(--r-field); overflow: hidden; background: var(--night-800); box-shadow: 0 0 0 1px oklch(0.96 0.015 266 / .14); }
.ph-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-name { padding: 4px; font-size: 10px; line-height: 1.2; text-align: center; color: var(--ice-2); word-break: break-all; }
.ph-bar { position: absolute; left: 7px; right: 7px; bottom: 7px; height: 4px; border-radius: 4px; overflow: hidden; background: rgb(0 0 0 / .55); }
.ph-bar i { display: block; height: 100%; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; transition: transform 160ms linear; }
.ph:not(.is-up) .ph-bar, .ph:not(.is-up) .ph-status { display: none; }
.ph.is-up .ph-thumb img { opacity: .55; }
.ph-status { color: var(--gold); }
.ph .count-row, .ach .count-row { margin-top: 6px; }

.ph-del, .ach-del { position: relative; display: grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer; color: var(--ice-2);
  background: var(--night-900); border: 1px solid oklch(0.96 0.015 266 / .35); transition: color 150ms var(--ease-out), border-color 150ms var(--ease-out); }
.ph-del .ic, .ach-del .ic { width: 14px; height: 14px; }
/* крестик сидит на углу миниатюры, подписи остаётся вся ширина; зона нажатия 44px */
.ph-del { position: absolute; left: 58px; top: -9px; width: 28px; height: 28px; }
.ph-del::after, .ach-del::after { content: ""; position: absolute; inset: -8px; }
@media (hover: hover) and (pointer: fine) { .ph-del:hover, .ach-del:hover { color: var(--danger); border-color: var(--danger); } }

/* фото закрыты, пока не отмечено согласие */
.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.field .add-btn.is-locked, .add-btn.is-locked { cursor: not-allowed; color: var(--ice-3); border-color: oklch(0.96 0.015 266 / .28); background: none; }
.lock-hint { flex: 1 1 220px; font-size: 14px; line-height: 1.45; color: var(--ice-2); }
.photos-note { font-size: 14.5px; color: var(--ok); }
.photos-note:empty { display: none; }
.photos-note:not(:empty) { margin-bottom: 12px; }

/* ---------- Согласия ---------- */
.consent--pdn { padding: 16px; border-radius: var(--r-field); background: oklch(0.15 0.07 266 / .55); box-shadow: inset 0 0 0 1px oklch(0.96 0.015 266 / .16); }
.consent--pdn.has-err { box-shadow: inset 0 0 0 1px var(--danger); }
.consent--pdn .check { font-size: 14.5px; line-height: 1.55; color: var(--ice); }
.consent--pdn .err { margin: 0; }
.consent--pdn.has-err .err { margin-top: 10px; }

.ach { display: grid; grid-template-columns: minmax(0, 1fr) 28px; gap: 12px; align-items: start; }
.ach-del { width: 28px; height: 28px; margin-top: 12px; background: none; }
.achs.is-min .ach { grid-template-columns: minmax(0, 1fr); }
.achs.is-min .ach-del { display: none; }

.field .add-btn, .add-btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; padding: 0 20px;
  border-radius: 999px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; color: var(--gold);
  border: 1px dashed rgb(236 201 120 / .55); background: rgb(236 201 120 / .06);
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.add-btn .ic { width: 18px; height: 18px; }
.add-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.add-btn:focus-within { outline: 2px solid var(--gold); outline-offset: 3px; }
.add-btn:active { background: rgb(236 201 120 / .14); }
@media (hover: hover) and (pointer: fine) { .add-btn:hover { background: rgb(236 201 120 / .12); border-color: var(--gold); } }

/* ---------- Итог и оплата ---------- */
.order-side { min-width: 0; }
.sum { padding: clamp(20px, 2.4vw, 28px); border-radius: var(--r-media); background: var(--panel-bg); border: var(--panel-border); box-shadow: var(--panel-shadow); }
.sum-label { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ice-3); }
.sum-plan { margin-top: 4px; font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.sum-price { margin-top: 6px; font-size: clamp(2.1rem, 1.6rem + 1.6vw, 2.8rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.sum-list { margin: 20px 0 0; border-top: 1px solid var(--line); }
.sum-list div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.4; }
.sum-list dt { color: var(--ice-3); }
.sum-list dd { margin: 0; color: var(--ice); overflow-wrap: anywhere; text-align: right; }
.sum-list dd.is-empty { color: var(--ice-3); }
.sum .consent { margin: 18px 0 14px; }
.sum .consent .check { font-size: 14.5px; line-height: 1.5; color: var(--ice); }
.sum .btn { white-space: normal; }
.sum .form-note { font-size: 13.5px; line-height: 1.5; text-align: left; }
.sum .form-fail { margin: 14px 0 0; }
.sum .form-fail .btn { margin-top: 12px; min-height: 46px; width: 100%; }
.order-help { margin-top: 18px; padding-inline: 4px; font-size: 14.5px; color: var(--ice-2); }
.order-help a { color: var(--gold); font-weight: 600; white-space: nowrap; }

/* Десктоп: сводка едет рядом с формой. Только если экран достаточно высокий, иначе кнопка оплаты уедет под обрез */
@media (min-width: 1024px) and (min-height: 760px) {
  .order-side { position: sticky; top: 24px; }
}

@media (max-width: 1023px) {
  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .order-fields { max-width: 720px; }
  .order-side { max-width: 720px; margin-top: 12px; }
}
@media (max-width: 600px) {
  .order-sky { height: 300px; }
  .order-sky img { object-position: 70% 20%; opacity: .4; }
  .tale-intro { grid-template-columns: 1fr; gap: 16px; }
  .tale-intro img { aspect-ratio: 16 / 8; }
  .duo, .duo--even { grid-template-columns: 1fr; }   /* длинные подписи полей: возраст и пол друг под другом */
  .sum { padding: 20px 16px; border-radius: 16px; }
  .field .add-btn, .add-btn { width: 100%; justify-content: center; min-height: 52px; }
  .seg-opt span { padding-inline: 6px; }
  .consent--pdn { padding: 14px 12px; }
  .field .add-row .add-btn { flex: 1 1 100%; }
  .field textarea.one-line { height: 94px; min-height: 94px; }
  .ach-del { margin-top: 33px; }
}

/* ---------- Подарок в ролике (26.11.2026): карточка-галочка как плитка тарифа, под ней название и одно фото ---------- */
.osec-opt { margin-left: 8px; font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--ice-3); }
.field .gift-card { display: block; position: relative; margin: 0; cursor: pointer; font-weight: 400; }
.gift-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gift-card-box { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: center; padding: 14px; border-radius: var(--r-field);
  background: oklch(0.15 0.07 266 / .75); border: 1px solid oklch(0.96 0.015 266 / .28);
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out); }
.gift-card-media { display: block; width: 112px; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--night-800); }
.gift-card-media img { width: 100%; height: 100%; object-fit: cover; }
.gift-card-text { display: grid; gap: 8px; min-width: 0; }
.gift-card-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.gift-card-tick { display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; color: transparent;
  border: 1.5px solid oklch(0.96 0.015 266 / .55); transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out); }
.gift-card-tick .ic { width: 14px; height: 14px; }
.gift-card-name { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--ice); }
.gift-card-price { font-size: 16px; font-weight: 600; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gift-card-lead { padding-left: 34px; font-size: 14px; line-height: 1.5; color: var(--ice-2); }
.gift-card input:checked + .gift-card-box { border-color: var(--gold); background: rgb(236 201 120 / .08); box-shadow: inset 0 0 0 1px var(--gold); }
.gift-card input:checked + .gift-card-box .gift-card-tick { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.gift-card input:focus-visible + .gift-card-box { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .gift-card:hover .gift-card-box { border-color: oklch(0.96 0.015 266 / .6); } }
.gift-fields { margin-top: 22px; }

.gift-ph { position: relative; display: inline-grid; grid-template-columns: 112px auto; gap: 14px; align-items: center; margin-bottom: 12px; }
.gift-ph .ph-thumb { width: 112px; height: 112px; }
.gift-ph .ph-del { left: 94px; }
.gift-ph-status { font-size: 14.5px; color: var(--ok); }
.gift-ph.is-up .gift-ph-status { color: var(--gold); }
.gift-ph:not(.is-up) .ph-bar { display: none; }
.gift-ph.is-up .ph-thumb img { opacity: .55; }
#fld-gift-photo .photos-note:not(:empty) { margin-bottom: 12px; }

@media (max-width: 600px) {
  /* на телефоне описание уходит под картинку на всю ширину карточки */
  .gift-card-box { grid-template-columns: 76px minmax(0, 1fr); gap: 12px 14px; padding: 12px; }
  .gift-card-text { display: contents; }
  .gift-card-media { width: 76px; grid-row: 1; }
  .gift-card-head { grid-column: 2; grid-row: 1; grid-template-columns: 22px minmax(0, 1fr); }
  .gift-card-price { grid-column: 2; }
  .gift-card-lead { grid-column: 1 / -1; padding-left: 0; }
}

/* Разворот книги в сказке (14.11.2026): «Каким был ребёнок» и «Наставление», до трёх коротких строк */
.osec .book .book-part { margin: 18px 0 0; }
.book .book-row + .book-row { margin-top: 10px; }
.book .book-row .count-row { margin-top: 6px; }
/* 26.11.2026 (Нина): блок подарка стоит сразу после выбора героя — отделяем его от соседних полей */
.osec .gift-block { margin: 8px 0 32px; }
.gift-block > .lbl { font-size: 16px; }
.gift-fields .consent--pdn { margin-bottom: 20px; }

/* 26.11.2026 (Нина): «Как это выглядит» под карточкой подарка + окно с куском ролика */
.gift-look { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; padding: 4px 2px; border: 0; background: none;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--gold); cursor: pointer;
  text-decoration: underline; text-decoration-color: rgb(236 201 120 / .45); text-underline-offset: 4px; }
.gift-look[hidden] { display: none; }
.gift-look-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--on-gold); flex: none; }
.gift-look-ic .ic { width: 12px; height: 12px; margin-left: 2px; }
.gift-look:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) { .gift-look:hover { text-decoration-color: currentColor; } }

.gift-dlg { width: min(880px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: auto;
  border: 1px solid oklch(0.96 0.015 266 / .22); border-radius: 16px; background: var(--night-900); color: var(--ice); }
.gift-dlg--short { width: min(560px, calc(100vw - 24px)); }
.gift-dlg::backdrop { background: oklch(0.12 0.05 266 / .84); }
.gift-dlg-in { padding: 12px 16px 16px; }
.gift-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.gift-dlg-t { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.gift-dlg-x { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -8px; border: 0; border-radius: 50%;
  background: none; color: var(--ice-2); cursor: pointer; flex: none; }
.gift-dlg-x .ic { width: 20px; height: 20px; }
.gift-dlg-x:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
@media (hover: hover) and (pointer: fine) { .gift-dlg-x:hover { color: var(--ice); background: oklch(0.96 0.015 266 / .08); } }
.gift-dlg-v { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 220px); border-radius: 10px; background: #000; }
.gift-dlg--short .gift-dlg-v { aspect-ratio: 1; }
.gift-dlg-cap { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--ice-2); }
html:has(.gift-dlg[open]) { overflow: hidden; }
/* 26.11.2026 (Нина): кнопка «Добавить в мой ролик · +200 ₽» под подписью в окне примера */
.gift-dlg-add { margin-top: 14px; min-height: 50px; padding: 0 26px; font-size: 15.5px; }
.gift-dlg-add[hidden] { display: none; }
.gift-dlg-add:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }
@media (max-width: 600px) { .gift-dlg-add { width: 100%; } }
/* 27.11.2026 (Нина, предложение Барыги): «+ подарок в шаре» в выбранной плитке тарифа */
.plan-opt-gift { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--gold); }
/* 27.11.2026 (Нина, предложение Барыги): разбивка суммы «тариф + подарок» в «Ваш заказ» */
.sum-break { margin: 10px 0 2px; font-size: 14px; color: var(--ice-2); }
.sum-break[hidden] { display: none; }
.sum-break div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.sum-break dt { font-weight: 400; }
.sum-break dd { margin: 0; font-weight: 600; color: var(--ice); white-space: nowrap; font-variant-numeric: tabular-nums; }
