/* ==========================================================================
   KARYA KREATIFKU - Nature Branch & Foliage Curtain Reveal Animation
   ========================================================================== */

.curtain-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: radial-gradient(circle at center, #133320 0%, #0a1f13 70%, #05100a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s ease;
  visibility: visible;
  opacity: 1;
}

.curtain-overlay.curtain-opened {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Canvas Partikel Daun Gugur & Kunang-kunang */
#curtainCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Sayap Tirai Dahan Pokok Kiri & Kanan */
.curtain-gate {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 58%;
  z-index: 3;
  pointer-events: none;
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.4s ease;
  will-change: transform;
}

.curtain-gate-left {
  left: 0;
  transform-origin: top left;
}

.curtain-gate-right {
  right: 0;
  transform-origin: top right;
}

/* Bila Tirai Terbuka: Dahan bergerak ke sisi kiri & kanan */
.curtain-opened .curtain-gate-left {
  transform: translateX(-110%) rotate(-8deg) scale(1.05);
}

.curtain-opened .curtain-gate-right {
  transform: translateX(110%) rotate(8deg) scale(1.05);
}

/* SVG Dahan & Dedaun */
.branch-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.6));
}

/* Pusat Gerbang (Center Portal Card) */
.curtain-portal-card {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 540px;
  padding: 3rem 2.5rem;
  background: rgba(13, 33, 21, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1.5px solid rgba(82, 183, 136, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    0 0 45px rgba(82, 183, 136, 0.2),
    inset 0 0 25px rgba(82, 183, 136, 0.1);
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.9s ease;
  animation: floatPortal 6s ease-in-out infinite alternate;
}

@keyframes floatPortal {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-10px); }
}

.curtain-opened .curtain-portal-card {
  transform: scale(0.9) translateY(-60px);
  opacity: 0;
  pointer-events: none;
}

/* Bingkai Logo Bergaris Luar (Emblem with Outline) */
.portal-logo-emblem-wrap {
  position: relative;
  margin-bottom: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-logo-emblem-wrap::before {
  content: '';
  position: absolute;
  inset: -18px;
  background: radial-gradient(circle, rgba(82, 183, 136, 0.5) 0%, rgba(198, 155, 45, 0.2) 60%, transparent 80%);
  border-radius: 28px;
  animation: pulseAura 3.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes pulseAura {
  0% { transform: scale(0.95); opacity: 0.5; }
  100% { transform: scale(1.15); opacity: 0.9; }
}

.portal-logo-emblem {
  position: relative;
  z-index: 2;
  background: #ffffff;
  padding: 10px 18px;
  border-radius: 20px;
  border: 2.5px solid var(--c-gold-400);
  outline: 3.5px solid rgba(82, 183, 136, 0.5);
  outline-offset: 4px;
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.5),
    0 0 25px rgba(82, 183, 136, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.portal-logo-emblem:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 
    0 20px 42px rgba(0, 0, 0, 0.6),
    0 0 35px rgba(82, 183, 136, 0.5);
}

.portal-logo-img {
  height: 120px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.portal-tagline {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 3px;
  color: var(--c-gold-400);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.portal-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.75rem;
  letter-spacing: 1.5px;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.portal-desc {
  font-family: var(--font-literary);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--c-forest-100);
  margin-bottom: 2.2rem;
  line-height: 1.6;
}

/* Butang Buka Gerbang */
.btn-open-curtain {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1rem 2.5rem;
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--c-forest-600) 0%, var(--c-forest-500) 50%, var(--c-forest-400) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 
    0 10px 30px rgba(15, 36, 23, 0.6),
    0 0 25px rgba(82, 183, 136, 0.5);
  overflow: hidden;
  transition: all var(--transition-bounce);
}

.btn-open-curtain::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 30%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 70%
  );
  transform: rotate(25deg);
  animation: shineGleam 4s infinite linear;
}

@keyframes shineGleam {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(100%) rotate(25deg); }
}

.btn-open-curtain:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 
    0 15px 40px rgba(15, 36, 23, 0.8),
    0 0 35px rgba(82, 183, 136, 0.8);
  background: linear-gradient(135deg, var(--c-forest-500) 0%, var(--c-forest-400) 50%, var(--c-forest-300) 100%);
  color: #ffffff;
}

.btn-open-curtain:active {
  transform: translateY(1px) scale(0.98);
}

.btn-curtain-icon {
  font-size: 1.4rem;
  animation: rotateLeaf 3s ease-in-out infinite alternate;
}

@keyframes rotateLeaf {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(15deg); }
}

/* Butang Uji Tirai Semula (Re-experience Curtain Button in Nav) */
.nav-curtain-toggle {
  background: rgba(82, 183, 136, 0.15);
  border: 1px dashed var(--c-forest-400);
  color: var(--c-forest-800);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-curtain-toggle:hover {
  background: var(--c-forest-600);
  color: #ffffff;
  border-style: solid;
}
