/* Gerak halus untuk SubGate. Semua opsional: kalau JS mati, halaman tetap terbaca. */

:root {
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- progress bar baca ---------- */
#progress {
  position: fixed; inset: 0 0 auto; height: 2px; z-index: 60;
  transform: scaleX(var(--p, 0)); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--blue) 55%, var(--violet));
  box-shadow: 0 0 12px rgba(110, 231, 183, .6);
  will-change: transform;
}

/* ---------- nav mengecil saat scroll ---------- */
.nav { transition: height .25s var(--ease-out), background .25s ease, box-shadow .25s ease; }
.nav-in { transition: height .25s var(--ease-out); }
.nav.scrolled { background: rgba(6, 7, 10, .88); box-shadow: 0 10px 30px -24px #000; }
.nav.scrolled .nav-in { height: 54px; }

/* ---------- reveal saat masuk layar ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
.js [data-reveal].in { opacity: 1; transform: none; }
.js [data-reveal="left"] { transform: translate3d(-24px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(24px, 0, 0); }
.js [data-reveal="zoom"] { transform: scale(.96); }

/* ---------- judul hero: kata naik satu-satu ---------- */
.hero h1 .w { display: inline-block; overflow: hidden; vertical-align: bottom;
  padding-bottom: .14em; margin-bottom: -.14em; }
.hero h1 .w > i {
  display: inline-block; font-style: inherit;
  animation: wordRise .78s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 60ms);
}
@keyframes wordRise { from { transform: translate3d(0, 108%, 0); } to { transform: none; } }

/* ---------- latar ASCII bergerak ---------- */
.hero { isolation: isolate; overflow-x: clip; }
.hero-canvas {
  position: absolute; inset: -6% -6% auto; height: 96%; width: 112%;
  z-index: -1; pointer-events: none; opacity: 0;
  transition: opacity 1.2s ease;
  -webkit-mask-image: radial-gradient(64% 62% at 66% 20%, #000 16%, transparent 70%),
                      linear-gradient(to bottom, #000 0 52%, transparent 84%);
  mask-image: radial-gradient(64% 62% at 66% 20%, #000 16%, transparent 70%),
              linear-gradient(to bottom, #000 0 52%, transparent 84%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.hero-canvas.ready { opacity: .4; }

/* ---------- terminal: kursor + sapuan cahaya ---------- */
.term { position: relative; }
.term::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(110, 231, 183, .09) 46%, transparent 62%);
  transform: translateX(-60%);
  animation: sweep 5.5s var(--ease-out) 1.2s infinite;
}
@keyframes sweep { 0%, 55% { transform: translateX(-70%); opacity: 0; } 62% { opacity: 1; } 100% { transform: translateX(70%); opacity: 0; } }
.term pre::after {
  content: "▌"; color: var(--accent); margin-left: 2px;
  animation: caret 1.1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

/* ---------- angka berhitung ---------- */
.stat b { font-variant-numeric: tabular-nums; transition: color .3s ease; }
.stat b.live { color: var(--accent); text-shadow: 0 0 22px rgba(110, 231, 183, .35); }

/* ---------- kartu: sorot mengikuti kursor ---------- */
.card { --mx: 50%; --my: 0%; overflow: hidden; }
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(340px circle at var(--mx) var(--my), rgba(110, 231, 183, .10), transparent 62%);
  opacity: 0; transition: opacity .3s ease;
}
.card:hover::after { opacity: 1; }
.card.plan { transition: transform .25s var(--ease-out), border-color .2s ease, box-shadow .25s ease; }
@media (hover: hover) {
  .card.plan:hover { transform: translateY(-4px); }
}

/* ---------- tombol: tekan ---------- */
.btn { transition: transform .12s var(--ease-out), background .16s ease, border-color .16s ease, box-shadow .2s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn.primary:hover::after { animation: shine .8s var(--ease-out); }
@keyframes shine { to { transform: translateX(120%); } }

/* ---------- marquee model ---------- */
.marquee {
  position: relative; margin: 34px 0 0; padding: 14px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; --dur: 38s;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex; gap: 28px; width: max-content;
  animation: marquee var(--dur) linear infinite;
  animation-play-state: var(--play, running);
}
.marquee:hover .marquee-track { --play: paused; }
.marquee-track > span {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .04em;
  color: var(--text-dim); white-space: nowrap;
  transition: color .2s ease;
}
.marquee-track > span:hover { color: var(--accent); }
.marquee-track > span::before { content: "◆"; font-size: .5rem; color: var(--line-strong); }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }

/* ---------- meter isi bertahap ---------- */
.meter > i { transform-origin: 0 50%; animation: meterIn 1s var(--ease-out) both; animation-delay: .2s; }
@keyframes meterIn { from { transform: scaleX(0); } }

/* ---------- alert masuk ---------- */
.alert { animation: alertIn .45s var(--ease-spring) both; }
@keyframes alertIn { from { opacity: 0; transform: translateY(-8px) scale(.99); } }

/* ---------- tabel: baris muncul berurutan ---------- */
tbody tr { animation: rowIn .4s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- hormati prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal].in { opacity: 1 !important; transform: none !important; }
  .hero h1 .w > i, .term::after, .term pre::after, .alert, tbody tr, .meter > i { animation: none !important; }
  .marquee-track { animation: none !important; }
  .btn.primary::after { display: none; }
  #progress { display: none; }
  html { scroll-behavior: auto; }
}
