/* Окно заявки на английской (/en/) и испанской (/es/) главных (#lead, разметка — home/i18n.mjs → leadDialog).
   Как окно кейса: тёмная коробка 16px поверх затемнения; слева — кто мы и как связаться, справа — форма инпут-линиями.
   На телефоне — шторка снизу. Движение: окно поднимается, услуги-чипы выплывают по очереди, линия поля прочерчивается при фокусе. */
.ld { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ivory); overflow: hidden; }
.ld::backdrop { background: rgba(8, 7, 6, .84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity .32s var(--ease); }
.ld.is-open::backdrop { opacity: 1; }
.ld__box {
  position: absolute; left: 50%; top: 50%; width: min(1080px, calc(100vw - 2 * clamp(20px, 4vw, 64px))); max-height: calc(100dvh - 2 * clamp(16px, 4vh, 48px));
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); overflow: auto; overscroll-behavior: contain;
  background: var(--wall); border: 1px solid var(--rule-2); border-radius: 16px; box-shadow: 0 40px 104px rgba(0, 0, 0, .92), 0 0 0 1px rgba(255, 255, 255, .04);
  opacity: 0; transform: translate(-50%, calc(-50% + 18px)) scale(.985); transition: opacity .32s var(--ease), transform .42s var(--slow);
}
.ld.is-open .ld__box { opacity: 1; transform: translate(-50%, -50%); }
.ld__x { position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--ivory-2); cursor: pointer; transition: color .3s var(--ease), transform .5s var(--slow); }
.ld__x:hover { color: var(--ivory); transform: rotate(90deg); }

/* слева: кто мы */
.ld__aside { position: relative; display: flex; flex-direction: column; gap: 22px; padding: clamp(28px, 3.4vw, 48px); border-right: 1px solid var(--rule); }
.ld__aside::before { content: ""; position: absolute; left: -20%; bottom: -30%; width: 120%; height: 70%; background: radial-gradient(closest-side, rgba(227, 6, 19, .16), transparent); pointer-events: none; }
.ld__k { display: flex; align-items: center; gap: 10px; }
.ld__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.ld__t { font: 300 clamp(32px, 3.4vw, 50px)/1 var(--f-display); letter-spacing: -.05em; }
.ld__t .it { font-size: 1.14em; }
.ld__d { font: var(--t-small); color: var(--ivory-2); max-width: 34ch; }
.ld__facts { display: grid; gap: 0; margin-top: auto; border-top: 1px solid var(--rule); }
.ld__facts li { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.ld__facts b { min-width: 3.2em; font: 200 26px/1 var(--f-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ld__facts span { font: var(--t-label); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.ld__alt { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 400 14px/1.4 var(--f-text); color: var(--ivory-2); }
.ld__alt span { flex-basis: 100%; font: var(--t-label); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.ld__alt a { border-bottom: 1px solid var(--rule-2); transition: border-color .3s var(--ease), color .3s var(--ease); }
.ld__alt a:hover { color: var(--ivory); border-color: var(--ivory); }

/* справа: форма */
.ld__form, .ld__ok { padding: clamp(28px, 3.4vw, 48px); padding-top: clamp(36px, 3.6vw, 52px); }
.ld__svc { margin: 0 0 18px; padding: 0; border: 0; }
.ld__lg { margin-bottom: 14px; padding: 0; font: var(--t-eyebrow); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.ld__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ld__chip { position: relative; cursor: pointer; }
.ld__chip input { position: absolute; opacity: 0; pointer-events: none; }
.ld__chip span { position: relative; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px 0 16px; border: 1px solid var(--rule-2); font: 400 14px/1.2 var(--f-text); color: var(--ivory-2);
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .2s var(--ease); }
.ld__chip span::before { content: ""; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--red); transform: scale(0); transition: transform .45s cubic-bezier(.3, 1.7, .5, 1); }
.ld__chip:hover span { border-color: var(--ivory-2); color: var(--ivory); }
.ld__chip input:checked + span { background: var(--ivory); border-color: var(--ivory); color: var(--ink); }
.ld__chip input:checked + span::before { transform: scale(1); }
.ld__chip input:focus-visible + span { outline: 2px solid var(--ivory); outline-offset: 2px; }
.ld__chip:active span { transform: scale(.97); }
.ld.is-open .ld__chip { animation: ld-in .5s var(--slow) both; animation-delay: calc(120ms + var(--i, 0) * 22ms); }
@keyframes ld-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ld__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.ld__f { position: relative; padding-top: 18px; }
.ld__f--wide { grid-column: 1 / -1; }
.ld__f input, .ld__f textarea { display: block; width: 100%; height: 48px; padding: 0; background: transparent; border: 0; border-bottom: 1px solid var(--rule-2); border-radius: 0;
  color: var(--ivory); font: 400 17px/1.3 var(--f-text); outline: 0; }
.ld__f textarea { height: auto; min-height: 76px; padding-top: 14px; resize: vertical; }
.ld__f label { position: absolute; left: 0; top: 32px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mute); font: 400 16px/1.2 var(--f-text);
  pointer-events: none; transform-origin: 0 0; transition: transform .35s var(--slow), color .25s var(--ease); }
.ld__f input:focus ~ label, .ld__f input:not(:placeholder-shown) ~ label,
.ld__f textarea:focus ~ label, .ld__f textarea:not(:placeholder-shown) ~ label { transform: translateY(-24px) scale(.76); color: var(--ivory-2); }
.ld__line { position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--ivory); transform: scaleX(0); transform-origin: 0 50%; transition: transform .55s var(--slow), background-color .3s; }
.ld__f textarea ~ .ld__line { bottom: 6px; }
.ld__f:focus-within .ld__line { transform: scaleX(1); }
.ld__err { display: block; height: 0; overflow: hidden; font: 400 12.5px/1.4 var(--f-text); color: var(--red-ink); opacity: 0; transition: opacity .3s var(--ease); }
.ld__f.bad .ld__line { transform: scaleX(1); background: var(--red-ink); }
.ld__f.bad .ld__err { height: auto; padding-top: 6px; opacity: 1; }
.ld__f.bad { animation: ld-shake .42s var(--ease); }
@keyframes ld-shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } 100% { transform: none; } }

.ld__chk { display: flex; align-items: flex-start; gap: 12px; margin-top: 22px; cursor: pointer; font: 400 14px/1.45 var(--f-text); color: var(--ivory-2); }
.ld__chk input { position: absolute; opacity: 0; pointer-events: none; }
.ld__tick { flex: none; position: relative; width: 20px; height: 20px; margin-top: 1px; border: 1px solid var(--rule-2); transition: border-color .3s var(--ease), background-color .3s var(--ease); }
.ld__tick::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--ink); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg) scale(0); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.ld__chk input:checked + .ld__tick { background: var(--ivory); border-color: var(--ivory); }
.ld__chk input:checked + .ld__tick::after { transform: rotate(45deg) scale(1); }
.ld__chk input:focus-visible + .ld__tick { outline: 2px solid var(--ivory); outline-offset: 2px; }
.ld__chk a { color: var(--ivory); border-bottom: 1px solid var(--rule-2); }
.ld__chk.bad .ld__tick { border-color: var(--red-ink); animation: ld-shake .42s var(--ease); }

