:root {
  color-scheme: dark;
  --ink: #eaf0ff;
  --muted: #9db0d4;
  --soft: #7386a8;
  --accent: #9cc0ff;
  --accent-deep: #bcd6ff;
  --glass: rgba(12, 18, 42, .42);
  --glass-line: rgba(150, 180, 255, .16);
  --cycle-duration: 4800ms;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: #04061a;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: #04061a;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, a { font: inherit; }

/* ---------- Pinned scene scaffolding ---------- */
.scene-wrap {
  position: relative;
  height: 280svh; /* scroll runway for the pinned camera move */
}

.scene {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #04061a 0%, #0a0f2e 34%, #141042 62%, #1d1149 100%);
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transform-origin: 50% 100%;
}

/* ---------- SKY ---------- */
.sky { z-index: 1; }

.galaxy {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(ellipse 40% 62% at 62% 30%, rgba(120, 90, 220, .34), transparent 60%),
    radial-gradient(ellipse 26% 44% at 38% 22%, rgba(60, 110, 220, .26), transparent 64%),
    radial-gradient(ellipse 70% 40% at 50% 60%, rgba(90, 60, 170, .18), transparent 70%);
  filter: blur(6px);
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(26px);
  opacity: .55;
  will-change: transform;
}
.nebula--one {
  width: 60vmin; height: 36vmin;
  top: 14%; left: 8%;
  background: radial-gradient(circle at 50% 50%, rgba(150, 110, 255, .5), rgba(80, 60, 200, .12) 60%, transparent 72%);
  animation: nebula-drift 26s ease-in-out infinite alternate;
}
.nebula--two {
  width: 52vmin; height: 32vmin;
  top: 30%; right: 4%;
  background: radial-gradient(circle at 50% 50%, rgba(80, 140, 255, .42), rgba(40, 90, 200, .1) 62%, transparent 74%);
  animation: nebula-drift 34s ease-in-out infinite alternate-reverse;
}

/* Stars are generated as small spans by script.js. */
.stars, .band-stars, .twinkles { position: absolute; inset: 0; }
.star {
  position: absolute;
  width: var(--s, 2px);
  height: var(--s, 2px);
  background: #dce6ff;
  box-shadow: 0 0 4px rgba(190, 210, 255, .8);
}
.band-stars .star { background: #c8d4ff; box-shadow: 0 0 3px rgba(160, 180, 255, .6); }

.twinkles .star { animation: twinkle var(--dur, 4s) ease-in-out var(--delay, 0s) infinite; }

.moon {
  position: absolute;
  top: 16%; right: 16%;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fdfaf0, #e9e3cd 55%, #cfc8b0 100%);
  box-shadow: 0 0 40px 14px rgba(240, 236, 210, .28), 0 0 120px 50px rgba(180, 190, 255, .12);
}
.moon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 40%, rgba(160, 156, 132, .35) 0 9%, transparent 10%),
    radial-gradient(circle at 40% 66%, rgba(160, 156, 132, .3) 0 7%, transparent 8%),
    radial-gradient(circle at 55% 74%, rgba(160, 156, 132, .25) 0 5%, transparent 6%);
}

.shooting {
  position: absolute;
  top: 22%; left: 68%;
  width: 120px; height: 2px;
  background: linear-gradient(90deg, rgba(223, 233, 255, .95), rgba(223, 233, 255, 0));
  opacity: 0;
  transform: rotate(18deg);
  animation: shooting 9s ease-in 3s infinite;
}

/* ---------- HORIZON ---------- */
.mountains { z-index: 2; top: auto; bottom: 34%; height: 26%; }
.horizon-glow {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(120, 140, 220, .12));
}

/* ---------- OCEAN ---------- */
.ocean { z-index: 3; top: auto; bottom: 0; height: 46%; }

.moon-path {
  position: absolute;
  left: 66%;
  top: 0;
  width: 13%;
  height: 100%;
  background: linear-gradient(180deg, rgba(238, 238, 214, .5), rgba(150, 180, 230, .06) 90%);
  clip-path: polygon(42% 0, 58% 0, 92% 100%, 8% 100%);
  opacity: .5;
  filter: blur(1px);
}

