/* =====================================================================
   PORTAL LAYANAN DIGITAL SMKN 6 BALIKPAPAN
   Style: Cyberpunk / Sci-Fi techno neon
   =====================================================================
   DAFTAR ISI:
   1. Reset & Variabel Global (Design Tokens)
   2. Background (Aurora + Grid + Scanline + Canvas Partikel)
   3. Layout Container
   4. Header / Hero (judul neon, badge, status bar)
   5. Daftar Link (Tombol Neon + Hover/Glitch Effect)
   6. Footer
   7. Animasi Keyframes
   8. Responsive (Mobile First Adjustments)
   9. Reduced Motion Support
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. RESET & VARIABEL GLOBAL
   --------------------------------------------------------------------- */
:root {
  /* Warna dasar -- biru navy yang jelas terlihat (bukan hampir-hitam)
     agar neon benar-benar kontras di atasnya */
  --bg-base: #0a1240;          /* navy utama, jelas kebiruan */
  --bg-base-2: #16308f;        /* biru royal terang untuk pusat gradient */
  --bg-base-3: #060a22;        /* navy gelap di tepi, tetap kebiruan bukan hitam pekat */
  --surface: rgba(10, 17, 37, 0.55);
  --surface-border: rgba(120, 160, 255, 0.16);

  /* Neon palette utama -- tiga warna yang dirotasi tiap tombol */
   /* aksen energi SMK */

  /* Teks */
  --text-primary: #eef1ff;
  --text-muted: #9aa3c2;

  /* Tipografi */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Poppins', sans-serif;

  /* Spacing / radius */
  --radius-lg: 18px;
  --radius-md: 14px;
  --gap-section: clamp(2rem, 6vw, 4rem);

  /* Transisi standar */
  --ease-snap: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg-base); /* fallback solid agar tidak putih saat overscroll mobile */
}

body {
  /* Gradient navy gelap: lebih terang di tengah-atas, gelap di tepi */
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, var(--bg-base-2) 0%, var(--bg-base) 55%, var(--bg-base-3) 100%);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Fokus keyboard tetap terlihat (aksesibilitas) walau tema neon */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 4px;
}

/* ---------------------------------------------------------------------
   2. BACKGROUND -- AURORA WAVE + GRID + SCANLINE + CANVAS PARTIKEL
   --------------------------------------------------------------------- */

/* Canvas tempat JS menggambar partikel + garis koneksi */
#bg-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(ellipse at top, var(--bg-base-2) 0%, var(--bg-base) 60%, var(--bg-base-3) 100%);
}

/* Aurora: tiga "blob" gradient besar yang melayang pelan -- efek wave/aurora */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
  mix-blend-mode: screen;
}

.aurora-blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
}

.blob-1 {
  top: -20%;
  left: -10%;
  background: var(--neon-cyan);
  animation: drift-1 22s ease-in-out infinite;
}

.blob-2 {
  bottom: -25%;
  right: -15%;
  background: var(--neon-magenta);
  animation: drift-2 26s ease-in-out infinite;
}

.blob-3 {
  top: 30%;
  left: 35%;
  background: var(--neon-violet);
  width: 45vmax;
  height: 45vmax;
  animation: drift-3 30s ease-in-out infinite;
}

/* Grid garis tipis ala "blueprint" sci-fi di atas aurora */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(0,0,0,0.9) 0%, transparent 75%);
}

/* Scanline tipis yang bergerak turun -- nuansa CRT/sci-fi */
.scanline {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 246, 255, 0.04) 50%,
    transparent 100%
  );
  height: 220px;
  animation: scan-move 7s linear infinite;
}

/* ---------------------------------------------------------------------
   3. LAYOUT CONTAINER
   --------------------------------------------------------------------- */
.container {
  position: relative;
  z-index: 5; /* di atas semua layer background */
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
}

/* ---------------------------------------------------------------------
   4. HEADER / HERO
   --------------------------------------------------------------------- */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

/* Badge kecil di atas judul */
.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--neon-cyan);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  background: rgba(0, 246, 255, 0.06);
  box-shadow: 0 0 12px rgba(0, 246, 255, 0.45), inset 0 0 8px rgba(0, 246, 255, 0.15);

  /* state awal untuk animasi entrance via JS/CSS class */
  opacity: 0;
  transform: translateY(-14px);
}

.logo-badge i {
  animation: pulse-icon 1.8s ease-in-out infinite;
}

/* Judul utama dengan efek neon flicker */
.neon-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.7rem, 6.5vw, 2.9rem);
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-transform: uppercase;
  color: #fff;

  /* multi-layer text-shadow = inti dari efek neon glow */
  text-shadow:
    0 0 6px rgba(255,255,255,0.85),
    0 0 14px var(--neon-cyan),
    0 0 28px var(--neon-cyan),
    0 0 48px rgba(0, 246, 255, 0.5);

  opacity: 0;
  transform: translateY(18px) scale(0.97);
}

