:root {
  --gold: #ddd9b0;
  --gold-glow: rgba(221, 217, 176, 0.4);
  --bg-dark: #0e1b12;
  --text-light: #f3f1e4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: "Cormorant Garamond", serif;
  overflow: hidden;
  height: 100vh;
}

main {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Landing Background - Terang (unblurred, slightly dimmed for text readability) */
.bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(14, 27, 18, 0.3), transparent 35%, rgba(14, 27, 18, 0.75)), url("assets/elven-kingdom-hero.png") center/cover no-repeat;
  filter: none;
  transform: scale(1);
  transform-origin: center;
  transition: filter 1.5s ease, transform 1.5s ease;
}

body.entering .bg {
  filter: blur(10px) brightness(0.2);
  transform: scale(1.08);
}

/* Falling Leaves Effect */
.falling-leaves {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.8s ease;
}

body.entering .falling-leaves {
  /* Allow leaves to perform wind gust animation instead of fading out immediately */
  opacity: 1; 
}

.falling-leaves i {
  position: absolute;
  top: -12%;
  width: 13px;
  height: 21px;
  background: linear-gradient(135deg, #dfe39a, #718b45 62%, #415c30);
  border-radius: 100% 0 100% 0;
  opacity: 0.72;
  filter: drop-shadow(0 2px 2px #1b2b17);
  animation: leaf-fall linear infinite;
  transition: opacity 0.5s ease;
}

.falling-leaves i:nth-child(1) { left: 7%; animation-duration: 12s; animation-delay: -4s; }
.falling-leaves i:nth-child(2) { left: 18%; width: 9px; height: 15px; animation-duration: 16s; animation-delay: -10s; }
.falling-leaves i:nth-child(3) { left: 31%; animation-duration: 11s; animation-delay: -2s; }
.falling-leaves i:nth-child(4) { left: 45%; width: 10px; height: 16px; animation-duration: 14s; animation-delay: -8s; }
.falling-leaves i:nth-child(5) { left: 59%; animation-duration: 10s; animation-delay: -5s; }
.falling-leaves i:nth-child(6) { left: 70%; width: 9px; height: 14px; animation-duration: 15s; animation-delay: -12s; }
.falling-leaves i:nth-child(7) { left: 82%; animation-duration: 13s; animation-delay: -7s; }
.falling-leaves i:nth-child(8) { left: 91%; width: 10px; height: 17px; animation-duration: 17s; animation-delay: -9s; }
.falling-leaves i:nth-child(9) { left: 38%; width: 8px; height: 13px; animation-duration: 18s; animation-delay: -15s; }

/* Gust wind animation for leaves */
.falling-leaves.gust i {
  animation-play-state: paused !important; /* Stop the normal falling animation */
}

.falling-leaves.gust i:nth-child(1) { animation: leaf-gust-1 1.4s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(2) { animation: leaf-gust-2 1.6s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(3) { animation: leaf-gust-3 1.3s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(4) { animation: leaf-gust-4 1.5s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(5) { animation: leaf-gust-5 1.4s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(6) { animation: leaf-gust-6 1.7s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(7) { animation: leaf-gust-7 1.3s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(8) { animation: leaf-gust-8 1.6s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
.falling-leaves.gust i:nth-child(9) { animation: leaf-gust-9 1.5s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }

@keyframes leaf-gust-1 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(450px, 110vh) rotate(540deg) scale(0.5); opacity: 0; } }
@keyframes leaf-gust-2 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(600px, 110vh) rotate(720deg) scale(0.4); opacity: 0; } }
@keyframes leaf-gust-3 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(350px, 110vh) rotate(600deg) scale(0.6); opacity: 0; } }
@keyframes leaf-gust-4 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(550px, 110vh) rotate(800deg) scale(0.5); opacity: 0; } }
@keyframes leaf-gust-5 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(400px, 110vh) rotate(480deg) scale(0.7); opacity: 0; } }
@keyframes leaf-gust-6 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(700px, 110vh) rotate(900deg) scale(0.4); opacity: 0; } }
@keyframes leaf-gust-7 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(500px, 110vh) rotate(640deg) scale(0.5); opacity: 0; } }
@keyframes leaf-gust-8 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(650px, 110vh) rotate(850deg) scale(0.6); opacity: 0; } }
@keyframes leaf-gust-9 { 0% { transform: translateY(0) rotate(0); opacity: 0.72; } 100% { transform: translate(480px, 110vh) rotate(580deg) scale(0.5); opacity: 0; } }

@keyframes leaf-fall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0);
    opacity: 0;
  }
  8% {
    opacity: 0.75;
  }
  50% {
    transform: translate3d(55px, 52vh, 0) rotate(220deg);
  }
  100% {
    transform: translate3d(-45px, 115vh, 0) rotate(520deg);
    opacity: 0;
  }
}

/* Header & Logo */
header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 35px;
  z-index: 10;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.logo {
  text-align: center;
  text-decoration: none;
  color: var(--text-light);
  font-family: "Cinzel", serif;
  font-size: 32px;
  letter-spacing: 2px;
}

.logo strong {
  display: block;
  font-weight: 600;
}

.logo small {
  display: block;
  font-size: 11px;
  letter-spacing: 4px;
  margin-top: 8px;
  color: var(--gold);
  text-transform: uppercase;
}

/* Hero Section */
.hero {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 10;
}

.fade-in-text {
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero p {
  font-family: "Cinzel", serif;
  font-size: 18px;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--gold);
  opacity: 0.85;
}

.hero h1 {
  font-family: "Cinzel", serif;
  font-size: clamp(65px, 8vw, 130px);
  margin: 0;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  font-weight: 500;
}

