/* =========================================================
   SERAGAME - Cube Sweeper Landing Page
   Struktur CSS:
   1. Reset & Variabel (Dark/Light Theme)
   2. Background (grid + floating shapes)
   3. Topbar & Theme Toggle
   4. Hero Section + 3D Cube
   5. Tombol Menu (Play/Settings/About)
   6. Modal (Settings & About)
   7. Toast Notifikasi
   8. Footer
   9. Animasi Keyframes
   10. Responsive
   ========================================================= */

/* ---------- 1. RESET & VARIABEL ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* ===== DARK MODE (default) - biru gelap + neon glow ===== */
  --bg-base: #0a0e1a;
  --bg-base-2: #0f1526;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.08);

  --text-primary: #eef1f8;
  --text-secondary: #8a93ad;

  --accent: #4dd8ff;       /* cyan neon */
  --accent-2: #7c5cff;     /* purple neon */
  --accent-contrast: #06121f;

  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glow: 0 0 40px rgba(77, 216, 255, 0.35);

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* ===== LIGHT MODE - abu terang + soft shadow ===== */
body.light-mode {
  --bg-base: #eef0f4;
  --bg-base-2: #e4e7ee;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --border-soft: rgba(20, 30, 50, 0.08);

  --text-primary: #1b2030;
  --text-secondary: #6b7280;

  --accent: #3b82f6;
  --accent-2: #8b5cf6;
  --accent-contrast: #ffffff;

  --shadow-soft: 0 10px 30px rgba(30, 41, 59, 0.12);
  --glow: 0 0 50px rgba(59, 130, 246, 0.25);
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: radial-gradient(ellipse at 50% 0%, var(--bg-base-2) 0%, var(--bg-base) 60%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background 0.5s ease, color 0.5s ease;
}

/* ---------- 2. BACKGROUND: GRID & FLOATING SHAPES ---------- */

/* Grid kotak-kotak transparan, kesan teknis/futuristik */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 0%, transparent 75%);
  opacity: 0.6;
  pointer-events: none;
}

/* Container untuk kubus-kubus floating di background */
.floating-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
  animation: floatShape 12s ease-in-out infinite;
}

.shape--1 { width: 70px;  height: 70px;  top: 12%; left: 8%;  animation-duration: 14s; }
.shape--2 { width: 46px;  height: 46px;  top: 22%; right: 10%; animation-duration: 10s; animation-delay: -2s; }
.shape--3 { width: 110px; height: 110px; bottom: 18%; left: 6%; border-radius: 22px; animation-duration: 16s; animation-delay: -5s; }
.shape--4 { width: 58px;  height: 58px;  bottom: 26%; right: 12%; animation-duration: 11s; animation-delay: -3s; }
.shape--5 { width: 34px;  height: 34px;  top: 48%; right: 22%; animation-duration: 9s; animation-delay: -1s; }

@keyframes floatShape {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-24px) rotate(8deg); }
}

/* ---------- 3. TOPBAR & THEME TOGGLE ---------- */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(20px, 5vw, 64px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.logo__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-size: 1rem;
  box-shadow: var(--glow);
}

/* Tombol toggle tema, bentuk pill dengan icon matahari/bulan */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.theme-toggle .icon {
  width: 20px;
  height: 20px;
}

/* Icon matahari & bulan: tampil bergantian sesuai mode */
.icon-moon { display: block; }
.icon-sun  { display: none; }

body.light-mode .icon-moon { display: none; }
body.light-mode .icon-sun  { display: block; }

/* ---------- 4. HERO SECTION + 3D CUBE ---------- */
.hero {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px clamp(20px, 5vw, 64px) 80px;
  max-width: 720px;
  margin: 0 auto;
}

/* Area panggung kubus 3D */
.cube-stage {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 12px auto 28px;
  perspective: 800px;
}

/* Glow lembut di belakang kubus */
.cube-glow {
  position: absolute;
  inset: -40px;
  z-index: -1;
  background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
  opacity: 0.25;
  filter: blur(30px);
  border-radius: 50%;
  animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.12); }
}

/* Kubus 3D dibangun dari 6 face yang diputar di ruang 3D */
.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: rotateCube 16s linear infinite;
}

.cube__face {
  position: absolute;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(12px);
  color: var(--accent);
  box-shadow: var(--shadow-soft), inset 0 0 20px rgba(255,255,255,0.04);
}

.cube__face--front  { transform: translateZ(90px); }
.cube__face--back   { transform: translateZ(-90px) rotateY(180deg); }
.cube__face--right  { transform: rotateY(90deg) translateZ(90px); }
.cube__face--left   { transform: rotateY(-90deg) translateZ(90px); }
.cube__face--top    { transform: rotateX(90deg) translateZ(90px); color: var(--accent-2); }
.cube__face--bottom { transform: rotateX(-90deg) translateZ(90px); }

@keyframes rotateCube {
  from { transform: rotateX(-20deg) rotateY(0deg); }
  to   { transform: rotateX(-20deg) rotateY(360deg); }
}

