/* ===== CLASSIC MINIMALIST DESIGN ===== */
/* Inspired by Swiss Design & Bauhaus principles */

@import url("https://fonts.googleapis.com/css2?family=Helvetica+Neue:wght@300;400;500;700&display=swap");

:root {
  /* Monochromatic Classic Palette */
  --primary: #1a1a1a;
  --secondary: #4a4a4a;
  --accent: #7acde3;
  --text: #1a1a1a;
  --text-light: #6a6a6a;
  --bg: #fafafa;
  --border: #e0e0e0;
  --white: #ffffff;

  /* Typography - Helvetica Neue for Swiss style */
  --font-primary: "Helvetica Neue", "Helvetica", Arial, sans-serif;

  /* Grid & Spacing - 8pt system */
  --unit: 8px;

  /* ... (variabel root Anda tetap sama) ... */
  --sidebar-width: clamp(320px, 40vw, 500px); /* Lebar sidebar responsif */
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background-color: var(--bg);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
}

#container {
  width: 100vw;
  height: 100vh;
  display: block;
}

.hidden {
  display: none !important;
}

/* ===== OVERLAY - Swiss Grid Layout ===== */
.screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 999;
  /* --- AWAL PERUBAHAN --- */
  /* Gabungkan warna dan gambar */
  background: var(--bg) url("../assets/images/bg.png") center/cover no-repeat; /* Warna dulu, lalu gambar */
  /* Opsional: Gunakan blend mode untuk mencampur warna dan gambar */
  /* background-blend-mode: multiply; */ /* atau screen, overlay, dll. Tergantung efek yang diinginkan */
  /* --- AKHIR PERUBAHAN --- */
  transition: opacity 0.3s ease;
  padding: calc(var(--unit) * 3);
}

.screen-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ===== TYPOGRAPHY - Hierarchical & Grid-Based ===== */
.screen-overlay h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  margin-bottom: calc(var(--unit) * 2);
  color: var(--primary);
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
}

.screen-overlay p {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  max-width: 480px;
  margin-bottom: calc(var(--unit) * 5);
  line-height: 1.6;
  color: var(--text-light);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ===== BUTTONS - Geometric & Functional ===== */
.overlay-button {
  position: relative;
  padding: calc(var(--unit) * 2) calc(var(--unit) * 6);
  font-size: 1rem;
  font-weight: 500;
  border: 2px solid var(--primary);
  color: var(--primary);
  background-color: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-primary);
  border-radius: 0; /* Pure geometric - no rounded corners */
}

.overlay-button:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 26, 26, 0.15);
}

.overlay-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(26, 26, 26, 0.15);
}

/* ===== INPUT - Underlined Minimalism ===== */
.input-container {
  position: relative;
  margin: calc(var(--unit) * 4) auto calc(var(--unit) * 6) auto;
  width: min(400px, 90%);
}

.input-container input[type="text"] {
  font-size: 1.125rem;
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--border);
  padding: calc(var(--unit) * 2) 0;
  background-color: transparent;
  outline: none;
  color: var(--text);
  text-align: center;
  font-weight: 400;
  transition: border-color 0.2s ease;
  letter-spacing: 0.02em;
  font-family: var(--font-primary);
}

.input-container .label {
  position: absolute;
  top: calc(var(--unit) * 2);
  left: 0;
  color: var(--text-light);
  transition: all 0.2s ease;
  pointer-events: none;
  width: 100%;
  text-align: center;
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.input-container input[type="text"]:focus {
  border-color: var(--primary);
}

.input-container input[type="text"]:focus ~ .label,
.input-container input[type="text"]:valid ~ .label {
  top: calc(var(--unit) * -3);
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ===== LOADING - Grid-Based Progress ===== */
#loading-text {
  margin-top: calc(var(--unit) * 4);
  font-size: 1rem;
  color: var(--text);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-bar-container {
  width: min(480px, 90%);
  height: 4px;
  background-color: var(--border);
  margin-top: calc(var(--unit) * 3);
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  transition: width 0.2s ease;
  background-color: var(--primary);
  position: relative;
}

/* Clean progress - no animations for classic look */
#progress-bar::after {
  display: none;
}

.spinner {
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== VR BUTTON ===== */
#VRButton {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.3s, opacity 0.3s ease;
  right: calc(var(--unit) * 3) !important;
  left: auto !important;
  top: calc(var(--unit) * 3) !important;
  bottom: auto !important;
  z-index: 10 !important;
}

#VRButton.visible {
  visibility: visible;
  opacity: 1;
}