.ld__go { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 26px; }
.ld__sub { min-width: 220px; }
.ld__sub[aria-busy="true"] { opacity: .6; pointer-events: none; }
.ld__sub:active { transform: scale(.98); }
.ld__note { font: 400 14px/1.45 var(--f-text); color: var(--red-ink); }

/* заявка ушла */
.ld__ok { grid-column: 2; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; min-height: 420px; outline: none; }
.ld__ok[hidden] { display: none; }
.ld__okic { color: var(--ivory); }
.ld__okic circle { stroke-dasharray: 170; stroke-dashoffset: 170; animation: ld-draw .8s var(--slow) .05s forwards; }
.ld__okic path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: ld-draw .5s var(--slow) .45s forwards; }
@keyframes ld-draw { to { stroke-dashoffset: 0; } }
.ld__okt { font: var(--t-title-l); letter-spacing: -.04em; }
.ld__okd { font: var(--t-small); color: var(--ivory-2); max-width: 36ch; }

/* телефон и узкий планшет: шторка снизу, «кто мы» — коротко сверху */
@media (max-width: 860px) {
  .ld__box { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: calc(100dvh - max(48px, env(safe-area-inset-top, 0px) + 36px)); grid-template-columns: 1fr;
    border: 0; border-top: 1px solid var(--rule-2); border-radius: 18px 18px 0 0; opacity: 1; transform: translateY(100%); transition: transform .42s cubic-bezier(.22, 1, .36, 1); }
  .ld.is-open .ld__box { transform: none; }
  .ld__aside { gap: 14px; padding: 28px 20px 8px; border-right: 0; }
  .ld__aside::before, .ld__facts { display: none; }
  .ld__t { font-size: clamp(30px, 8.6vw, 40px); padding-right: 44px; }
  .ld__alt { font-size: 13.5px; }
  .ld__form, .ld__ok { padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .ld__ok { grid-column: 1; min-height: 320px; }
  /* на телефоне сначала поля (имя, почта), потом выбор услуг: короткая заявка не прячется за чипами */
  .ld__form { display: flex; flex-direction: column; }
  .ld__grid { order: 1; } .ld__svc { order: 2; margin: 26px 0 0; } .ld__chk { order: 3; } .ld__go { order: 4; }
  .ld__x { top: 10px; right: 8px; }
}
@media (max-width: 560px) {
  .ld__grid { grid-template-columns: 1fr; }
  .ld__chip span { min-height: 40px; }
  .ld__sub { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ld__box, .ld::backdrop, .ld__line, .ld__f label { transition: none; }
  .ld.is-open .ld__chip, .ld__f.bad, .ld__chk.bad .ld__tick { animation: none; }
  .ld__okic circle, .ld__okic path { animation: none; stroke-dashoffset: 0; }
}
html.is-lead { overflow: hidden; }

/* Подгонка вёрстки главной под длину английских и испанских слов (только /en/ и /es/: русская главная этот файл не грузит) */
.gr__x > span:only-child { font-size: .66em; letter-spacing: -.01em; }
