/* =========================================================
   ANIMASI – Pandawa Karya Perkasa
   Dimuat setelah style.css. Semua gerakan dimatikan otomatis
   jika pengunjung memilih "reduce motion" (blok paling bawah).
   ========================================================= */

/* Scroll progress bar */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 100;
  background: linear-gradient(90deg, var(--yellow), #FFE38A, var(--blue-500));
  transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}

/* Hero: Ken Burns (zoom pelan) + parallax (--py diisi JS) */
.hero-bg { animation: kenburns 22s ease-in-out infinite alternate; will-change: transform; }
@keyframes kenburns {
  from { transform: translate3d(0, var(--py, 0px), 0) scale(1.04); }
  to   { transform: translate3d(-1.5%, var(--py, 0px), 0) scale(1.15); }
}

/* Hero: teks masuk bertahap */
.hero-content > *, .hero-features li {
  opacity: 0; animation: fadeUp .8s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero-content > :nth-child(1) { animation-delay: .1s; }
.hero-content > :nth-child(2) { animation-delay: .25s; }
.hero-content > :nth-child(3) { animation-delay: .45s; }
.hero-content > :nth-child(4) { animation-delay: .6s; }
.hero-features li:nth-child(1) { animation-delay: .8s; }
.hero-features li:nth-child(2) { animation-delay: .9s; }
.hero-features li:nth-child(3) { animation-delay: 1s; }
.hero-features li:nth-child(4) { animation-delay: 1.1s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* Teks kuning berkilau */
.shine-text {
  background: linear-gradient(100deg, var(--yellow) 0%, var(--yellow) 40%, #FFF1B8 50%, var(--yellow) 60%, var(--yellow) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important;
  animation: shineText 4.5s linear infinite;
}
@keyframes shineText { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* Ikon keunggulan hero berayun */
.hf-ico { animation: bob 3s ease-in-out infinite; }
.hero-features li:nth-child(2) .hf-ico { animation-delay: .4s; }
.hero-features li:nth-child(3) .hf-ico { animation-delay: .8s; }
.hero-features li:nth-child(4) .hf-ico { animation-delay: 1.2s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Gelembung air naik */
.bubbles { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bubbles span {
  position: absolute; bottom: -40px; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.35);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,.04) 60%);
  animation: rise linear infinite;
}
.bubbles span:nth-child(1)  { left: 4%;  animation-duration: 14s; animation-delay: 0s; }
.bubbles span:nth-child(2)  { left: 12%; width: 8px;  height: 8px;  animation-duration: 10s; animation-delay: 2s; }
.bubbles span:nth-child(3)  { left: 22%; width: 20px; height: 20px; animation-duration: 18s; animation-delay: 4s; }
.bubbles span:nth-child(4)  { left: 31%; width: 10px; height: 10px; animation-duration: 12s; animation-delay: 1s; }
.bubbles span:nth-child(5)  { left: 42%; animation-duration: 16s; animation-delay: 6s; }
.bubbles span:nth-child(6)  { left: 50%; width: 6px;  height: 6px;  animation-duration: 9s;  animation-delay: 3s; }
.bubbles span:nth-child(7)  { left: 58%; width: 18px; height: 18px; animation-duration: 17s; animation-delay: 7s; }
.bubbles span:nth-child(8)  { left: 66%; width: 9px;  height: 9px;  animation-duration: 11s; animation-delay: 5s; }
.bubbles span:nth-child(9)  { left: 74%; animation-duration: 15s; animation-delay: 2.5s; }
.bubbles span:nth-child(10) { left: 83%; width: 22px; height: 22px; animation-duration: 20s; animation-delay: 8s; }
.bubbles span:nth-child(11) { left: 90%; width: 7px;  height: 7px;  animation-duration: 10s; animation-delay: 4.5s; }
.bubbles span:nth-child(12) { left: 96%; width: 12px; height: 12px; animation-duration: 13s; animation-delay: 9s; }
@keyframes rise {
  0%   { transform: translate(0, 0) scale(.6); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(18px, -300px) scale(1); }
  100% { transform: translate(-12px, -640px) scale(1.1); opacity: 0; }
}

/* Dekorasi hero: cincin penampang pipa + badge teks berputar (posisi mouse dari JS) */
.hero-deco {
  position: absolute; right: 5%; bottom: 60px; width: 260px; height: 260px; z-index: 0;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0); transition: transform .3s ease-out;
}
.pipe-ring { position: absolute; border-radius: 50%; top: 50%; left: 50%; }
.pipe-ring.r1 { width: 260px; height: 260px; margin: -130px 0 0 -130px; border: 2px dashed rgba(255,194,26,.6); animation: spin 40s linear infinite; }
.pipe-ring.r2 { width: 206px; height: 206px; margin: -103px 0 0 -103px; border: 10px solid rgba(255,255,255,.08); border-top-color: rgba(30,107,224,.8); border-right-color: rgba(30,107,224,.35); animation: spin 9s linear infinite reverse; }
.pipe-ring.r3 { width: 150px; height: 150px; margin: -75px 0 0 -75px; border: 2px dotted rgba(255,255,255,.45); animation: spin 24s linear infinite; }
.spin-badge { position: absolute; top: 50%; left: 50%; width: 150px; height: 150px; margin: -75px 0 0 -75px; }
.spin-badge svg { width: 100%; height: 100%; animation: spin 16s linear infinite; }
.spin-badge text { fill: #fff; font-size: 13.5px; font-weight: 800; letter-spacing: 1px; }
.spin-badge-logo {
  position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  background: #fff; border-radius: 50%; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  animation: pulseLogo 3s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseLogo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* Tombol: kilau menyapu & denyut */
.btn-shine { position: relative; overflow: hidden; isolation: isolate; }
.btn-shine::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-20deg); animation: sweep 3.5s ease-in-out infinite 1.5s;
}
@keyframes sweep { 0% { left: -80%; } 35%, 100% { left: 130%; } }
.btn-pulse { position: relative; }
.btn-pulse::before, .wa-float::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; border: 2px solid;
  animation: ring 2.2s ease-out infinite; pointer-events: none;
}
.btn-pulse::before { border-color: var(--yellow); }
.wa-float::before { border-color: #25D366; }
@keyframes ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.3, 1.6); } }
.wa-float::before { animation-name: ringRound; }
@keyframes ringRound { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }

