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

html {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
  background: #fff;
}

/* Navigation */
.top-nav {
  position: fixed;
  top: 1.15rem;
  left: 50%;
  z-index: 20;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 2rem);
  justify-content: center;
  gap: clamp(.9rem, 2.2vw, 1.8rem);
  padding: 0;
  transform: translateX(-50%);
}

.top-nav a {
  position: relative;
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  border-radius: .65rem;
  color: rgb(245 249 255 / 76%);
  text-decoration: none;
  filter: drop-shadow(0 .3rem .8rem rgb(0 0 0 / 40%));
  transition: color .2s ease, transform .2s ease, filter .2s ease;
}

.top-nav svg {
  width: 1.9rem;
  height: 1.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color .2s ease, filter .2s ease, transform .2s ease;
}

.top-nav .icon-fill { fill: currentColor; stroke: none; }
.top-nav .github-mark { fill: currentColor; stroke: none; }

.top-nav a::after {
  position: absolute;
  top: calc(100% + .62rem);
  left: 50%;
  padding: .34rem 0;
  transform: translate(-50%, -.2rem);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  content: attr(data-label);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
  transition: opacity .16s ease, transform .16s ease;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: #fff;
  transform: translateY(-2px) scale(1.08);
}

.top-nav a:hover svg,
.top-nav a:focus-visible svg {
  filter:
    drop-shadow(0 0 .22rem rgb(255 255 255 / 85%))
    drop-shadow(0 0 .7rem rgb(100 180 255 / 95%));
  transform: scale(1.08);
}

.top-nav a:hover::after,
.top-nav a:focus-visible::after {
  box-shadow: none;
  opacity: 1;
  text-shadow: 0 0 .5rem rgb(100 180 255 / 85%);
  transform: translate(-50%, 0);
}

.top-nav a:focus-visible {
  border-radius: 3px;
  outline: 2px solid rgb(125 190 255 / 85%);
  outline-offset: 5px;
}

/* Hero */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 500px;
  scroll-snap-align: start;
  background: radial-gradient(ellipse at 50% 45%, var(--hero-bg1), var(--hero-bg2) 50%, var(--hero-bg3) 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

/* Canvas */
canvas#sky {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; z-index: 0;
  pointer-events: none;
}

/* Nebula */
.nebula {
  position: absolute; border-radius: 50%;
  filter: blur(60px); z-index: 0; pointer-events: none;
}
.n1 { width: 300px; height: 200px; top: 8%; left: -5%; background: radial-gradient(ellipse, var(--neb1), transparent); animation: neb 8s ease-in-out infinite; }
.n2 { width: 250px; height: 180px; bottom: 5%; right: -5%; background: radial-gradient(ellipse, var(--neb2), transparent); animation: neb 10s ease-in-out infinite 2s; }
.n3 { width: 200px; height: 140px; top: 35%; right: 8%; background: radial-gradient(ellipse, var(--neb3), transparent); animation: neb 12s ease-in-out infinite 4s; }

/* Content */
.content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; pointer-events: none;
}

/* TACO system */
.taco-system {
  position: relative; width: 385px; height: 385px;
  display: flex; justify-content: center; align-items: center;
}

.taco-glow {
  position: absolute; width: 182px; height: 182px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color) 0%, var(--glow-color2) 50%, transparent 70%);
  animation: pulse 4s ease-in-out infinite; z-index: 0;
}

/* Taco-to-earth morph */
.morph-center {
  position: relative; z-index: 1; width: 145px; height: 145px;
  display: flex; justify-content: center; align-items: center;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 0 30px var(--earth-shadow));
}

.taco-emoji,
.earth-emoji {
  position: absolute; font-size: 7.8rem; line-height: 1;
}
.taco-emoji  { animation: morph-taco 8s infinite; }
.earth-emoji { animation: morph-planet 8s infinite; }

/* Orbit */
.orbit-ring {
  position: absolute; width: 325px; height: 325px;
  border: 1px solid var(--orbit-color); border-radius: 50%; z-index: 3;
}

.sat-orbit {
  position: absolute; width: 325px; height: 325px;
  animation: spin 12s linear infinite; z-index: 4;
}

.satellite {
  position: absolute; top: -18px; left: calc(50% - 18px);
  font-size: 2.15rem; line-height: 1;
  animation: counter-spin 12s linear infinite;
  filter: drop-shadow(0 0 6px var(--sat-glow));
}

/* Titles */
.title-wrap {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transform: translateY(-18px);
}

