/* 25.11: заставка при открытии — 4 варианта (index.html?intro=1…4), логика в js/intro.js.
   Все анимации стоят на паузе, пока скрипт не поставит .intro-go (после загрузки фото), и держат первый кадр. */

/* ---------- общее: заголовок выезжает снизу из «окошка», остальное проявляется ---------- */
.intro-line, .intro-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.intro-line > span, .intro-w > span { display: inline-block; }

html[class*="intro-"] .hero__photo { animation: none; }

html.intro-1, html.intro-2, html.intro-3, html.intro-4 { --t0: .5s; --st: .1s; --t1: .8s; }
html.intro-2 { --t0: .25s; --st: .07s; --t1: .55s; }
html.intro-3 { --t0: .8s; --t1: 1.05s; }
html.intro-4 { --t0: 1.45s; --t1: 1.7s; }

:is(.intro-1, .intro-2, .intro-3, .intro-4, .intro-logo) .hero__title :is(.intro-line, .intro-w) > span {
  animation: intro-up .8s cubic-bezier(.2, .8, .2, 1) calc(var(--t0) + var(--i, 0) * var(--st)) both paused;
}
:is(.intro-1, .intro-2, .intro-3, .intro-4, .intro-logo) .hero__lead { animation: intro-fade .7s ease var(--t1) both paused; }
:is(.intro-1, .intro-2, .intro-3, .intro-4, .intro-logo) .hero__cta { animation: intro-fade .7s ease calc(var(--t1) + .1s) both paused; }
:is(.intro-1, .intro-2, .intro-3, .intro-4, .intro-logo) .hcard { animation: intro-side .8s cubic-bezier(.2, .8, .2, 1) calc(var(--t1) + .15s) both paused; }
:is(.intro-1, .intro-2, .intro-3, .intro-4, .intro-logo) .hcard + .hcard { animation-delay: calc(var(--t1) + .27s); }
:is(.intro-1, .intro-2, .intro-3, .intro-4) .bar { animation: intro-drop .6s ease calc(var(--t1) - .1s) both paused; }

/* запуск */
.intro-go [class], .intro-go .hero__lead, .intro-go .hero__cta, .intro-go .hcard, .intro-go .bar,
.intro-go .hero__title span { animation-play-state: running !important; }
html:not(.intro-go) .intro-splash *, html:not(.intro-go) .intro-planks *, html:not(.intro-go) .intro-saw * { animation-play-state: paused !important; }

@keyframes intro-up { from { transform: translateY(105%); } }
@keyframes intro-fade { from { opacity: 0; transform: translateY(14px); } }
@keyframes intro-side { from { opacity: 0; transform: translateX(40px); } }
@keyframes intro-drop { from { opacity: 0; transform: translateY(-12px); } }

/* ---------- 1. Распил: полотно пилы открывает фото слева направо, летит опил ---------- */
.intro-cover { position: absolute; inset: 0; z-index: -1; background: #0B0A09; pointer-events: none;
  animation: intro-cut 1s cubic-bezier(.6, 0, .25, 1) .15s both paused; }