/* Eyebrow dengan garis bergerak */
.eyebrow.line { display: inline-flex; align-items: center; gap: 10px; }
.eyebrow.line::before {
  content: ''; width: 28px; height: 3px; border-radius: 3px; background: var(--yellow);
  animation: lineGrow 2.4s ease-in-out infinite alternate;
}
@keyframes lineGrow { from { width: 14px; } to { width: 34px; } }

/* Kartu produk: tilt 3D (JS isi --rx/--ry/--gx/--gy) + kilau mengikuti kursor */
.product-card { position: relative; }
.product-card.tilting {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px);
  transition: transform .08s linear, box-shadow .25s;
}
.product-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,.55), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.product-card:hover::after { opacity: 1; }
.product-card:hover .pc-img img { transform: scale(1.12) rotate(2deg); }
.product-card .link-arrow .icon { transition: transform .25s; }
.product-card:hover .link-arrow .icon { transform: translateX(4px); }

/* Ikon keunggulan: cincin putus-putus berputar, ikon berputar saat hover */
.feature-ico { position: relative; }
.feature-ico::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px dashed rgba(10,42,102,.25); animation: spin 14s linear infinite;
}
.feature-ico .icon { transition: transform .7s cubic-bezier(.3,1.6,.5,1); }
.feature:hover .feature-ico .icon { transform: rotate(360deg) scale(1.1); }
.feature:hover .feature-ico::before { border-color: var(--yellow); animation-duration: 3s; }

