/* WIFI ORIONET — страница входа. Цвета и знак по брендбуку ORIONET (с. 05–09). */

@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap;
             src: url("../fonts/fira-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap;
             src: url("../fonts/fira-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 700; font-display: swap;
             src: url("../fonts/fira-sans-700.woff2") format("woff2"); }

:root {
  --orange: #FAA01E;          /* pantone orange, веб-вариант */
  --orange-hi: #FBAE40;
  --ink: #231F20;             /* pantone black */
  --ink-2: #5E5759;           /* второстепенный на белом, 7:1 */
  --rim: #E6E6E6;             /* окантовка знака, black 15% */
  --rim-dark: #D2D0D0;
  --tint: #FEF1DD;            /* оранжевый 15% — реплики ORIONET */
  --paper: #FFFFFF;
  --alert-bg: #FCEBE8;
  --alert-ink: #7A1C14;

  --radius-key: 12px;
  --radius-msg: 20px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --step: 340ms;              /* шаг «набора» одной реплики: вся лента - около секунды */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: "Fira Sans", Verdana, Geneva, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
  caret-color: var(--orange);
}

::selection { background: var(--orange); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
a { color: var(--ink); text-underline-offset: 0.2em; }
.nowrap { white-space: nowrap; }

/* ---------- шапка ---------- */

/* белая шапка: знак-клавиша остаётся оранжевым в серой окантовке; оранжевая кромка снизу */
.bar {
  background: var(--paper);
  border-bottom: 6px solid var(--orange);
  padding: max(0.875rem, env(safe-area-inset-top)) 1.25rem 0.875rem;
}
.bar__logo {
  display: block;
  height: 2.5rem;
  width: auto;
  margin-inline: auto;
}

/* ---------- лента ---------- */

.chat {
  flex: 1;
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding: 1.5rem 1.125rem 2rem;
}

.chat__log {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.msg {
  position: relative;
  width: fit-content;
  max-width: 88%;
  align-self: flex-start;
  padding: 0.8125rem 1rem 0.875rem;
  border-radius: var(--radius-msg) var(--radius-msg) var(--radius-msg) 6px;
  background: var(--tint);
}
.msg b { font-weight: 700; }

/* ответ человека — справа, фирменным чёрным */
.msg--out {
  align-self: flex-end;
  border-radius: var(--radius-msg) var(--radius-msg) 6px var(--radius-msg);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.msg--alert { background: var(--alert-bg); color: var(--alert-ink); }

/* итог — реплика целиком оранжевая, как клавиша знака */
.msg--done { background: var(--orange); font-size: 1.1875rem; }

/* номер для звонка — главное, что надо увидеть на этом шаге */
.msg--call { max-width: 100%; width: auto; align-self: stretch; }
.callnum {
  display: block;
  margin: 0.25rem 0 0.375rem;
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.125rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-decoration: none;
}
.msg__note { display: block; font-size: 0.9375rem; color: var(--ink-2); }

/* ---------- ответ: поле номера ---------- */

.reply { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.reply__label { font-weight: 600; }

.phone {
  display: flex;
  align-items: center;
  min-height: 3.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-key);
  background: var(--paper);
  transition: box-shadow 160ms var(--ease-out);
}
.phone:focus-within { box-shadow: 0 0 0 4px var(--orange); }
.phone__cc {
  padding-inline: 1rem 0.375rem;
  font-size: 1.5rem;
  font-weight: 600;
}
.phone__input {
  flex: 1;
  min-width: 0;
  height: 3.5rem;
  border: 0;
  padding: 0 1rem 0 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.phone__input:focus { outline: none; }
.phone__input::placeholder { color: #8C8486; font-weight: 400; opacity: 1; } /* 3.6:1 — крупный текст */
.phone__input[aria-invalid="true"] { color: var(--alert-ink); }

.consent { margin: 0.25rem 0 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }
.consent__more { font-size: 0.875rem; color: var(--ink-2); }
.consent__more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  list-style: none;
  cursor: pointer;
  width: max-content;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
}
.consent__more summary::-webkit-details-marker { display: none; }
/* шеврон: поворачивается, когда текст раскрыт */
.consent__more summary::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 200ms var(--ease-out);
}
.consent__more[open] summary::before { transform: translateY(2px) rotate(225deg); }
.consent__more p { margin: 0.5rem 0 0; max-width: 62ch; }

/* ---------- клавиши: знак ORIONET — оранжевая грань в серой окантовке ---------- */

.actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.actions form { margin: 0; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.5rem;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: var(--radius-key);
  background: var(--orange);
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--rim), 0 10px 18px -8px rgba(35, 31, 32, 0.38);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.key--wide { width: 100%; margin-top: 0.25rem; }
.key--paper { background: var(--paper); }
.key__icon { width: 1.25rem; height: 1.25rem; fill: currentColor; flex: none; }

@media (hover: hover) {
  .key:hover { background: var(--orange-hi); box-shadow: 0 0 0 4px var(--rim-dark), 0 12px 20px -8px rgba(35, 31, 32, 0.42); }
  .key--paper:hover { background: var(--tint); }
}
.key:active {
  transform: translateY(2px) scale(0.985);
  box-shadow: 0 0 0 4px var(--rim-dark), 0 3px 6px -3px rgba(35, 31, 32, 0.4);
  transition-duration: 60ms;
}

.linkbtn {
  display: block;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  cursor: pointer;
}

.foot {
  padding: 1rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* ---------- «набор» реплик: точки в углу, затем пузырь раскрывается ---------- */

@media (prefers-reduced-motion: no-preference) {
  .is-new { animation: rise var(--step) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--step) + 120ms); }

  /* ответ и клавиши не ждут всю ленту: не позже 0,7 с */
  .reply.is-new, .actions.is-new { animation-delay: min(calc(var(--i, 0) * var(--step) + 120ms), 800ms); }

  .msg--in.is-new {
    animation-name: unfold;
    animation-duration: calc(var(--step) * 1.25);
  }
  .msg--in.is-new::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
      radial-gradient(circle, var(--ink-2) 3px, transparent 3.5px) 16px calc(100% - 16px) / 12px 12px no-repeat,
      radial-gradient(circle, var(--ink-2) 3px, transparent 3.5px) 28px calc(100% - 16px) / 12px 12px no-repeat,
      radial-gradient(circle, var(--ink-2) 3px, transparent 3.5px) 40px calc(100% - 16px) / 12px 12px no-repeat,
      var(--tint);
    animation: typing calc(var(--step) * 1.25) linear both;
    animation-delay: inherit;
    pointer-events: none;
  }
  .msg--alert.is-new::after { background-color: var(--alert-bg); }
  .msg--done.is-new::after  { background-color: var(--orange); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes unfold {
  0%   { opacity: 0; clip-path: inset(calc(100% - 44px) calc(100% - 68px) 0 0 round 20px 20px 20px 6px); }
  10%  { opacity: 1; }
  42%  { clip-path: inset(calc(100% - 44px) calc(100% - 68px) 0 0 round 20px 20px 20px 6px); }
  100% { opacity: 1; clip-path: inset(0 0 0 0 round 20px 20px 20px 6px); }
}
@keyframes typing {
  0%, 46% { opacity: 1; }
  64%, 100% { opacity: 0; }
}

/* ---------- широкие экраны: та же лента, по центру ---------- */

@media (min-width: 48rem) {
  .bar { padding-block: 1.25rem; }
  .bar__logo { height: 2.75rem; }
  .chat { padding-top: 3rem; }
}
