.home-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: clip;
  position: relative;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --kh-btn-scale: 0.7;
  --kh-btn-desktop-font: 15px;
  --kh-btn-desktop-padding-y: 10px;
  --kh-btn-desktop-padding-x: 20px;
  --kh-btn-desktop-gap: 14px;
  --kh-btn-desktop-icon-h: 36px;
  --kh-btn-desktop-border-radius: 0;
  --kh-btn-mobile-font: 13px;
  --kh-btn-mobile-padding-y: 10px;
  --kh-btn-mobile-padding-x: 20px;
  --kh-btn-mobile-gap: 10px;
  --kh-btn-mobile-icon-h: 28px;
}

/* ── Favicons ── */
.header-logo-desktop {
  position: fixed;
  top: 28px;
  left: 24px;
  width: 2.5rem;
  height: 2.5rem;
  z-index: 12;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: opacity, filter;
  animation: logoBloomIn 0.7s ease-out 0.1s both;
}
.header-logo-desktop.pop-in {
  animation: logoBloomIn 0.5s ease-out 0s both;
}
.header-logo-mobile {
  will-change: opacity, filter;
}
.header-logo-mobile.pop-in {
  animation: logoBloomIn 0.4s ease-out 0s both;
}

/* ── Hero ── */
.home-hero {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 40px 48px 60px;
  position: relative;
  overflow-x: clip;
  transition: padding 0.4s ease, gap 0.4s ease;
}
.hero-content {
  flex: 1 0 0%;
  max-width: min(500px, 85%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: flex-grow 0.4s ease, max-width 0.4s ease;
}
.hero-content h1 {
  font-family: var(--kh-font-cinzel);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: 1px;
  transition: font-size 0.4s ease, margin-bottom 0.4s ease;
  line-height: 1.15;
  --ks: #fff;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.15), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.hero-content h1 .line > span {
  color: var(--kh-gold);
  --ks: var(--kh-gold);
}
.hero-content h1 .line,
.hero-content .sub .line {
  white-space: nowrap;
}
.hero-content .sub {
  font-size: 0.8rem;
  color: #9a8ab0;
  margin-bottom: 32px;
  max-width: min(480px, 90%);
  line-height: 1.3;
  font-style: italic;
  transition: max-width 0.4s ease, font-size 0.4s ease, margin-bottom 0.4s ease;
}
.hero-content .sub strong {
  color: var(--kh-gold);
  font-weight: 600;
}
.hero-character {
  flex: 0 0 auto;
  width: 300px;
  height: 460px;
  position: relative;
  opacity: 0;
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  will-change: opacity;
  animation: fadeIn 0.4s ease-out 0.2s both;
}
.hero-char {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(18px 10px 10px rgba(0, 0, 0, 0.8));
  transition: opacity 0.4s ease, transform 0.4s ease;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}
.hero-char--sora { width: 100%; }
.hero-char--riku { width: 78%; left: 40px; }
.hero-char--kairi { width: 72%; left: 20px; }
.hero-char--roxas { width: 120%; left: -50px; top: -25px; }
.hero-char.active { opacity: 1; }

/* ── Cone ── */
.home-cone-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateX(20%);
  filter: brightness(1.8);
  will-change: transform, opacity, filter;
  animation: coneSlideRight 0.45s cubic-bezier(0.55, 0.085, 0.68, 0.53) 0.05s both;
}
.home-cone-bg > * {
  position: absolute;
  inset: 0;
}
.cone-rim-shadow {
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  will-change: opacity;
  animation: fadeIn 0.45s ease-out 0.05s both;
}
.cone-canvas-watermark { z-index: 0; opacity: 0; }
.cone-wash {
  z-index: 1;
  opacity: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.04), rgba(212, 175, 55, 0.01));
}
.cone-canvas-posters {
  z-index: 2;
  transform: perspective(2000px) rotateY(25deg);
  transform-origin: right center;
}
.cone-fade { z-index: 2; }

/* ── CTA button ── */
.kh-timeline-btn {
  position: relative;
  overflow: hidden;
  background: #141116;
  border: 1.5px solid #cca64b;
  border-radius: calc(var(--kh-btn-desktop-border-radius) * var(--kh-btn-scale));
  padding: calc(var(--kh-btn-desktop-padding-y) * var(--kh-btn-scale))
    calc(var(--kh-btn-desktop-padding-x) * var(--kh-btn-scale));
  color: #cca64b;
  font-family: var(--kh-font-cinzel);
  font-size: calc(var(--kh-btn-desktop-font) * var(--kh-btn-scale));
  font-weight: 500;
  letter-spacing: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--kh-btn-desktop-gap) * var(--kh-btn-scale));
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              background 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              border-color 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              box-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              text-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 8px rgba(204, 166, 75, 0.05);
}
.kh-timeline-btn .btn-text { white-space: nowrap; }
.kh-timeline-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 223, 145, 0.12) 50%, transparent 100%);
  background-size: 200% 100%;
  pointer-events: none;
  border-radius: inherit;
  animation: shimmer 5s ease-in-out infinite;
}
.kh-timeline-btn:hover {
  background: #19151c;
  color: #ffdf91;
  border-color: #ffdf91;
  box-shadow: 0 0 20px rgba(204, 166, 75, 0.35);
  text-shadow: 0 0 4px rgba(255, 223, 145, 0.4);
  animation: pulse 2s ease-in-out infinite;
}
.kh-timeline-btn:active {
  transform: scale(0.98);
  box-shadow: 0 0 10px rgba(204, 166, 75, 0.2);
}

