﻿/* Объёмный телефон первого экрана (index.html, блок data-phone; логика assets/js/phone-core.js и phone.js).
   Все размеры в em от font-size сцены; font-size — от ширины своей колонки (cqi) и высоты окна, а не от окна целиком.
   Размеры корпуса задаются только здесь (--pw, --ph, --pr, --pt, --bump*): phone.js читает их при запуске.
   Переходы тона внутри одного нейтрального цвета — это металл и свет, не декоративные градиенты. */

.hero-figure { margin: 0; min-width: 0; }
.hero-figure.p3 { container-type: inline-size; display: grid; justify-items: center; }

.p3-stage {
  --pw: 27em; --ph: 56em; --pr: 4.7em; --pt: 2.9em; --bez: .72em;
  --bump: 10.6em; --bump-r: 3.1em; --bump-h: .6em;
  position: relative; width: 100%; max-width: 38em; height: 62em;
  font-size: 9px;
  /* по высоте: первый экран = 100svh − шапка и поля (~110 px) − подпись и кнопки (~95 px); сцена 62em */
  font-size: clamp(7.2px, min(3.3cqi, calc((100vh - 210px) / 62)), 12.6px);
  font-size: clamp(7.2px, min(3.3cqi, calc((100svh - 210px) / 62)), 12.6px);
  perspective: 170em; perspective-origin: 50% 40%;
  touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: grab; outline-offset: 6px; border-radius: 24px;
}
.p3-stage.is-drag, .p3-stage.is-drag * { cursor: grabbing; }
/* мягкое пятно света за телефоном: один радиальный переход низкой прозрачности, поверх любого фона */
.p3.is-3d .p3-stage::before {
  content: ""; position: absolute; left: 0; right: 0; top: 4em; height: 52em; pointer-events: none;
  background: radial-gradient(closest-side, rgba(170, 178, 232, .15), rgba(170, 178, 232, .06) 55%, rgba(170, 178, 232, 0));
}
.p3-stage a { -webkit-touch-callout: none; -webkit-user-drag: none; }
.p3-stage img { -webkit-user-drag: none; }

.p3-phone {
  position: absolute; left: 50%; top: 2.4em; width: var(--pw); height: var(--ph); margin-left: calc(var(--pw) / -2);
  transform-style: preserve-3d; transform: rotateX(4deg); will-change: transform;
}