.intro-saw { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  animation: intro-saw 1s cubic-bezier(.6, 0, .25, 1) .15s both paused; }
.intro-saw__blade { position: absolute; top: 0; bottom: 0; left: -2px; width: 4px;
  background: linear-gradient(180deg, transparent, #FFF6E8 12%, #FFF6E8 88%, transparent);
  box-shadow: 0 0 18px 5px rgba(242, 160, 74, .85), 0 0 60px 14px rgba(242, 160, 74, .35); }
.intro-saw b { position: absolute; left: 0; top: var(--y); width: var(--s); height: var(--s); border-radius: 50%;
  background: #F4D9AE; opacity: 0; animation: intro-chip .7s ease-out calc(.15s + var(--d)) both paused; }
.intro-done .intro-cover, .intro-done .intro-saw { display: none; }
@keyframes intro-cut { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
@keyframes intro-saw { from { transform: translateX(0); opacity: 1; } 92% { opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes intro-chip { 0% { opacity: 0; transform: none; } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
.intro-1 .hero__photo { animation: intro-zoom 1.8s cubic-bezier(.2, .8, .2, 1) .15s both paused; }
@keyframes intro-zoom { from { transform: scale(1.06); } }

/* ---------- 2. Въезд: фото оседает из приближения и светлеет ---------- */
.intro-2 .hero__photo { animation: intro-settle 1.5s cubic-bezier(.2, .8, .2, 1) 0s both paused; }
@keyframes intro-settle { from { transform: scale(1.12); filter: brightness(.35); } }

/* ---------- 3. Штабель: фото собирается из досок, которые заезжают с боков снизу вверх ---------- */
.intro-planks { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.intro-planks > div { position: absolute; left: 0; right: 0; overflow: hidden;
  animation: intro-plank .6s cubic-bezier(.25, .9, .3, 1) calc(.1s + var(--k) * .08s) both paused; }
.intro-planks img { position: absolute; left: 0; width: 100%; max-width: none; object-fit: cover; }
.intro-3 .hero__photo { visibility: hidden; }
.intro-3.intro-done .hero__photo { visibility: visible; }
.intro-done .intro-planks { display: none; }
@keyframes intro-plank { from { transform: translateX(var(--from)); } }

/* ---------- 4. Заставка: логотип, пачка наполняется, экран уезжает вверх ---------- */
.intro-splash { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: #0B0A09;
  animation: intro-lift .6s cubic-bezier(.7, 0, .2, 1) 1.2s both paused; }
.intro-splash__in { display: grid; justify-items: center; gap: 28px; }
.intro-splash__in img { width: 200px; height: auto; animation: intro-fade .5s ease .05s both paused; }
.intro-splash__pack { display: grid; gap: 4px; width: 170px; }
.intro-splash__pack i { display: block; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #E6C083, #D9AE6C);
  transform-origin: 0 50%; animation: intro-fill .35s ease-out calc(.3s + (5 - var(--n)) * .12s) both paused; }
.intro-splash__pack i:nth-child(1) { --n: 1; } .intro-splash__pack i:nth-child(2) { --n: 2; } .intro-splash__pack i:nth-child(3) { --n: 3; }
.intro-splash__pack i:nth-child(4) { --n: 4; } .intro-splash__pack i:nth-child(5) { --n: 5; }
.intro-4 .hero__photo { animation: intro-settle 1.4s cubic-bezier(.2, .8, .2, 1) 1.25s both paused; }
.intro-done .intro-splash { display: none; }
@keyframes intro-lift { to { transform: translateY(-100%); } }
@keyframes intro-fill { from { transform: scaleX(0); } }

/* ---------- переключатель вариантов (только пока выбираем) ---------- */
.intro-sw {
  position: fixed; left: 12px; bottom: 12px; z-index: 10000; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  max-width: calc(100vw - 24px); padding: 6px; border-radius: 14px; background: rgba(20, 19, 17, .92); color: #fff;
  font: 500 13px/1 var(--f-text); box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.intro-sw span { padding: 0 6px 0 8px; color: rgba(255, 255, 255, .6); }
.intro-sw a { padding: 8px 10px; border-radius: 9px; color: #fff; }
.intro-sw a[aria-current] { background: var(--spil); color: var(--ink); }
@media (hover: hover) { .intro-sw a:not([aria-current]):hover { background: rgba(255, 255, 255, .12); } }
@media (max-width: 640px) { .intro-sw { bottom: 84px; font-size: 12px; } .intro-sw a { padding: 7px 8px; } }

/* ---------- 5. Логотип (основная, как на prestigeles.ru): логотип собирается на тёмном экране и улетает в шапку ---------- */
html.intro-logo { --t0: .1s; --st: .1s; --t1: .4s; }
.intro-logo .hero__photo { animation: intro-settle 1.5s cubic-bezier(.2, .8, .2, 1) 0s both paused; }
/* 25.11: логотип больше не улетает в шапку — логотип шапки виден сразу */
.pl-intro { display: none; }
.intro-logo .pl-intro { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; }
.intro-logo.intro-done .pl-intro { display: none; }
.pl-intro::before { content: ""; position: absolute; inset: 0; background: #0B0A09; transition: opacity .7s ease-out .1s; }
.pl-intro.is-out::before { opacity: 0; }
.pl-intro__logo { position: relative; display: block; width: min(460px, 76vw); height: auto; aspect-ratio: 835.72 / 230; overflow: visible; transform-origin: 0 0; }
.pl-intro__sq { transform-box: fill-box; transform-origin: center; animation: pli-sq .6s cubic-bezier(.2, .8, .2, 1) .05s both; }
.pl-intro__ring { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pli-draw .9s cubic-bezier(.65, 0, .35, 1) calc(.3s + var(--r) * .12s) forwards; }
.pl-intro__house { fill: #fff; fill-opacity: 0; stroke: #fff; stroke-width: 12; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: pli-draw .9s cubic-bezier(.65, 0, .35, 1) .35s forwards, pli-fill .4s ease-out 1.1s forwards; }
.pl-intro__word path { opacity: 0; transform: translateY(40px); animation: pli-letter .6s cubic-bezier(.2, .8, .2, 1) calc(.55s + var(--k) * .055s) forwards; }
.pl-intro__tag path { opacity: 0; animation: pli-fade .5s ease calc(1.15s + (var(--k) - 10) * .03s) forwards; }
@keyframes pli-sq { from { opacity: 0; transform: scale(.6); } }
@keyframes pli-draw { to { stroke-dashoffset: 0; } }
@keyframes pli-fill { to { fill-opacity: 1; stroke-opacity: 0; } }
@keyframes pli-letter { to { opacity: 1; transform: none; } }
@keyframes pli-fade { to { opacity: 1; } }
/* ===== 25.11: варианты заставки с логотипом (?intro=l1…l5). l1 «Сборка» — правила выше ===== */
/* общее для 2–5: кольца растут из угла, как годовые кольца */
@keyframes pli-grow { from { transform: scale(0); } }
@keyframes pli-rise { from { opacity: 0; transform: translateY(40px); } }

/* l2 «Кольца»: квадрат проявляется, кольца растут из угла, домик поднимается, буквы выезжают слева по одной */
.intro-l2 .pl-intro__ring, .intro-l4 .pl-intro__ring {
  stroke-dasharray: none; stroke-dashoffset: 0; transform-box: view-box; transform-origin: 18.4px 211.6px;
  animation: pli-grow .9s cubic-bezier(.2, .8, .2, 1) calc(.2s + var(--r) * .16s) both;
}
.intro-l2 .pl-intro__house, .intro-l4 .pl-intro__house { stroke: none; fill-opacity: 1; animation: none; }
.intro-l2 .pl-intro__hw, .intro-l4 .pl-intro__hw { animation: pli-rise .7s cubic-bezier(.2, .8, .2, 1) .6s both; }
.intro-l2 .pl-intro__word path { transform: translateX(-36px); animation: pli-letter .55s cubic-bezier(.2, .8, .2, 1) calc(.85s + var(--k) * .045s) forwards; }

/* l3 «Клеймо»: логотип целиком падает сверху, как клеймо на доску, — удар, лёгкая отдача, разлетается опил */
.intro-l3 .pl-intro__sq, .intro-l3 .pl-intro__hw { animation: none; }
.intro-l3 .pl-intro__ring { stroke-dashoffset: 0; animation: none; }
.intro-l3 .pl-intro__house { fill-opacity: 1; stroke: none; animation: none; }
.intro-l3 .pl-intro__word path, .intro-l3 .pl-intro__tag path { opacity: 1; transform: none; animation: none; }
.intro-l3 .pl-intro__logo { animation: pli-stamp .75s cubic-bezier(.55, 0, .35, 1) .2s both; }
@keyframes pli-stamp {
  0% { opacity: 0; transform: scale(2.1); filter: blur(12px); }
  62% { opacity: 1; transform: scale(.94); filter: blur(0); }
  80% { transform: scale(1.025); }
  100% { opacity: 1; transform: none; filter: none; }
}
.pl-intro__puff { position: absolute; left: 50%; top: 50%; width: min(460px, 76vw); aspect-ratio: 835.72 / 230; transform: translate(-50%, -50%); pointer-events: none; }
.pl-intro__puff b { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2); border-radius: 50%; background: #E9CFA3; opacity: 0;
  animation: pli-puff .9s cubic-bezier(.1, .7, .3, 1) calc(.66s + var(--d)) both; }
@keyframes pli-puff { 0% { opacity: 0; transform: none; } 12% { opacity: .95; } 100% { opacity: 0; transform: translate(var(--x), var(--y)); } }
.pl-intro.is-out .pl-intro__puff { display: none; }

/* l4 «Опил»: буквы слетаются из разных сторон с поворотом, как опилки оседают на место; кольца растут, домик поднимается */
.intro-l4 .pl-intro__word path, .intro-l4 .pl-intro__tag path {
  opacity: 0; transform-box: fill-box; transform-origin: center; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.4);
  animation: pli-letter 1s cubic-bezier(.2, .8, .2, 1) var(--d) forwards;
}

/* l5 «Из-за знака»: знак собирается по центру, потом сдвигается влево, а название выезжает из-под него */
.intro-l5 .pl-intro__logo { animation: pli-slide .85s cubic-bezier(.7, 0, .2, 1) .8s both; }
@keyframes pli-slide { from { transform: translateX(36.24%); } }
.intro-l5 .pl-intro__word path, .intro-l5 .pl-intro__tag path {
  opacity: 1; transform: translateX(var(--off)); animation: pli-letter .85s cubic-bezier(.7, 0, .2, 1) .8s forwards;
}