.neon-title .line {
  display: block;
}

/* Setiap huruf dibungkus JS menjadi <span class="letter"> agar bisa
   "menari" pelan satu per satu -- memberi kesan hidup & dinamis,
   bukan teks statis. Delay tiap huruf diatur lewat inline style oleh JS. */
.letter {
  display: inline-block;
  animation: letter-float 2.8s ease-in-out infinite;
}

.neon-title .accent {
  color: var(--neon-magenta);
  text-shadow:
    0 0 6px rgba(255,255,255,0.85),
    0 0 14px var(--neon-magenta),
    0 0 28px var(--neon-magenta),
    0 0 48px rgba(255, 43, 214, 0.5);
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(10px);
}

.subtitle i {
  color: var(--neon-violet);
}

/* Status bar kecil bertema "system online" */
.status-bar {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  opacity: 0;
}

.status-bar .divider {
  opacity: 0.35;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2dffb0;
  box-shadow: 0 0 8px #2dffb0, 0 0 16px #2dffb0;
  animation: blink-dot 1.6s ease-in-out infinite;
}

#live-clock {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------
   5. DAFTAR LINK -- TOMBOL NEON
   --------------------------------------------------------------------- */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(10px);
  overflow: hidden;
  isolation: isolate;

  /* state awal untuk staggered entrance animation (diatur via JS) */
  opacity: 0;
  transform: translateY(28px);

  transition:
    transform 0.35s var(--ease-snap),
    box-shadow 0.35s var(--ease-snap),
    border-color 0.35s var(--ease-snap),
    background 0.35s var(--ease-snap);
}

/* Variabel warna neon per-kartu, di-set lewat attribute [data-glow] */
.link-card[data-glow="cyan"]    { --glow: var(--neon-cyan); }
.link-card[data-glow="magenta"] { --glow: var(--neon-magenta); }
.link-card[data-glow="violet"]  { --glow: var(--neon-violet); }

/* Garis tepi tipis neon, default redup, menyala saat hover */
.link-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--glow);
  opacity: 0.35;
  box-shadow: 0 0 10px var(--glow), inset 0 0 10px rgba(255,255,255,0.02);
  transition: opacity 0.35s var(--ease-snap), box-shadow 0.35s var(--ease-snap);
  z-index: -1;
}

/* Lapisan "sweep" cahaya yang lewat saat hover */
.link-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.18) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  z-index: 1;
  pointer-events: none;
}

.link-card:hover::after,
.link-card:focus-visible::after {
  left: 130%;
}

/* HOVER -- inti dari "premium neon" interaction:
   1) scale up sedikit
   2) glow makin terang & menyebar
   3) border makin solid
   4) ikon & teks judul memicu glitch (lihat .card-title.is-glitching) */
.link-card:hover,
.link-card:focus-visible {
  transform: translateY(-4px) scale(1.025);
  background: rgba(22, 36, 78, 0.75);
  border-color: var(--glow);
}

.link-card:hover::before,
.link-card:focus-visible::before {
  opacity: 1;
  box-shadow:
    0 0 14px var(--glow),
    0 0 32px var(--glow),
    0 0 60px var(--glow),
    inset 0 0 16px rgba(255,255,255,0.05);
}

.link-card:active {
  transform: translateY(-1px) scale(0.99);
}

/* Ikon kiri */
.card-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 1.05rem;
  color: var(--glow);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.35s var(--ease-snap), color 0.35s ease;
}

.link-card:hover .card-icon {
  transform: rotate(-6deg) scale(1.08);
  text-shadow: 0 0 10px var(--glow), 0 0 22px var(--glow);
}

/* Blok teks: judul + deskripsi */
.card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0; /* agar teks panjang tidak overflow di mobile */
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  letter-spacing: 0.02em;
  position: relative;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Panah kanan */
.card-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.35s var(--ease-snap), color 0.35s ease;
}

.link-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--glow);
}

/* ---- EFEK GLITCH pada judul tombol saat hover ----
   Menggunakan pseudo-element ::before/::after yang menumpuk teks asli
   (lewat atribut data-glitch) dengan offset warna RGB-split khas glitch. */
.card-title.is-glitching::before,
.card-title.is-glitching::after {
  content: attr(data-glitch);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  background: transparent;
  overflow: hidden;
}

.card-title.is-glitching::before {
  color: var(--neon-cyan);
  animation: glitch-shift-1 0.35s steps(2, end) 1;
  clip-path: inset(0 0 55% 0);
}

.card-title.is-glitching::after {
  color: var(--neon-magenta);
  animation: glitch-shift-2 0.35s steps(2, end) 1;
  clip-path: inset(45% 0 0 0);
}

/* ---------------------------------------------------------------------
   6. FOOTER
   --------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px solid var(--surface-border);
  opacity: 0;
}

.footer-accent {
  color: var(--neon-cyan);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   7. ANIMASI KEYFRAMES
   --------------------------------------------------------------------- */