/* сердцевина: тёмная пластина посередине толщины, чтобы в стыках граней никогда не было видно фона */
.p3-core { position: absolute; inset: .35em; border-radius: calc(var(--pr) - .35em); background: #07080D; }
.p3:not(.is-3d) .p3-core { display: none; }
.p3-edge { position: absolute; inset: 0; transform-style: preserve-3d; }

/* грань ребра: скруглённая металлическая рейка; i — тень от света, b — узкий блик, его двигает JS */
.p3-f {
  position: absolute; left: 50%; top: 50%; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: linear-gradient(90deg, #262937 0%, #5B6074 18%, #767B90 50%, #5B6074 82%, #262937 100%);
}
.p3-f i { position: absolute; inset: 0; background: #04050A; opacity: .4; }
.p3-f b {
  position: absolute; top: 0; bottom: 0; left: 0; width: 34%; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(236, 239, 250, .85) 50%, rgba(255, 255, 255, 0));
}
/* s — бегущий блик вдоль длинного ребра в момент «с ребра»; его двигает JS */
.p3-f s {
  position: absolute; left: 6%; right: 6%; top: 30%; height: 40%; opacity: 0; text-decoration: none;
  background: linear-gradient(180deg, rgba(240, 243, 255, 0), rgba(240, 243, 255, .8) 50%, rgba(240, 243, 255, 0));
}
.p3-f.p3-key { border-radius: .35em; background: linear-gradient(90deg, #2F3242, #6B7085 45%, #2F3242); }
.p3-f.p3-wall { background: linear-gradient(90deg, #454A6C, #2A2E48); }

.p3-face { position: absolute; inset: 0; border-radius: var(--pr); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.p3-front {
  background: #05060A; padding: var(--bez); transform: translateZ(calc(var(--pt) / 2));
  box-shadow: inset 0 0 0 .1em #4A4E62, inset 0 0 0 .22em #0B0C12;
}
.p3-back {
  transform: rotateY(180deg) translateZ(calc(var(--pt) / 2)); overflow: hidden;
}
/* крышка: матовое стекло сине-графитового тона, свет сверху слева; по краю тонкий контровой свет */
.p3-plate-back {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(160deg, #3A3F60 0%, #2E3252 32%, #2A2E48 58%, #22253B 100%);
  box-shadow: inset 0 0 0 .1em rgba(255, 255, 255, .12), inset .3em .35em .7em rgba(255, 255, 255, .07), inset -.3em -.4em 1.4em rgba(4, 5, 12, .35);
}
/* тень блока камеры на крышке: свет сверху слева, тень вправо вниз */
.p3-plate-back::after {
  content: ""; position: absolute; top: 2em; left: 2em; width: var(--bump); height: var(--bump); border-radius: var(--bump-r);
  box-shadow: .35em .5em 1em rgba(4, 5, 12, .6), 0 0 0 .1em rgba(4, 5, 12, .4);
}
.p3-dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; border-radius: inherit; }

/* знак </> как гравировка в тон крышке: тёмный край сверху, светлый снизу */
.p3-mark-back { position: absolute; left: 50%; top: 56%; width: 8.4em; margin-left: -4.2em; }
.p3-mark-back svg { display: block; width: 100%; height: auto; overflow: visible; }
.p3-mark-back path { fill: none; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.p3-mark-back .lo { stroke: #12142A; transform: translate(-.45px, -.55px); }
.p3-mark-back .hi { stroke: #5A6088; transform: translate(.45px, .6px); }
.p3-mark-back .mid { stroke: #20233A; }

/* блок камеры: выступает над крышкой (стенки строит JS) */
.p3-bump {
  position: absolute; top: 2em; left: calc(var(--pw) - 2em - var(--bump)); width: var(--bump); height: var(--bump);
  transform-style: preserve-3d; transform: translateZ(calc(var(--pt) / -2)) rotateY(180deg);
}
.p3:not(.is-3d) .p3-bump { display: none; }
.p3-bump-top {
  position: absolute; inset: 0; border-radius: var(--bump-r); transform: translateZ(var(--bump-h));
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
  background: linear-gradient(150deg, #40466A, #30344F 55%, #262A42);
  box-shadow: inset 0 0 0 .1em rgba(255, 255, 255, .16), inset .2em .25em .4em rgba(255, 255, 255, .08), inset -.2em -.3em .6em rgba(4, 5, 12, .4);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; padding: 1.05em; gap: .55em;
}
.p3-lens {
  position: relative; border-radius: 50%;
  background: radial-gradient(circle, #04050A 0 36%, #11131D 37% 52%, #2E3245 53% 64%, #4B5066 65% 70%, #1A1C28 71%);
  box-shadow: 0 .12em .2em rgba(0, 0, 0, .55);
}
.p3-lens:first-child { grid-column: 1; grid-row: 1; }
.p3-lens:nth-child(2) { grid-column: 1; grid-row: 2; }
.p3-lens::after {
  content: ""; position: absolute; left: 38%; top: 30%; width: 14%; height: 14%; border-radius: 50%;
  background: rgba(220, 226, 245, .75); transform: translateX(calc(var(--g, 0) * -.9em));
}
.p3-flash { grid-column: 2; grid-row: 1; align-self: center; justify-self: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: #3A3D4C; box-shadow: inset 0 0 0 .2em #2A2D3B; }

/* ---------- экран ---------- */
.p3-screen { position: relative; height: 100%; border-radius: calc(var(--pr) - var(--bez)); overflow: hidden; background: #0F1120; color: var(--text); }
.p3-island { position: absolute; top: .95em; left: 50%; width: 8.8em; height: 2.5em; margin-left: -4.4em; border-radius: 1.25em; background: #000; pointer-events: none; }
.p3-island::after { content: ""; position: absolute; right: .85em; top: .7em; width: 1.1em; height: 1.1em; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #2A3150, #07080E 60%); }
.p3-status {
  position: absolute; top: 0; left: 0; right: 0; height: 4.2em; padding: 0 2.6em 0 3em;
  display: flex; align-items: center; justify-content: space-between; pointer-events: none; color: #EDEEF5;
}
.p3-screen[data-tone="light"] .p3-status { color: #0E0F1A; }
.p3-status b { font-size: 1.35em; font-weight: 600; letter-spacing: .01em; }
.p3-sig { display: flex; align-items: flex-end; gap: .18em; height: 1.05em; margin-left: auto; margin-right: .6em; }
.p3-sig i { width: .3em; border-radius: .1em; background: currentColor; }
.p3-sig i:nth-child(1) { height: 35%; } .p3-sig i:nth-child(2) { height: 55%; } .p3-sig i:nth-child(3) { height: 78%; } .p3-sig i:nth-child(4) { height: 100%; }
.p3-bat { position: relative; width: 2.3em; height: 1.1em; border: .12em solid currentColor; border-radius: .34em; opacity: .9; }
.p3-bat::before { content: ""; position: absolute; inset: .14em; right: 30%; border-radius: .14em; background: currentColor; }
.p3-bat::after { content: ""; position: absolute; right: -.32em; top: .26em; width: .14em; height: .38em; border-radius: 0 .1em .1em 0; background: currentColor; }

/* мягкий блик на стекле: без жёстких краёв, его сдвигает JS */
.p3-glare {
  position: absolute; top: -10%; bottom: -10%; left: -100%; width: 300%; pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) 36%, rgba(255, 255, 255, .055) 44%, rgba(255, 255, 255, .1) 49%, rgba(255, 255, 255, .04) 55%, rgba(255, 255, 255, 0) 63%);
}

/* ---------- слайды ---------- */
.p3-slide { position: absolute; inset: 0; display: flex; flex-direction: column; color: var(--text); font-size: 1em; }
.p3-case { padding-top: 4.2em; background: var(--bar, #0F1120); }
.p3-link { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.p3-link:hover { color: inherit; }
.p3-link:focus-visible { outline: .3em solid var(--mint); outline-offset: -.3em; border-radius: calc(var(--pr) - var(--bez)); }
.p3-link > img { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; background: var(--bar, #F1F5F4); }
.p3-link > img.p3-fit { object-fit: contain; object-position: top center; }
.p3-plate { flex: none; display: grid; gap: .35em; padding: 1.45em 1.9em 2.3em; background: #10121E; border-top: 1px solid #23263A; }
.p3-tag { font-family: var(--mono); font-size: 1.1em; line-height: 1.3; color: var(--muted); }
.p3-name { font-size: 2.2em; line-height: 1.08; font-weight: 700; letter-spacing: -.015em; }
.p3-more { font-family: var(--mono); font-size: 1.2em; color: var(--text); margin-top: .25em; }
.p3-u { text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; }
.p3-arr { display: inline-block; margin-left: .3em; text-decoration: none; transition: transform .25s var(--ease); }
.p3-link:hover .p3-arr, .p3-all:hover .p3-arr { transform: translateX(.25em); }

/* переписка с ботом: свой нейтральный вид чата, собрана вёрсткой */
.p3-chat { padding-top: 4.2em; background: #0E1019; }
.p3-chat-head { display: flex; align-items: center; gap: .9em; padding: .7em 1.5em 1em; border-bottom: 1px solid #1F2234; }
.p3-ava { display: grid; place-items: center; width: 3.3em; height: 3.3em; border-radius: 50%; background: #23263A; color: #EDEEF5; font: 700 1.05em/1 var(--mono); }
.p3-who { display: grid; line-height: 1.2; }
.p3-who b { font-size: 1.4em; font-weight: 600; }
.p3-who span { font-size: 1.1em; color: var(--muted); }
.p3-feed { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 1.2em 1.3em 2em; overflow: hidden; }
.p3-feed > * { margin-top: .7em; flex: none; }
.p3-feed > :nth-child(n+6) { overflow: hidden; }
.p3-msg { max-width: 84%; padding: .7em .95em .75em; border-radius: 1.25em; font-size: 1.27em; line-height: 1.33; }
.p3-in { align-self: flex-start; background: #1C1F31; border-bottom-left-radius: .4em; }
.p3-out { align-self: flex-end; background: #E9EBF4; color: #11131F; border-bottom-right-radius: .4em; }
.p3-keys { display: flex; flex-wrap: wrap; gap: .4em; max-width: 92%; }
.p3-keys span { padding: .5em .75em; border: 1px solid #34384F; border-radius: .8em; font-size: 1.1em; line-height: 1.2; color: #C8CBDD; }
/* плашка «Сегодня» и первые четыре реплики уже на месте, остальные доезжают снизу и поднимают ленту, как в живом чате
   (a/b — одна анимация под двумя именами, чтобы перезапускать её при каждом показе слайда) */
.p3-chat.is-run-a .p3-feed > :nth-child(n+6) { animation: p3-in-a .55s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.9s + (var(--i) - 4) * .75s); }
.p3-chat.is-run-b .p3-feed > :nth-child(n+6) { animation: p3-in-b .55s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.9s + (var(--i) - 4) * .75s); }
.p3-day { align-self: center; padding: .3em .9em; border-radius: 1em; background: #181B2B; color: var(--muted); font-size: 1.05em; line-height: 1.3; }
@keyframes p3-in-a {
  from { max-height: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateY(.9em); }
  45% { opacity: 0; }
  to { max-height: 9em; margin-top: .7em; opacity: 1; transform: none; }
}
@keyframes p3-in-b {
  from { max-height: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateY(.9em); }
  45% { opacity: 0; }
  to { max-height: 9em; margin-top: .7em; opacity: 1; transform: none; }
}

/* заказ */
.p3-order { justify-content: center; gap: 1em; padding: 5em 2.3em 2.6em; background: #0E1019; }
.p3-mark { font-family: var(--mono); font-size: 3.4em; line-height: 1; color: #5D6180; }
.p3-order .p3-name { font-size: 2.45em; }
.p3-q { list-style: none; counter-reset: q; margin: .3em 0 0; padding: 0; display: grid; border-top: 1px solid #23263A; }
.p3-q li { counter-increment: q; display: flex; gap: .9em; padding: .62em 0; border-bottom: 1px solid #23263A; font-size: 1.3em; line-height: 1.25; }
.p3-q li::before { content: counter(q); font-family: var(--mono); color: var(--mint); min-width: 1em; }
.p3-line { font-size: 1.25em; line-height: 1.4; color: var(--muted); }
.p3-btn { margin-top: .5em; min-height: 3.2em; font-size: 1.45em; padding: 0 1.2em; width: 100%; }

/* ---------- тень, подсказки ---------- */
.p3-shadow {
  position: absolute; left: 50%; top: calc(2.4em + var(--ph) + .2em); width: 25em; height: 3.4em; margin-left: -12.5em;
  border-radius: 50%; pointer-events: none; opacity: .9;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 55%, rgba(0, 0, 0, 0));
}
/* тихая подпись под телефоном; прячется после первого поворота рукой (класс is-hint-off ставит JS) */
.p3-hint {
  position: absolute; left: 0; right: 0; bottom: .3em; display: none; text-align: center; pointer-events: none;
  font-size: 12.5px; line-height: 1.3; color: var(--muted); transition: opacity .4s var(--ease);
}
.p3.is-3d:not(.is-still) .p3-hint { display: block; }
.p3.is-hint-off .p3-hint { opacity: 0; }

/* ---------- подпись и управление ---------- */
.p3-bar { display: grid; justify-items: center; gap: .2rem; width: 100%; max-width: 30rem; margin-top: .2rem; text-align: center; }
/* номер отдельной строкой; под текст всегда ровно две строки, чтобы ничего не прыгало между слайдами */
.p3-cap { display: grid; gap: .15rem; font-size: .92rem; line-height: 1.4; color: var(--muted); width: 100%; max-width: 36ch; }
.p3-num { font-family: var(--mono); font-size: .8rem; letter-spacing: .04em; color: var(--mint); }
.p3-title {
  color: var(--text); height: 2.8em; overflow: hidden; text-wrap: balance;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.p3-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 1.25rem; }
.p3-controls, .p3-dots { display: flex; align-items: center; gap: .1rem; }
.p3:not(.is-3d) .p3-controls { visibility: hidden; }
.p3-arrow, .p3-dot { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; color: var(--muted); font: 400 1.1rem/1 var(--mono); cursor: pointer; border-radius: 10px; transition: color .15s var(--ease), background-color .15s var(--ease); }
.p3-arrow:hover { color: var(--text); background: var(--surface-2); }
.p3-dot { width: 32px; }
.p3-dot::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: transform .25s var(--ease), background-color .15s var(--ease); }
.p3-dot:hover::before { background: var(--muted); }
.p3-dot[aria-current="true"]::before { background: var(--mint); transform: scaleX(2.4); }
.p3-all { font-size: .92rem; display: inline-flex; gap: .3em; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; }
.p3-all:hover { color: var(--mint); }
.p3-all .p3-arr { margin-left: 0; }
.p3-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .p3-stage { cursor: default; }
  .p3-chat .p3-feed > * { animation: none !important; }
}
