/* Оформление обеих страниц сайта (название — в настройках сборки).

   Оглавление
   1. Шрифты
   2. Цвета времени суток (их каждую минуту пересчитывает скрипт; здесь — дневные, они же вид без скрипта)
   3. Основа: страница, шапка, подвал
   4. Телефон: корпус и экран с небом, часами и волнами
   5. Текст: плашка, заголовок со сменным словом, строки
   6. Ползунок времени
   7. Кнопки
   8. Вторая страница
   9. Широкие экраны
   10. Движение и спокойный режим

   Часть суток задаёт атрибут data-part у <html>: morning, day, evening, night. */

/* 1. Шрифты лежат рядом с сайтом */
@font-face { font-family: "Fira Sans"; font-weight: 300; font-display: swap; src: url(fonts/fira-sans-cyrillic-300-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-weight: 300; font-display: swap; src: url(fonts/fira-sans-latin-300-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-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: "Fira Sans"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: "Fira Sans"; font-weight: 800; font-display: swap; src: url(fonts/fira-sans-cyrillic-800-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-weight: 800; font-display: swap; src: url(fonts/fira-sans-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }

/* 2. Цвета времени суток */
:root {
  --bg1: #f2f8ff; --bg2: #dcebff;                  /* страница: верх и низ */
  --s1: #38a0ff; --s2: #bfe6ff;                    /* небо на экране телефона */
  --w1: #7cc4ff; --w2: #55aef5; --w3: #3b96e6;     /* три волны внизу экрана */
  --accent: #1f6bff; --on: #ffffff;                /* главный цвет и текст на нём */
  --ink: #141a3a;                                  /* текст страницы */
  --glass: rgb(255 255 255 / .72); --edge: rgb(20 26 58 / .12);
  --stars: 0;
  --sun-x: 62%; --sun-y: 30%; --sun-o: 1;
  --moon-x: 50%; --moon-y: 130%; --moon-o: 0;
  --tx: 0; --ty: 0;                                /* наклон телефона за курсором */
  --wait: 3000ms;                                  /* отсчёт на второй странице */
}

/* 3. Основа */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
i { font-style: normal; }
svg { display: block; }

body {
  margin: 0;
  font: 500 17px/1.4 "Fira Sans", system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg2);
  -webkit-font-smoothing: antialiased;
}

.shell {
  position: relative; isolation: isolate;
  display: grid; grid-template-rows: auto 1fr auto;
  min-height: 100vh; min-height: 100svh;
  overflow-x: clip;
  background: linear-gradient(var(--bg1), var(--bg2));
  transition: opacity .28s;
}
/* мягкое цветное пятно в углу — того же цвета, что кнопка */
.shell::before {
  content: ''; position: absolute; top: -20vmax; right: -24vmax; z-index: -1;
  width: 70vmax; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent), transparent 72%);
  opacity: .17; pointer-events: none;
}

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 0; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.logo svg { width: 26px; height: 26px; }
.back { padding: 8px 0; font-size: 15px; color: inherit; text-decoration-thickness: 1.500px; text-underline-offset: 4px; }

/* на телефоне: слева плашка и заголовок, справа телефон, остальное — во всю ширину под ними */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; align-items: center; column-gap: 8px; padding: 2px 16px 12px; }
.text { display: contents; }
.lead { grid-row: 1; grid-column: 1; }
.line, .note, .dial, .ask, .links { grid-column: 1 / -1; }
.foot { padding: 6px 16px calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 12.500px; text-align: center; opacity: .72; }
.foot p { margin: 0; }
.foot .legal { max-width: 46em; margin: 4px auto 0; font-size: 11.500px; line-height: 1.4; }

/* 4. Телефон */
.device {
  --pw: clamp(96px, 30vw, 140px);           /* ширина телефона; от неё считаются все его детали */
  position: relative; grid-row: 1; grid-column: 2;
  padding: 8px 4px 8px 8px;
}

.phone {
  position: relative; flex: none;
  width: var(--pw); aspect-ratio: 9 / 18.600;
  border: calc(var(--pw) * .03) solid #262e60; border-radius: calc(var(--pw) * .16);
  background: #0f1330;
  box-shadow: 0 30px 60px -22px rgb(15 19 48 / .6), inset 0 0 0 2px rgb(255 255 255 / .07);
}


.screen { position: absolute; inset: calc(var(--pw) * .018); isolation: isolate; overflow: hidden; border-radius: calc(var(--pw) * .115); background: linear-gradient(var(--s1), var(--s2)); }
.island { position: absolute; top: 2.800%; left: 50%; z-index: 5; width: 29%; height: 3.900%; border-radius: 99px; background: #0b0e24; translate: -50% 0; }

.sky-stars {
  position: absolute; inset: 0; opacity: var(--stars);
  background:
    radial-gradient(1.400px 1.400px at 9% 9%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 22% 30%, #fff 50%, transparent 52%),
    radial-gradient(1.600px 1.600px at 34% 6%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 47% 40%, #ffe9b8 50%, transparent 52%),
    radial-gradient(1.400px 1.400px at 58% 12%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 69% 34%, #fff 50%, transparent 52%),
    radial-gradient(1.600px 1.600px at 81% 8%, #ffe9b8 50%, transparent 52%), radial-gradient(1px 1px at 91% 26%, #fff 50%, transparent 52%),
    radial-gradient(1.400px 1.400px at 15% 50%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 76% 52%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 40% 58%, #fff 50%, transparent 52%), radial-gradient(1.400px 1.400px at 88% 46%, #fff 50%, transparent 52%);
}

.orb { position: absolute; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; }
.orb--sun {
  top: var(--sun-y); left: var(--sun-x); width: 24%; opacity: var(--sun-o);
  background: #fff4b8;
  box-shadow: 0 0 0 calc(var(--pw) * .028) rgb(255 255 255 / .18), 0 0 calc(var(--pw) * .18) calc(var(--pw) * .04) #ffe27a;
}
.orb--moon {
  top: var(--moon-y); left: var(--moon-x); width: 19%; opacity: var(--moon-o);
  background: radial-gradient(circle at 34% 36%, #e9e1b9 0 12%, transparent 13%), radial-gradient(circle at 62% 64%, #e9e1b9 0 9%, transparent 10%), #fdf6d3;
  box-shadow: 0 0 calc(var(--pw) * .12) calc(var(--pw) * .01) rgb(253 246 211 / .5);
}

/* экран блокировки: приветствие и часы */
.lock { position: absolute; top: 11.500%; right: 0; left: 0; z-index: 3; color: #fff; text-align: center; text-shadow: 0 2px 12px rgb(10 16 54 / .4); }
.lock-greet { display: block; font-size: max(8.500px, calc(var(--pw) * .066)); letter-spacing: .04em; white-space: nowrap; }
.lock-time { display: block; font-weight: 300; font-size: calc(var(--pw) * .27); line-height: 1.02; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.waves { position: absolute; bottom: 0; left: -12%; z-index: 2; width: 124%; height: 36%; }

/* 5. Текст */
.offer { display: inline-block; margin: 0 0 9px; padding: 5px 13px 6px; border-radius: 99px; background: var(--accent); color: var(--on); font-weight: 800; font-size: 14.500px; line-height: 1.2; }

.title { margin: 0; font-weight: 800; font-size: clamp(24px, 7.400vw, 40px); line-height: 1.08; letter-spacing: -.02em; }
.hot { color: var(--accent); }

/* четыре варианта слова лежат друг на друге; виден тот, что совпадает с частью суток */
.slot { display: inline-grid; color: var(--accent); }
.line { display: grid; margin: 8px 0 0; font-size: clamp(16px, 4.600vw, 19px); }
.slot-item, .line-item {
  grid-area: 1 / 1;
  opacity: 0; visibility: hidden; translate: 0 .35em;
  transition: opacity .3s, translate .45s cubic-bezier(.2, .9, .3, 1), visibility 0s .3s;
}
.slot-item { white-space: nowrap; }
:root[data-part='morning'] [data-part='morning'],
:root[data-part='day'] [data-part='day'],
:root[data-part='evening'] [data-part='evening'],
:root[data-part='night'] [data-part='night'] {
  opacity: 1; visibility: visible; translate: 0 0;
  transition-delay: .12s, .12s, 0s;
}

.note { margin: 6px 0 0; font-size: 15.500px; opacity: .84; }

/* 6. Ползунок времени */
.dial { display: none; margin-top: 14px; padding: 9px 13px 8px; border: 1px solid var(--edge); border-radius: 17px; background: var(--glass); }
.js .dial { display: block; }
.dial-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 14px; }
.dial-now { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--accent); }
.dial-range {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 30px; margin: 2px 0 0; padding: 0;
  background: transparent; cursor: pointer;
}
/* дорожка раскрашена как сутки: ночь — рассвет — день — закат — ночь */
.dial-range::-webkit-slider-runnable-track { height: 10px; border-radius: 99px; background: linear-gradient(90deg, #1b2260 0 17%, #ffab85 27%, #55aef5 46% 68%, #b85fc4 81%, #1b2260 93%); }
.dial-range::-moz-range-track { height: 10px; border-radius: 99px; background: linear-gradient(90deg, #1b2260 0 17%, #ffab85 27%, #55aef5 46% 68%, #b85fc4 81%, #1b2260 93%); }
.dial-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -9px;
  border: 4px solid var(--accent); border-radius: 50%; background: #fff;
  box-shadow: 0 4px 8px -2px rgb(10 16 54 / .45);
}
.dial-range::-moz-range-thumb { width: 20px; height: 20px; border: 4px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 4px 8px -2px rgb(10 16 54 / .45); }
.dial-range:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 99px; }
.dial-marks { display: flex; justify-content: space-between; margin: -2px 2px 0; font-size: 11.500px; font-variant-numeric: tabular-nums; opacity: .7; }

/* 7. Кнопки */
.ask { margin: 14px 0 8px; font-weight: 800; font-size: 15.500px; }
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.go {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 9px;
  justify-content: center;
  padding: 15px 12px 16px;
  border-radius: 17px;
  background: var(--accent); color: var(--on);
  box-shadow: 0 16px 22px -15px var(--accent), inset 0 -3px 0 rgb(0 0 0 / .15);
  text-decoration: none;
  transition: translate .2s; -webkit-tap-highlight-color: transparent;
}
/* вторая кнопка — цвета текста: днём тёмная, ночью светлая */
.go--tg { background: var(--ink); color: var(--bg1); box-shadow: 0 16px 22px -15px var(--ink), inset 0 -3px 0 rgb(0 0 0 / .22); }
.go-icon { position: relative; flex: none; }
.go-icon svg { width: 25px; height: 25px; }
.go-text { position: relative; display: grid; gap: 1px; line-height: 1.1; min-width: 0; }
.go-text b { font-weight: 800; font-size: clamp(16px, 4.700vw, 20px); }
.go-text small { font-size: 12.500px; opacity: .86; }
/* заливка-отсчёт (работает на второй странице) */
.go-fill { position: absolute; inset: 0; background: rgb(255 255 255 / .3); transform-origin: 0 50%; transform: scaleX(0); }
@media (hover: hover) {
  .go:hover { translate: 0 -2px; }
}
.go:active { translate: 0 1px; }
.go:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* 8. Вторая страница
   body[data-to="vk|tg"] — какую кнопку нажали; body[data-run] — идёт отсчёт до перехода */
.say { display: none; grid-area: 1 / 1; }
body:not([data-to]) .say[data-when='none'],
body[data-to='vk']:not([data-run]) .say[data-when='vk'],
body[data-to='vk'][data-run] .say[data-when='vk-run'],
body[data-to='tg']:not([data-run]) .say[data-when='tg'],
body[data-to='tg'][data-run] .say[data-when='tg-run'] { display: block; }
body[data-page='next'] .links { margin-top: 14px; }
/* нажатая кнопка стоит первой */
body[data-to='tg'] .go--tg { order: -1; }

/* низкие телефоны: без строки-пояснения, телефон поменьше — кнопки должны быть видны сразу */
@media (max-width: 599px) and (max-height: 700px) {
  .device { --pw: clamp(88px, 27vw, 110px); }
  .note { display: none; }
  .dial { margin-top: 10px; }
  .ask { margin-top: 10px; }
}

/* планшеты в портретном положении: телефон и заголовок крупнее */
@media (min-width: 600px) and (max-width: 899px) {
  .hero { column-gap: 30px; padding: 10px 32px 16px; }
  .device { --pw: 190px; padding: 16px 20px 12px 20px; }
  .title { font-size: 50px; }
  .line { font-size: 21px; }
  .dial, .links { max-width: 520px; }
}

/* 9. Широкие экраны: текст слева, телефон справа целиком */
@media (min-width: 900px) {
  .bar { padding: 20px 40px 0; }
  .logo { font-size: 22px; }
  .logo svg { width: 30px; height: 30px; }
  .hero {
    grid-template-columns: minmax(0, 1fr) auto; align-content: center; align-items: center; gap: 30px;
    width: 100%; max-width: 1160px; margin: 0 auto; padding: 10px 40px 20px;
  }
  .text { display: block; grid-row: 1; grid-column: 1; max-width: 560px; }
  .offer { margin-bottom: 14px; font-size: 16px; }
  .title { font-size: clamp(44px, 4.700vw, 66px); }
  .line { margin-top: 14px; font-size: 21px; }
  .note { margin-top: 8px; font-size: 17px; }
  .dial { max-width: 480px; margin-top: 22px; }
  .ask { margin-top: 20px; font-size: 17px; }
  .links { max-width: 480px; gap: 12px; }
  .go { padding: 16px 18px 17px; border-radius: 19px; }
  .go-icon svg { width: 30px; height: 30px; }
  .go-text b { font-size: 22px; }
  .go-text small { font-size: 14px; }

  .device { --pw: clamp(230px, 21vw, 300px); padding: 24px 50px 20px 50px; perspective: 1100px; }
  .phone { rotate: 4deg; transform: rotateY(calc(var(--tx) * 1deg)) rotateX(calc(var(--ty) * 1deg)); }
  .foot { font-size: 13px; }
  .foot .legal { font-size: 12px; }
}
/* невысокие экраны ноутбуков: плотнее */
@media (min-width: 900px) and (max-height: 800px) {
  .device { --pw: clamp(200px, 27vh, 260px); padding-top: 16px; }
  .title { font-size: clamp(40px, 4.200vw, 56px); }
  .dial { margin-top: 16px; }
  .ask { margin-top: 14px; }
}
/* большие мониторы: крупнее */
@media (min-width: 1500px) and (min-height: 900px) {
  .hero { max-width: 1360px; gap: 60px; }
  .text { max-width: 660px; }
  .title { font-size: 80px; }
  .line { font-size: 25px; }
  .note { font-size: 19px; }
  .dial, .links { max-width: 560px; }
  .go-text b { font-size: 25px; }
  .device { --pw: 340px; }
}

/* 10. Движение и спокойный режим */
@keyframes twinkle { 50% { opacity: calc(var(--stars) * .55); } }
@keyframes swell { from { transform: translateX(-3%); } to { transform: translateX(3%); } }
@keyframes come { from { opacity: 0; translate: 0 14px; } }
@keyframes bob { from { translate: 0 0; } to { translate: 0 -8px; } }
@keyframes fill { to { transform: scaleX(1); } }

.sky-stars { animation: twinkle 3.400s ease-in-out infinite; }
.waves path { animation: swell 7s ease-in-out infinite alternate; }
.waves path:nth-child(2) { animation-duration: 9s; animation-direction: alternate-reverse; }
.waves path:nth-child(3) { animation-duration: 11s; }
.text > * { animation: come .55s cubic-bezier(.2, .8, .3, 1) backwards; }
.text > :nth-child(2) { animation-delay: .05s; }
.text > :nth-child(3) { animation-delay: .09s; }
.text > :nth-child(4) { animation-delay: .13s; }
.text > :nth-child(5) { animation-delay: .17s; }
.device { animation: come .6s cubic-bezier(.2, .8, .3, 1) backwards; }
@media (min-width: 900px) {
  .phone { animation: bob 3.600s ease-in-out infinite alternate; }
}
body[data-run][data-to='vk'] .go--vk .go-fill,
body[data-run][data-to='tg'] .go--tg .go-fill { animation: fill var(--wait) linear both; }

/* уход на вторую страницу */
.is-leaving .shell { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .sky-stars, .waves path, .text > *, .device, .phone { animation: none; }
  .slot-item, .line-item, .shell, .go { transition: none; }
}
