/* ============================================================
   ОКНО «ПОПРОСИТЬ ОТРЫВОК» — общий файл.

   Раньше это окно жило только внутри index.html, и кнопка на странице
   фрагмента вела на главную ради него: человек нажимал «попросить отрывок»
   и оказывался на лендинге, а окно приезжало через полсекунды. Теперь окно
   открывается там, где нажали кнопку, — на любой странице, где подключены
   этот файл и otryvok-okno.js.

   Свои имена классов (.ot-*), а не .fm-* лендинга: те обслуживают ещё
   и форму брони внизу главной, и трогать их ради переезда нельзя.
   Внешний вид при этом тот же — те же токены, поля-подчёркивания
   высотой 48, ошибка на поле, экран успеха без галочек и зелёного.

   Токенов :root здесь нет намеренно: файл подключается к страницам,
   у которых они уже объявлены. Значения взяты те же.
   ============================================================ */
.ot-overlay{
  position:fixed;inset:0;z-index:120;
  display:flex;align-items:center;justify-content:center;
  padding:clamp(16px,3vh,28px);
  background:rgba(8,5,2,.74);backdrop-filter:blur(6px);
  opacity:0;visibility:hidden;
  /* visibility гасим отдельно и с задержкой: при переходе она переключается
     на середине, и в момент открытия окно ещё считалось невидимым —
     а невидимый элемент нельзя сфокусировать, фокус утекал на страницу */
  transition:opacity .28s cubic-bezier(.2,.7,.2,1),visibility 0s .28s;
}
.ot-overlay.open{opacity:1;visibility:visible;transition-delay:0s}

.ot-modal{
  --p:clamp(20px,3vw,36px);
  position:relative;width:min(560px,100%);max-height:calc(100svh - 32px);
  overflow-y:auto;overscroll-behavior:contain;
  background:#1c150d;border-radius:8px;
  box-shadow:0 26px 70px rgba(0,0,0,.5);
  transform:translateY(10px);transition:transform .28s cubic-bezier(.2,.7,.2,1);
}
.ot-overlay.open .ot-modal{transform:none}
.ot-modal:focus{outline:none}

