/* Вход: что такое Via Lactea вообще, и дверь, которая открывается словами «Milky Way».
   gate-boot.js ставит .gated на <html> до разметки; без JS входа нет и лендинг виден сразу.
   Палитра, шрифты, .hero-title, .section-head, .facts, .care-list, .band — из styles.css. */

.gate, .door { display: none; }
/* Вход — свой прокручиваемый слой поверх лендинга. Лендинг под ним свёрстан и стоит в начале, но невидим:
   когда дверь открывается, странице не нужно прыгать с конца входа наверх (прыжок под фиксированной
   дверью давал кадр, где створки съезжали), а картинка hero уже загружена. */
.gated, .gated body { overflow: hidden; }
.gated .gate {
  display: block; position: fixed; inset: 0; z-index: 5;
  overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
}
.gated .top, .gated main, .gated .foot, .gated .skip { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .gated .gate { scroll-behavior: auto; } }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.gate > section { position: relative; padding-block: var(--section-y); }

/* ---------- Первый экран: имя и полоса неба ---------- */
.gate > .gate-first {
  display: grid; align-items: center; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  padding-block: calc(env(safe-area-inset-top, 0px) + 4rem) 7.5rem;
}
.gate-sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.gate-sky::before, .gate-sky::after {
  content: ""; position: absolute; left: 50%; top: 56%; width: 190vmax;
  translate: -50% -50%; rotate: -24deg; border-radius: 50%;
}
.gate-sky::before { /* сама полоса */
  height: 34vmax;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--ice) 26%, transparent),
    color-mix(in srgb, var(--cobalt) 18%, transparent) 42%,
    color-mix(in srgb, var(--royal) 7%, transparent) 70%, transparent);
  filter: blur(6px);
}
.gate-sky::after { /* пылевая прожилка посередине */
  height: 4.5vmax; top: 57.5%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--space) 75%, transparent), transparent);
  filter: blur(10px);
}
@media (orientation: portrait) {
  .gate-sky::before, .gate-sky::after { rotate: -58deg; top: 60%; }
  .gate-sky::after { top: 61.5%; }
}
.gate-first .hero-inner { gap: 1rem; }
.gate-latin { font-size: var(--step-1); font-weight: 300; color: var(--text-soft); max-width: 26rem; line-height: 1.45; }

/* ---------- Текст разделов ---------- */
.gate-prose { display: grid; gap: 1.2rem; max-width: 40rem; }
.gate-prose p { color: var(--text-soft); }
.gate-prose i { color: var(--star); }

.gate-names { margin-top: .4rem; }
.gate-names .glyph {
  display: block; margin-bottom: .2rem;
  font-size: var(--step-2); font-weight: 300; line-height: 1.2; color: var(--star);
  text-shadow: 0 0 24px var(--glow);
}

/* ---------- «Lost to the light»: строки загораются по одной ---------- */
.gate-lines {
  display: grid; gap: .35em; max-width: 52rem;
  font-family: var(--font-display); font-size: var(--step-manifesto); font-weight: 250; line-height: 1.3;
}
.gate-lines span { transition: opacity 1.4s var(--ease), color 1.4s var(--ease), text-shadow 1.4s; }
.js:not(.reduced) .gate-lines span { opacity: .4; }
.js:not(.reduced) .gate-lost.is-lit .gate-lines span { opacity: 1; }
.gate-lost.is-lit .gate-lines span:nth-child(2) { transition-delay: .5s; }
.gate-lost.is-lit .gate-lines span:nth-child(3) { transition-delay: 1s; }
.gate-lines span:last-child { color: var(--ice); }
.gate-lost.is-lit .gate-lines span:last-child { transition-delay: 1.5s; text-shadow: 0 0 30px var(--glow); }
.gate-source { margin-top: 1.6rem; font-size: var(--step--1); color: var(--text-faint); max-width: 40rem; }
.gate-source a { text-decoration-color: color-mix(in srgb, var(--ice) 40%, transparent); text-underline-offset: .2em; }

/* ---------- Say it: арка двери и поле ---------- */
.gate > .gate-say { padding-block: calc(var(--section-y) * .6) calc(var(--section-y) * .7 + env(safe-area-inset-bottom, 0px)); }
.say-door {
  position: relative; display: grid; justify-items: center; align-content: end;
  width: min(100%, 23.5rem); aspect-ratio: 300 / 420; margin-inline: auto;
  padding: 0 1.1rem 2.4rem;
}
.say-arch { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.arch-fill { fill: url(#arch-glow); }
/* Цвета градиента — здесь, а не атрибутом style в разметке: CSP сайта (style-src 'self') не пускает инлайновые стили. */
#arch-glow .glow-a { stop-color: var(--royal); stop-opacity: .32; }
#arch-glow .glow-b { stop-color: var(--midnight); stop-opacity: .45; }
#arch-glow .glow-c { stop-color: var(--space); stop-opacity: .2; }
.arch-line {
  fill: none; stroke: var(--ice); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0 2;
  opacity: .75; transition: stroke 1s var(--ease), opacity 1s, filter 1s;
}
.arch-key { fill: var(--star); filter: drop-shadow(0 0 5px var(--cobalt)); }
.say-door::after { /* свет из-под двери */
  content: ""; position: absolute; left: 7%; right: 7%; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--ice) 30%, var(--star) 50%, var(--ice) 70%, transparent);
  box-shadow: 0 0 26px 5px var(--glow);
  animation: breathe 5s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .55; } }

