/*
 * Подарцев Wizard Screen — Layout & Component Styles
 * spec v1.1 §3.2 / §3.7 (Phase B-1 2026-05-22)
 *
 * Design brief: premium concierge, left-aligned, no emoji, no social proof.
 * One question per screen. Buttons are the primary interaction surface.
 * Free-text fields are always available below button grids.
 * Mobile-first: full-width on <=375px; constrained on wider.
 * Touch targets >=44px per spec §16.2.
 */

/* ── Page layout ────────────────────────────────────────────────────────── */

/*
 * Entry unification (founder-ratified 2026-06-12): the wizard carries the
 * podartsev.ru site chrome (_site_header.html / _site_footer.html, flow
 * mode). Body = full-height flex column: sticky navy header on top, the
 * step content stretches, navy footer sits at the bottom (pushed below the
 * fold only when the step content is taller than the viewport).
 * The old minimal .wizard-header / .wizard-footer chrome is retired.
 */
.wizard-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.wizard-body .site-footer {
  margin-top: auto;
}

.wizard-page {
  width: min(var(--max-content-width), calc(100% - (2 * var(--space-md))));
  margin-inline: auto;
  padding-block: var(--space-xl) var(--space-3xl);
  /* iPhone home-bar safe area */
  padding-bottom: calc(var(--space-3xl) + env(safe-area-inset-bottom, 0px));
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* centre the step content vertically so the focal
                                block sits at a stable screen height across steps;
                                a no-op when content fills the page (tall steps
                                don't clip) — founder 2026-06-13. */
  gap: 0;
}

/* ── Site chrome ────────────────────────────────────────────────────────── */
/* (The <768px social-cluster visibility override died with the in-header
   socials — C1 declutter 2026-07-08; they render in the footer «Подарцев в
   сети» now.) */

/* ── Progress indicator ─────────────────────────────────────────────────── */

.wizard-progress {
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.wizard-progress-label {
  font-family: var(--font-sans);
  font-size: var(--fz-slot-label);
  font-weight: var(--fw-bold);
  color: var(--color-muted);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

.wizard-progress-bar {
  height: 2px;
  background-color: var(--color-border);
  border-radius: 0;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  background-color: var(--color-accent);
  transition: width 0.25s ease;
}

/* ── Step block ─────────────────────────────────────────────────────────── */

.wizard-step-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── Back navigation ────────────────────────────────────────────────────── */

.wizard-back-nav {
  margin-bottom: 0;
}

.btn-wizard-back {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  font-weight: var(--fw-regular);
  color: var(--color-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-wizard-back:hover {
  color: var(--color-text);
}

/* ── Question heading ────────────────────────────────────────────────────── */

.wizard-question {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3vw + 0.5rem, 1.625rem);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  color: var(--navy);   /* podartsev.ru headings = #002d5b (was the grey --color-text); brand-consistent ink */
  margin-bottom: var(--space-lg);
  /* No syllable hyphenation on the question heading — words wrap whole
     (founder 2026-06-13). */
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* ── Error region ────────────────────────────────────────────────────────── */

.wizard-error-region {
  padding: var(--space-sm) var(--space-md);
  background-color: #fff3f0;
  border-left: 3px solid var(--color-accent);
  border-radius: 0;
}

.wizard-error-text {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  color: var(--color-accent);
}

/* ── Button grid ─────────────────────────────────────────────────────────── */

.wizard-button-grid {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-sm);
}

/*
 * 2-column grid: recipient + age steps.
 * 1-column grid: occasion + budget steps (longer labels, full-width).
 */
.wizard-button-grid--2col {
  grid-template-columns: 1fr 1fr;
}

.wizard-button-grid--1col {
  grid-template-columns: 1fr;
}

/* Force 2-column for age on wide screens */
@media (min-width: 376px) {
  .wizard-button-grid--2col {
    max-width: 380px;
  }
}

/* ── Option buttons ─────────────────────────────────────────────────────── */

.btn-wizard-option {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  min-height: 44px;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease,
              color 0.15s ease;
  /* Prevent text overflow on small screens */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-wizard-option:hover {
  background-color: var(--color-bg);
  border-color: var(--color-accent);
}

.btn-wizard-option--selected,
.btn-wizard-option[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.btn-wizard-option--selected:hover,
.btn-wizard-option[aria-pressed="true"]:hover {
  background-color: var(--color-accent);
}

/* ── Free-text input row ─────────────────────────────────────────────────── */

.wizard-freetext-row {
  margin-top: var(--space-md);
}

.wizard-freetext {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  outline: none;
}

.wizard-freetext:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(183, 110, 77, 0.15);
}

/* Placeholder — upright (italic is reserved for the brand-voice concierge line)
   + warm muted tone (#8a7f78 ≈ 4.6:1 on cream, WCAG AA). opacity:1 overrides the
   washed-out browser default. ui-designer verdict 2026-06-13. */
.wizard-freetext::placeholder,
.wizard-textarea::placeholder {
  font-style: normal;
  color: #8a7f78;
  opacity: 1;
}

/* ── Textarea (interests + extra_info) ──────────────────────────────────── */

.wizard-freetext-block {
  display: flex;
  flex-direction: column;
}

.wizard-textarea {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 110px;
  outline: none;
  line-height: 1.5;
}

.wizard-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(183, 110, 77, 0.15);
}

/* ── Actions row ─────────────────────────────────────────────────────────── */

.wizard-actions-row {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

/* In step-1-style steps (e.g. interests) the optional «Пропустить» link sits
   centered below the centered «Продолжить» (founder 2026-06-13). */
.wizard-step-block--step1 .wizard-skip-row {
  text-align: center;
}


/* ── Continue / primary button ──────────────────────────────────────────── */

.btn-wizard-continue {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  font-weight: var(--fw-semibold);
  color: #fff;
  background-color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-xl);
  cursor: pointer;
  min-height: 44px;
  transition: opacity 0.15s ease;
}

.btn-wizard-continue:hover {
  opacity: 0.9;
}

.btn-wizard-continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading state: spinner-text class added by JS */
.btn-wizard-continue.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Skip button ─────────────────────────────────────────────────────────── */

.wizard-skip-row {
  margin-top: var(--space-sm);
}

.btn-wizard-skip {
  font-family: var(--font-sans);
  font-size: var(--fz-body);
  font-weight: var(--fw-regular);
  color: var(--color-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.btn-wizard-skip:hover {
  color: var(--color-text);
}

/* ── Step 1 — entry redesign T2 (founder-ratified 2026-06-12) ───────────────
 * Mockup: docs/design_mockups/entry/step1-podartsev-style.html.
 * Centered composition: concierge line → question → free-text input (top
 * door) → quiet divider → centered chip grid → «Продолжить» row.
 * Express expand button removed with express mode.
 * ────────────────────────────────────────────────────────────────────────── */

.wizard-step-block--step1 {
  width: min(560px, 100%);
  margin-inline: auto;
  /* top-align the focal block: the question sits at the SAME height on every step.
     The block is flex:1 (fills the page), so `justify-content: center` floated the
     content to mid-screen on sparse free-text steps (interests / extra_info / city,
     no chips) → big empty gap above the question; chip-heavy steps hid it by filling
     the height. flex-start keeps the question pinned under the progress bar across all
     steps — delivering the 06-13 «stable height» goal (gap fix 2026-06-14). */
  justify-content: flex-start;
}

.wizard-step-block--step1 .wizard-question {
  text-align: center;
}

/* Concierge line — one-time promise above step 1 only */
.wizard-concierge-line {
  font-family: var(--font-warm, Georgia, serif);
  font-style: italic;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-muted);
  border-left: 2px solid var(--color-accent);
  padding-left: var(--space-md);
  margin-inline: auto;
  margin-bottom: var(--space-xl);
  width: fit-content;
  max-width: 36em;
  text-align: left;
  -webkit-hyphens: none;
  hyphens: none;
}

/* Тихая строка условий под обещанием (2026-08-17).
   НЕ часть обещания: без курсива, без золотой линейки слева, мельче и глуше —
   она снимает тревогу («сколько это стоит, нужна ли учётка»), а не продаёт.
   Отрицательный верхний отступ подбирает воздух, который concierge-строка
   оставила под собой: две строки должны читаться как пара, а не как два
   независимых заявления. */
.wizard-entry-note {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-muted);
  text-align: center;
  margin: calc(var(--space-xl) * -1 + var(--space-sm)) auto var(--space-xl);
  max-width: 36em;
}

/* Free-text — the top, primary door */
.wizard-freetext-row--step1 {
  margin-top: 0;
}

.wizard-freetext--step1 {
  font-size: 1.0625rem;
  min-height: 52px;
}

/* Quiet «или выберите» divider */
.wizard-chip-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-block: var(--space-lg);
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wizard-chip-divider::before,
.wizard-chip-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Centered wrapping chip grid (13 recipient chips) */
.wizard-chip-grid {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-wizard-chip {
  white-space: nowrap;
  min-height: 48px;                 /* touch ≥44px */
  padding: var(--space-sm) 1.125rem;
  display: inline-flex;
  align-items: center;
  text-align: center;
}

/* «Продолжить» appears once an answer exists (either door) */
.wizard-continue-row {
  text-align: center;
  margin-top: var(--space-xl);
  min-height: 52px;
}

.wizard-continue-row .btn-wizard-continue {
  min-height: 52px;
  padding-inline: var(--space-2xl);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

/*
 * Retired 2026-06-12 (entry unification): .wizard-footer replaced by the
 * shared navy site footer (_site_footer.html, flow mode). The slogan
 * «Подарцев · личный консьерж в мире подарков» renders inside
 * .site-footer__slogan (style.css).
 */

/* ── Screen-reader only utility ─────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Passive legal notice (consent_flow v2.0 §2.1) ──────────────────────────
 * Big-player model (Яндекс/GigaChat): no blocking consent checkbox; a quiet
 * passive line states acceptance of Оферта + Политика. Links open the WordPress
 * legal pages in a new tab. Muted, centered, sits below the wizard card.
 */
/* ПДн-minimisation hint under the two open-text fields (interests, extra_info).
   Copy is ratified in docs/legal/consent_flow_quiz.md §2.2. Quieter than the
   field and never a blocker: it advises, it does not gate «Продолжить».
   Sits inside .wizard-freetext-block (a flex column), so it lands directly
   below the textarea and inherits its left edge. */
.wizard-freetext-hint {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--color-muted);
}

.wizard-legal-note {
  margin: 0.9rem auto 0;
  max-width: 34rem;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--color-muted);
}
.wizard-legal-note a {
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wizard-legal-note a:hover {
  color: var(--navy);
}

/* ---------------------------------------------------------------------------
   §E④ free-text entry (flag-gated; wizard step 1 only). The fast one-line path;
   the step-by-step wizard sits below as the fallback.
   --------------------------------------------------------------------------- */
/* ⚠️ Селектор привязан к ЭЛЕМЕНТУ намеренно (2026-08-19).
   Имя `.wizard-freetext` носят два разных компонента: этот блок §E④ (section)
   и ПОЛЕ визарда (input, правило выше в файле, `width: 100%`). Голый селектор
   стоит ниже при равной специфичности, поэтому его потолок 520px протекал на
   поле и делал его уже своей колонки (560px): замер founder'а 18.08 —
   поле 433→953 при колонке и сетке чипов 433→993, справа 40px пустоты.
   Центрирование при этом не спасало: поле — inline-block, а у строчных
   элементов `margin: auto` не центрует. Прибито тестом на свойство:
   tests/web/test_wizard_freetext_width_collision.py */
section.wizard-freetext {
  max-width: 520px;
  margin: 0 auto 18px;
  text-align: left;
}
.wizard-freetext__label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}
.wizard-freetext__row {
  display: flex;
  gap: 8px;
}
.wizard-freetext__input {
  flex: 1 1 auto;
  min-height: 46px;
  padding: 0 14px;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--navy);
  background: #fff;
  border: 1px solid #d9cfba;
  border-radius: 8px;
}
.wizard-freetext__input:focus {
  outline: none;
  border-color: var(--gold-light, #a68751);
  box-shadow: 0 0 0 2px rgba(166, 135, 81, 0.18);
}
.wizard-freetext__submit {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 20px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--navy, #002d5b);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.wizard-freetext__submit:disabled {
  opacity: 0.6;
  cursor: default;
}
.wizard-freetext__or {
  margin: 14px 0 0;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: #8a8f97;
  text-align: center;
}
