/* ============================================================
   Анімації та «живі» ефекти для сайту Відводи ПЕ100
   ============================================================ */

/* --- Базові появи при скролі --- */
/* reveal — только смещение, БЕЗ скрытия (контент всегда читаем) */
.reveal {
  opacity: 1;
  transform: translateY(18px);
  transition: transform .7s cubic-bezier(.22,.61,.36,1);
}
.reveal.in { transform: none; }

.reveal-left  { opacity:1; transform: translateX(-24px);
  transition: transform .8s cubic-bezier(.22,.61,.36,1); }
.reveal-right { opacity:1; transform: translateX(24px);
  transition: transform .8s cubic-bezier(.22,.61,.36,1); }
.reveal-left.in, .reveal-right.in { transform:none; }

.reveal-zoom { opacity:1; transform: scale(.97);
  transition: transform .7s cubic-bezier(.22,.61,.36,1); }
.reveal-zoom.in { transform:none; }

/* каскад для сіток */
.cards .card, .why-grid .why-item, .docs-grid .doc-card,
.contacts-grid .contact-block {
  opacity: 1;
  transform: none;
  transition: transform .6s cubic-bezier(.22,.61,.36,1),
              box-shadow .3s ease;
}
/* галерея: без opacity:0 — чтобы фото не пропадали, если JS не сработал */
.gallery-item {
  opacity: 1;
  transform: none;
}
.cards.in .card, .why-grid.in .why-item, .docs-grid.in .doc-card,
.contacts-grid.in .contact-block {
  opacity: 1; transform: none;
}

/* ============================================================
   HERO: анімований фон з труб + паралакс
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: #173d5f;
}
.hero::before {
  content:"";
  position:absolute; inset:-10%;
  background-image: url("images/pipe-big-thumb.jpg");
  background-size: cover;
  background-position: center;
  opacity: .18;
  filter: blur(2px) saturate(1.2);
  animation: heroDrift 34s ease-in-out infinite alternate;
  will-change: transform;
  z-index:0;
}
.hero::after {
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(1100px 520px at 12% 0%, rgba(47,111,168,.92), transparent 62%),
    linear-gradient(135deg, rgba(23,61,95,.96) 0%, rgba(31,78,120,.92) 48%, rgba(47,111,168,.88) 100%);
  z-index:1;
}
@keyframes heroDrift {
  0%   { transform: scale(1.06) translate3d(0,0,0); }
  50%  { transform: scale(1.13) translate3d(-2.2%, -1.4%, 0); }
  100% { transform: scale(1.06) translate3d(1.6%, 1%, 0); }
}
.hero .container { position: relative; z-index: 2; }

/* промінь світла, що пробігає */
.hero .container::after {
  content:"";
  position:absolute; top:-40%; left:-30%;
  width: 45%; height: 200%;
  background: linear-gradient(105deg, transparent 0%,
    rgba(255,255,255,.10) 42%, rgba(255,255,255,.20) 50%,
    rgba(255,255,255,.10) 58%, transparent 100%);
  transform: rotate(8deg);
  animation: lightSweep 9s ease-in-out infinite;
  pointer-events:none;
  z-index: 3;
}
@keyframes lightSweep {
  0%, 62%  { transform: translateX(-40%) rotate(8deg); opacity: 0; }
  70%      { opacity: 1; }
  100%     { transform: translateX(360%) rotate(8deg); opacity: 0; }
}

/* пульсуючий бейдж */
.hero-badge {
  position: relative;
  animation: badgePulse 3.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.32); }
  50%     { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
}

