/* =====================================================================
   hub.css - the opening screen (gift) and the night sky (main menu)
   ===================================================================== */

/* ---------- opening screen ---------- */
#gate {
  position: fixed; inset: 0; z-index: 10; display: flex; overflow-y: auto; overflow-x: hidden;
  padding: calc(24px + var(--safe-t)) 20px 24px;
  background:
    radial-gradient(70% 45% at 50% 108%, rgba(178, 58, 99, .45), transparent 70%),
    radial-gradient(60% 40% at 80% -5%, rgba(201, 184, 240, .22), transparent 70%);
  transition: opacity 1s ease, transform 1.3s var(--ease), filter 1s ease;
}
#gate.gone { opacity: 0; transform: scale(1.18); filter: blur(10px); pointer-events: none; }

.gate-inner {
  margin: auto;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: clamp(8px, 1.8vh, 16px); max-width: 640px;
}
.gate-inner > * { opacity: 0; transform: translateY(16px); }
body:not(.is-loading) .gate-inner > * { animation: rise 1s var(--ease) forwards; }
body:not(.is-loading) .gate-inner > :nth-child(1) { animation-delay: .1s; }
body:not(.is-loading) .gate-inner > :nth-child(2) { animation-delay: .25s; }
body:not(.is-loading) .gate-inner > :nth-child(3) { animation-delay: 1.5s; }
body:not(.is-loading) .gate-inner > :nth-child(4) { animation-delay: 1.8s; }
body:not(.is-loading) .gate-inner > :nth-child(5) { animation-delay: 2.1s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .gate-inner .eyebrow { letter-spacing: .2em; font-size: .64rem; } }

