/* ARYCHITECT — landing page 3D (hanya aktif saat html.has-3d).
   Palet: limestone #F2F0EA, ivory #FAF9F5, charcoal #252725, graphite #171B19,
   sage #8D9788, stone #C9C5B9, muted #4E534E. */

.scene3d-stage,
.scene3d-fade,
.scene3d-loader,
.scene3d-rail { display: none; }

/* ---------- Stage (canvas) ---------- */
html.has-3d .scene3d-stage {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--limestone, #F2F0EA);
  transition: filter 600ms ease, opacity 600ms ease;
}
html.has-3d .scene3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
html.has-3d .scene3d-stage.is-dimmed {
  filter: saturate(0.85) brightness(0.92);
}
html.has-3d .scene3d-stage.is-form-focus {
  filter: blur(6px) saturate(0.7) brightness(0.82);
}

/* ---------- Fade ivory antar bangunan ---------- */
html.has-3d .scene3d-fade {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ivory, #FAF9F5);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Loader ---------- */
html.has-3d .scene3d-loader {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--limestone, #F2F0EA);
  overflow: hidden;
  transition: opacity 700ms ease, visibility 700ms ease;
}
html.has-3d .scene3d-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.scene3d-loader-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: blur(18px) saturate(0.8);
  transform: scale(1.08);
}
.scene3d-loader-inner {
  position: relative;
  text-align: center;
  color: var(--charcoal, #252725);
  padding: 0 1.5rem;
}
.scene3d-loader-text {
  margin-top: 0.75rem;
  font-size: clamp(1.4rem, 2.4vw, 2.2rem);
  font-style: italic;
  font-variant-numeric: tabular-nums;
}
.scene3d-loader-bar {
  display: block;
  margin: 1.4rem auto 0;
  width: min(16rem, 60vw);
  height: 1px;
  background: var(--stone, #C9C5B9);
  position: relative;
  overflow: hidden;
}
.scene3d-loader-bar i {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--sage, #8D9788);
  transition: transform 240ms ease;
}

.scene3d-loader-skip {
  margin-top: 1.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #4E534E);
  border-bottom: 1px solid var(--stone, #C9C5B9);
  padding-bottom: 0.15rem;
  background: none;
}
.scene3d-loader-skip:hover { color: var(--charcoal, #252725); border-color: var(--charcoal, #252725); }

html.has-3d .scene3d-fade.is-waiting { opacity: 1 !important; }

/* ---------- Track & panel bab ---------- */
html.has-3d .scene3d-track {
  position: relative;
  height: calc(var(--scene3d-len, 900) * 1vh);
}
html.has-3d .chapter-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  background: transparent !important;
  padding-top: calc(var(--header-height, 4.5rem) + 1.25rem);
  will-change: opacity;
}
html.has-3d .chapter-panel.is-active { pointer-events: auto; }
html.has-3d .hero.chapter-panel {
  display: block;
  padding-top: 0;
  opacity: 1;
}

/* ---------- Hero di mode 3D ---------- */
html.has-3d .hero {
  background: transparent;
}
html.has-3d .hero .hero-frame,
html.has-3d .hero .hero-overlay,
html.has-3d .hero picture {
  display: none;
}
html.has-3d .hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(23, 27, 25, 0.55) 0%, rgba(23, 27, 25, 0.25) 38%, rgba(23, 27, 25, 0) 62%),
    linear-gradient(180deg, rgba(23, 27, 25, 0.38) 0%, rgba(23, 27, 25, 0) 34%, rgba(23, 27, 25, 0) 52%, rgba(23, 27, 25, 0.62) 100%);
}

/* Navbar: pastikan terbaca di atas scene terang saat masih transparan */
html.has-3d #siteNav:not(.is-solid):not(.is-menu-open) {
  background: linear-gradient(180deg, rgba(23, 27, 25, 0.28), rgba(23, 27, 25, 0));
}

/* ---------- Kartu panel melayang ---------- */
html.has-3d .chapter-panel .chapter-card {
  position: relative;
  width: 100%;
  max-height: calc(100svh - var(--header-height, 4.5rem) - 3rem);
  overflow: hidden;
  padding: clamp(1.4rem, 2.6vw, 2.6rem);
  background: rgba(250, 249, 245, 0.86);
  border: 1px solid rgba(201, 197, 185, 0.7);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  box-shadow: 0 30px 80px -40px rgba(23, 27, 25, 0.45);
  will-change: transform;
}
html.has-3d .chapter-panel[data-tone="dark"] .chapter-card {
  background: rgba(23, 27, 25, 0.86);
  border-color: rgba(250, 249, 245, 0.08);
}
@media (min-width: 1024px) {
  html.has-3d .chapter-panel[data-card="wide"] { align-items: flex-end; padding-bottom: 6vh; }
}
html.has-3d .chapter-panel[data-card="right"] .chapter-card { max-width: 46rem; margin-left: auto; margin-right: clamp(6.5rem, 9vw, 9rem); }
html.has-3d .chapter-panel[data-card="left"] .chapter-card { max-width: 40rem; margin-right: auto; margin-left: clamp(1rem, 5vw, 6rem); }
html.has-3d .chapter-panel[data-card="wide"] .chapter-card { max-width: min(1200px, calc(100% - 15rem)); margin-left: auto; margin-right: clamp(6.5rem, 9vw, 9rem); }
html.has-3d .chapter-panel .editorial-text-reveal,
html.has-3d .chapter-panel .service-row-reveal { opacity: 1 !important; }

/* Tentang: gambar diganti scene, kutipan jadi fokus */
html.has-3d #tentang .about-split-media { display: none; }
html.has-3d #tentang .chapter-card { display: block; min-height: 0; padding: 0; }
html.has-3d #tentang .chapter-card > div { padding: clamp(1.6rem, 3vw, 3rem); }
html.has-3d #tentang blockquote { font-size: clamp(1.8rem, 3vw, 2.9rem); line-height: 1.15; }

/* Karya: kartu lebih pendek agar 3 proyek muat */
html.has-3d #karya-terpilih .project-card-media { aspect-ratio: 16 / 10; max-height: 22vh; }
html.has-3d #karya-terpilih .project-card h3 {
  font-size: 1.15rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.has-3d #karya-terpilih .mt-12 { margin-top: 1.5rem; }
html.has-3d #karya-terpilih h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
html.has-3d #karya-terpilih .grid.lg\:grid-cols-\[1fr_1fr\] { grid-template-columns: 1fr; }
/* Angkat elemen dalam, bukan slot: area hover tetap diam (slot yang bergerak memicu enter/leave berulang). */
html.has-3d #karya-terpilih .project-slot > * { transition: transform 300ms ease; }
@media (hover: hover) {
  html.has-3d #karya-terpilih .project-slot:hover > * { transform: translateY(-4px); }
}

/* Teks CMS panjang tidak meluapkan panel */
html.has-3d .chapter-panel p.leading-relaxed {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.has-3d .chapter-panel .service-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.has-3d #nilai .mt-14 { margin-top: 2rem; padding-top: 1.5rem; }
html.has-3d #nilai article p.text-\[0\.68rem\] {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  letter-spacing: 0;
  line-height: 1;
}
html.has-3d .chapter-panel .service-cards > li,
html.has-3d #nilai .grid > article { will-change: transform; }

/* ---------- Konsultasi & footer di atas canvas setelah p = 1 ---------- */
html.has-3d #konsultasi,
html.has-3d footer {
  position: relative;
  z-index: 5;
}
html.has-3d #konsultasi {
  background: rgba(242, 240, 234, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ---------- Navbar adaptif + auto-hide (home saja) ---------- */
html.has-3d #siteNav {
  transition: background-color 320ms ease, border-color 320ms ease, color 320ms ease, transform 420ms cubic-bezier(.2,.7,.2,1), opacity 320ms ease;
}
html.has-3d #siteNav.scene3d-nav-hidden {
  transform: translateY(calc(-100% - 1rem));
  opacity: 0;
}
html.has-3d #siteNav.is-solid.is-on-dark:not(.is-menu-open) {
  background: rgba(23, 27, 25, 0.86);
  border-color: rgba(250, 249, 245, 0.08);
}
html.has-3d #siteNav.is-solid.is-on-dark:not(.is-menu-open) .brand,
html.has-3d #siteNav.is-solid.is-on-dark:not(.is-menu-open) .nav-link,
html.has-3d #siteNav.is-solid.is-on-dark:not(.is-menu-open) .menu-btn { color: var(--ivory, #FAF9F5); }
html.has-3d #siteNav.is-solid.is-on-dark:not(.is-menu-open) .nav-cta { border-color: rgba(250, 249, 245, 0.55); color: var(--ivory, #FAF9F5); }