/* ===== FLOATING BUTTON - Circular Geometric ===== */
.floating-button {
  position: fixed;
  bottom: calc(var(--unit) * 3);
  right: calc(var(--unit) * 3);
  width: 56px;
  height: 56px;
  background-color: var(--white);
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(26, 26, 26, 0.1);
  z-index: 1000;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
  cursor: pointer; /* Tambahkan cursor pointer untuk button */
}

.floating-button:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(26, 26, 26, 0.15);
}

.floating-button .tooltip {
  /* Hapus atau komentari style tooltip jika tidak digunakan lagi */
  /* visibility: hidden; ... */
  display: none; /* Sembunyikan tooltip */
}

#about-button.floating-button {
  /* Fluid default yang tetap kecil di layar sempit, besar di layar lebar */
  width: clamp(44px, 7vw, 56px);
  height: clamp(44px, 7vw, 56px);
  font-size: clamp(14px, 2.6vw, 18px);
  /* Jaga jarak dari notch/safe area */
  bottom: max(calc(var(--unit) * 2), env(safe-area-inset-bottom));
  right: max(calc(var(--unit) * 2), env(safe-area-inset-right));
}

/* ===== TAMBAHAN: Styles untuk Sidebar About ===== */
#about-sidebar {
  position: fixed;
  top: 0;
  right: calc(-1 * var(--sidebar-width)); /* Mulai dari luar layar */
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 15px rgba(26, 26, 26, 0.1);
  z-index: 1001;
  transition: right 0.4s ease-in-out;
  overflow-y: auto; /* Aktifkan scroll vertikal jika konten panjang */
  padding-bottom: calc(var(--unit) * 8); /* Beri ruang di bawah */
}

#about-sidebar.visible {
  right: 0; /* Pindahkan ke dalam layar */
}

#close-sidebar-button {
  position: absolute;
  top: calc(var(--unit) * 2);
  right: calc(var(--unit) * 2);
  background: none;
  border: none;
  font-size: 2rem;
  font-weight: 300;
  color: var(--secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0 var(--unit);
  transition: color 0.2s ease;
}

#close-sidebar-button:hover {
  color: var(--primary);
}

#sidebar-content {
  padding: calc(var(--unit) * 3);
  padding-top: calc(var(--unit) * 8); /* Beri ruang untuk tombol close */
  font-family: var(--font-primary);
  color: var(--text);
}

#sidebar-content h1,
#sidebar-content h2,
#sidebar-content h3 {
  color: var(--primary);
  font-weight: 500;
  margin-top: calc(var(--unit) * 3);
  margin-bottom: calc(var(--unit) * 1.5);
  letter-spacing: 0.01em;
}

#sidebar-content h1 {
  font-size: 1.75rem;
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#sidebar-content h2 {
  font-size: 1.375rem;
}

#sidebar-content h3 {
  font-size: 1.125rem;
}

#sidebar-content p,
#sidebar-content li,
#sidebar-content blockquote {
  font-size: 0.9375rem; /* Sedikit lebih kecil dari overlay */
  line-height: 1.6;
  color: var(--text-light);
  margin-bottom: calc(var(--unit) * 1.5);
  font-weight: 400;
}

#sidebar-content ul,
#sidebar-content ol {
  margin-left: calc(var(--unit) * 3);
  margin-bottom: calc(var(--unit) * 1.5);
}

#sidebar-content ul li::marker {
  color: var(--primary);
}
#sidebar-content ol li::marker {
  color: var(--primary);
  font-weight: 500;
}

#sidebar-content ul ul {
  margin-top: calc(var(--unit) / 2);
  margin-bottom: calc(var(--unit));
}

#sidebar-content code {
  font-family: monospace;
  background-color: #f0f0f0;
  padding: calc(var(--unit) / 4) calc(var(--unit));
  border-radius: 3px;
  font-size: 0.875rem;
  color: var(--secondary);
}

#sidebar-content strong {
  font-weight: 500;
  color: var(--text);
}

#sidebar-content em {
  font-style: italic;
  color: var(--secondary);
}

#sidebar-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

#sidebar-content a:hover {
  border-bottom-color: var(--accent);
}

#sidebar-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: calc(var(--unit) * 3) 0;
}

#sidebar-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: calc(var(--unit) * 2);
  font-size: 0.875rem;
}

#sidebar-content th,
#sidebar-content td {
  border: 1px solid var(--border);
  padding: calc(var(--unit));
  text-align: left;
  vertical-align: top;
}

#sidebar-content th {
  background-color: #f7f7f7;
  font-weight: 500;
  color: var(--primary);
}

#sidebar-content td {
  color: var(--text-light);
}
#sidebar-content td strong {
  color: var(--text);
}