.ot-head{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:max(20px,calc(env(safe-area-inset-top) + 10px)) var(--p) 0;
}
.ot-kicker{
  display:inline-flex;align-items:center;gap:12px;margin:0;
  font-family:var(--sans);font-size:12px;font-weight:500;
  letter-spacing:.14em;text-transform:uppercase;color:rgba(231,197,131,.9);
}
.ot-kicker::before{
  content:"";width:13px;height:13px;flex:none;
  background:url("ribbon-diamond.webp") center/contain no-repeat;opacity:.92;
}
.ot-close{
  /* 44 по высоте, а не 38: тач-цель, даже если сам знак мелкий */
  flex:none;width:44px;height:44px;display:grid;place-items:center;
  background:rgba(255,245,225,.06);border:1px solid rgba(231,197,131,.2);
  border-radius:6px;color:#cbb890;font-size:15px;line-height:1;cursor:pointer;
  transition:background-color .2s,color .2s;
}
.ot-close:hover{background:rgba(255,245,225,.12);color:#f0e6d6}

.ot-body{display:grid;gap:18px;padding:16px var(--p) calc(var(--p) + env(safe-area-inset-bottom))}
.ot-title{
  margin:0;font-family:var(--serif);font-weight:500;
  font-size:clamp(21px,2.4vw,26px);line-height:1.16;letter-spacing:-.018em;
  color:#f0e6d6;
}
.ot-lede{margin:0;font-family:var(--serif);font-size:17px;line-height:1.6;color:#cbb890}
/* кавычка вынесена в поле, левый край текста стоит ровно по колонке */
.ot-quote{
  margin:0;font-family:var(--serif);font-style:italic;
  font-size:19px;line-height:1.5;color:#e7c583;text-indent:-.42em;
}
.ot-count{margin:0;font-family:var(--sans);font-size:15px;line-height:1.5;color:rgba(203,184,144,.74)}
.ot-count b{font-weight:500;color:#e7c583}

.ot-form{display:grid;gap:18px}
.ot-quest{display:grid;gap:10px}
.ot-q{margin:0;font-family:var(--sans);font-size:15px;line-height:1.4;color:rgba(203,184,144,.74)}
.ot-opts{display:flex;flex-wrap:wrap;gap:10px}
.ot-opt{
  min-height:44px;padding:0 16px;
  font-family:var(--sans);font-size:15px;line-height:1.3;color:#cbb890;
  background:transparent;border:1px solid rgba(231,197,131,.3);border-radius:6px;
  cursor:pointer;transition:border-color .18s,color .18s,background-color .18s;
}
.ot-opt:hover{border-color:rgba(231,197,131,.6);color:#f0e6d6}
.ot-opt[aria-checked="true"]{
  color:#2a1c0c;background:#d3ba8a;border-color:#d3ba8a;font-weight:500;
}
.ot-note{margin:0;font-family:var(--sans);font-size:13px;line-height:1.5;color:rgba(203,184,144,.55)}
.ot-quest.err .ot-opt{border-color:#c96a4f}

.ot-field{display:grid;gap:6px}
.ot-field label{font-family:var(--sans);font-size:15px;line-height:1.3;color:rgba(203,184,144,.74)}
.ot-field input{
  font-family:var(--serif);font-size:17.5px;line-height:1.4;color:#f0e6d6;
  background:transparent;border:0;border-radius:0;
  border-bottom:1px solid rgba(231,197,131,.45);
  padding:10px 0;min-height:48px;width:100%;outline:none;
  transition:border-color .18s;
}
.ot-field input::placeholder{color:rgba(203,184,144,.55)}
.ot-field input:focus{border-bottom-color:#e7c583}
.ot-field input[aria-invalid="true"]{border-bottom:2px solid #c96a4f}

/* ошибка живёт на поле, а не плашкой. display:flex сюда не ставить:
   ссылка внутри текста станет вторым флекс-элементом и улетит в колонку */
.ot-err{display:none;margin:0;font-family:var(--sans);font-size:15px;line-height:1.5;color:#f0c9b4}
.ot-err.on{display:block;padding-left:1.15em;text-indent:-1.15em}
.ot-err.on::before{content:'\2191\00a0'}
.ot-err a{color:#f0c9b4}

.ot-btn{
  display:inline-flex;align-items:center;justify-content:center;text-align:center;
  width:100%;min-height:52px;padding:14px 20px;
  font-family:var(--sans);font-size:12px;font-weight:600;
  letter-spacing:.07em;text-transform:uppercase;line-height:1.35;
  color:#2a1c0c;background:#d3ba8a;border:0;border-radius:3px;cursor:pointer;
  text-decoration:none;transition:background-color .2s,opacity .2s;
}
.ot-btn:hover{background:#e2cb9f}
.ot-btn[disabled]{cursor:progress;opacity:.72}
.ot-btn--ghost{
  color:#e7c583;background:transparent;border:1px solid rgba(231,197,131,.45);
}
.ot-btn--ghost:hover{background:rgba(231,197,131,.08);color:#d3ba8a}
/* спиннеров на сайте нет: дышащая точка и глагол */
.ot-wait{display:inline-flex;align-items:center;gap:12px}
.ot-wait::before{
  content:'';flex:none;width:7px;height:7px;border-radius:50%;
  background:currentColor;animation:otPulse 1.1s ease-in-out infinite;
}
@keyframes otPulse{0%,100%{opacity:.35}50%{opacity:.8}}
.ot-terms{margin:0;font-family:var(--sans);font-size:13px;line-height:1.5;color:rgba(203,184,144,.74);text-align:center}
.ot-consent{margin:0;font-family:var(--sans);font-size:12px;line-height:1.5;color:rgba(203,184,144,.74);text-align:center}
.ot-consent a{color:inherit;display:inline-block;padding-block:15px}
.ot-dot{
  display:inline-block;width:5px;height:5px;border-radius:50%;
  background:rgba(231,197,131,.5);vertical-align:middle;margin:0 4px;
}

/* ---------------- экран успеха ---------------- */
.ot-done{display:none;gap:22px;padding:16px var(--p) calc(var(--p) + env(safe-area-inset-bottom))}
.ot-modal.done .ot-body{display:none}
.ot-modal.done .ot-done{display:grid}
.ot-done-num{
  margin:0;font-family:var(--serif);font-weight:500;
  font-size:clamp(21px,2.4vw,26px);line-height:1.16;color:#e7c583;
}
/* появление двумя тактами: сначала номер, пауза, потом остальное */
@keyframes otIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.ot-done-num{animation:otIn .7s ease-out .1s both}
.ot-done-title,.ot-list,.ot-tail,.ot-cta{animation:otIn .7s ease-out .55s both}
@media(prefers-reduced-motion:reduce){
  .ot-done-num,.ot-done-title,.ot-list,.ot-tail,.ot-cta{animation:none}
  .ot-wait::before{animation:none}
  .ot-overlay,.ot-modal{transition:none}
}
.ot-done-title{margin:0;font-family:var(--serif);font-weight:500;font-size:21px;line-height:1.25;color:#f0e6d6}
.ot-list{margin:0;padding:0;list-style:none;display:grid}
.ot-list li{
  display:flex;align-items:baseline;justify-content:space-between;gap:16px;
  padding:12px 0;border-bottom:1px solid rgba(231,197,131,.16);
  font-family:var(--serif);font-size:17px;line-height:1.35;color:rgba(203,184,144,.74);
}
.ot-list li:last-child{border-bottom:0}
.ot-list li.on{color:#f0e6d6}
.ot-list li em{
  font-style:normal;font-family:var(--sans);font-size:12px;
  letter-spacing:.12em;text-transform:uppercase;color:#e7c583;opacity:0;
}
.ot-list li.on em{opacity:1}
.ot-tail{margin:0;font-family:var(--sans);font-size:15px;line-height:1.55;color:rgba(203,184,144,.74)}
/* лента — тот же орнамент с переплёта; в этот счёт «не больше пяти
   появлений на страницу» окна не входят: окно видно только при открытии */
.ot-ribbon{
  display:block;height:20px;background:url("ribbon-red.webp") repeat-x center;
  background-size:auto 20px;opacity:.82;
}
.ot-cta{display:grid;gap:10px}

@media(max-width:640px){
  /* поля вокруг окна ужимаем: на 390px по 33px с каждой стороны съедали
     шестую часть ширины, и текст ломался на обрубки */
  .ot-overlay{padding:12px}
  .ot-modal{max-height:calc(100svh - 24px);border-radius:6px}
  .ot-opts{display:grid}
  .ot-opt{width:100%}
}
