/* Восточный океан - слой движения и «дожатый» дизайн.
   Подключается ПОСЛЕ styles.css и ничего в нём не ломает: если этот файл убрать,
   сайт останется рабочим, просто без анимаций.
   Всё уважает prefers-reduced-motion (в конце файла). */

/* ---------------------------------------------- 1. интро с логотипом */
#intro {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background:
    radial-gradient(900px 520px at 78% 12%, rgba(10,186,181,.30), transparent 62%),
    linear-gradient(150deg, #1A2370, #283593 58%, #14205e);
  transition: opacity .55s ease, visibility .55s;
}
#intro.done { opacity: 0; visibility: hidden; }
.intro-in { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-logo {
  will-change: transform;
  transition: transform .95s cubic-bezier(.65,.02,.24,1);
}
.intro-logo { color: #fff; }
.intro-logo svg { display: block; width: min(320px, 74vw); height: auto; }
/* волны в логотипе прорисовываются, а не просто появляются */
.intro-logo .wave { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .85s ease forwards; }
.intro-logo .wave.w2 { animation-delay: .12s; }
.intro-logo .flask { stroke-dasharray: 90; stroke-dashoffset: 90; animation: draw .9s ease .18s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.intro-name {
  color: #fff; font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  opacity: 0; transform: translateY(10px);
  animation: introName .7s ease .35s forwards;
}
.intro-sub {
  color: #A9BDF6; font-size: 14.5px; letter-spacing: .16em; text-transform: uppercase;
  opacity: 0; animation: introName .7s ease .55s forwards;
}
@keyframes introName { to { opacity: 1; transform: none; } }
.intro-fade .intro-name, .intro-fade .intro-sub { transition: opacity .35s ease; opacity: 0 !important; }
/* пока идёт интро - страница не скроллится и логотип в шапке спрятан */
body.intro-on { overflow: hidden; }
body.intro-on header .logo svg { opacity: 0; }

/* ---------------------------------------------- 2. появление блоков при скролле */
[data-reveal] {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
}
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal].d1 { transition-delay: .07s; }
[data-reveal].d2 { transition-delay: .14s; }
[data-reveal].d3 { transition-delay: .21s; }

/* ---------------------------------------------- 3. переход между страницами
   Плавное затухание (выбор владельца 05.08): уходящая страница гаснет, новая
   проявляется. Нативный View Transitions НЕ используем - браузер его иногда
   пропускает («Transition was skipped» на медленной загрузке), и тогда переход
   пропадал бы вовсе; свой фолбэк работает одинаково и предсказуемо везде. */
body { animation: pageIn .38s ease; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
body.leaving { opacity: 0; transition: opacity .19s ease; }

/* ---------------------------------------------- 3.1 счётчики цифр */
.stat b.counting { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------- 3.2 сжимающаяся шапка
   При прокрутке шапка становится ниже, логотип мельче, фон - полупрозрачное
   стекло с тенью. Экрана освобождается ~20 px, а сайт читается как приложение. */
header { transition: box-shadow .3s ease, background-color .3s ease, border-color .3s ease; }
.topbar { transition: padding .28s cubic-bezier(.22,.61,.36,1); }
.logo .logo-svg { transition: height .28s cubic-bezier(.22,.61,.36,1); }
nav a { transition: padding .28s cubic-bezier(.22,.61,.36,1), color .2s ease, background .2s ease; }
body.scrolled header {
  background-color: rgba(255,255,255,.88);
  -webkit-backdrop-filter: saturate(1.7) blur(10px);
  backdrop-filter: saturate(1.7) blur(10px);
  border-bottom-color: transparent;
  box-shadow: 0 6px 22px rgba(20,26,51,.09);
}
body.scrolled .topbar { padding: 6px 0; }
body.scrolled .logo .logo-svg { height: 27px; }
body.scrolled nav a { padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 560px) { body.scrolled .logo .logo-svg { height: 23px; } }

/* ---------------------------------------------- 4. полоса прогресса чтения */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60;
  background: linear-gradient(90deg, var(--tiffany), var(--indigo2));
  transition: width .1s linear;
}

/* ---------------------------------------------- 5. кнопка «наверх» */
#toTop {
  position: fixed; right: 22px; bottom: 22px; z-index: 55; width: 46px; height: 46px;
  border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--indigo);
  font-size: 19px; cursor: pointer; box-shadow: 0 6px 20px rgba(20,26,51,.14);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, background .2s ease;
}
#toTop.on { opacity: 1; transform: none; pointer-events: auto; }
#toTop:hover { background: var(--sky); }

/* ---------------------------------------------- 6. дожатый дизайн */
/* воздуха между секциями больше, заголовки крупнее и плотнее */
section, .section { padding-top: 12px; padding-bottom: 12px; }
h2 { font-size: clamp(26px, 2.9vw, 36px); line-height: 1.15; letter-spacing: -.02em; }
h3 { letter-spacing: -.015em; }
p { max-width: 74ch; }

/* карточки: тонкая линия вместо тяжёлой тени, мягкий подъём по наведению */
.card, .tile, .prod, .art-card {
  transition: transform .28s cubic-bezier(.22,.61,.36,1), box-shadow .28s ease, border-color .28s ease;
}
.card:hover, .tile:hover, .prod:hover, .art-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(20,26,51,.10);
  border-color: #C7D4EA;
}

/* меню: подчёркивание вырастает из центра */
nav a { position: relative; transition: color .2s ease, background .2s ease; }
nav a:not(.active)::after {
  content: ""; position: absolute; left: 50%; right: 50%; bottom: 4px; height: 2px;
  background: var(--tiffany); border-radius: 2px; transition: left .25s ease, right .25s ease;
}
nav a:not(.active):hover::after { left: 12px; right: 12px; }

/* кнопки: лёгкий отклик на нажатие вместо статики */
.btn { transition: background .2s ease, transform .12s ease, box-shadow .2s ease; }
.btn:hover { box-shadow: 0 8px 20px rgba(10,186,181,.22); }
.btn:active { transform: translateY(1px); }
.btn.indigo:hover { box-shadow: 0 8px 20px rgba(40,53,147,.25); }

/* герой: содержимое въезжает после интро */
.hero-in > * { opacity: 0; transform: translateY(18px); }
body.ready .hero-in > * { animation: heroIn .8s cubic-bezier(.22,.61,.36,1) forwards; }
body.ready .hero-in > *:nth-child(2) { animation-delay: .09s; }
body.ready .hero-in > *:nth-child(3) { animation-delay: .18s; }
body.ready .hero-in > *:nth-child(4) { animation-delay: .27s; }
@keyframes heroIn { to { opacity: 1; transform: none; } }

/* фоновая химическая графика в герое медленно дышит */
.hero .chem-bg { animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); }
                   to   { transform: translate3d(-18px,-10px,0) scale(1.04); } }

/* ---------------------------------------------- 7. уважение к настройкам */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hero-in > * { opacity: 1 !important; transform: none !important; }
  #intro { display: none; }
}

/* логотип заказчика: высота фиксирована, ширина по пропорции */
.logo .logo-svg { height: 34px; width: auto; display: block; color: var(--ink); }
@media (max-width: 560px) { .logo .logo-svg { height: 28px; } }
