/* muhan.dev - Fairycore Neon Metropolis */
:root {
  --deep-night: #0d0f1a;
  --twilight-concrete: #1e2233;
  --aurora-green: #39ff9f;
  --aurora-pink: #c77dff;
  --aurora-cyan: #48d1e8;
  --warm-interior: #fff0d4;
  --moss-soft: #7ec8a0;
  --concrete-gray: #3a3d4a;
  --mid-purple: #2d1b69;
  --deep-purple: #1a1040;
  --elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-snap-type: y mandatory;
  overflow-x: hidden;
}

body {
  background: var(--deep-night);
  color: var(--warm-interior);
  font-family: 'Nunito', sans-serif;
  font-weight: 400;
  line-height: 1.75;
  overflow-x: hidden;
}

/* Vine Progress Indicator */
.vine-progress {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 60vh;
  background: rgba(57, 255, 159, 0.08);
  z-index: 100;
  border-radius: 2px;
}

.vine-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, var(--aurora-green), var(--aurora-pink));
  border-radius: 2px;
  transition: height 0.4s ease-out;
  box-shadow: 0 0 8px rgba(57, 255, 159, 0.4), 0 0 20px rgba(57, 255, 159, 0.15);
}

.vine-bud {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--deep-purple);
  border: 1.5px solid rgba(57, 255, 159, 0.3);
  transition: all 0.4s var(--elastic);
  cursor: pointer;
}

.vine-bud[data-floor="0"] { bottom: 0%; }
.vine-bud[data-floor="1"] { bottom: 25%; }
.vine-bud[data-floor="2"] { bottom: 50%; }
.vine-bud[data-floor="3"] { bottom: 75%; }
.vine-bud[data-floor="4"] { bottom: 100%; }

.vine-bud.active {
  background: var(--aurora-green);
  border-color: var(--aurora-green);
  box-shadow: 0 0 12px rgba(57, 255, 159, 0.6);
  animation: budPulse 2s ease-in-out infinite;
}

@keyframes budPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(57, 255, 159, 0.4); }
  50% { box-shadow: 0 0 18px rgba(57, 255, 159, 0.8); }
}

/* Firefly Canvas */
#fireflies {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

/* Floor Sections */
.floor {
  position: relative;
  width: 100vw;
  height: 100vh;
  scroll-snap-align: start;
  overflow: hidden;
}

/* Korean Watermarks */
.korean-watermark {
  position: absolute;
  font-size: 40vw;
  font-weight: 700;
  opacity: 0.03;
  color: var(--warm-interior);
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  z-index: 1;
}

/* Moss Border */
.moss-border {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--aurora-green) 10%,
    var(--moss-soft) 30%,
    transparent 50%,
    var(--aurora-green) 70%,
    var(--moss-soft) 90%,
    transparent 100%
  );
  opacity: 0.5;
  box-shadow: 0 0 15px rgba(57, 255, 159, 0.3), 0 0 30px rgba(57, 255, 159, 0.1);
}

/* Floor 0 - Hero */
.floor--hero {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 120%, var(--mid-purple) 0%, var(--deep-purple) 40%, var(--deep-night) 80%);
}

.hero-content {
  text-align: center;
  z-index: 10;
  opacity: 0;
  animation: heroFadeIn 1.5s ease forwards 0.3s;
}

@keyframes heroFadeIn {
  to { opacity: 1; }
}

.hero-title {
  font-family: 'Space Mono', monospace;
  font-size: clamp(4rem, 15vw, 12rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s var(--elastic), color 0.3s ease, text-shadow 0.3s ease;
}

.letter:hover {
  transform: translateY(-5px) !important;
}

.letter[data-index="0"] { color: var(--aurora-pink); }
.letter[data-index="1"] { color: var(--warm-interior); }
.letter[data-index="2"] { color: var(--aurora-green); }
.letter[data-index="3"] { color: var(--aurora-cyan); }
.letter[data-index="4"] { color: var(--aurora-pink); }
.letter[data-index="5"] { color: var(--concrete-gray); }
.letter[data-index="6"] { color: var(--aurora-green); }
.letter[data-index="7"] { color: var(--aurora-cyan); }
.letter[data-index="8"] { color: var(--moss-soft); }

/* Floor 1 - Skyline */
.floor--skyline {
  background: var(--deep-night);
  display: flex;
  align-items: center;
  justify-content: center;
}

.aurora-sky-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, #0d0f1a 0%, #1a1040 20%, #2d1b69 40%, #c77dff 55%, #48d1e8 70%, #39ff9f 85%, #0d0f1a 100%);
  opacity: 0.3;
  z-index: 1;
}

.skyline-letterbox {
  position: relative;
  width: 100%;
  height: 60vh;
  z-index: 2;
  overflow: hidden;
}

.cityscape {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1vw;
  width: 100%;
  height: 100%;
}

.building {
  width: var(--w);
  height: var(--h);
  background: var(--shade);
  border-top: 2px solid rgba(199, 125, 255, 0.15);
  position: relative;
  flex-shrink: 0;
}

.building::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  width: 70%;
  height: 80%;
  background-image:
    radial-gradient(circle, var(--warm-interior) 1px, transparent 1px),
    radial-gradient(circle, var(--aurora-pink) 1px, transparent 1px),
    radial-gradient(circle, var(--aurora-cyan) 1px, transparent 1px);
  background-size: 8px 12px, 12px 16px, 10px 20px;
  background-position: 0 0, 4px 6px, 2px 3px;
  opacity: 0.3;
  animation: windowFlicker 8s ease-in-out infinite alternate;
}