#sidebar-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: calc(var(--unit) * 2);
  margin-left: 0;
  font-style: italic;
  color: var(--secondary);
}

/* ===== ORIENTATION OVERLAY ===== */
#orientation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text);
  font-family: var(--font-primary);
  text-align: center;
  padding: calc(var(--unit) * 3);
}

#orientation-overlay .message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--unit) * 3);
  max-width: 400px;
}

#orientation-overlay p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-light);
  font-weight: 400;
}

/* ===== BUTTON GROUP - Grid Layout ===== */
.button-group {
  display: flex;
  justify-content: center;
  gap: calc(var(--unit) * 2);
  margin-top: calc(var(--unit) * 4);
  flex-wrap: wrap;
}

.button-group .overlay-button {
  margin-top: 0;
  min-width: 160px;
}

.overlay-button.secondary {
  background-color: transparent;
  border: 2px solid var(--border);
  color: var(--text-light);
}

.overlay-button.secondary:hover {
  background-color: var(--border);
  border-color: var(--secondary);
  color: var(--text);
}

/* ===== ANIMATIONS - Subtle & Purposeful ===== */
.shake {
  animation: shake 0.4s ease both;
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-3px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(3px, 0, 0);
  }
}

/* ===== RESPONSIVE - Mobile Grid ===== */
@media (max-width: 640px) {
  :root {
    --sidebar-width: 90vw; /* Sidebar lebih lebar di mobile */
  }
  #about-button.floating-button {
    width: 44px;
    height: 44px;
    font-size: 14px;
    bottom: calc(var(--unit) * 2);
    right: calc(var(--unit) * 2);
  }

  #sidebar-content {
    padding: calc(var(--unit) * 2);
    padding-top: calc(var(--unit) * 7);
  }

  #close-sidebar-button {
    top: calc(var(--unit));
    right: calc(var(--unit));
    font-size: 1.75rem;
  }

  .screen-overlay {
    padding: calc(var(--unit) * 2);
  }

  .screen-overlay h1 {
    margin-bottom: calc(var(--unit));
  }

  .overlay-button {
    padding: calc(var(--unit) * 1.5) calc(var(--unit) * 4);
    font-size: 0.875rem;
  }

  .floating-button {
    width: 48px;
    height: 48px;
    font-size: 16px;
    bottom: calc(var(--unit) * 2);
    right: calc(var(--unit) * 2);
  }

  .floating-button .tooltip {
    width: 160px;
    right: 50%;
    transform: translateX(50%);
    text-align: center;
  }

  .floating-button:hover .tooltip {
    transform: translateX(50%);
  }

  .button-group {
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }

  .button-group .overlay-button {
    width: 100%;
  }
}

/* ===== PRINT - Preserve Clarity ===== */
@media print {
  .screen-overlay {
    background-color: white;
  }

  .floating-button,
  #VRButton {
    display: none;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  #about-button.floating-button {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }
  /* Perkecil padding utama overlay */
  .screen-overlay {
    padding: calc(var(--unit) * 1.5); /* 12px */
  }

  /* Perkecil font H1 dan marginnya */
  .screen-overlay h1 {
    /* Ganti 8vw (lebar) menjadi 8vh (tinggi) atau rem kecil */
    font-size: clamp(1.5rem, 8vh, 2.25rem);
    margin-bottom: var(--unit); /* 8px */
  }

  /* Perkecil font paragraf dan marginnya */
  .screen-overlay p {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: calc(var(--unit) * 2); /* 16px */
    max-width: 70%; /* Jaga agar tidak terlalu lebar */
  }

  /* Perkecil margin container input */
  .input-container {
    margin-top: calc(var(--unit) * 2); /* 16px */
    margin-bottom: calc(var(--unit) * 2); /* 16px */
  }

  .input-container input[type="text"] {
    font-size: 1rem;
    padding: var(--unit) 0;
  }

  /* Perkecil tombol */
  .overlay-button {
    padding: calc(var(--unit) * 1.25) calc(var(--unit) * 3); /* 10px 24px */
    font-size: 0.8rem;
  }

  /* Perkecil margin atas grup tombol */
  .button-group {
    margin-top: calc(var(--unit) * 2); /* 16px */
  }

  /* Atur progress bar agar tidak terlalu makan tempat */
  .progress-bar-container {
    margin-top: calc(var(--unit) * 2);
  }
  #loading-text {
    margin-top: calc(var(--unit) * 2);
    font-size: 0.8rem;
  }
  .spinner {
    width: 32px;
    height: 32px;
  }
}

/* Focus states for accessibility */
.overlay-button:focus,
.input-container input[type="text"]:focus,
.floating-button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

#close-sidebar-button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
