/* ==========================================================================
   Vila Rizki Insaani — Site Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset & Base
   --------------------------------------------------------------------------
   Hide scrollbar globally; override for .custom-scrollbar scope only.
   *-overflow-style and scrollbar-width on * keeps Firefox/Presto clean.
   ::-webkit-scrollbar hidden on body, visible inside .custom-scrollbar. */

* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html {
  scroll-behavior: smooth;
}

body::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------------------------------------------
   2. Typography & Icon Font
   --------------------------------------------------------------------------
   Material Symbols Outlined — FILL 0 per design system. */

.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}

/* --------------------------------------------------------------------------
   3. Layout Helpers
   --------------------------------------------------------------------------
   Utility classes for hero gradient overlay and frosted-glass panels. */

.hero-gradient {
  background: linear-gradient(180deg,
      rgba(248, 249, 250, 0) 0%,
      rgba(248, 249, 250, 1) 100%);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------------------
   4. Scrollbar — Scoped Overrides
   --------------------------------------------------------------------------
   Global hidden (above). Modal content & dialog need thin visible track. */

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #bec9c1;
  border-radius: 10px;
}

dialog::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

dialog::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

dialog::-webkit-scrollbar-thumb {
  background: rgba(0, 81, 55, 0.2);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 300ms ease;
}

dialog::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 81, 55, 0.45);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* --------------------------------------------------------------------------
   5. Animations — Keyframes
   --------------------------------------------------------------------------
   Core animation keyframes used across components: fade-in, heartbeat pulse,
   modal transitions. */

.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.3s ease-out forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hypnoticHeartbeat {

  0%,
  100% {
    box-shadow:
      0 10px 25px -5px rgba(37, 211, 102, 0.4),
      0 8px 16px -8px rgba(0, 0, 0, 0.1),
      0 0px 0px 0px rgba(37, 211, 102, 0.3);
  }

  50% {
    box-shadow:
      0 10px 30px -3px rgba(37, 211, 102, 0.6),
      0 12px 24px -6px rgba(0, 0, 0, 0.15),
      0 0px 0px 18px rgba(37, 211, 102, 0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  to {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes backdropFadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   6. Components — Hero CTA 3D Button
   --------------------------------------------------------------------------
   Primary call-to-action button with perspective-based 3D tilt, spotlight
   radial-gradient, and depth layering via CSS custom properties. */

#hero-cta-btn {
  perspective: 1000px;
  transform-style: preserve-3d;
  -webkit-font-smoothing: antialiased;
  will-change: transform, box-shadow;
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale3d(var(--scale, 1), var(--scale, 1), 1);
  transition:
    transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 400ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow,
      0 10px 15px -3px rgba(0, 81, 55, 0.1),
      0 4px 6px -4px rgba(0, 0, 0, 0.1));
}

#hero-cta-btn>span:last-child {
  transform: translateZ(var(--tz, 6px));
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   7. Components — 3D Tilt Card System
   --------------------------------------------------------------------------
   Card components with mouse-follow 3D tilt, depth shadows, and smooth
   transitions driven by CSS custom properties set via JS. */

.tilt-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  will-change: transform, box-shadow;
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale3d(var(--scale, 1), var(--scale, 1), 1);
  transition:
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 600ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 600ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow,
      0 4px 6px -1px rgba(0, 0, 0, 0.05),
      0 2px 4px -1px rgba(0, 0, 0, 0.03));
}

