/* The request form (main.js builds it) on the new home page.
   The rules below the line are a copy of the "Lead dialog" section of assets/css/base.css (lines 457–776),
   so the form looks and behaves exactly as on the other pages. Change both together.
   Above the line: the tokens and buttons the form takes from base.css, scoped to the dialog. */

dialog.lead {
  --ink-2: #131315; --ink-3: #1C1C1F;
  --bg: var(--ink); --bg-2: var(--ink-2); --bg-3: var(--ink-3);
  --fg: #F2F2F0; --muted: #9A9A9F; --line: rgba(255, 255, 255, .13); --accent: var(--terra-lit);
  color-scheme: dark; font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
/* zero-weight resets (:where), so every rule copied below still wins */
:where(dialog.lead) :where(h2, h3, p) { margin: 0; }
:where(dialog.lead) :where(h2, h3) { font-weight: 500; letter-spacing: -0.03em; line-height: 1.02; }
:where(dialog.lead) :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:where(dialog.lead) a { color: inherit; }
:where(dialog.lead) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(dialog.lead) svg { display: block; }
/* the page's own .btn (home.css) is lighter; the form keeps the buttons of the other pages */
:where(dialog.lead) .btn { gap: 14px; font: 500 17px/1 var(--font); letter-spacing: -0.005em; padding: 0 26px; transition: background .25s, color .25s, border-color .25s, transform .25s var(--ease); }
:where(dialog.lead) .btn .arr { transition: transform .3s var(--ease); }
:where(dialog.lead) .btn:hover .arr { transform: translateX(4px); }
:where(dialog.lead) .btn-primary { background: var(--fg); color: var(--bg); }
:where(dialog.lead) .btn-primary:hover { background: var(--terra); color: #fff; }
:where(dialog.lead) .btn-line { border: 1px solid var(--line); background: none; }
:where(dialog.lead) .btn-line:hover { border-color: var(--fg); background: none; }

/* ---------------------------------------------------------------------------------------------- */

/* ---------- Lead dialog ---------- */
/* A dark card on every page (.theme-dark on the dialog, so the main button is always
   light on dark). Desktop: anchored near the top, grows downwards between steps.
   Phone: a bottom sheet that can be pulled down. */

.lead {
  --ok: #4CC38A;
  --lead-top: clamp(24px, 10vh, 110px);
  width: min(560px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - var(--lead-top) - 24px);
  margin: var(--lead-top) auto auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: var(--ink-2);
  color: #F2F2F0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: transform .32s var(--ease);
}
/* warm light that travels across the card as the steps advance, green once sent */
.lead::before, .lead::after {
  content: ''; position: absolute; top: -180px; left: 0; width: 100%; height: 360px;
  pointer-events: none;
  background: no-repeat 50% 0 / 75% 100%;
  transition: background-position 1.2s var(--ease), opacity .9s var(--ease);
}
.lead::before {
  background-image: radial-gradient(closest-side, rgba(210, 102, 74, .17), transparent);
  background-position: calc(var(--p, 0) * 100%) 0;
}
.lead::after { background-image: radial-gradient(closest-side, rgba(76, 195, 138, .15), transparent); opacity: 0; }
.lead.is-done::before { opacity: 0; }
.lead.is-done::after { opacity: 1; }
.lead::backdrop { background: rgba(5, 5, 6, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lead[open] { animation: leadIn .45s var(--ease); }
.lead[open]::backdrop { animation: leadFade .35s ease-out; }
.lead.is-closing { animation: leadOut .23s ease-in forwards; }
.lead.is-closing::backdrop { animation: leadFade .23s ease-in reverse forwards; }
.lead.is-drag { transition: none; }
@keyframes leadIn { from { opacity: 0; transform: translateY(24px); } }
@keyframes leadOut { to { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes leadFade { from { opacity: 0; } }
html.lead-lock { overflow: hidden; }

.lead-inner { position: relative; z-index: 1; padding: 18px clamp(24px, 5vw, 40px) clamp(28px, 4vw, 36px); }
.lead-grab { display: none; }

/* top row: back, progress, close */
.lead-bar { display: flex; align-items: center; gap: 10px; margin: 0 -12px 0 -12px; }
.lead-back, .lead-close {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  color: #9A9A9F; border-radius: 50%; transition: color .2s, background-color .2s, opacity .25s, visibility .25s;
}
.lead-back svg, .lead-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lead-back { visibility: hidden; opacity: 0; }
.lead.has-back .lead-back { visibility: visible; opacity: 1; }
.lead-back:hover, .lead-close:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.lead-prog { flex: 1; display: flex; gap: 6px; transition: opacity .3s; }
.lead-prog i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); position: relative; overflow: hidden; }
.lead-prog i::after {
  content: ''; position: absolute; inset: 0; background: var(--terra-lit);
  transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease) .05s;
}
.lead-prog i.is-on::after { transform: none; }
.lead.is-done .lead-prog, .lead.is-done .lead-back { opacity: 0; visibility: hidden; }

/* who answers */
.lead-head { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.lead-ava { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--ink-3); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.lead-ava img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.lead h2 { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.lead-by { margin-top: 2px; font-size: 14px; color: #8E8E93; line-height: 1.4; }
.lead-by b { font-weight: 500; color: #C9C9CE; }
.lead-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* steps */
.lead form { margin-top: 26px; }
.lead-steps { transition: height .42s var(--ease); }
.lead-steps.is-sizing { overflow: hidden; }
.lead-step { animation: stepIn .42s var(--ease) both; }
.lead-steps.is-back .lead-step { animation-name: stepBack; }
@keyframes stepIn { from { opacity: 0; transform: translateX(26px); } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-26px); } }
.lead-q { font-size: clamp(24px, 3vw, 28px); font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; outline: none; }
.lead-hint { margin-top: 8px; font-size: 15px; color: #8E8E93; }
.lead-note {
  position: relative; margin: 0 0 22px; padding: 12px 16px; max-width: 92%;
  border-radius: 4px 14px 14px 14px; background: rgba(255, 255, 255, .06);
  font-size: 16px; line-height: 1.45; color: #E6E6E3;
  animation: noteIn .55s var(--ease) .12s both;
}
@keyframes noteIn { from { opacity: 0; transform: translateY(8px) scale(.98); transform-origin: 0 0; } }

/* choices */
.lead .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.lead .chips.is-nudge { animation: nudge .4s var(--ease); }
@keyframes nudge { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }
.chip { position: relative; display: inline-flex; animation: chipIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms + 90ms); }
@keyframes chipIn { from { opacity: 0; transform: translateY(10px); } }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 17px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: #D9D9D6; font-size: 16px; line-height: 1.25;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease);
}
.chip span::before {
  content: ''; flex: none; width: 0; height: 14px; margin-right: 0; opacity: 0;
  background: center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D2664A' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  transition: width .25s var(--ease), margin .25s var(--ease), opacity .2s;
}
.chip input:checked + span { border-color: var(--terra-lit); background: rgba(210, 102, 74, .14); color: #fff; animation: chipPop .34s var(--ease); }
.chip input:checked + span::before { width: 14px; margin-right: 8px; opacity: 1; }
@keyframes chipPop { 40% { transform: scale(1.045); } }
.chip input:focus-visible + span { outline: 2px solid var(--terra-lit); outline-offset: 2px; }
.chip:active span { transform: scale(.96); }
@media (hover: hover) {
  .chip:hover span { border-color: rgba(255, 255, 255, .42); color: #fff; }
  .chip:hover input:checked + span { border-color: var(--terra-lit); }
}
.lead .chips-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chips-seg .chip span { width: 100%; padding: 10px 8px; font-size: 15px; }
@media (max-width: 440px) { .lead .chips-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* fields */
.lead-field { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.lead-field[hidden] { display: none; }
.lead-field label { font-size: 15px; color: #B5B5BA; }
.lead-in { position: relative; }
.lead-field input, .lead-field textarea {
  width: 100%;
  font: inherit; font-size: 18px; color: #fff;
  background: #0E0E10;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 3px;
  padding: 14px 16px;
  transition: border-color .2s, box-shadow .25s;
}
.lead-in input { padding-right: 46px; }
.lead-field input::placeholder, .lead-field textarea::placeholder { color: #66666B; }
.lead-field textarea { min-height: 96px; resize: vertical; }
.lead-field input:focus, .lead-field textarea:focus { outline: none; border-color: var(--terra-lit); box-shadow: 0 0 0 3px rgba(210, 102, 74, .18); }
.lead-field input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 100px #0E0E10 inset; caret-color: #fff; }
.lead-ok {
  position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; pointer-events: none;
  fill: none; stroke: var(--ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .4s var(--ease);
}
.lead-field.is-ok .lead-ok { stroke-dashoffset: 0; }
.lead-field.is-bad input { border-color: #E5484D; }
.lead-field.is-bad input:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }
.lead-fe { font-size: 14px; color: #F2B8BA; margin-top: -2px; }
.lead-fe:empty { display: none; }
.lead-more { margin-top: 14px; font-size: 15px; color: #9A9A9F; padding: 6px 0; transition: color .2s; }
.lead-more:hover { color: #fff; }
.lead-more[hidden] { display: none; }

/* actions and small print */
.lead-nav { margin-top: 26px; }
.lead-nav[hidden] { display: none; }
.lead .btn { width: 100%; }
.lead .btn-line { border-color: rgba(255, 255, 255, .2); color: #D9D9D6; }
.lead .btn-line:hover { border-color: #fff; color: #fff; }
.lead-send { margin-top: 24px; position: relative; overflow: hidden; }
.lead-send.is-busy { pointer-events: none; }
.lead-send.is-busy [data-send]::after { content: '…'; display: inline-block; width: 1.2em; text-align: left; animation: dots 1s steps(4) infinite; clip-path: inset(0 100% 0 0); }
@keyframes dots { to { clip-path: inset(0 -10% 0 0); } }
.lead-send.is-busy::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%;
  background: var(--terra); animation: busy 1s var(--ease) infinite;
}
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.lead .lead-terms a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #4A4A4E; cursor: pointer; transition: color .2s, text-decoration-color .2s; }
.lead .fine { margin-top: 16px; font-size: 14px; color: #8E8E93; }
/* Возможность ознакомиться с AGB до заключения договора — условие их применения */
.lead .lead-terms { margin-top: 6px; font-size: 13px; color: #77777C; }
.lead .lead-terms a:hover { color: #C9C9CE; text-decoration-color: currentColor; }

.lead-err {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(229, 72, 77, .45);
  border-radius: 10px;
  background: rgba(229, 72, 77, .08);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.lead-err[hidden] { display: none; }
.lead-err b { flex: 1 0 100%; font-weight: 500; color: #F2B8BA; }
.lead-err a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.lead-err a:hover { color: var(--terra-lit); }

/* the calendar step */
.lead .lead-days { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); max-width: 440px; }
.chip-day span {
  width: 100%; flex-direction: column; gap: 0; min-height: 0; padding: 8px 4px 7px;
  border-radius: 14px; line-height: 1.15;
}
.chip-day span::before { display: none; }
.chip-day small { font-size: 11px; letter-spacing: .02em; color: #8E8E93; white-space: nowrap; transition: color .2s; }
.chip-day b { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; margin: 2px 0 1px; font-variant-numeric: tabular-nums; }
.chip-day input:checked + span small { color: #F0C2B5; }
.lead .lead-times { margin-top: 12px; }
.lead-times .chip span { min-width: 78px; font-variant-numeric: tabular-nums; }
.chip-skel {
  display: block; width: 78px; height: 46px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .04) 20%, rgba(255, 255, 255, .1) 50%, rgba(255, 255, 255, .04) 80%) 0 0 / 250% 100%;
  animation: skel 1.2s linear infinite; animation-delay: calc(var(--i, 0) * 80ms);
}
.chip-skel.is-day { width: auto; height: 62px; border-radius: 14px; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.lead-tz { margin-top: 12px; font-size: 13px; }
.lead-slots[hidden], .lead-when-msg[hidden], .lead-noslot[hidden], .lead-warn[hidden] { display: none; }
.lead-when-msg {
  margin-top: 20px; padding: 12px 16px; max-width: 92%;
  border-radius: 4px 14px 14px 14px; background: rgba(255, 255, 255, .06);
  font-size: 16px; line-height: 1.45; color: #E6E6E3;
}
.lead-noslot { display: block; margin-top: 18px; padding: 6px 0; font-size: 15px; color: #9A9A9F; text-align: left; transition: color .2s; }
.lead-noslot:hover { color: #fff; }
.lead-noslot .arr { display: inline-block; transition: transform .3s var(--ease); }
.lead-noslot:hover .arr { transform: translateX(3px); }
.lead-warn {
  margin: 0 0 18px; padding: 12px 16px; border-radius: 10px;
  border: 1px solid rgba(229, 72, 77, .45); background: rgba(229, 72, 77, .08);
  color: #F2B8BA; font-size: 15px; line-height: 1.45;
}

/* booking mode of the last step */
.lead:not(.is-booking) .lead-bookonly, .lead.is-booking .lead-askonly { display: none !important; }
.lead-slot {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin-top: 16px;
  padding: 9px 14px; border-radius: 12px;
  border: 1px solid rgba(210, 102, 74, .38); background: rgba(210, 102, 74, .12);
  font-size: 15px; color: #fff; font-variant-numeric: tabular-nums;
}
.lead-slot svg, .lead-when svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--terra-lit); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lead-change { margin-left: 2px; font-size: 14px; color: #C9C9CE; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #5A5A5F; transition: color .2s; }
.lead-change:hover { color: #fff; }
.lead .chips-fmt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.chips-fmt .chip span { width: 100%; }

/* sent */
.lead-done { display: none; outline: none; }
.lead.is-done form, .lead.is-done .lead-head { display: none; }
.lead.is-done .lead-done { display: block; animation: stepIn .5s var(--ease) both; }
.lead-check { width: 56px; height: 56px; margin: 8px 0 22px; overflow: visible; }
.lead-check circle, .lead-check path { fill: none; stroke: var(--ok); stroke-linecap: round; stroke-linejoin: round; }
.lead-check circle { stroke-width: 2; stroke-dasharray: 164; stroke-dashoffset: 164; transform: rotate(-90deg); transform-origin: center; }
.lead-check path { stroke-width: 2.6; stroke-dasharray: 34; stroke-dashoffset: 34; }
.lead.is-done .lead-check circle { animation: draw .7s var(--ease) .1s forwards; }
.lead.is-done .lead-check path { animation: draw .45s var(--ease) .62s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.lead.is-mail .lead-check, .lead.is-mail .lead-next { display: none; }
.lead-when {
  display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 14px 18px;
  border-radius: 14px; border: 1px solid rgba(76, 195, 138, .32); background: rgba(76, 195, 138, .08);
  animation: rise .5s var(--ease) .7s both;
}
.lead-when[hidden] { display: none; }
.lead-when svg { width: 24px; height: 24px; stroke: var(--ok); }
.lead-when b { display: block; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: #fff; }
.lead-when span { display: block; margin-top: 2px; font-size: 15px; color: #B5B5BA; font-variant-numeric: tabular-nums; }
.lead-done h2 { font-size: clamp(28px, 3.4vw, 32px); letter-spacing: -0.03em; line-height: 1.1; }
.lead-done p { margin-top: 12px; color: #B5B5BA; }
.lead-next { list-style: none; margin: 20px 0 0; padding: 0; }
.lead-next li {
  position: relative; padding: 0 0 18px 28px; color: #E6E6E3; line-height: 1.45;
  animation: rise .5s var(--ease) both; animation-delay: calc(.8s + var(--i, 0) * .14s);
}
.lead-next li::before {
  content: ''; position: absolute; left: 3px; top: .5em; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--terra-lit); background: var(--ink-2);
}
.lead-next li:first-child::before { background: var(--terra-lit); }
.lead-next li:not(:last-child)::after {
  content: ''; position: absolute; left: 7px; top: calc(.5em + 12px); bottom: 2px; width: 1px; background: rgba(255, 255, 255, .14);
}
.lead-next li:last-child { padding-bottom: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.lead-done .btn { margin-top: 28px; animation: rise .5s var(--ease) 1.3s both; }
.lead-done .btn[hidden] { display: none; }

/* phone: a bottom sheet */
@media (max-width: 640px) {
  .lead {
    width: 100%; margin: auto 0 0;
    max-height: calc(100dvh - 12px);
    border-width: 1px 0 0; border-radius: 18px 18px 0 0;
  }
  .lead[open] { animation: sheetIn .5s var(--ease); }
  .lead.is-closing { animation: sheetOut .23s ease-in forwards; }
  .lead-grab { display: flex; justify-content: center; padding: 10px 0 4px; touch-action: none; }
  .lead-grab i { width: 38px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); }
  .lead-bar, .lead-head { touch-action: none; }
  .lead-inner { padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); }
  .lead-bar { margin: 0 -10px; }
  .lead form { margin-top: 22px; }
  .lead-q { font-size: 24px; }
  .lead .chips { gap: 7px; margin-top: 18px; }
  .chip span { min-height: 44px; padding: 9px 14px; font-size: 15px; }
  .lead-note { font-size: 15px; margin-bottom: 18px; }
  /* the next step stays under the thumb even when the choices run past the screen */
  .lead-nav {
    position: sticky; bottom: 0; z-index: 2;
    margin: 12px -20px 0; padding: 14px 20px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--ink-2) 72%, rgba(19, 19, 21, 0));
  }
}
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }

