/* creative.bognat.ru: film in steps. Layout modes:
   html.js       story: full-screen stage, one clip per scroll tick, copy blocks driven by js/main.js
   html.no-js    plain page: copy, form and footer one after another
   portrait      (max-aspect-ratio: 1/1): the clip is cropped around the mascot, copy goes under it */

@property --skin-a { syntax: '<color>'; inherits: true; initial-value: #e198ce; }
@property --skin-b { syntax: '<color>'; inherits: true; initial-value: #7c93f5; }

:root {
  --pink: #e198ce;
  --blue: #7c93f5;
  --indigo: #3c3e8e;
  --muted: rgba(255, 255, 255, .62);
  --line: rgba(255, 255, 255, .18);
  --gut: clamp(16px, 5vw, 96px);
  --header-h: 72px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --skin-a: var(--pink);
  --skin-b: var(--blue);
  transition: --skin-a 1.2s var(--ease), --skin-b 1.2s var(--ease);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: #000; }
html.locked { overflow: hidden; overscroll-behavior: none; } /* the story moves in steps, the page never scrolls */
.js .stage { touch-action: pinch-zoom; } /* swipes are steps, not pans; no pull-to-refresh */
.js .contact { touch-action: pan-y pinch-zoom; }
body {
  color: #fff;
  font: 400 16px/1.45 "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--skin-a); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Buttons (style.html) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .95rem 1.75rem; border: 0; border-radius: 50rem;
  font: 500 1rem/1 "Inter Tight", system-ui, sans-serif; color: #fff; text-decoration: none;
  cursor: pointer; transition: background-color .2s, box-shadow .2s, opacity .2s, filter .2s;
}
.btn--pink { background: linear-gradient(90deg, var(--pink), var(--blue)); } /* brand gradient, as on the phone digits */
.btn--pink:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px #fff; background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .6; cursor: progress; }

/* ---------- Start screen ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: grid; place-items: center;
  transition: opacity .9s cubic-bezier(.3, 0, .2, 1), visibility 0s .9s;
}
.preloader.out { opacity: 0; visibility: hidden; }
.no-js .preloader { display: none; }
.preloader__mark {
  position: relative; width: 52px; height: 52px; display: grid; place-items: center;
  opacity: 0; animation: preloader-in .5s ease .1s forwards;
}
.preloader__mark::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .1); border-top-color: var(--pink); border-right-color: var(--blue);
  animation: preloader-spin 1.1s linear infinite;
}
.preloader__mark svg { animation: preloader-breathe 1.8s ease-in-out infinite; }
@keyframes preloader-in { to { opacity: 1; } }
@keyframes preloader-spin { to { transform: rotate(1turn); } }
@keyframes preloader-breathe { 50% { opacity: .35; } }

/* ---------- Header ---------- */
.top {
  position: fixed; z-index: 20; inset: 0 0 auto; height: var(--header-h);
  display: flex; align-items: center; gap: 2rem; padding: 0 var(--gut);
  padding-top: env(safe-area-inset-top);
}
.top__logo img { display: block; height: 26px; width: auto; }
.phone-accent {
  font-weight: 600;
  background: linear-gradient(90deg, var(--pink), var(--blue)); 
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top__cta { margin-left: auto; padding: .7rem 1.25rem; }

/* ---------- Stage ---------- */
.track { position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

.media { position: absolute; inset: 0; }
.media > video, .media > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; /* fill the screen: the mascot runs off the frame edge in close-ups, so a letterbox would cut him visibly */
  opacity: 0;
}
.media > .on, .media > .near { opacity: 1; }
.media > .clip.on { z-index: 1; } /* the active clip covers its neighbours */
/* Loops appear at once (their first frame is the frame already on screen); the idle pose fades out
   when the story starts, the lying pose leaves at once when the story moves back */
.media > .idle { transition: opacity .35s ease; z-index: 2; }
.media > .idle.on, .media > .idle-end:not(.on) { transition: none; }
/* Very wide screens: cover would crop the full-height poses, so fit the frame instead */
@media (min-aspect-ratio: 2/1) { .media > video, .media > img { object-fit: contain; } }

.media > .intro { z-index: 3; }
.media > .still { z-index: 0; }
.js .media__poster { display: none; }
.js .media.poster-fallback .media__poster { display: block; opacity: 1; z-index: 1; }

/* Copy blocks: opacity and slide are written by main.js from the story position */
.copy {
  position: absolute; z-index: 5; top: 50%;
  width: min(36rem, 34vw);
  opacity: 0; transform: translateY(-50%);
  pointer-events: none; will-change: opacity, transform;
}
.copy--left { left: var(--gut); }
.copy--right { right: var(--gut); }
.copy--low { top: auto; bottom: 14svh; width: min(32rem, 32vw); transform: none; }
.copy.copy--low h2 { font-size: clamp(1.375rem, 2vw, 2.25rem); text-shadow: 0 2px 24px rgba(0, 0, 0, .6); }
.copy h1, .copy h2 {
  font-size: clamp(2rem, 3.9vw, 4.25rem); line-height: 1.02; font-weight: 700; letter-spacing: -.03em;
  text-wrap: balance;
}
.copy em, .contact h2 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--skin-a), var(--skin-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.copy__next { margin-top: 2rem; padding: .7rem 1.25rem; pointer-events: auto; } /* copy blocks ignore the mouse, the button does not */
.no-js .copy__next { display: none; }
.copy__call { display: none; margin-top: 2.25rem; padding: .7rem 1.25rem; pointer-events: auto; } /* phones only, see the portrait block */
.copy__call .phone-accent { background-image: linear-gradient(90deg, var(--skin-a), var(--skin-b)); } /* follows the chameleon's skin, like the copy accents */
.copy__lead { margin-top: 1.25rem; white-space: nowrap; font-size: clamp(1.125rem, 1.7vw, 1.625rem); color: var(--muted); }
/* The hero fills the empty left half up to the mascot (he stands at 67-90% of the width) */
.copy--hero { width: min(58rem, 52vw); }
.copy--hero h1 { font-size: clamp(2.5rem, 5.6vw, 6.5rem); }

/* Progress rail */
.rail {
  position: absolute; z-index: 6; left: 50%; bottom: max(3.5svh, 20px); transform: translateX(-50%);
  opacity: 0; transition: opacity .6s ease;
}
.rail.on { opacity: 1; transition: opacity 1.2s cubic-bezier(.45, 0, .25, 1) 1.4s; } /* after the hero copy has come in */
.rail__steps { display: flex; gap: 6px; }
.rail__steps i { width: 18px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .22); transition: background-color .4s, width .4s var(--ease); }
.rail__steps i.done { background: rgba(255, 255, 255, .55); }
.rail__steps i.now { width: 36px; background: linear-gradient(90deg, var(--skin-a), var(--skin-b)); }

/* Loader: under the intro, gone once the story is ready */
.loader {
  position: absolute; z-index: 7; left: 50%; bottom: max(4svh, 24px); transform: translateX(-50%);
  display: grid; justify-items: center; gap: .6rem;
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  transition: opacity .5s ease;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader__bar { display: block; width: 160px; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.loader__bar > span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--pink), var(--blue)); transition: transform .3s ease; }

/* ---------- Contact form (frame 9, right side) ---------- */
/* The last stop: form on the right, FAQ on the left, one block centred as a whole so their tops line up */
.final {
  position: absolute; z-index: 8; left: var(--gut); right: var(--gut); top: 50%;
  display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: flex-start; gap: 2rem;
  opacity: 0; transform: translateY(-50%);
}
.contact { width: min(30rem, 38vw); max-height: calc(100svh - var(--header-h) - 5rem); overflow-y: auto; }
.contact h2 { font-size: clamp(1.875rem, 3vw, 3rem); line-height: 1.04; font-weight: 700; letter-spacing: -.03em; }
.contact__lead { margin: .75rem 0 1.5rem; color: var(--muted); }
.form { display: grid; gap: .75rem; }
.form input[type=text], .form input[type=tel], .form textarea {
  width: 100%; padding: .95rem 1.25rem; border-radius: 1.5rem;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
  color: #fff; font: inherit; outline: none; transition: border-color .2s, background-color .2s;
}
.form textarea { resize: none; min-height: 5.5rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form ::placeholder { color: rgba(255, 255, 255, .45); }
.form input:focus-visible, .form textarea:focus-visible { border-color: var(--blue); background: rgba(255, 255, 255, .09); outline: none; }
.form [aria-invalid=true] { border-color: #ff8a8a; }
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__agree { display: flex; gap: .65rem; align-items: flex-start; font-size: .8125rem; line-height: 1.4; color: var(--muted); cursor: pointer; }
.form__agree input {
  flex: none; width: 20px; height: 20px; margin: 0; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 6px;
  background: rgba(255, 255, 255, .06) center / 12px no-repeat;
  transition: border-color .2s, background-color .2s;
}
.form__agree input:hover { border-color: rgba(255, 255, 255, .7); }
.form__agree input:checked {
  border-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), linear-gradient(135deg, var(--pink), var(--blue));
  background-size: 12px, cover;
}
.form__agree input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.form__agree input[aria-invalid=true] { border-color: #ff8a8a; }
.form__agree a { color: #fff; text-decoration: none; }
.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .25rem; }
.form__call { white-space: nowrap; }
.form__msg { min-height: 1.4em; font-size: .875rem; color: #ff8a8a; }
.form__msg:empty { min-height: 0; }
.contact__thanks { display: none; padding: 1.5rem; border-radius: 1.5rem; background: rgba(124, 147, 245, .14); border: 1px solid var(--blue); outline: none; }
.contact__thanks-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .35rem; }
.contact.sent .form, .popup.sent .form { display: none; }
.contact.sent .contact__thanks, .popup.sent .contact__thanks { display: block; }

/* ---------- Popup form ---------- */
.popup {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 16px;
  border: 0; background: transparent; color: #fff; overflow: auto;
}
.popup[open] { display: grid; place-items: center; }
.popup::backdrop { background: rgba(0, 0, 0, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.popup__card {
  position: relative; width: min(940px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  background: #0c0c0f; border: 1px solid rgba(255, 255, 255, .1); border-radius: 28px; overflow: hidden;
  animation: popup-in .5s var(--ease);
}
@keyframes popup-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
/* The window is pure black like the clip, and the clip fills it edge to edge (at least square) */
.popup__window { position: relative; width: 100%; align-self: stretch; aspect-ratio: 1; background: #000; }
.popup__mascot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
/* sqmascot.png stands in the window; it gives way to the clip once the clip has shown its first frame (the same pose) */
video.popup__mascot { opacity: 0; } /* hidden under the transparent still until the jump */
.popup.jumped video.popup__mascot { opacity: 1; }
.popup.jumped .popup__still { opacity: 0; }
.popup__body { padding: clamp(28px, 4vw, 48px); align-self: center; }
.popup__body h2 { font-size: clamp(1.5rem, 2.3vw, 2.125rem); line-height: 1.04; font-weight: 700; letter-spacing: -.03em; white-space: nowrap; }
.popup__close {
  position: absolute; z-index: 2; top: 14px; right: 14px; width: 40px; height: 40px;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: #fff; transition: background-color .2s;
}
.popup__close:hover { background: rgba(255, 255, 255, .16); }
@media (max-width: 720px) {
  .popup { padding: 12px; }
  .popup[open] { place-items: start center; }
  .popup__card { grid-template-columns: 1fr; border-radius: 24px; }
  /* On top of the form: a wide strip, the clip fitted to its height so top and bottom stay the window's edges */
  .popup__window { aspect-ratio: auto; height: min(30svh, 260px); }
  .popup__mascot { object-fit: contain; }
  .popup__body { padding: 24px 20px 28px; }
}

.foot {
  position: absolute; z-index: 8; left: var(--gut); right: var(--gut); bottom: max(2.5svh, 16px);
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem 1.5rem;
  font-size: .8125rem; color: rgba(255, 255, 255, .5); opacity: 0;
}
.foot__links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.foot a { text-decoration: none; transition: color .2s; }
.foot a:hover { color: #fff; }
.js .final[inert], .js .foot[inert] { pointer-events: none; }

/* ---------- FAQ (last stop, left, above the lying mascot) ---------- */
.faq { width: min(30rem, 34vw); }
.faq h2 { font-size: clamp(1.875rem, 3vw, 3rem); line-height: 1.04; font-weight: 700; letter-spacing: -.03em; margin-bottom: 1.25rem; }
.faq h3 { margin: 0; font: inherit; }
.faq__item { border-top: 1px solid var(--line); }
.faq__item:last-child { border-bottom: 1px solid var(--line); }
.faq__q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .95rem 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: 500 clamp(1rem, 1.15vw, 1.125rem)/1.3 "Inter Tight", system-ui, sans-serif; color: #fff;
}
.faq__icon { position: relative; flex: none; width: 14px; height: 14px; transition: transform .45s var(--ease); }
.faq__icon::before, .faq__icon::after { content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; border-radius: 1px; background: currentColor; }
.faq__icon::after { transform: rotate(90deg); }
.faq__item.open .faq__icon { transform: rotate(45deg); color: var(--skin-a); }
/* Height animates through a 0fr -> 1fr grid row: smooth both ways, nothing outside the FAQ moves */
.faq__a {
  display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden;
  transition: grid-template-rows .45s var(--ease), opacity .3s ease, visibility 0s .45s;
}
.faq__a > div { overflow: hidden; }
.faq__a p { padding-bottom: 1rem; font-size: .9375rem; line-height: 1.5; color: var(--muted); }
.faq__item.open .faq__a { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition-delay: 0s; }

/* ---------- Portrait: phones and portrait tablets ---------- */
@media (max-aspect-ratio: 1/1) {
  :root { --header-h: 60px; --gut: 20px; }
  .top { gap: 1rem; }
  .top__logo img { height: 20px; }
  .top__cta { margin-left: auto; padding: .6rem 1rem; font-size: .875rem; }

  /* A 16:9 clip much wider than the screen; main.js pans it to keep the mascot centred */
  /* At the bottom of the screen: the clip's lower edge (where the mascot is cut in close-ups) is the screen edge */
  .js .media {
    inset: auto; bottom: 0; left: 0;
    width: min(160vw, 92svh); aspect-ratio: 16 / 9;
    will-change: transform;
  }

  .copy, .copy--low { top: calc(var(--header-h) + 4svh); bottom: auto; left: var(--gut); right: var(--gut); width: auto; transform: none; }
  .copy h1, .copy h2, .copy.copy--low h2 { font-size: clamp(1.75rem, 8vw, 2.75rem); }
  .copy__lead { margin-top: .75rem; font-size: 1rem; white-space: normal; }
  .js .copy__call { display: inline-flex; } /* the phone under every story slide: the screen is otherwise empty there */

  /* A bottom sheet: the form, then the FAQ under it */
  .final {
    top: auto; left: 0; right: 0; bottom: 0; transform: none;
    flex-direction: column; gap: 2.5rem;
    max-height: calc(100svh - var(--header-h)); overflow-y: auto;
    padding: 3rem var(--gut) 5.5rem;
    background: linear-gradient(transparent, #000 3rem);
  }
  .contact, .faq { width: auto; max-height: none; overflow: visible; }
  .contact__lead { margin-bottom: 1rem; }
  .form__actions .btn { flex: 1 1 100%; }
  /* The footer sits over the scrolling sheet: a black fade under it keeps the text readable */
  .foot { left: 0; right: 0; bottom: 0; padding: 1.5rem var(--gut) 12px; background: linear-gradient(transparent, #000 55%); font-size: .75rem; gap: .25rem 1rem; justify-content: flex-start; }
  .foot__links { gap: .25rem 1rem; }
  .foot__links a[href^="mailto"], .foot__links a[href^="https://bognat"] { display: none; }
}

/* ---------- No JS: a plain page with the same copy and a working form ---------- */
.no-js .stage { position: static; height: auto; overflow: visible; padding: calc(var(--header-h) + 2rem) var(--gut) 2rem; }
.no-js .media { position: relative; inset: auto; aspect-ratio: 16 / 9; max-width: 1200px; margin: 0 auto 2rem; }
.no-js .media__poster { opacity: 1; }
.no-js .final { position: static; display: block; opacity: 1; transform: none; }
.no-js .faq { margin: 0 auto 4rem; max-width: 44rem; width: auto; }
.no-js .faq__a { grid-template-rows: 1fr; opacity: 1; visibility: visible; }
.no-js .faq__icon { display: none; }
.no-js .copy, .no-js .contact, .no-js .foot { position: static; width: auto; max-width: 44rem; margin: 0 auto 4rem; opacity: 1; transform: none; max-height: none; padding: 0; background: none; }
.no-js .foot { max-width: none; margin: 4rem 0 0; }
.no-js .rail, .no-js .loader { display: none; }

/* Hero copy comes in softly after the intro: the heading, then the line under it */
.js .copy--hero > * { opacity: 0; transform: translateY(18px); transition: opacity 1.4s cubic-bezier(.45, 0, .25, 1), transform 1.6s var(--ease); }
.js .copy--hero > .copy__lead { transition-delay: .45s; }
/* "Расскажи" waits for the end of the intro (the idle pose), when the story can actually move */
.js .copy--hero > .copy__next { opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .8s var(--ease), transform .8s var(--ease), visibility 0s .8s; }
.story-ready .copy--hero > .copy__next { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.hero-in .copy--hero > * { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .js .copy--hero > * { transition: none; }
  .preloader__mark::before, .preloader__mark svg { animation: none; }
}