.keyblade-icon {
  height: calc(var(--kh-btn-desktop-icon-h) * var(--kh-btn-scale));
  color: #cca64b;
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0.85;
  flex-shrink: 0;
}
.keyblade-icon.right { transform: scaleX(-1); }
.kh-timeline-btn:hover .keyblade-icon {
  color: #ffdf91;
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 223, 145, 0.5));
}
.kh-timeline-btn:hover .keyblade-icon.left { transform: translateX(-4px); }
.kh-timeline-btn:hover .keyblade-icon.right { transform: scaleX(-1) translateX(-4px); }

/* ══════════════════════════════════════
   Keyframes
   ══════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes heroFadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoBloomIn { from { opacity: 0; filter: brightness(1.8) drop-shadow(0 0 12px rgba(8,4,14,0.9)); } to { opacity: 1; filter: brightness(1) drop-shadow(0 0 12px rgba(8,4,14,0.9)); } }
@keyframes coneSlideRight { from { opacity: 0; transform: translateX(20%); filter: brightness(1.8); } to { opacity: 1; transform: translateX(0); filter: brightness(1); } }
@keyframes coneSlideUp { from { opacity: 0; transform: translateY(-20%); filter: brightness(1.8); } to { opacity: 1; transform: translateY(0); filter: brightness(1); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }

/* ── Metallic sheen ── */
.kh-shine {
  --ks: #fff;
  background: linear-gradient(160deg, var(--ks) 0%, #f3e8b4 25%, var(--ks) 50%, #f3e8b4 75%, var(--ks) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Hero entrance sequence ── */
.hero-favicon, .hero-sub, .hero-title-wrap, .hero p {
  opacity: 0;
  transform: translateY(16px);
  animation: heroFadeIn 0.7s ease both;
}
.hero-favicon    { animation-delay: 0.08s; }
.hero-title-wrap { animation-delay: 0.16s; }
.hero-sub        { animation-delay: 0.24s; }
.hero p          { animation-delay: 0.32s; }

/* ── Hero content entrance (stronger slide-up) ── */
.hero-content .hero-title-wrap {
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
  animation: fadeInUp 0.9s ease-out 0.2s both;
}
.hero-content .sub {
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
  animation: fadeInUp 0.9s ease-out 0.35s both;
}

/* ── Footer entrance ── */
.home-page > .footer {
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  animation: heroFadeIn 0.6s ease 1.4s both;
}

/* ─── Desktop: show desktop favicon ─── */
@media (width >= 769px) {
  .header-logo-desktop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .header-logo-mobile {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
    filter: none;
  }
}

/* ─── Mobile ─── */
@media (width <= 768px) {
  .home-hero {
    flex-direction: row;
    text-align: center;
    padding: 0 24px;
    gap: 0;
    z-index: 2;
  }
  .hero-content {
    flex: 0 1 auto;
    max-width: 100%;
  }
  .hero-content h1 {
    font-size: 1.6rem;
    margin-bottom: 6px;
    text-shadow: 0 0 14px rgba(8, 4, 14, 1), 0 0 28px rgba(8, 4, 14, 0.9),
      0 2px 16px rgba(8, 4, 14, 0.85), 0 0 40px rgba(212, 175, 55, 0.25);
  }
  .hero-content .sub {
    max-width: 90vw;
    font-size: 0.9rem;
    margin-bottom: 26px;
    text-shadow: 0 1px 10px rgba(8, 4, 14, 1), 0 0 8px rgba(8, 4, 14, 0.9);
  }
  .hero-character {
    width: 0;
    height: 0;
    opacity: 0;
    animation: none;
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  }
  .hero-char {
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .hero-char.active { transform: translateX(100vw); }
  .kh-timeline-btn {
    padding: calc(var(--kh-btn-mobile-padding-y) * var(--kh-btn-scale))
      calc(var(--kh-btn-mobile-padding-x) * var(--kh-btn-scale));
    margin-top: 10px;
    font-size: calc(var(--kh-btn-mobile-font) * var(--kh-btn-scale));
    gap: calc(var(--kh-btn-mobile-gap) * var(--kh-btn-scale));
    white-space: nowrap;
    max-width: 92vw;
  }
  .kh-timeline-btn .btn-text { white-space: nowrap; }
  .kh-timeline-btn .keyblade-icon {
    height: calc(var(--kh-btn-mobile-icon-h) * var(--kh-btn-scale));
  }
  .header-logo-desktop {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .header-logo-mobile {
    position: relative;
    top: auto;
    left: auto;
    width: 14rem;
    height: 14rem;
    margin: 0 0 12px;
    display: block;
    z-index: 1;
    transform: none;
    filter: drop-shadow(0 0 12px rgba(8, 4, 14, 0.9));
  }
  .header-logo-mobile.entrance { animation: logoBloomIn 0.6s ease-out 0s both; }
  .home-cone-bg {
    transform: translateY(-20%);
    animation-name: coneSlideUp;
  }
}

/* ── Reduced motion overrides ── */
@media (prefers-reduced-motion: reduce) {
  .hero-content .hero-title-wrap,
  .hero-content .sub,
  .hero-character,
  .kh-timeline-btn::before,
  .kh-timeline-btn:hover {
    animation: none;
  }
  .hero-content .hero-title-wrap,
  .hero-content .sub {
    opacity: 1;
    transform: none;
  }
  .hero-character { opacity: 1; }
  .header-logo-desktop,
  .header-logo-desktop.pop-in,
  .header-logo-mobile.pop-in {
    animation: none;
    filter: none;
  }
  .home-cone-bg {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }
  .cone-rim-shadow {
    animation: none;
    opacity: 1;
  }
}