.tilt-card>* {
  transform: translateZ(var(--tz, 0px));
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 300ms cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tilt-card img {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* --------------------------------------------------------------------------
   8. Components — Scroll Sweep-in
   --------------------------------------------------------------------------
   Cards start invisible with a perspective tilt; IntersectionObserver adds
   .in-view to sweep them into place, then removes .scroll-intro-card so
   hover-tilt can take over. */

.scroll-intro-card {
  opacity: 0;
  will-change: opacity, transform;
  transform: perspective(1000px) rotateX(8deg) translateY(35px) scale(0.97) !important;
  transition:
    opacity 700ms cubic-bezier(0.25, 1, 0.5, 1),
    transform 700ms cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.scroll-intro-card.in-view {
  opacity: 1;
  transform: perspective(1000px) rotateX(0deg) translateY(0px) scale(1) !important;
}

/* --------------------------------------------------------------------------
   9. Components — Aspect Ratio Anti-flicker Mask
   --------------------------------------------------------------------------
   Prevents layout flicker on aspect-ratio images by forcing GPU isolation
   and compositing via translateZ and mask-image. */

.aspect-\[4\/5\],
.aspect-\[4\/3\] {
  isolation: isolate;
  transform: translateZ(0);
  -webkit-transform: translate3d(0, 0, 0);
  mask-image: -webkit-radial-gradient(white, black);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

/* --------------------------------------------------------------------------
   10. Components — WhatsApp Floating Pulse
   --------------------------------------------------------------------------
   Pulsating green glow animation on the floating WhatsApp contact button. */

.hypnotic-pulse {
  animation: hypnoticHeartbeat 4s ease-in-out infinite;
  will-change: box-shadow;
}

/* --------------------------------------------------------------------------
   11. Components — Dialog Modal
   --------------------------------------------------------------------------
   Native <dialog> element with backdrop blur, animated open/close via
   keyframes, and closing-class pattern for smooth exit transitions. */

dialog::backdrop {
  backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.3s ease-out forwards;
}

dialog[open] {
  animation: modalFadeIn 0.3s ease-out forwards;
}

dialog.closing::backdrop {
  animation: backdropFadeOut 0.3s ease-out forwards;
}

dialog.closing {
  animation: modalFadeOut 0.3s ease-out forwards;
}

/* --------------------------------------------------------------------------
   12. Components — Denah Floor Plan Crossfade
   --------------------------------------------------------------------------
   Dual-image crossfade system: house and denah images are stacked.
   Opacity transitions provide buttery smooth swaps in both directions.
   The denah-peek overlay still bounces in on hover for preview. */

.unit-house-img {
  transition:
    opacity 500ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 300ms ease;
}

.unit-house-img.denah-hidden {
  opacity: 0;
}

.unit-denah-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  transition:
    opacity 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.unit-denah-img.denah-visible {
  opacity: 1;
}

.denah-peek {
  position: absolute;
  bottom: 5%;
  right: 3%;
  width: 58%;
  background: white;
  border-radius: 14px;
  padding: 5px;
  opacity: 0;
  z-index: 5;
  pointer-events: none;
  transform: translateY(28px) translateX(12px) rotate(-4deg) scale(0.85);
  transition:
    opacity 650ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 650ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 8px 32px rgba(0, 81, 55, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.08);
}

.group:hover .denah-peek {
  opacity: 1;
  transform: translateY(0) translateX(0) rotate(0.5deg) scale(1);
}

.group.denah-active .denah-peek {
  opacity: 0 !important;
  transform: translateY(28px) translateX(12px) rotate(-4deg) scale(0.85) !important;
}

.denah-label {
  display: block;
  text-align: center;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #005137;
  padding: 2px 0 0 0;
}

/* --------------------------------------------------------------------------
   13. Components — Editorial Navigation (homunculus.jp-inspired)
   --------------------------------------------------------------------------
   Ultra-minimal floating header: no box, no border, no shadow over hero.
   Thin uppercase tracked links. Subtle backdrop when scrolled. */

#top-nav {
  letter-spacing: 0.02em;
}

#top-nav .nav-link {
  position: relative;
}

#top-nav .nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background: currentColor;
  transition:
    width 300ms cubic-bezier(0.25, 0.8, 0.25, 1),
    left 300ms cubic-bezier(0.25, 0.8, 0.25, 1);
}

#top-nav .nav-link:hover::after {
  width: 100%;
  left: 0;
}

/* --------------------------------------------------------------------------
   14. Components — Secure Viewer Modals
   --------------------------------------------------------------------------
   Katalog PDF and Peta image viewer dialogs with anti-download overlays. */

.viewer-modal {
  max-height: 90vh;
  caret-color: transparent;
}

.viewer-modal .peta-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
  overflow: hidden;
}

.viewer-modal .peta-container img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   15. Components — Preload Overlay
   --------------------------------------------------------------------------
   Interactive loading screen with sakura petals and brand identity.
   Sakura petals drift across during load; brand logo + "Memuat…" pulse.
   Fades out once everything is loaded, revealing the site underneath. */

#preload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: white;
  transition: opacity 600ms ease-out;
}

#preload-overlay.reveal {
  opacity: 0;
  pointer-events: none;
}

#preload-sakura {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

#preload-overlay .preload-brand {
  position: relative;
  z-index: 10;
}

#preload-overlay .preload-logo {
  opacity: 0;
  transition: opacity 500ms ease-out 200ms;
}

#preload-overlay .preload-logo.loaded {
  opacity: 0.5;
}

#preload-overlay .preload-text {
  animation: preloadPulse 2s ease-in-out infinite;
}

@keyframes preloadPulse {

  0%,
  100% {
    opacity: 0.25;
  }

  50% {
    opacity: 0.5;
  }
}

/* --------------------------------------------------------------------------
   16. Components — Sakura Petal Animation
   --------------------------------------------------------------------------
   Pure CSS/JS sakura petals that drift slowly across the hero section.
   Each petal is a small rounded div with keyframe animations for falling
   and lateral swaying. Custom properties (--fall-dur, --sway-amp,
   --sway-dur) allow per-petal variation set via JS. */

.sakura-petal {
  position: absolute;
  border-radius: 50% 0 50% 0;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation:
    sakuraFall var(--fall-dur, 14s) linear infinite,
    sakuraSway var(--sway-dur, 5s) ease-in-out infinite alternate,
    sakuraFade var(--fall-dur, 14s) linear infinite;
}

@keyframes sakuraFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translateY(calc(100vh + 40px)) rotate(720deg);
    opacity: 0;
  }
}

@keyframes sakuraSway {
  0% {
    margin-left: calc(var(--sway-amp, 20px) * -1);
  }

  100% {
    margin-left: var(--sway-amp, 20px);
  }
}

@keyframes sakuraFade {
  0% {
    opacity: 0;
  }

  5% {
    opacity: 0.7;
  }

  85% {
    opacity: 0.7;
  }

  100% {
    opacity: 0;
  }
}