.waves {
  position: absolute;
  left: -5%; right: -5%;
  height: 44%;
  background-repeat: repeat-x;
  background-size: 320px 100%;
}
.waves--back {
  top: 6%;
  opacity: .5;
  background-image:
    repeating-linear-gradient(90deg, rgba(130, 170, 240, .35) 0 6px, transparent 6px 22px);
  mask-image: repeating-linear-gradient(180deg, #000 0 3px, transparent 3px 14px);
  animation: wave-shift 11s linear infinite;
}
.waves--front {
  top: 26%;
  opacity: .32;
  background-image:
    repeating-linear-gradient(90deg, rgba(90, 130, 210, .4) 0 8px, transparent 8px 30px);
  mask-image: repeating-linear-gradient(180deg, #000 0 4px, transparent 4px 22px);
  animation: wave-shift 8s linear infinite reverse;
}
.sea-glint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(60, 90, 160, .35), rgba(6, 20, 40, .85) 90%);
}

/* ---------- SHORE ---------- */
.shore { z-index: 4; top: auto; bottom: 0; height: 22%; }
.sand {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .02) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, #262038 0%, #1c1a2c 40%, #14121f 100%);
  clip-path: polygon(0 34%, 18% 42%, 42% 30%, 66% 44%, 86% 32%, 100% 40%, 100% 100%, 0 100%);
}

.palms { z-index: 5; top: auto; bottom: 6%; height: 52%; color: #04060f; }
.palm { position: absolute; bottom: 0; height: 100%; width: auto; filter: drop-shadow(0 0 18px rgba(0, 0, 0, .5)); }
.palm--left { left: -2%; height: 104%; }
.palm--right { right: -1%; height: 88%; transform: scaleX(-1); }

.vignette {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 42%, transparent 52%, rgba(2, 4, 14, .66) 100%);
}

/* ---------- PINNED UI ---------- */
.ui {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 4vh, 34px);
  padding: clamp(26px, 6vh, 60px) clamp(20px, 5vw, 56px) clamp(20px, 4vh, 34px);
  pointer-events: none;
}
.ui-content {
  display: flex;
  width: min(660px, 100%);
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ui a, .ui .quick-grid { pointer-events: auto; }

.greeting-window {
  display: grid;
  width: 100%;
  min-height: clamp(96px, 13vw, 140px);
  place-items: center;
}

.greeting-copy { width: 100%; will-change: transform, opacity, clip-path, filter; }
.greeting-copy.is-entering { animation: slide-reveal-in .9s cubic-bezier(.19, 1, .22, 1) both; }
.greeting-copy.is-leaving { animation: slide-reveal-out .44s cubic-bezier(.7, 0, .84, 0) both; }

.greeting-title {
  margin: 0 auto;
  color: #f2f6ff;
  font-size: clamp(26px, 4.8vw, 46px);
  font-weight: 660;
  letter-spacing: -.04em;
  line-height: 1.16;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(4, 8, 24, .8), 0 1px 2px rgba(0, 0, 0, .5);
}
.greeting-title span {
  color: #a8c6ff;
  font-weight: 780;
  text-shadow: 0 0 22px rgba(120, 160, 255, .55);
}

/* ---------- CTA ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(16px, 2.6vh, 26px);
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: rgba(20, 28, 58, .55);
  box-shadow: 0 8px 26px rgba(2, 4, 16, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 650;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
.cta svg { width: 16px; height: 16px; transition: transform .25s ease; }
.cta:hover {
  transform: translateY(-2px);
  background: rgba(34, 48, 90, .7);
  border-color: rgba(170, 200, 255, .34);
  box-shadow: 0 12px 34px rgba(20, 40, 100, .5), 0 0 24px rgba(120, 160, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.cta:hover svg { transform: translateX(3px); }
.cta:active { transform: translateY(0); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5); }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Hihuu reveal (late scroll) ---------- */
.hihuu {
  position: absolute;
  z-index: 8;
  top: 50%; left: 50%;
  margin: 0;
  color: #eaf2ff;
  font-size: clamp(48px, 12vw, 132px);
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
  text-shadow: 0 0 30px rgba(140, 180, 255, .65), 0 8px 40px rgba(4, 8, 30, .9);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, 60vh, 0);
  will-change: transform, opacity;
}