/* Drift lambat untuk blob aurora */
@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8vw, 10vh) scale(1.15); }
}
@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10vw, -6vh) scale(1.1); }
}
@keyframes drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-6vw, 8vh) scale(0.92); }
}

/* Scanline bergerak turun lalu mengulang */
@keyframes scan-move {
  0% { transform: translateY(-220px); }
  100% { transform: translateY(110vh); }
}

/* Berkedip lembut untuk dot status "online" */
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes pulse-icon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* Flicker neon khas lampu sign -- dipakai via class .flicker pada judul */
@keyframes neon-flicker {
  0%, 3%, 6%, 100% { opacity: 1; }
  4% { opacity: 0.4; }
  5% { opacity: 0.85; }
  62% { opacity: 1; }
  63% { opacity: 0.45; }
  64% { opacity: 1; }
}

/* Tarian pelan tiap huruf judul -- naik-turun bergiliran (delay berbeda
   per huruf, diisi via JS) sehingga keseluruhan judul terasa "bernapas"
   dan hidup, bukan diam kaku. */
@keyframes letter-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}

/* Ledakan glitch singkat & acak pada warna glow judul (dipicu JS tiap
   beberapa detik) -- mengubah warna text-shadow secara cepat seolah
   sinyal neon "tersendat" sesaat lalu normal kembali. */
@keyframes glitch-color-burst {
  0%, 100% {
    text-shadow:
      0 0 6px rgba(255,255,255,0.85),
      0 0 14px var(--neon-cyan),
      0 0 28px var(--neon-cyan),
      0 0 48px rgba(0, 246, 255, 0.5);
  }
  20% {
    text-shadow:
      0 0 6px #fff,
      0 0 16px var(--neon-magenta),
      0 0 32px var(--neon-magenta),
      0 0 50px rgba(255, 43, 214, 0.5);
  }
  40% {
    text-shadow:
      0 0 6px #fff,
      0 0 16px var(--neon-violet),
      0 0 32px var(--neon-violet),
      0 0 50px rgba(139, 92, 246, 0.5);
  }
  60% {
    text-shadow:
      0 0 8px #fff,
      0 0 20px var(--neon-yellow),
      0 0 36px var(--neon-yellow),
      0 0 55px rgba(244, 255, 94, 0.4);
  }
  80% {
    text-shadow:
      0 0 6px #fff,
      0 0 16px var(--neon-cyan),
      0 0 30px var(--neon-cyan),
      0 0 48px rgba(0, 246, 255, 0.5);
  }
}

/* Entrance utama: fade + rise + sedikit scale (dipicu via class .is-visible) */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* RGB-split glitch untuk judul tombol saat hover */
@keyframes glitch-shift-1 {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0, 0); }
}
@keyframes glitch-shift-2 {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* Kelas generik yang dipasang oleh JS ketika elemen siap tampil */
.is-visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  transition: opacity 0.7s var(--ease-snap), transform 0.7s var(--ease-snap);
}

/* Khusus judul utama: setelah animasi masuk selesai, JS menambahkan .flicker */
.neon-title.flicker {
  animation: neon-flicker 5s infinite;
}

/* Dipicu JS secara periodik & acak untuk efek "glitch burst" singkat */
.neon-title.glitch-burst {
  animation: glitch-color-burst 0.5s steps(3, end) 1;
}

/* Saat flicker & glitch-burst aktif bersamaan, gabungkan kedua animasi
   secara eksplisit (CSS tidak menggabungkan otomatis jika ditulis di
   rule terpisah, karena 'animation' adalah shorthand satu properti). */
.neon-title.flicker.glitch-burst {
  animation:
    neon-flicker 5s infinite,
    glitch-color-burst 0.5s steps(3, end) 1;
}

/* ---------------------------------------------------------------------
   8. RESPONSIVE / MOBILE-FIRST ADJUSTMENTS
   --------------------------------------------------------------------- */
@media (max-width: 480px) {
  .neon-title { font-size: 1.55rem; letter-spacing: 0.02em; }
  .card-desc { display: none; } /* sembunyikan deskripsi di layar sangat kecil agar rapi */
  .link-card { padding: 0.9rem 1rem; gap: 0.75rem; }
  .card-icon { width: 40px; height: 40px; font-size: 0.95rem; }
}

@media (min-width: 481px) and (max-width: 700px) {
  .card-desc { white-space: normal; } /* boleh wrap di tablet kecil */
}

/* Layar besar: beri sedikit lebih banyak ruang & ukuran tombol nyaman dibaca */
@media (min-width: 1024px) {
  .container { max-width: 780px; }
  .link-card { padding: 1.15rem 1.5rem; }
}

/* ---------------------------------------------------------------------
   9. REDUCED MOTION -- hormati preferensi pengguna
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .neon-title.flicker,
  .neon-title.glitch-burst,
  .neon-title.flicker.glitch-burst,
  .letter {
    animation: none !important;
  }
}