/* поява H1 слово за словом */
.hero h1 {
  opacity: 0;
  animation: fadeUpHero .9s .15s cubic-bezier(.22,.61,.36,1) forwards;
}
.hero-sub  { opacity:0; animation: fadeUpHero .8s .32s ease forwards; }
.hero-points li { opacity:0; animation: fadeUpHero .7s ease forwards; }
.hero-points li:nth-child(1){ animation-delay:.46s; }
.hero-points li:nth-child(2){ animation-delay:.58s; }
.hero-points li:nth-child(3){ animation-delay:.70s; }
.hero-points li:nth-child(4){ animation-delay:.82s; }
.hero-cta { opacity:0; animation: fadeUpHero .8s .95s ease forwards; }
.hero-card {
  opacity:0;
  animation: cardIn 1s .4s cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes fadeUpHero {
  from { opacity:0; transform: translateY(22px); }
  to   { opacity:1; transform: none; }
}
@keyframes cardIn {
  from { opacity:0; transform: translateY(30px) scale(.97); }
  to   { opacity:1; transform: none; }
}

/* галочки з «малюванням» */
.hero-points li::before {
  animation: checkPop .45s ease backwards;
}
.hero-points li:nth-child(1)::before { animation-delay:.55s; }
.hero-points li:nth-child(2)::before { animation-delay:.67s; }
.hero-points li:nth-child(3)::before { animation-delay:.79s; }
.hero-points li:nth-child(4)::before { animation-delay:.91s; }
@keyframes checkPop {
  from { opacity:0; transform: scale(0) rotate(-40deg); }
  to   { opacity:1; transform: none; }
}

/* рядки картки параметрів — по одному */
.hero-card .range-row {
  opacity: 0;
  animation: fadeUpHero .5s ease forwards;
}
.hero-card .range-row:nth-child(1){ animation-delay:.62s; }
.hero-card .range-row:nth-child(2){ animation-delay:.72s; }
.hero-card .range-row:nth-child(3){ animation-delay:.82s; }
.hero-card .range-row:nth-child(4){ animation-delay:.92s; }
.hero-card .range-row:nth-child(5){ animation-delay:1.02s; }
.hero-card .range-row:nth-child(6){ animation-delay:1.12s; }
.hero-card .hero-note {
  opacity:0;
  animation: fadeUpHero .6s 1.28s ease forwards;
}

/* ============================================================
   Кнопки — живий відгук
   ============================================================ */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.22,.61,.36,1),
              box-shadow .22s ease, background .22s ease, color .22s ease;
}
.btn::after {
  content:"";
  position:absolute; top:0; left:-120%;
  width: 60%; height:100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.42), transparent);
  transform: skewX(-18deg);
  transition: left .55s ease;
}
.btn:hover::after { left: 130%; }
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(232,121,43,.42);
}
.btn-ghost:hover { transform: translateY(-2px); }

.btn-primary {
  animation: btnGlow 4s ease-in-out infinite;
}
@keyframes btnGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,121,43,.42); }
  50%     { box-shadow: 0 0 18px 2px rgba(232,121,43,.34); }
}

/* ============================================================
   Біжуча стрічка (маркіза під hero)
   ============================================================ */
.ticker {
  background: var(--accent);
  color:#fff;
  overflow:hidden;
  padding: 11px 0;
  position: relative;
  z-index: 3;
}
.ticker-track {
  display: flex;
  gap: 46px;
  width: max-content;
  animation: marquee 26s linear infinite;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display:flex; align-items:center; gap:9px; }
.ticker-dot { width:6px; height:6px; border-radius:50%; background:#fff; opacity:.75; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   Галерея фото
   ============================================================ */
.gallery-section { padding: 64px 0; background: #0f2131; color:#fff; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  background: #173d5f;
}
.gallery-item.tall { grid-row: span 2; aspect-ratio: 4/6; }
.gallery-item.wide { grid-column: span 2; aspect-ratio: 8/3; }

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display:block;
  transition: transform .8s cubic-bezier(.22,.61,.36,1), filter .5s ease;
  filter: saturate(1.05) contrast(1.02);
}
.gallery-item:hover img { transform: scale(1.09) rotate(.6deg); filter: saturate(1.2); }