/* Teks Hero */
.hero__text {
  margin-bottom: 36px;
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 600;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  font-weight: 600;
  color: var(--accent-2);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.description {
  margin-top: 18px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 480px;
  margin-inline: auto;
}

/* ---------- 5. TOMBOL MENU ---------- */
.menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.btn__icon {
  font-size: 0.9rem;
}

/* Tombol Play: highlight utama dengan gradient + glow */
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  border: none;
  box-shadow: var(--glow), var(--shadow-soft);
}

.btn--primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 60px rgba(124, 92, 255, 0.45), var(--shadow-soft);
}

.btn--primary:active {
  transform: translateY(-1px) scale(0.99);
}

/* Tombol Settings/About: glassmorphism */
.btn--glass {
  background: var(--surface);
  color: var(--text-primary);
  backdrop-filter: blur(14px);
}

.btn--glass:hover {
  background: var(--surface-strong);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- 5b. HALAMAN KONTEN (About & Privacy) ---------- */
.page {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 24px clamp(20px, 5vw, 64px) 80px;
}

.page__card {
  width: 100%;
  max-width: 640px;
  padding: clamp(28px, 5vw, 44px);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.page__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 6px 0 22px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page__text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.page__back {
  width: auto;
  margin-top: 28px;
}

/* Daftar kontak pada halaman Contact */
.contact-list {
  list-style: none;
  margin: 24px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  transition: border-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.contact-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.contact-item__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-size: 1.15rem;
  box-shadow: var(--glow);
}

.contact-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-item__label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.contact-item__value {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  word-break: break-word;
}

a.contact-item__value:hover {
  color: var(--accent);
}

/* ---------- 6. MODAL (Settings & About) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 16, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s ease;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.modal__text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s;
}

.modal__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.95rem;
}

.modal__row:last-child {
  border-bottom: none;
}

/* Slider volume custom */
.modal__row input[type="range"] {
  width: 130px;
  accent-color: var(--accent);
}

/* Switch toggle on/off (digunakan untuk Vibrasi & Dark Mode di Settings) */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: absolute;
  inset: 0;
  background: var(--border-soft);
  border-radius: 999px;
  transition: background 0.3s;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 0.3s ease;
}

.switch input:checked + .switch__track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(20px);
  background: #fff;
}

/* Tag pada About modal */
.modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--accent);
}

/* ---------- 6b. GALLERY & LIGHTBOX ---------- */
.gallery {
  position: relative;
  z-index: 5;
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px clamp(20px, 5vw, 64px) 40px;
}

.gallery__head {
  text-align: center;
  margin-bottom: 32px;
}

.gallery__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gallery__hint {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(16px, 3vw, 28px);
}

/* Kartu screenshot dengan efek glass + hover */
.shot {
  position: relative;
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
  transition: transform 0.25s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.shot:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--glow), var(--shadow-soft);
}

.shot__img {
  display: block;
  width: 100%;
  height: auto;
}

/* Tampilkan gambar sesuai tema aktif */
.shot__img--light { display: none; }
.shot__img--dark  { display: block; }

body.light-mode .shot__img--light { display: block; }
body.light-mode .shot__img--dark  { display: none; }

/* Lightbox untuk preview ukuran penuh */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 16, 0.82);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__img {
  max-width: min(92vw, 1000px);
  max-height: 88vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  transform: scale(0.96);
  transition: transform 0.3s ease;
}

.lightbox.is-open .lightbox__img {
  transform: scale(1);
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, color 0.2s;
}

.lightbox__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 7. TOAST NOTIFIKASI ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 200;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- 8. FOOTER ---------- */
.footer {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- 10. RESPONSIVE ---------- */
@media (min-width: 640px) {
  .menu {
    flex-direction: row;
  }

  .btn {
    width: auto;
    flex: 1;
  }

  .btn--primary {
    flex: 1.4;
  }
}

@media (max-width: 640px) {
  .gallery__grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 70%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .shot {
    scroll-snap-align: center;
  }
}

@media (max-width: 380px) {
  .toast {
    white-space: normal;
    width: 90%;
    text-align: center;
  }

  .cube-stage {
    width: 140px;
    height: 140px;
  }

  .cube__face {
    width: 140px;
    height: 140px;
    font-size: 2rem;
  }

  .cube__face--front  { transform: translateZ(70px); }
  .cube__face--back   { transform: translateZ(-70px) rotateY(180deg); }
  .cube__face--right  { transform: rotateY(90deg) translateZ(70px); }
  .cube__face--left   { transform: rotateY(-90deg) translateZ(70px); }
  .cube__face--top    { transform: rotateX(90deg) translateZ(70px); }
  .cube__face--bottom { transform: rotateX(-90deg) translateZ(70px); }
}

/* Hormati preferensi pengguna yang mengurangi animasi */
@media (prefers-reduced-motion: reduce) {
  .cube, .shape, .cube-glow {
    animation: none;
  }
}