.title {
  display: flex; align-items: baseline; gap: 8px;
}

.title-main {
  font-size: 5rem; font-weight: 900; letter-spacing: 16px;
  color: var(--text-primary);
  text-shadow: 0 0 40px var(--title-glow);
}

.title-version {
  padding: .3rem .46rem .26rem;
  border: 2px solid rgb(255 255 255 / 72%);
  border-radius: .34rem;
  background: #f7c948;
  box-shadow: 0 .3rem .8rem rgb(0 0 0 / 32%), inset 0 1px 0 rgb(255 255 255 / 50%);
  color: #17130a;
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1;
  transform: translateY(-.22rem) rotate(5deg);
}

.subtitle {
  font-size: .85rem; letter-spacing: 4px; text-transform: uppercase;
  margin-top: 8px; line-height: 1.6;
  color: var(--text-sub);
}

/* Entrance */
.content { opacity: 0; animation: rise .8s ease-out .2s forwards; }

/* Responsive layout */
@media (max-width: 600px) {
  html { scroll-snap-type: none; }
  .hero { min-height: 100vh; }
  .taco-system { width: 220px; height: 220px; }
  .taco-glow { width: 100px; height: 100px; }
  .morph-center { width: 80px; height: 80px; }
  .taco-emoji, .earth-emoji { font-size: 4.5rem; }
  .orbit-ring { width: 185px; height: 185px; }
  .sat-orbit { width: 185px; height: 185px; }
  .satellite { top: -14px; left: calc(50% - 14px); font-size: 1.4rem; }
  .title-main { font-size: 3rem; letter-spacing: 10px; }
  .title-version { font-size: 1rem; }
  .subtitle { font-size: .7rem; letter-spacing: 3px; }
  .label { display: none; }
  .nav-dpad { bottom: 14px; right: 14px; }
  .dpad-key { width: 36px; height: 36px; }
  .dpad-key svg { width: 14px; height: 14px; }
  .nav-dpad {
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(2, 36px);
  }
  .top-nav {
    width: max-content;
    max-width: calc(100vw - 1.5rem);
  }
  .top-nav::-webkit-scrollbar { display: none; }
}

/* Navigation pad */
.nav-dpad {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  display: grid;
  grid-template-areas:
    ".  up  ."
    "lt dn  rt";
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(2, 42px);
  gap: 4px;
  opacity: 0; animation: fade-in .5s ease 1.5s forwards;
}

#key-up    { grid-area: up; }
#key-left  { grid-area: lt; }
#key-down  { grid-area: dn; }
#key-right { grid-area: rt; }

.dpad-key {
  width: 42px; height: 42px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(20, 20, 30, .55); backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, .08);
  display: flex; align-items: center; justify-content: center;
  transition: background .3s ease, transform .12s ease, border-color .3s ease;
}

.dpad-key svg {
  width: 18px; height: 18px;
  stroke: #fff; stroke-width: 2.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .3s ease;
}

/* Light slides */
.nav-dpad.on-light .dpad-key {
  background: rgba(20, 20, 30, .55);
  border-color: rgba(0, 0, 0, .08);
}
.nav-dpad.on-light .dpad-key svg { stroke: #fff; }
.nav-dpad.on-light .dpad-key:hover:not(:disabled) {
  background: rgba(20, 20, 30, .75);
  border-color: rgba(0, 0, 0, .15);
}
.nav-dpad.on-light .dpad-key:active:not(:disabled),
.nav-dpad.on-light .dpad-key.pressed {
  background: rgba(20, 20, 30, .85);
  border-color: rgba(0, 0, 0, .2);
}

/* Dark slides */
.nav-dpad.on-dark .dpad-key {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .15);
}
.nav-dpad.on-dark .dpad-key svg { stroke: #fff; }
.nav-dpad.on-dark .dpad-key:hover:not(:disabled) {
  background: rgba(100, 180, 255, .2);
  border-color: rgba(100, 180, 255, .35);
}

.nav-dpad.on-dark .dpad-key:active:not(:disabled),
.nav-dpad.on-dark .dpad-key.pressed {
  background: rgba(100, 180, 255, .3);
  border-color: rgba(100, 180, 255, .5);
}

/* Shared states */
.dpad-key:hover:not(:disabled) { transform: scale(1.08); }
.dpad-key:active:not(:disabled),
.dpad-key.pressed { transform: scale(.9); }
.dpad-key:disabled { opacity: .2; cursor: default; }