/* ---------- Quick Access ---------- */
.quick {
  width: 100%;
  margin-top: clamp(22px, 3.4vh, 34px);
}
.quick-title {
  margin: 0 0 clamp(12px, 2vh, 18px);
  color: #8ea3c8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .28em;
  text-align: center;
  text-transform: uppercase;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
}
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--ink);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform .28s cubic-bezier(.2, .7, .3, 1), border-color .28s ease, box-shadow .28s ease, background .28s ease;
  text-align: left;
}
a.quick-card:hover {
  transform: translateY(-3px);
  background: rgba(24, 36, 74, .6);
  border-color: rgba(170, 200, 255, .3);
  box-shadow: 0 10px 26px rgba(10, 24, 60, .45), 0 0 20px rgba(120, 160, 255, .16);
}
a.quick-card:active { transform: translateY(0); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .4); }
a.quick-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.quick-card.is-soon { opacity: .68; }

.quick-icon {
  display: grid;
  width: 30px; height: 30px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(120, 150, 230, .22), rgba(60, 80, 160, .12));
  color: #a8c6ff;
}
.quick-icon svg { width: 16px; height: 16px; }
.quick-name { font-size: 12.5px; font-weight: 700; letter-spacing: -.01em; }
.quick-desc { color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.quick-badge {
  position: absolute;
  top: 10px; right: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(120, 150, 230, .16);
  color: #9fb4dc;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- UI footer ---------- */
.ui-footer {
  position: absolute;
  left: 0; right: 0; bottom: clamp(14px, 3vh, 26px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 56px);
  color: #7c8fb4;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.ui-brand { color: #a7b8d8; font-weight: 850; letter-spacing: .22em; }
.ui-scroll { display: inline-flex; align-items: center; gap: 7px; }
.ui-scroll::after {
  content: "";
  width: 5px; height: 5px;
  border-right: 1px solid #8fa2c6;
  border-bottom: 1px solid #8fa2c6;
  transform: rotate(45deg);
  animation: scroll-nudge 2.2s ease-in-out infinite;
}

/* ---------- Postlude ---------- */
.postlude {
  position: relative;
  padding: 34px 20px;
  background: #04061a;
  color: #6f82a6;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  text-align: center;
  text-transform: uppercase;
}

/* ---------- Keyframes ---------- */
@keyframes slide-reveal-in {
  0% { opacity: 0; filter: blur(9px); clip-path: inset(0 0 100% 0); transform: translate3d(0, 34px, 0); }
  58% { opacity: 1; filter: blur(0); clip-path: inset(0 0 0 0); }
  100% { opacity: 1; filter: blur(0); clip-path: inset(0 0 0 0); transform: translate3d(0, 0, 0); }
}
@keyframes slide-reveal-out {
  0% { opacity: 1; filter: blur(0); clip-path: inset(0 0 0 0); transform: translate3d(0, 0, 0); }
  100% { opacity: 0; filter: blur(6px); clip-path: inset(0 0 100% 0); transform: translate3d(0, -22px, 0); }
}
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes nebula-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(4%, -3%, 0) scale(1.08); } }
@keyframes wave-shift { from { background-position: 0 0; } to { background-position: -320px 0; } }
@keyframes shooting {
  0%, 88% { opacity: 0; transform: translate3d(0, 0, 0) rotate(18deg); }
  90% { opacity: 1; transform: translate3d(0, 0, 0) rotate(18deg); }
  96% { opacity: 1; transform: translate3d(-260px, 84px, 0) rotate(18deg); }
  100% { opacity: 0; transform: translate3d(-300px, 96px, 0) rotate(18deg); }
}
@keyframes scroll-nudge { 0%, 100% { transform: translateY(0) rotate(45deg); } 50% { transform: translateY(4px) rotate(45deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .scene-wrap { height: 220svh; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .greeting-title { font-size: clamp(24px, 7vw, 34px); }
  .cta { padding: 11px 19px; font-size: 13.5px; }
  .moon { width: 60px; height: 60px; top: 12%; right: 12%; }
  .palm--left { height: 86%; }
  .palm--right { height: 72%; }
  .moon-path { left: 62%; width: 18%; }
  .ui-footer { font-size: 7px; letter-spacing: .12em; }
}

@media (max-width: 380px) {
  .greeting-title { font-size: 23px; }
  .quick-desc { display: none; }
}

/* ---------- Reduced motion: static, readable world ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .greeting-copy.is-entering, .greeting-copy.is-leaving { animation: none !important; }
  .scene-wrap { height: 100svh; }
  .shooting { display: none; }
  .twinkles .star { opacity: .7 !important; }
}