@keyframes windowFlicker {
  0%, 100% { opacity: 0.3; }
  25% { opacity: 0.5; }
  50% { opacity: 0.2; }
  75% { opacity: 0.6; }
}

/* Floor 2 - Story (Typewriter) */
.floor--story {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--deep-night) 0%, #1a1040 40%, var(--twilight-concrete) 100%);
}

.story-content {
  position: relative;
  z-index: 10;
  max-width: 32ch;
  text-align: left;
  padding: 0 2rem;
}

.typewriter-text {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 400;
  line-height: 1.75;
  color: var(--warm-interior);
  min-height: 12em;
}

.typewriter-cursor {
  display: inline;
  font-family: 'Space Mono', monospace;
  color: var(--aurora-green);
  animation: cursorBlink 0.8s step-end infinite;
  opacity: 0;
}

.typewriter-cursor.active {
  opacity: 1;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Floor 3 - Garden */
.floor--garden {
  background: linear-gradient(180deg, var(--twilight-concrete) 0%, var(--deep-night) 40%, var(--deep-purple) 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.garden-container {
  position: relative;
  width: 80%;
  height: 70vh;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  z-index: 10;
  padding-bottom: 2vh;
}

.plant {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 1.2s var(--elastic);
}

.floor--garden.floor--active .plant {
  transform: scaleY(1);
}

.plant-1 { transition-delay: 0s; }
.plant-2 { transition-delay: 0.15s; }
.plant-3 { transition-delay: 0.3s; }
.plant-4 { transition-delay: 0.45s; }
.plant-5 { transition-delay: 0.6s; }
.plant-6 { transition-delay: 0.75s; }
.plant-7 { transition-delay: 0.9s; }

.stem {
  width: 2px;
  background: var(--aurora-green);
  box-shadow: 0 0 6px rgba(57, 255, 159, 0.3);
}

.plant-1 .stem { height: 22vh; }
.plant-2 .stem { height: 30vh; }
.plant-3 .stem { height: 26vh; }
.plant-4 .stem { height: 18vh; }
.plant-5 .stem { height: 34vh; }
.plant-6 .stem { height: 28vh; }
.plant-7 .stem { height: 20vh; }

.leaf {
  position: absolute;
  width: 20px;
  height: 12px;
  background: var(--moss-soft);
  border-radius: 50%;
  opacity: 0.8;
}

.leaf-left {
  left: -18px;
  bottom: 40%;
  transform: rotate(-20deg);
}

.leaf-right {
  right: -18px;
  bottom: 55%;
  transform: rotate(20deg);
}

.leaf-upper.leaf-left {
  bottom: 70%;
}

.leaf-upper.leaf-right {
  bottom: 80%;
}

.flower {
  position: absolute;
  top: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flower-outer {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--aurora-pink);
  opacity: 0.5;
  box-shadow: 0 0 12px rgba(199, 125, 255, 0.4);
}

.flower-inner {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warm-interior);
}

/* Floor 4 - Close */
.floor--close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% -20%, var(--mid-purple) 0%, var(--deep-purple) 40%, var(--deep-night) 80%);
}

.close-content {
  position: relative;
  z-index: 10;
  text-align: center;
}

.close-title {
  font-family: 'Space Mono', monospace;
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--moss-soft);
  display: block;
  margin-bottom: 1.5rem;
}

.close-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  letter-spacing: 0.2em;
  color: var(--aurora-green);
  opacity: 0.8;
}

.aurora-sky-close {
  position: absolute;
  inset: 0;
  background: linear-gradient(350deg, #0d0f1a 0%, #39ff9f 15%, #48d1e8 30%, #c77dff 45%, #2d1b69 60%, #1a1040 80%, #0d0f1a 100%);
  opacity: 0.08;
  pointer-events: none;
  animation: auroraPulse 10s ease-in-out infinite alternate;
}

@keyframes auroraPulse {
  0% { opacity: 0.06; }
  50% { opacity: 0.12; }
  100% { opacity: 0.08; }
}

.rooftop-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 15%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 25% 8%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 40% 22%, var(--aurora-pink) 50%, transparent 100%),
    radial-gradient(1px 1px at 55% 5%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 70% 18%, var(--aurora-cyan) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 85% 12%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 15% 35%, var(--aurora-green) 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 30%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 90% 28%, var(--aurora-pink) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 35% 40%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 42%, var(--aurora-cyan) 50%, transparent 100%),
    radial-gradient(1px 1px at 5% 48%, var(--warm-interior) 50%, transparent 100%),
    radial-gradient(1px 1px at 48% 45%, var(--aurora-green) 50%, transparent 100%),
    radial-gradient(1px 1px at 95% 35%, var(--warm-interior) 50%, transparent 100%);
  opacity: 0.6;
  animation: starTwinkle 5s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.4; }
  100% { opacity: 0.7; }
}

/* Responsive */
@media (max-width: 768px) {
  .vine-progress {
    right: 10px;
    height: 40vh;
  }

  .garden-container {
    width: 95%;
  }

  .leaf {
    width: 14px;
    height: 8px;
  }

  .flower-outer {
    width: 14px;
    height: 14px;
  }
}