.hero h2 {
  font-family: "Cinzel", serif;
  font-size: clamp(18px, 2.5vw, 32px);
  letter-spacing: 8px;
  text-transform: uppercase;
  margin: 5px 0 15px;
  font-weight: 400;
  opacity: 0.9;
}

.hero i {
  color: var(--gold);
  margin: 20px 0;
  font-style: normal;
  font-size: 14px;
  letter-spacing: 2px;
  opacity: 0.7;
}

.hero article {
  font-size: clamp(16px, 1.8vw, 21px);
  line-height: 1.8;
  max-width: 650px;
  color: rgba(243, 241, 228, 0.85);
}

/* Enter Button (Centered and Premium) */
.enter {
  margin: 45px 0 20px;
  min-width: 320px;
  padding: 16px 30px;
  background: linear-gradient(135deg, #faf9ed, #c8cbb5, #f1f0df);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #344631;
  text-decoration: none;
  font-family: "Cinzel", serif;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 600;
  border-radius: 2px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
  transform: scale(1);
  opacity: 1;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              box-shadow 0.3s ease, 
              background 0.3s ease,
              color 0.3s ease,
              opacity 0.6s ease;
  cursor: pointer;
}

.enter:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #ffffff, #e1e3ce, #ffffff);
  box-shadow: 0 8px 30px var(--gold-glow), 0 0 15px var(--gold-glow);
  color: #1e2b1c;
}

.enter.clicked {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* Footer styling */
footer {
  text-align: center;
  padding: 20px;
  z-index: 10;
  font-family: "Cinzel", serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(243, 241, 228, 0.5);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Heavy Transition Fog Overlay */
.transition-fog {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.transition-fog-inner {
  position: absolute;
  inset: -50px;
  background: radial-gradient(circle at center, rgba(14, 27, 18, 0.98), rgba(7, 14, 9, 1));
  filter: blur(10px);
  opacity: 0;
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.entering .transition-fog {
  pointer-events: auto;
}

body.entering .transition-fog-inner {
  opacity: 1;
}

/* Fog transition layers */
.transition-fog-layer {
  position: absolute;
  inset: -100px;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fog-layer-1 {
  background: radial-gradient(circle at 10% 20%, rgba(14, 27, 18, 0.7), transparent 45%),
              radial-gradient(circle at 80% 30%, rgba(71, 92, 48, 0.5), transparent 50%);
  filter: blur(40px);
  transform: scale(0.8) translate(-10%, -10%);
}

.fog-layer-2 {
  background: radial-gradient(circle at 90% 80%, rgba(14, 27, 18, 0.8), transparent 45%),
              radial-gradient(circle at 20% 70%, rgba(52, 70, 49, 0.6), transparent 50%);
  filter: blur(50px);
  transform: scale(0.9) translate(10%, 10%);
}

.fog-layer-3 {
  background: radial-gradient(circle at 50% 50%, rgba(14, 27, 18, 0.85), transparent 60%),
              radial-gradient(circle at 40% 60%, rgba(71, 92, 48, 0.4), transparent 45%);
  filter: blur(35px);
  transform: scale(0.7) translateY(20%);
}

/* Entering state for fog layers */
body.entering .transition-fog-layer {
  opacity: 1;
}

body.entering .fog-layer-1 {
  transform: scale(1.1) translate(0, 0);
  transition: transform 1.4s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 1.2s ease;
  animation: fog-swirl-1 20s linear infinite 1.2s;
}

body.entering .fog-layer-2 {
  transform: scale(1.15) translate(0, 0);
  transition: transform 1.5s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 1.3s ease;
  animation: fog-swirl-2 24s linear infinite 1.3s;
}

body.entering .fog-layer-3 {
  transform: scale(1.2) translateY(0);
  transition: transform 1.6s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 1.4s ease;
  animation: fog-swirl-3 18s linear infinite 1.4s;
}

@keyframes fog-swirl-1 {
  0% { transform: scale(1.1) rotate(0deg) translate(0, 0); }
  50% { transform: scale(1.15) rotate(5deg) translate(-20px, 10px); }
  100% { transform: scale(1.1) rotate(0deg) translate(0, 0); }
}

@keyframes fog-swirl-2 {
  0% { transform: scale(1.15) rotate(0deg) translate(0, 0); }
  50% { transform: scale(1.1) rotate(-6deg) translate(20px, -15px); }
  100% { transform: scale(1.15) rotate(0deg) translate(0, 0); }
}

@keyframes fog-swirl-3 {
  0% { transform: scale(1.2) rotate(0deg) translate(0, 0); }
  50% { transform: scale(1.25) rotate(4deg) translate(-10px, -20px); }
  100% { transform: scale(1.2) rotate(0deg) translate(0, 0); }
}

/* Fade Out States */
.fade-out-element {
  opacity: 0 !important;
  transform: translateY(-20px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Side panels (gate) closing animation */
.transition-fog .fog-side-left, 
.transition-fog .fog-side-right {
  position: absolute;
  top: -10%;
  bottom: -10%;
  width: 60%;
  background: radial-gradient(circle at center, rgba(14, 27, 18, 0.98), rgba(7, 14, 9, 1));
  filter: blur(20px);
  z-index: 105;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.transition-fog .fog-side-left {
  left: -10%;
  transform: translateX(-110%);
}

.transition-fog .fog-side-right {
  right: -10%;
  transform: translateX(110%);
}

body.entering .transition-fog .fog-side-left {
  transform: translateX(0);
}

body.entering .transition-fog .fog-side-right {
  transform: translateX(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 55px;
  }
  .enter {
    min-width: 80%;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fog-layer {
    animation: none !important;
  }
}