.say-inner { position: relative; z-index: 1; display: grid; justify-items: center; gap: 1.1rem; width: 100%; text-align: center; }
.say-inner h2 {
  font-family: var(--font-display); font-size: var(--step-3); font-weight: 250; line-height: 1.05;
  text-shadow: 0 0 40px color-mix(in srgb, var(--cobalt) 50%, transparent);
}
.say-form {
  display: flex; align-items: center; gap: .4rem;
  width: 100%; max-width: 18.5rem; padding: .3rem .3rem .3rem 1.2rem;
  background: color-mix(in srgb, var(--space) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--ice) 40%, transparent); border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .4s, box-shadow .6s var(--ease);
}
.say-form:focus-within { border-color: var(--ice); box-shadow: 0 0 36px -6px var(--glow); }
.say-form input {
  flex: 1; min-width: 0; padding: .7rem 0;
  /* 18 px: меньше 16 px iOS увеличивает страницу при фокусе */
  font: 400 1.125rem/1.2 var(--font-text); letter-spacing: .04em; color: var(--star);
  background: none; border: 0; border-radius: 0; outline: 0; -webkit-appearance: none; appearance: none;
}
.say-form input::placeholder { color: var(--text-faint); opacity: 1; }
.say-btn {
  display: grid; place-items: center; flex: none;
  width: 2.9rem; height: 2.9rem; padding: 0; cursor: pointer;
  color: var(--star); background: var(--royal);
  border: 1px solid color-mix(in srgb, var(--ice) 40%, transparent); border-radius: 50%;
  transition: background .4s, box-shadow .6s var(--ease), transform .4s var(--ease);
}
.say-btn .icon { width: 1.35rem; height: 1.35rem; }
.say-btn:hover { background: color-mix(in srgb, var(--royal) 80%, var(--cobalt)); box-shadow: 0 0 30px -4px var(--glow); }
.say-btn:active { transform: scale(.96); }
.say-hint { min-height: 1.6em; font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }

.say-form.is-wrong { animation: nope .45s var(--ease); border-color: color-mix(in srgb, var(--violet) 70%, transparent); }
@keyframes nope { 20% { translate: -7px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 2px 0; } }

.is-said .arch-line { stroke: var(--star); opacity: 1; stroke-dasharray: none; filter: drop-shadow(0 0 6px var(--cobalt)); }
.is-said .say-door::after { animation: none; opacity: 1; box-shadow: 0 0 60px 14px var(--glow); }

/* ---------- Дверь: две створки на весь экран, за ними лендинг ---------- */
.door { position: fixed; inset: 0; z-index: 60; perspective: 1400px; pointer-events: none; overflow: hidden; }
.door.is-on { display: block; }
.leaf {
  position: absolute; top: 0; bottom: 0; width: 50.2%; opacity: 0;
  background:
    radial-gradient(ellipse 120% 50% at 50% 100%, color-mix(in srgb, var(--royal) 22%, transparent), transparent 70%),
    linear-gradient(var(--midnight), var(--space));
  backface-visibility: hidden;
  transition: opacity .55s var(--ease), transform 1.8s cubic-bezier(.65, 0, .25, 1);
}
.leaf-l { left: 0; transform-origin: left center; }
.leaf-r { right: 0; transform-origin: right center; }
.leaf::before { /* филёнка: половина арки из точек */
  content: ""; position: absolute; top: 10%; bottom: 7%;
  border: 1px dotted color-mix(in srgb, var(--ice) 34%, transparent);
}
.leaf-l::before { left: 16%; right: 7%; border-right: 0; border-top-left-radius: 100% 26%; }
.leaf-r::before { right: 16%; left: 7%; border-left: 0; border-top-right-radius: 100% 26%; }
.leaf::after { /* ручка — звезда у шва */
  content: ""; position: absolute; top: 54%; width: 6px; height: 6px; border-radius: 50%;
  background: var(--star); box-shadow: 0 0 10px 2px var(--ice);
}
.leaf-l::after { right: 11%; }
.leaf-r::after { left: 11%; }
.seam {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; translate: -50% 0; opacity: 0;
  background: var(--star); box-shadow: 0 0 18px 4px var(--ice), 0 0 80px 24px var(--glow);
  transition: opacity .5s, width 1.6s cubic-bezier(.65, 0, .25, 1), box-shadow 1.6s;
}
.door.is-shut .leaf { opacity: 1; }
.door.is-shut .seam { opacity: .95; }
.door.is-open .leaf-l { transform: rotateY(-100deg); }
.door.is-open .leaf-r { transform: rotateY(100deg); }
.door.is-open .seam {
  opacity: 0; width: 70vw; box-shadow: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ice) 55%, transparent) 30%, var(--star) 50%, color-mix(in srgb, var(--ice) 55%, transparent) 70%, transparent);
  transition: opacity 1.5s .25s, width 1.6s cubic-bezier(.65, 0, .25, 1), box-shadow 1.6s;
}

/* gate.js переводит фокус на заголовок лендинга (tabindex=-1): рамка вокруг заголовка не нужна */
.hero-title[tabindex="-1"]:focus { outline: none; }
