/* ════════════════════════════════════════════════════════════════
   БЛИК — страница брони.
   ────────────────────────────────────────────────────────────────
   Визуальный язык «Студии на двоих»: нейтральный лист, карточки с
   радиусом 16, один синий акцент (основная кнопка, выбранные часы,
   включённый доп), чёрный — для выбранной даты, как выбранный чип в
   учёте. Токены — tokens.css, шрифты — fonts.css, оба свои.

   С ТЕЛЕФОНА В ПЕРВУЮ ОЧЕРЕДЬ. Основа — ширина 320 px без
   горизонтальной прокрутки страницы (прокручивается только лента дат,
   внутри себя), кнопки и строки не ниже 44 px. Шире 600 px — та же
   колонка, просто с воздухом по краям.

   ПЛАШКА ВНИЗУ — position: sticky, а не fixed: она занимает место в
   потоке, поэтому последний блок формы никогда не прячется под ней, и
   высоту плашки не надо считать скриптом, даже когда на узком экране
   кнопка переносится под текст.

   Атрибутов style в разметке нет (CSP): всё состояние — классы,
   hidden и aria-атрибуты.
   ════════════════════════════════════════════════════════════════ */

/* ── Основа ───────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--field); color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-deep); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue); color: #fff; }
svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.app {
  max-width: 600px; margin: 0 auto; padding: 0 16px;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}
.main { flex: 1 0 auto; display: grid; gap: 14px; align-content: start; padding-bottom: 20px; }

/* ── Шапка ────────────────────────────────────────────────────── */
/* Логотип не уже 200 px: тоньше штрихи знака теряются (план, §10
   п. 18). Подпись — живым текстом, а не кривыми из логотипа: у неё
   волосяной штрих, который на 200 px уже не читается. */
.head { display: grid; justify-items: center; gap: 6px; padding: 22px 0 6px; }
.wordmark { display: block; width: 200px; height: auto; }
.tagline { font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: 0.06em; line-height: 1.2; }