/* Aliran air di pipa (atas section portfolio) */
.portfolio { overflow: hidden; }
.flow-pipe { position: absolute; top: 0; left: 0; right: 0; height: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.flow-pipe span {
  position: absolute; top: 0; bottom: 0; left: -150px; right: 0;
  background: repeating-linear-gradient(90deg, transparent 0 40px, rgba(255,194,26,.9) 40px 70px, transparent 70px 110px, rgba(30,107,224,.9) 110px 150px);
  animation: flow 2.5s linear infinite;
}
@keyframes flow { from { transform: translateX(0); } to { transform: translateX(150px); } }

/* Kartu proyek */
.project-card { transition: transform .35s, box-shadow .35s; }
.project-card:hover { transform: translateY(-8px); box-shadow: 0 18px 34px rgba(0,0,0,.35); }
.project-card:hover .pj-img img { transform: scale(1.1) rotate(-1.5deg); }
.pj-cat .icon { transition: transform .5s; }
.project-card:hover .pj-cat .icon { transform: rotate(360deg); }

/* Tentang Kami: orbit berputar + badge melayang */
.about-orbit {
  position: absolute; width: 180px; height: 180px; left: -60px; top: -60px; z-index: 0; border-radius: 50%;
  border: 3px dashed var(--blue-100); animation: spin 22s linear infinite;
}
.about-orbit::after {
  content: ''; position: absolute; top: -8px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 5px rgba(255,194,26,.25);
}
.about-float {
  position: absolute; z-index: 2; right: -14px; bottom: 22px; display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--navy-800); font-weight: 700; font-size: 12.5px; padding: 10px 14px;
  border-radius: 999px; box-shadow: var(--shadow); animation: float 4s ease-in-out infinite;
}
.about-float .icon { color: #1BA260; width: 18px; height: 18px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.about-img img { transition: transform .5s; }
.about-img:hover img { transform: rotate(-1deg) scale(1.02); }
.ap-ico { transition: transform .6s cubic-bezier(.3,1.6,.5,1), background .3s, color .3s; }
.about-points li:hover .ap-ico { transform: rotate(360deg); background: var(--navy-800); color: var(--yellow); }

/* Sektor: ikon berputar 3D saat hover */
.sector-grid .icon { transition: transform .8s cubic-bezier(.3,1.4,.5,1), color .3s; }
.sector-grid li:hover .icon { transform: rotateY(360deg) scale(1.15); color: var(--blue-500); }
.sector-grid li:hover { background: linear-gradient(180deg, #fff, var(--blue-50)); }

/* CTA: ikon bergoyang */
.cta-ico .icon { animation: wiggle 2.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 90% { transform: rotate(-6deg); } }

/* Artikel */
.ac-img img { transition: transform .5s; }
.article-card:hover .ac-img img { transform: scale(1.08); }
.ac-arrow { transition: transform .3s, background .3s, color .3s; }
.article-card:hover .ac-arrow { transform: translateY(-50%) rotate(-45deg); background: var(--navy-800); color: var(--yellow); }

/* Footer social: berputar saat hover */
.social a { transition: transform .6s, background .2s, color .2s; }
.social a:hover { transform: rotate(360deg); }

/* Variasi reveal (dipasang JS) */
.reveal[data-reveal="left"]  { transform: translateX(-40px); }
.reveal[data-reveal="right"] { transform: translateX(40px); }
.reveal[data-reveal="zoom"]  { transform: scale(.85); }
.reveal[data-reveal="flip"]  { transform: perspective(600px) rotateX(-35deg); transform-origin: top; }
.reveal.in[data-reveal] { transform: none; }

/* =========================================================
   INTRO BANNER
   Alur: huruf "Selamat Datang di <nama>" jatuh satu per satu, lalu
   layanan muncul. Setelah 3 detik semua tertiup angin, lalu konten
   hero asli masuk. Urutan waktu diatur main.js (initIntro).
   ========================================================= */
.hero-intro { display: none; }
.hero.intro-playing .hero-intro {
  display: flex; flex-direction: column; justify-content: center;
  position: absolute; inset: 0 24px; z-index: 2; pointer-events: none;
}
/* Konten asli disembunyikan selama intro; animasi fadeUp berjalan setelah kelas dilepas */
.hero.intro-playing .hero-content > *,
.hero.intro-playing .hero-features li { animation: none !important; opacity: 0; }

.intro-greet {
  color: var(--yellow); font-size: clamp(15px, 1.9vw, 22px); font-weight: 800;
  letter-spacing: .32em; text-transform: uppercase; margin-bottom: 10px;
}
.intro-name {
  color: #fff; font-size: clamp(34px, 6.2vw, 76px); font-weight: 800; line-height: 1.04;
  text-transform: uppercase; letter-spacing: -.01em; max-width: 900px;
  text-shadow: 0 6px 30px rgba(0,0,0,.35);
}
.hero-intro .word { display: inline-block; white-space: nowrap; }
.hero-intro .ch {
  display: inline-block; opacity: 0;
  animation: chIn .7s cubic-bezier(.2,.9,.25,1.25) forwards;
  animation-delay: calc(var(--i) * 35ms + .25s);
}
@keyframes chIn {
  from { opacity: 0; transform: translateY(-70px) rotate(-30deg) scale(.3); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.intro-bar {
  display: block; height: 4px; width: 150px; border-radius: 4px; margin: 22px 0 20px;
  background: linear-gradient(90deg, var(--yellow), #FFE38A);
  transform: scaleX(0); transform-origin: left;
  animation: barIn .6s ease-out forwards; animation-delay: var(--svc-start, 1.8s);
}
@keyframes barIn { to { transform: scaleX(1); } }

.intro-services { display: flex; flex-wrap: wrap; gap: 10px; max-width: 760px; }
.intro-services li {
  color: #fff; font-size: 14px; font-weight: 600; padding: 7px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); backdrop-filter: blur(4px);
  opacity: 0; animation: svcIn .55s cubic-bezier(.2,.8,.3,1.2) forwards;
  animation-delay: calc(var(--svc-start, 1.8s) + .2s + var(--k) * 130ms);
}
@keyframes svcIn { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }

.intro-skip {
  pointer-events: auto; position: absolute; left: 0; bottom: 36px; background: none; border: 0;
  color: rgba(255,255,255,.6); font-size: 13px; font-weight: 600; letter-spacing: .05em; padding: 6px 0;
  opacity: 0; animation: svcIn .5s forwards 1s;
}
.intro-skip::after { content: ' ›'; }
.intro-skip:hover { color: var(--yellow); }

/* Tertiup angin: tiap huruf terbang ke kanan-atas dengan arah acak (--wx/--wy/--wr dari PHP) */
.hero.intro-out .hero-intro .ch {
  opacity: 1; animation: windAway 1s cubic-bezier(.55,0,.75,.35) forwards;
  animation-delay: calc(var(--i) * 20ms);
}
.hero.intro-out .intro-services li {
  opacity: 1; animation: windAway .9s cubic-bezier(.55,0,.75,.35) forwards;
  animation-delay: calc(.25s + var(--k) * 70ms);
}
.hero.intro-out .intro-bar { transform: scaleX(1); animation: barOut .5s ease-in forwards; }
.hero.intro-out .intro-skip { animation: none; opacity: 0; transition: opacity .2s; }
@keyframes windAway {
  0%   { opacity: 1; transform: none; filter: blur(0); }
  25%  { opacity: 1; transform: translate(calc(var(--wx) * .08), calc(var(--wy) * .05)) rotate(calc(var(--wr) * .15)); }
  100% { opacity: 0; transform: translate(var(--wx), var(--wy)) rotate(var(--wr)) skewX(-25deg) scale(.5); filter: blur(7px); }
}
@keyframes barOut { to { transform: scaleX(0) translateX(200px); opacity: 0; } }

/* Garis-garis hembusan angin melintas */
.hero-intro::before, .hero-intro::after {
  content: ''; position: absolute; left: -30%; height: 2px; width: 45%; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
}
.hero-intro::before { top: 38%; }
.hero-intro::after { top: 58%; width: 60%; }
.hero.intro-out .hero-intro::before { animation: gust .9s ease-in forwards; }
.hero.intro-out .hero-intro::after { animation: gust 1.1s ease-in forwards .15s; }
@keyframes gust {
  0%   { opacity: 0; transform: translateX(0); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(260%); }
}

@media (max-width: 720px) {
  .hero.intro-playing .hero-intro { inset: 0 16px; }
  .intro-greet { letter-spacing: .2em; }
  .intro-services li { font-size: 12.5px; padding: 6px 12px; }
  .intro-skip { bottom: 20px; }
}

@media (max-width: 1024px) {
  .hero-deco { right: -30px; bottom: auto; top: 30px; opacity: .5; transform: scale(.75); }
  .about-float { right: 8px; }
}
@media (max-width: 720px) {
  .hero-deco { right: -90px; top: 0; opacity: .3; transform: scale(.65); }
  .about-orbit { width: 120px; height: 120px; left: -30px; top: -30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-content > *, .hero-features li { opacity: 1; }
  .scroll-progress { display: none; }
}
