/* М2К — посадочная: переписка с Настей. Редакционная светлая композиция (ориентир — Mostar Guide). */

@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(/fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(/fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap; src: url(/fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap; src: url(/fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(/fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(/fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Playfair Display"; font-weight: 500; font-display: swap; src: url(/fonts/playfair-display-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-weight: 500; font-display: swap; src: url(/fonts/playfair-display-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/playfair-display-cyrillic-500-italic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/playfair-display-latin-500-italic.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }

:root {
  --bg: #f6f2ea;          /* тёплый белый */
  --paper: #fffdf9;
  --ink: #1d262b;         /* графит */
  --ink-2: #4a565c;
  --muted: #7c8589;
  --line: #e2dacc;
  --line-2: #d3c9b8;
  --brand: #093244;       /* тёмно-бирюзовый М2К (magazinnovostroek.su) */
  --brand-2: #0f4a63;
  --accent: #1867ed;      /* синий М2К — фокус и индикатор */
  --err: #8a2b1d;
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; min-height: 54px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; min-width: 0; }
.brand__mark { font: 500 22px/1 var(--serif); letter-spacing: .01em; color: var(--brand); margin: 0; }
.brand__line { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: none; }
.top__phone {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none;
  font-weight: 500; font-size: 14px; color: var(--brand); background: var(--paper);
  transition: border-color .2s var(--ease);
}
.top__phone:hover { border-color: var(--brand); }

/* ---------- первый экран: Настя ---------- */
.hero__media {
  position: relative; margin: 0 12px; border-radius: 22px; overflow: hidden;
  height: clamp(220px, 32svh, 300px); background: #c9cfcc; isolation: isolate;
}
.hero__img { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: 55% 22%; animation: settle 1.4s var(--ease) both; }
.hero__tag:empty { display: none; }
.hero__tag {
  position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px; background: rgba(255, 253, 249, .78); color: var(--ink-2);
}
.glass {
  background: rgba(255, 253, 249, .7);
  -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 10px 30px -18px rgba(9, 50, 68, .45);
}
.hero__card { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 10px 14px 12px; border-radius: 16px; animation: rise .7s .1s var(--ease) both; }
.agent { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.agent__ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; flex: none; }
.agent__text p { margin: 0; line-height: 1.2; }
.agent__name { font-weight: 600; font-size: 15px; }
.agent__role { font-size: 12px; color: var(--ink-2); }
.display { margin: 0; font: 500 clamp(22px, 6.4vw, 30px)/1.1 var(--serif); letter-spacing: -.005em; color: var(--ink); text-wrap: balance; }
.display--md { font-size: clamp(26px, 6vw, 40px); }

.hero__side { padding: 12px 16px 0; }
.hero__sub { display: none; margin: 0 0 14px; font-size: 15px; line-height: 1.45; color: var(--ink-2); max-width: 46ch; }
.hero__note { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); border-left: 2px solid var(--accent); padding-left: 10px; }

/* ---------- переписка ---------- */
.chat { outline: none; scroll-margin-top: 8px; }
.chat__head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; row-gap: 6px; margin-bottom: 10px; }
.chat__ava { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
/* на телефоне имя Насти уже в карточке над перепиской — в шапке чата только прогресс */
@media (max-width: 959px) { .chat__ava, .chat__who { display: none; } .chat__head { grid-template-columns: 1fr; } .chat__progress { justify-self: end; margin-top: 2px; } }
.chat__who { margin: 0; font-size: 14px; line-height: 1.2; }
.chat__who span { display: block; font-size: 12px; color: var(--muted); }
.chat__who span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3aa76d; margin-right: 6px; vertical-align: 1px; }
.chat__progress { margin: 0; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar__fill { display: block; height: 100%; width: 100%; background: var(--brand); transform-origin: 0 50%; transform: scaleX(var(--p, .2)); transition: transform .45s var(--ease); }

.chat__log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msg__ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.msg--agent:has(+ .msg--agent) .msg__ava { visibility: hidden; } /* аватар — у последнего сообщения подряд */
.msg__text {
  margin: 0; padding: 9px 13px; border-radius: 18px; font-size: 15.5px; line-height: 1.4; max-width: min(84%, 34em);
  overflow-wrap: anywhere;
}
.msg--agent .msg__text { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; color: var(--ink); }
.msg--agent[data-q] .msg__text { font-weight: 500; }
.msg--user { justify-content: flex-end; margin: 4px 0 6px; }
.msg--user .msg__text { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg__edit { order: -1; background: none; border: 0; padding: 8px 4px; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }
.msg__edit:hover { color: var(--brand); }
.msg--agent[data-q] { outline: none; scroll-margin-top: 12px; }
.msg.is-new { animation: msgIn .32s var(--ease) both; }
.msg--user.is-new { animation-name: msgInRight; }
.msg--done .msg__text { border-color: rgba(9, 50, 68, .25); }
.msg__check { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; margin-right: 6px; vertical-align: -5px; }
.msg__id { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 400; }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 13px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .4; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

.chat__reply { margin-top: 10px; padding-left: 36px; }
.replies { display: flex; flex-wrap: wrap; gap: 8px; }
.replies.is-new { animation: msgIn .3s .05s var(--ease) both; }
.opt {
  flex: 1 1 auto; min-width: calc(50% - 4px); min-height: 46px; padding: 10px 14px; text-align: center;
  background: var(--paper); border: 1.5px solid var(--brand); border-radius: 999px; cursor: pointer;
  font-size: 15px; font-weight: 500; line-height: 1.25; color: var(--brand);
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.opt:hover { background: rgba(9, 50, 68, .06); box-shadow: 0 6px 16px -12px rgba(9, 50, 68, .6); }
.opt:active { transform: scale(.97); }
.opt[aria-pressed="true"] { background: var(--brand); color: #fff; }

.chat__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.link {
  background: none; border: 0; padding: 10px 2px; min-height: 44px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--brand); text-decoration: underline; text-decoration-color: rgba(9, 50, 68, .3);
  text-underline-offset: 4px; transition: text-decoration-color .2s var(--ease);
}
.link:hover { text-decoration-color: currentColor; }
.back { color: var(--ink-2); text-decoration: none; }
.direct { margin-left: auto; }

/* ---------- форма телефона (карточка в переписке) ---------- */
.lead { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 12px; }
.chat__reply--form { padding-left: 0; }
.field { display: grid; gap: 6px; margin-bottom: 10px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field__label small { font-weight: 400; color: var(--muted); }
.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line-2); font-size: 17px; /* ≥16px — iOS не зумит */
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 103, 237, .15); }
.input[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 3px rgba(138, 43, 29, .1); }
.field__error { font-size: 13px; color: var(--err); margin: 0; }
.field__error:empty { display: none; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 8px; font-size: 13px; line-height: 1.45; color: var(--ink-2); cursor: pointer; }
.consent input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); }
.consent a { color: var(--brand); }
.pending { background: #fff3dc; color: #7a4a00; border-bottom: 1px dashed #c88a2a; padding: 0 3px; border-radius: 3px; }
.explain { margin: 6px 0 12px; font-size: 13px; color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 22px; border-radius: var(--radius); border: 0; cursor: pointer;
  font-size: 16px; font-weight: 600; text-decoration: none;
  transition: background-color .2s var(--ease), transform .15s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 10px 24px -14px rgba(9, 50, 68, .8); }
.btn--primary:hover { background: var(--brand-2); }
.btn--primary:active { transform: translateY(1px) scale(.995); }
.btn--block { width: 100%; }
.btn[aria-busy="true"] { opacity: .85; cursor: progress; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.alert { margin: 10px 0 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; background: #fff1ee; border: 1px solid #f0c9c1; color: var(--err); }
.alert a { color: inherit; font-weight: 600; }

/* ---------- что дальше ---------- */
.next { padding: 56px 16px 24px; }
.next__list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; }
.next__item { padding: 18px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; }
.next__num { grid-row: span 2; font: italic 500 22px/1.2 var(--serif); color: var(--accent); }
.next__item h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.next__item p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ---------- подвал ---------- */
.foot { padding: 32px 16px calc(110px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 20px; font-size: 14px; }
.foot p { margin: 0 0 6px; }
.brand__mark--foot { font-size: 26px; }
.foot__phone { font-size: 20px; font-weight: 600; color: var(--brand); text-decoration: none; }
.foot__links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px !important; }
.foot__link { color: var(--brand); text-underline-offset: 3px; }
.foot__muted { color: var(--muted); font-size: 13px; }
.foot__legal { font-size: 13px; color: var(--ink-2); }

/* ---------- липкая кнопка (телефон, когда переписка ушла с экрана) ---------- */
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(246, 242, 234, .98) 60%, rgba(246, 242, 234, 0));
  transform: translateY(110%); transition: transform .35s var(--ease);
}
.sticky.is-visible { transform: none; }

/* ---------- появление ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@keyframes settle { from { transform: scale(1.05); } to { transform: none; } }
@keyframes rise { from { transform: translateY(12px); } to { transform: none; } } /* без прозрачности: заголовок виден сразу */
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes msgInRight { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- узкие и низкие телефоны ---------- */
@media (max-width: 370px) {
  .top__phone { padding: 0 10px; font-size: 13px; }
  .chat__reply { padding-left: 0; }
  .msg__text { font-size: 15px; }
  .opt { font-size: 14.5px; padding: 9px 12px; }
}
@media (max-height: 700px) and (max-width: 959px) {
  .hero__media { height: clamp(190px, 28svh, 230px); }
  .opt { min-height: 44px; }
}

/* ---------- планшет ---------- */
@media (min-width: 640px) {
  .top { padding: 14px 24px; }
  .brand__line { display: inline; }
  .hero__media { margin: 0 24px; height: clamp(300px, 40svh, 420px); border-radius: 26px; }
  .hero__img { object-position: 50% 22%; }
  .hero__card { left: 20px; bottom: 20px; right: auto; max-width: 440px; padding: 16px 22px 18px; border-radius: 20px; }
  .agent__ava { width: 44px; height: 44px; }
  .hero__side { padding: 20px 24px 0; }
  .chat { max-width: 640px; }
  .opt { min-width: 0; flex: 0 1 auto; padding: 10px 18px; }
  .next { padding: 72px 24px 32px; }
  .next__list { grid-template-columns: repeat(3, 1fr); gap: 28px; }
  .next__item { grid-template-columns: 1fr; padding-top: 20px; }
  .next__num { grid-row: auto; margin-bottom: 8px; }
  .foot { grid-template-columns: 1fr 1fr; padding: 40px 24px calc(110px + env(safe-area-inset-bottom)); }
  .foot__legal { grid-column: 1 / -1; }
}

/* ---------- компьютер: Настя слева, переписка справа ---------- */
@media (min-width: 960px) {
  body { font-size: 17px; }
  .top { padding: 18px 40px; max-width: 1440px; margin: 0 auto; }
  .brand__mark { font-size: 26px; }
  .top__phone { font-size: 15px; min-height: 44px; padding: 0 18px; }
  .hero {
    max-width: 1440px; margin: 0 auto; padding: 0 40px;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(440px, 1fr); gap: 48px; align-items: stretch;
  }
  .hero__media { margin: 0; height: auto; min-height: min(780px, calc(100svh - 104px)); border-radius: 30px; }
  .hero__img { object-position: 50% 30%; }
  .hero__card { left: 28px; bottom: 28px; right: 28px; max-width: 560px; padding: 22px 28px 26px; border-radius: 22px; }
  .agent { margin-bottom: 12px; }
  .agent__ava { width: 52px; height: 52px; }
  .agent__name { font-size: 17px; }
  .agent__role { font-size: 13px; }
  .display { font-size: clamp(36px, 3.2vw, 52px); line-height: 1.05; }
  .hero__side { padding: 8px 0 0; display: flex; flex-direction: column; justify-content: center; }
  .hero__sub { display: block; font-size: 18px; margin-bottom: 18px; }
  .chat { max-width: none; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; padding: 22px 26px 14px; box-shadow: 0 30px 60px -40px rgba(9, 50, 68, .35); }
  .msg--agent .msg__text { background: var(--bg); }
  .opt { background: var(--paper); }
  .lead { background: var(--bg); }
  .next { max-width: 1440px; margin: 0 auto; padding: 96px 40px 48px; }
  .foot { max-width: 1440px; margin: 0 auto; grid-template-columns: 1.2fr 1fr 1.6fr; padding: 40px 40px 48px; }
  .foot__legal { grid-column: auto; }
  .sticky { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