.gate-title { display: flex; flex-direction: column; align-items: center; font-weight: 400; line-height: 1; }
.gate-headline { font-family: var(--display); font-size: clamp(2.3rem, 9vw, 3.8rem); color: var(--blush); text-shadow: 0 0 30px rgba(244, 194, 201, .4); }
.gate-name {
  font-family: var(--display); font-size: clamp(3.8rem, 20vw, 8.5rem); padding: 0 .1em .1em; color: var(--gold);
  filter: drop-shadow(0 4px 30px rgba(230, 194, 122, .25));
}
.gate-name span {
  display: inline-block; opacity: 0; transform: translateY(26px) rotate(5deg); filter: blur(8px);
  padding: .12em .14em .34em; margin: -.12em -.14em -.34em;
  background: linear-gradient(100deg, var(--gold), #fff1d6, var(--blush), var(--lav), var(--gold));
  background-size: 700% 100%; background-position: calc(var(--i) * 17%) 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body:not(.is-loading) .gate-name span { animation: letterIn 1s var(--ease) forwards; animation-delay: calc(.5s + var(--i) * .12s); }
@keyframes letterIn { to { opacity: 1; transform: none; filter: none; } }
.gate-sub { font-family: var(--script); font-size: 1.5rem; color: var(--cream); opacity: .85; }

/* the gift box */
.gift { position: relative; width: 132px; height: 128px; margin: 4px 0 6px; display: block; animation: floaty 4.5s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
.gift-box, .gift-lid {
  position: absolute;
  background:
    linear-gradient(90deg, transparent 42%, var(--gold) 42%, #f6dc9f 50%, var(--gold) 58%, transparent 58%),
    linear-gradient(180deg, #b23a63, #6a1a38);
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .4);
}
.gift-box { left: 12px; right: 12px; bottom: 0; height: 74px; border-radius: 6px 6px 12px 12px; }
.gift-lid { left: 3px; right: 3px; bottom: 70px; height: 28px; border-radius: 7px; transition: transform 1s var(--ease), opacity 1s ease; transform-origin: 0 100%; z-index: 2; }
.bow { position: absolute; left: 50%; top: -20px; width: 46px; height: 24px; transform: translateX(-50%); }
.bow i { position: absolute; bottom: 0; width: 22px; height: 20px; border: 5px solid var(--gold); border-radius: 60% 60% 0 60%; }
.bow i:first-child { left: 0; transform: rotate(-22deg); }
.bow i:last-child { right: 0; transform: scaleX(-1) rotate(-22deg); }
.gift-glow {
  position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 160, .75), rgba(244, 194, 201, .25) 45%, transparent 68%);
  opacity: .4; animation: glowPulse 3.2s ease-in-out infinite; pointer-events: none;
}
@keyframes glowPulse { 0%, 100% { opacity: .3; scale: .9; } 50% { opacity: .6; scale: 1.08; } }
.gift:hover .gift-lid { transform: translateY(-5px) rotate(-3deg); }

#gate.opening .gift { animation: none; }
#gate.opening .gift-lid { transform: translate(-14px, -90px) rotate(-22deg); opacity: 0; }
#gate.opening .gift-glow { animation: none; opacity: 1; scale: 9; transition: scale 1.5s cubic-bezier(.5, 0, .9, .4), opacity 1.5s ease-in; }
#gate.opening .gate-inner > :not(:nth-child(4)) { transition: opacity .8s, transform .8s; opacity: 0 !important; transform: translateY(-10px) !important; animation: none; }

/* the moon (secret way to unlock the surprise) */
.moon {
  position: absolute; top: calc(20px + var(--safe-t)); left: 20px; width: 56px; height: 56px; border-radius: 50%;
  background:
    radial-gradient(circle at 62% 28%, rgba(0, 0, 0, .12) 0 7px, transparent 8px),
    radial-gradient(circle at 34% 62%, rgba(0, 0, 0, .1) 0 9px, transparent 10px),
    radial-gradient(circle at 72% 70%, rgba(0, 0, 0, .09) 0 5px, transparent 6px),
    radial-gradient(circle at 35% 30%, #fffaea, #ecdcb6 62%, #bfa97a);
  box-shadow: 0 0 30px 6px rgba(255, 240, 200, .35), 0 0 90px 20px rgba(255, 240, 200, .12);
  opacity: 0; animation: rise 1.4s ease 1s forwards;
  transition: transform .3s var(--ease);
}
.moon:hover { transform: scale(1.06); }
.moon.tap { animation: moonTap .45s var(--ease); opacity: 1; }
@keyframes moonTap { 40% { transform: scale(1.18) rotate(-6deg); } }

/* ---------- the sky ---------- */
#sky { position: fixed; inset: 0; z-index: 10; opacity: 0; transition: opacity 1.4s ease; }
#sky.show { opacity: 1; }

.sky-top { position: absolute; top: calc(72px + var(--safe-t)); left: 0; right: 0; text-align: center; padding: 0 24px; pointer-events: none; }
.sky-hello { font-family: var(--display); font-size: clamp(2.4rem, 8vw, 3.6rem); color: var(--blush); text-shadow: 0 0 30px rgba(244, 194, 201, .4); line-height: 1.1; }
.sky-hint { font-family: var(--script); font-size: 1.35rem; color: var(--cream); opacity: .85; margin-top: 2px; }
.progress { display: flex; justify-content: center; gap: 9px; margin-top: 12px; }
.progress i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(230, 194, 122, .7); transition: background .6s, box-shadow .6s; }
.progress i.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
@media (min-width: 860px) { .sky-top { top: 104px; } }
.progress-text { font-size: .66rem; letter-spacing: .24em; text-transform: uppercase; color: rgba(251, 241, 227, .55); margin-top: 8px; }

.constellation { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.constellation line {
  stroke: rgba(244, 194, 201, .32); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 6; stroke-linecap: round;
  opacity: 0; animation: lineIn 1.6s ease forwards; animation-delay: calc(1s + var(--i) * .25s);
}
@keyframes lineIn { to { opacity: 1; } }

.star {
  position: absolute; left: var(--x); top: var(--y); width: calc(var(--s, 1) * 62px); height: calc(var(--s, 1) * 62px);
  margin: calc(var(--s, 1) * -31px) 0 0 calc(var(--s, 1) * -31px);
  display: grid; place-items: center; opacity: 0; scale: .2;
  animation: starIn 1.1s var(--ease) forwards; animation-delay: calc(.5s + var(--i) * .16s);
  transition: scale .35s var(--ease);
}
@keyframes starIn { to { opacity: 1; scale: 1; } }
.star svg { width: 100%; height: 100%; filter: drop-shadow(0 0 9px rgba(255, 220, 150, .95)); animation: twinkle 4s ease-in-out infinite; animation-delay: calc(var(--i) * -.7s); }
.star svg path { fill: #ffe7a8; transition: fill .6s; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.9) rotate(8deg); } }
.star .halo {
  position: absolute; inset: -45%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(244, 194, 201, .32), transparent 62%);
  animation: glowPulse 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * -.6s);
}
.star .label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 0;
  white-space: nowrap; font-family: var(--script); font-size: 1.4rem; color: var(--cream); text-shadow: 0 2px 12px #000, 0 0 14px rgba(0, 0, 0, .8);
}
.star.visited svg path { fill: var(--blush); }
.star.visited .label::after { content: ' \2713'; color: var(--gold); font-size: 1.05rem; }
@media (hover: hover) { .star:hover { scale: 1.18; } }
.star:active { scale: .92; }

/* the tiny hidden star */
.star.secret { --s: .5; display: none; }
.star.secret.found { display: grid; animation: secretIn 2.4s ease forwards; }
.star.secret svg { filter: drop-shadow(0 0 6px rgba(201, 184, 240, .9)); }
.star.secret svg path { fill: var(--lav); }
.star.secret .label { display: none; }
@keyframes secretIn { from { opacity: 0; scale: .1; } to { opacity: .8; scale: 1; } }
.star.secret::before { content: ''; position: absolute; inset: -60%; }  /* bigger tap area */

/* short screens (phones turned sideways) */
@media (max-height: 560px) {
  #gate { padding-top: 16px; padding-bottom: 16px; }
  .gate-inner { gap: 6px; }
  .gate-name { font-size: clamp(2.8rem, 17vh, 5rem); }
  .gate-headline { font-size: clamp(1.8rem, 9vh, 2.6rem); }
  .gate-sub { display: none; }
  .gift { transform: scale(.7); margin: -10px 0 -2px; }
  .sky-hint, .progress-text { display: none; }
  .sky-top { top: 58px; }
  .sky-hello { font-size: 2rem; }
  .star .label { font-size: 1.15rem; }
}