/* ── Типографика ──────────────────────────────────────────────── */
.step-title { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; text-wrap: balance; }
.step-title:focus { outline: none; }
.h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.h2:focus { outline: none; }
.h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.caption { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.pre { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.center { text-align: center; justify-items: center; }

/* ── Экраны ───────────────────────────────────────────────────── */
/* Новый экран чуть всплывает. Анимация запускается сама, когда у
   секции снимают hidden: display:none → block перезапускает её. */
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step { display: grid; gap: 14px; align-content: start; animation: step-in 260ms var(--ease) both; }

.card { background: var(--paper); border: 1px solid var(--rule-hair); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 16px; min-width: 0; }
.stack { display: grid; gap: 14px; }
@media (min-width: 600px) { .card { padding: 20px; } }

/* ── Загрузка ─────────────────────────────────────────────────── */
.loading { display: grid; gap: 14px; padding-top: 30px; }
.skeleton {
  border-radius: var(--r-lg); border: 1px solid var(--rule-hair);
  background: linear-gradient(90deg, var(--paper) 0%, var(--field) 50%, var(--paper) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease infinite;
}
.skeleton-strip { height: 78px; }
.skeleton-grid { height: 280px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ── Кнопки ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r);
  font-size: 15px; font-weight: 600; line-height: 1.15; text-align: center; text-decoration: none;
  border: 1px solid var(--rule-soft); background: var(--paper); color: var(--ink);
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--ink-4); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: var(--sh-1); }
.btn.primary:hover:not(:disabled) { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; box-shadow: var(--sh-2); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.quiet:hover:not(:disabled) { background: var(--hover); border-color: transparent; }
.btn:disabled { opacity: 0.45; box-shadow: none; }
.btn.is-busy { cursor: progress; }
.link-btn {
  min-height: 44px; padding: 0 2px; color: var(--blue); font-weight: 600; font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { color: var(--blue-deep); }
.link-btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); border: 1px solid var(--rule-soft); background: var(--paper);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); border-color: var(--ink-4); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn svg { width: 18px; height: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Плашки-сообщения ─────────────────────────────────────────── */
.notice {
  display: grid; gap: 10px; padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--blue-tint); border: 1px solid var(--blue-hair); color: var(--ink);
  font-size: 14px; line-height: 1.45;
}
.notice.warn { background: var(--warm-tint); border-color: var(--warm-hair); }
.notice.error { background: var(--alarm-tint); border-color: var(--alarm-tint); }
.notice.info { background: var(--paper); border-color: var(--rule-hair); box-shadow: var(--sh-1); }
.notice-title { font-weight: 600; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notice a { font-weight: 600; white-space: nowrap; }

/* ── Шаг 1: лента дат ─────────────────────────────────────────── */
.picker { display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
/* Стрелки нужны мышке; на телефоне ленту листают пальцем. */
.strip-nav { display: none; gap: 6px; }
@media (hover: hover) and (pointer: fine) { .strip-nav { display: flex; } }

/* Лента во всю ширину экрана: отрицательные поля съедают отступ
   колонки, а внутренний отступ возвращает первую плитку на место. */
.strip {
  position: relative; display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px;
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.strip::-webkit-scrollbar { display: none; }
@media (min-width: 632px) { .strip { margin: 0; padding-inline: 0; scroll-padding-inline: 0; } }
.date {
  flex: 0 0 auto; width: 64px; min-height: 84px; padding: 6px 2px 8px;
  display: grid; grid-template-rows: 14px 18px 28px 16px; justify-items: center; align-items: center;
  border-radius: var(--r); border: 1px solid var(--rule-hair); background: var(--paper); box-shadow: var(--sh-1);
  scroll-snap-align: start; color: var(--ink);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
.date:hover { border-color: var(--ink-4); }
.date-month { font-size: 10.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.date-wd { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.date-num { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.date-tariff { font-size: 10.5px; font-weight: 600; color: var(--warm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.date.is-weekend .date-wd { color: var(--warm); }
/* День без свободных часов — тише, но его можно открыть и убедиться. */
.date.is-full .date-num, .date.is-full .date-wd { color: var(--ink-4); }
.date[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: var(--sh-2); }
.date[aria-checked="true"] .date-month,
.date[aria-checked="true"] .date-wd,
.date[aria-checked="true"] .date-num { color: var(--paper); }
.date[aria-checked="true"] .date-tariff { color: var(--warm-hair); }

/* ── Шаг 1: сетка часов ───────────────────────────────────────── */
.hours-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hours { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hour {
  min-height: 48px; border-radius: var(--r); border: 1px solid var(--rule-soft); background: var(--paper);
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
.hour:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-tint); }
/* Занято, закрыто или прошло — одинаково серое, без объяснений. */
.hour:disabled { background: var(--field); border-color: var(--field); color: var(--ink-4); }
.hour.is-sel { background: var(--blue); border-color: var(--blue); color: #fff; }
.hour.is-sel:hover:not(:disabled) { background: var(--blue-deep); border-color: var(--blue-deep); }

/* ── Шаг 2 ────────────────────────────────────────────────────── */
.when { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; padding-block: 8px; }
.when-text { font-weight: 600; font-size: 15px; }
.when-text .zone { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--r);
  border: 1px solid var(--rule-soft); background: var(--paper); color: var(--ink); outline: none;
  font-size: 16px; /* меньше 16 px — iOS увеличивает страницу при фокусе */
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.input::placeholder { color: var(--ink-4); }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.input[aria-invalid="true"] { border-color: var(--alarm); box-shadow: 0 0 0 3px var(--alarm-tint); }
.input[readonly] { background: var(--field); color: var(--ink-2); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.err-msg { color: var(--alarm); font-size: 12.5px; line-height: 1.4; }
.err-msg:empty { display: none; }
.verified { display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--r); background: var(--ok-tint); color: var(--ok); }
.verified .link-btn { justify-self: start; min-height: 44px; }

/* Счётчик «− 3 +» */
.stepper { display: inline-flex; align-items: center; justify-self: start; border: 1px solid var(--rule-soft); border-radius: var(--r); background: var(--paper); }
.stepper-btn {
  width: 48px; height: 46px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 500; color: var(--ink-2); border-radius: var(--r);
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.stepper-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.stepper-btn:disabled { color: var(--ink-4); }
.stepper-input {
  width: 56px; height: 46px; border: 0; border-inline: 1px solid var(--rule-hair); text-align: center;
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; background: transparent; outline: none;
}
.stepper-input:focus { background: var(--blue-tint); }
.stepper-input[aria-invalid="true"] { color: var(--alarm); }
.stepper-val {
  min-width: 48px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-inline: 1px solid var(--rule-hair); font-weight: 600; font-variant-numeric: tabular-nums;
}
/* Маленький счётчик (часы допа) — уже, но не ниже 44 px: палец тот же. */
.stepper.sm .stepper-btn { width: 44px; height: 44px; font-size: 20px; }

/* Допы — переключатели. Вся строка — подпись к флажку, поэтому
   нажать можно в любое место строки, а не только в тумблер. */
.addons { display: grid; gap: 4px; }
.addon { border-top: 1px solid var(--rule-hair); padding-top: 4px; }
.addon:first-child { border-top: 0; padding-top: 0; }
.addon-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; cursor: pointer; }
.addon-text { display: grid; gap: 1px; min-width: 0; }
.addon-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.addon-price { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.addon-note { font-size: 12.5px; color: var(--ink-3); }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch { position: relative; width: 46px; height: 28px; flex: none; border-radius: var(--r-pill); background: var(--ink-4); transition: background-color 200ms var(--ease); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 200ms var(--ease);
}
.switch-input:checked + .switch { background: var(--blue); }
.switch-input:checked + .switch::after { transform: translateX(18px); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--blue); outline-offset: 2px; }
.addon-hours { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 0 0 10px; animation: step-in 200ms var(--ease) both; }
.addon-hours .caption { font-size: 13px; }

/* Комментарий — свёрнут */
.details { padding-block: 0; }
.details summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 52px; font-weight: 600; font-size: 15px;
}
.details summary::-webkit-details-marker { display: none; }
.details summary svg { width: 18px; height: 18px; color: var(--ink-3); transition: transform 200ms var(--ease); }
.details[open] summary svg { transform: rotate(90deg); }
.details-body { padding-bottom: 16px; }

/* Разбивка цены */
.lines { display: grid; gap: 8px; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.line-label { min-width: 0; color: var(--ink-2); }
.line-caption { display: block; font-size: 12px; color: var(--ink-3); }
.amt { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.amt.pending { font-family: var(--font); color: var(--ink-3); font-weight: 500; }
.line.total { border-top: 1px solid var(--rule-soft); padding-top: 10px; font-weight: 600; font-size: 16px; }
.line.total .amt { font-weight: 600; }

/* Галочки согласия: пустые по умолчанию (152-ФЗ, план, §3.8). */
.consents { gap: 6px; }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 8px 0; cursor: pointer; font-size: 14.5px; line-height: 1.4; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.check input:disabled, .check input:disabled + span { cursor: default; opacity: 0.7; }
.consents .caption { padding-top: 4px; }

/* Ловушка для ботов: вне экрана, а не display:none — часть ботов
   пропускает скрытые поля. Человек с клавиатурой сюда не попадёт:
   tabindex="-1", а для диктора блок aria-hidden. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ── Шаг 3: код ───────────────────────────────────────────────── */
.code-row { display: flex; gap: 8px; flex-wrap: wrap; }
.code-input {
  flex: 1 1 160px; max-width: 240px; min-height: 60px; text-align: center;
  font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: 0.3em; padding-inline: 12px 4px;
}
.code-row .btn { min-height: 60px; flex: 0 1 auto; }
.help { padding: 0 4px; }
.code-when { font-weight: 600; }
.code-when .zone { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }

/* ── Шаг 4: готово ────────────────────────────────────────────── */
.done-head { display: flex; align-items: center; gap: 12px; }
.done-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--ok-tint); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; }
.done-icon svg { width: 24px; height: 24px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv dd .item { display: block; }
.kv dd .zone { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.pay { font-size: 15px; line-height: 1.45; }
.pay b { font-size: 18px; font-weight: 700; white-space: nowrap; }

/* ── Подвал ───────────────────────────────────────────────────── */
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; padding: 12px 0 4px; font-size: 12.5px; }
.foot a { color: var(--ink-3); display: inline-flex; align-items: center; min-height: 44px; }
.foot a:hover { color: var(--ink); }
.noscript { margin: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--warm-tint); }

/* ── Плашка внизу ─────────────────────────────────────────────── */
.bar {
  position: sticky; bottom: 0; z-index: 20; margin: 0 -16px;
  background: var(--paper); border-top: 1px solid var(--rule-hair);
  box-shadow: 0 -6px 20px rgba(17,17,17,0.07);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 632px) {
  .bar { margin: 0; border: 1px solid var(--rule-hair); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-inline: 20px; }
}
.bar-in { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.bar-info { flex: 1 1 170px; min-width: 0; }
.bar-text { font-size: 14px; font-weight: 600; line-height: 1.35; }
.bar-text .part { white-space: nowrap; }
.bar-text .sep { color: var(--ink-4); }
.bar-text .rub { font-variant-numeric: tabular-nums; }
.bar-hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.bar-hint:empty { display: none; }
.bar-btn { flex: 1 0 auto; min-height: 50px; }
@media (min-width: 420px) { .bar-btn { flex: 0 0 auto; } }

/* ── Меньше движения ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