.gallery-item::after {
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(to top, rgba(11,26,38,.88) 0%, rgba(11,26,38,.15) 48%, transparent 78%);
  transition: opacity .4s ease;
  pointer-events:none;
}
.gallery-cap {
  position:absolute; left:0; right:0; bottom:0;
  padding: 16px 18px;
  z-index: 2;
  transform: translateY(4px);
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}
.gallery-item:hover .gallery-cap { transform: none; }
.gallery-cap b { display:block; font-size: 15px; margin-bottom:3px; }
.gallery-cap span { font-size: 12.5px; color:#b9cfdf; }

.gallery-item::before {
  content:"";
  position:absolute; inset:0;
  border: 2px solid var(--accent);
  border-radius: 12px;
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 3;
  pointer-events:none;
}
.gallery-item:hover::before { opacity: .9; }

/* ============================================================
   Лайтбокс
   ============================================================ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(8,18,28,.94);
  display: none;
  align-items: center; justify-content: center;
  z-index: 300;
  padding: 30px;
  opacity: 0;
  transition: opacity .3s ease;
}
.lightbox.show { display: flex; opacity: 1; }
.lightbox img {
  max-width: 92vw; max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0,0,0,.7);
  animation: lbIn .38s cubic-bezier(.22,.61,.36,1);
}
@keyframes lbIn {
  from { opacity:0; transform: scale(.94); }
  to   { opacity:1; transform:none; }
}
.lightbox-close {
  position: absolute; top: 22px; right: 28px;
  background: none; border: none; color:#fff;
  font-size: 42px; cursor: pointer; line-height:1;
  opacity:.8; transition: opacity .2s, transform .2s;
}
.lightbox-close:hover { opacity:1; transform: rotate(90deg); }
.lightbox-nav {
  position:absolute; top:50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border:none; color:#fff;
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 24px; cursor:pointer;
  transition: background .2s, transform .2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,.26); }
.lightbox-prev { left: 28px; }
.lightbox-next { right: 28px; }

/* ============================================================
   Анімована схема відводу (SVG)
   ============================================================ */
.pipe-demo {
  background: #fff;
  border-radius: 14px;
  padding: 26px;
  margin-top: 34px;
  box-shadow: 0 14px 40px rgba(0,0,0,.14);
}
.pipe-demo-title {
  font-weight: 700; color: var(--blue);
  font-size: 16px; margin-bottom: 6px;
}
.pipe-demo-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.bend-svg { width: 100%; height: auto; display:block; overflow: visible; }
.bend-pipe {
  fill: none;
  stroke: #2b3d4f;
  stroke-width: 26;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: drawPipe 2.4s .3s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes drawPipe { to { stroke-dashoffset: 0; } }
.bend-flow {
  fill: none;
  stroke: #47b8ff;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 16 26;
  opacity: 0;
  animation: flowMove 1.5s linear infinite, fadeIn .6s 1.4s forwards;
}
@keyframes flowMove { to { stroke-dashoffset: -84; } }
@keyframes fadeIn { to { opacity: .95; } }
.bend-flange { fill: var(--accent); opacity:0; animation: fadeUpHero .5s 1.2s ease forwards; }
.bend-label {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px; fill: #61707f; font-weight: 600;
}

/* ============================================================
   Лічильники (цифри, що біжать)
   ============================================================ */
.stat-band {
  background: linear-gradient(135deg, #1f4e78, #2f6fa8);
  color:#fff;
  padding: 46px 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  text-align: center;
}
.stat-num {
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height:1.1;
  color: #ffd9b8;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13.5px; color:#c3d3e1; margin-top:6px; }

/* ============================================================
   Лінія часу виробництва
   ============================================================ */
.timeline { position: relative; padding: 8px 0 0; }
.timeline::before {
  content:""; position:absolute; left: 23px; top: 10px; bottom: 10px;
  width: 3px; background: var(--line); border-radius: 2px;
}
.timeline-line {
  position:absolute; left: 23px; top: 10px;
  width: 3px; height: 0;
  background: linear-gradient(to bottom, var(--accent), var(--blue-l));
  border-radius: 2px;
  transition: height 1.6s cubic-bezier(.22,.61,.36,1);
}
.timeline.in .timeline-line { height: calc(100% - 20px); }
.tl-item {
  position: relative;
  padding: 0 0 26px 62px;
  opacity: 1;
  transform: translateX(-8px);
  transition: transform .5s cubic-bezier(.22,.61,.36,1);
}
.timeline.in .tl-item { transform:none; }
.timeline.in .tl-item:nth-child(2){ transition-delay:.18s; }
.timeline.in .tl-item:nth-child(3){ transition-delay:.36s; }
.timeline.in .tl-item:nth-child(4){ transition-delay:.54s; }
.timeline.in .tl-item:nth-child(5){ transition-delay:.72s; }
.tl-dot {
  position:absolute; left: 12px; top: 2px;
  width: 25px; height: 25px; border-radius: 50%;
  background:#fff; border:3px solid var(--blue);
  display:flex; align-items:center; justify-content:center;
  font-size: 11px; font-weight:800; color: var(--blue);
  transition: border-color .3s, transform .3s;
  z-index: 2;
}
.tl-item:hover .tl-dot {
  border-color: var(--accent);
  transform: scale(1.16);
}
.tl-item b { display:block; font-size: 15.5px; margin-bottom: 4px; }
.tl-item p { font-size: 14px; color: var(--muted); }
.tl-days {
  display:inline-block; background: var(--accent);
  color:#fff; font-size: 11.5px; font-weight:700;
  padding: 2px 9px; border-radius: 11px; margin-left: 8px;
  vertical-align: middle;
}

/* ============================================================
   Плаваюча кнопка дзвінка
   ============================================================ */
.fab-call {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 150;
  display: flex; align-items:center; gap: 10px;
  background: var(--accent);
  color:#fff; text-decoration:none;
  padding: 14px 20px;
  border-radius: 50px;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 28px rgba(232,121,43,.45);
  transform: translateY(90px);
  opacity: 0;
  transition: transform .45s cubic-bezier(.22,.61,.36,1),
              opacity .45s ease, background .2s;
}
.fab-call.show { transform:none; opacity:1; }
.fab-call:hover { background: var(--accent-d); }
.fab-call::before {
  content:"";
  position:absolute; inset:-6px;
  border-radius: 50px;
  border: 2px solid rgba(232,121,43,.55);
  animation: fabRing 2.6s ease-out infinite;
}
@keyframes fabRing {
  0%   { transform: scale(.96); opacity:.85; }
  70%  { transform: scale(1.14); opacity:0; }
  100% { opacity:0; }
}
.fab-icon { font-size: 19px; }

/* прогрес читання */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), #ffd9b8);
  z-index: 200;
  transition: width .1s linear;
}

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 1000px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-item.tall { grid-row: span 1; aspect-ratio: 4/3; }
  .gallery-item.wide { grid-column: span 2; aspect-ratio: 8/4; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .hero .container::after { display:none; }
}
@media (max-width: 720px) {
  .gallery-grid { grid-template-columns: 1fr; gap: 12px; }
  .gallery-item.wide { grid-column: span 1; aspect-ratio: 4/3; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .fab-call { right: 14px; bottom: 14px; padding: 12px 16px; font-size: 14px; }
  .fab-call span.fab-text { display:none; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .timeline::before, .timeline-line { left: 15px; }
  .tl-dot { left: 4px; }
  .tl-item { padding-left: 50px; }
}

/* Повага до налаштувань зменшення руху */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal, .reveal-left, .reveal-right, .reveal-zoom,
  .cards .card, .why-grid .why-item, .gallery-item,
  .hero h1, .hero-sub, .hero-points li, .hero-cta, .hero-card,
  .hero-card .range-row, .hero-card .hero-note, .tl-item {
    opacity: 1 !important;
    transform: none !important;
  }
}