/* ---------- Rel bab ---------- */
html.has-3d .scene3d-rail:not([hidden]) {
  display: flex;
  position: fixed;
  right: clamp(0.75rem, 1.6vw, 1.75rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  gap: 0.9rem;
  color: var(--charcoal, #252725);
  transition: color 320ms ease;
}
html.has-3d .scene3d-rail.is-on-dark { color: var(--ivory, #FAF9F5); }
.scene3d-rail-track {
  position: relative;
  width: 1px;
  background: rgba(141, 151, 136, 0.35);
}
.scene3d-rail-track i {
  position: absolute;
  inset: 0;
  transform-origin: top center;
  transform: scaleY(0);
  background: var(--sage, #8D9788);
}
.scene3d-rail ol { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.scene3d-rail-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.9rem;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.55;
  transition: opacity 220ms ease;
}
.scene3d-rail-num { font-variant-numeric: tabular-nums; }
.scene3d-rail-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 320ms ease;
}
.scene3d-rail-link:hover,
.scene3d-rail-link:focus-visible,
.scene3d-rail-link[aria-current] { opacity: 1; }
.scene3d-rail-link[aria-current] .scene3d-rail-num { color: var(--sage, #8D9788); }
.scene3d-rail:hover .scene3d-rail-label,
.scene3d-rail:focus-within .scene3d-rail-label,
.scene3d-rail-link[aria-current] .scene3d-rail-label { max-width: 8rem; }

/* ---------- Mobile / mode ringan ---------- */
@media (max-width: 1023px) {
  html.has-3d .chapter-panel { align-items: flex-end; padding-bottom: 1rem; }
  html.has-3d .chapter-panel[data-card] .chapter-card {
    max-width: none;
    margin: 0 0.75rem;
    max-height: calc(100svh - var(--header-height, 4.5rem) - 2rem);
    padding: 1.25rem;
  }
  html.has-3d #karya-terpilih div:has(> .project-slot) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    grid-template-columns: none;
    gap: 0.9rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  html.has-3d #karya-terpilih .project-slot { scroll-snap-align: start; }
  html.has-3d #karya-terpilih .project-card-media { max-height: 18vh; }
  /* Daftar yang bisa di-scroll di dalam panel. overscroll-behavior: auto → saat mentok di ujung,
     scroll diteruskan ke halaman sehingga parallax/kamera tetap berjalan. */
  html.has-3d .service-cards,
  html.has-3d #nilai .grid {
    max-height: 46svh;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 2.25rem), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 2.25rem), transparent 100%);
    padding-bottom: 1.5rem;
  }
  html.has-3d #nilai .grid { gap: 1.25rem; max-height: 44svh; }
  html.has-3d #nilai .mt-14 { margin-top: 1.25rem; padding-top: 1rem; }
  html.has-3d #nilai h2 { font-size: clamp(1.9rem, 8vw, 2.4rem); }
  html.has-3d #nilai article p.text-\[0\.68rem\] { font-size: 2rem; }
  html.has-3d .chapter-panel p.leading-relaxed { -webkit-line-clamp: 3; }
  html.has-3d .scene3d-rail:not([hidden]) {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    height: 2px;
  }
  html.has-3d .scene3d-rail ol { display: none; }
  html.has-3d .scene3d-rail-track { width: 100%; height: 2px; }
  html.has-3d .scene3d-rail-track i { transform-origin: left center; }
}

/* ---------- Mode debug ---------- */
html.has-3d.scene3d-orbit .scene3d-stage { pointer-events: auto; }
html.has-3d.scene3d-orbit .chapter-panel,
html.has-3d.scene3d-orbit .scene3d-track { pointer-events: none !important; }
.scene3d-debug-hud {
  position: fixed;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 95;
  font: 11px/1.5 ui-monospace, Consolas, monospace;
  color: var(--ivory, #FAF9F5);
  background: rgba(23, 27, 25, 0.82);
  padding: 0.5rem 0.75rem;
  white-space: pre;
  pointer-events: none;
}
