/* =====================================================================
   Nick DeMarco — homepage styles
   Quick-edit colors live in :root below.
   ===================================================================== */

:root {
  --bg: #07031a;                         /* page background behind everything */
  --ink: #ffffff;                        /* main text color */
  --muted: rgba(255, 255, 255, 0.78);    /* tagline / hint text */
  --glass: rgba(255, 255, 255, 0.08);    /* pill backgrounds */
  --glass-line: rgba(255, 255, 255, 0.22);
  --status-dot: #3dffb0;                 /* the pulsing dot in the status pill */
  --hue: 320;                            /* animated by main.js */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- background layers ---------- */
#gl, #fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
}
#gl { z-index: 0; }
#fx { z-index: 1; pointer-events: none; }

/* fallback when WebGL is unavailable */
body.no-gl {
  background:
    radial-gradient(60vmax 60vmax at 20% 30%, #ff2d95aa, transparent 60%),
    radial-gradient(55vmax 55vmax at 80% 70%, #00d5ffaa, transparent 60%),
    radial-gradient(50vmax 50vmax at 60% 20%, #7b3cffcc, transparent 60%),
    var(--bg);
  background-size: 200% 200%;
  animation: drift 18s ease-in-out infinite alternate;
}
body.no-gl #gl { display: none; }
@keyframes drift { to { background-position: 100% 100%; } }

/* ---------- foreground ---------- */
.hero {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  padding: 0 16px;
  text-align: center;
  pointer-events: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  opacity: 0;
  animation: fadeUp 0.9s 0.1s cubic-bezier(.2,.8,.2,1) forwards;
}
.status::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--status-dot);
  animation: ping 1.8s infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(61, 255, 176, 0.7); }
  80%  { box-shadow: 0 0 0 10px rgba(61, 255, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 255, 176, 0); }
}

h1 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 5vw, 5.6rem);     /* size of your name */
  line-height: 0.95;
  letter-spacing: -0.035em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.28em;
}
.word { display: inline-flex; white-space: nowrap; }

.ch {
  display: inline-block;
  animation: rise 1.15s cubic-bezier(.2,.9,.25,1.15) both;
  animation-delay: calc(var(--i) * 55ms + 0.2s);
}
.gl {
  display: inline-block;
  will-change: transform;
  padding: 0.04em 0.012em;
  background: linear-gradient(170deg,
    #ffffff 18%,
    hsl(calc(var(--hue) + var(--i) * 22) 100% 74%) 58%,
    hsl(calc(var(--hue) + var(--i) * 22 + 70) 100% 62%) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 0 0.035em rgba(7, 3, 26, 1))
    drop-shadow(0 0 0.16em hsl(calc(var(--hue) + var(--i) * 22) 100% 60% / 0.6));
}
@keyframes rise {
  from { opacity: 0; transform: translateY(0.7em) rotate(10deg) scale(0.8); filter: blur(14px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.tagline {
  max-width: 34ch;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.5;
  color: var(--muted);
  text-shadow: 0 2px 18px rgba(7, 3, 26, 0.65);
  opacity: 0;
  animation: fadeUp 1s 1.05s cubic-bezier(.2,.8,.2,1) forwards;
}

/* "Begin your training" button */
.cta {
  pointer-events: auto;
  display: inline-block;
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: #eaffea;
  padding: 14px 28px;
  border-radius: 999px;
  background: rgba(20, 60, 20, 0.35);
  border: 1.5px solid rgba(120, 255, 120, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 0 12px rgba(80, 255, 80, 0.8);
  box-shadow: 0 0 18px rgba(60, 255, 60, 0.3);
  opacity: 0;
  animation: fadeUp 1s 1.6s cubic-bezier(.2,.8,.2,1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.cta:hover, .cta:focus-visible {
  outline: none;
  transform: translateY(-2px) scale(1.04);
  background: rgba(30, 110, 30, 0.45);
  box-shadow: 0 0 44px rgba(60, 255, 60, 0.75), inset 0 0 18px rgba(60, 255, 60, 0.35);
}

/* the two buttons side by side (stacked on narrow phones) */
.ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 14px;
}

/* "Personal login": same pill, in the logo's orange */
.cta-login {
  color: #fff1ea;
  background: rgba(70, 25, 8, 0.35);
  border-color: rgba(255, 120, 60, 0.75);
  text-shadow: 0 0 12px rgba(255, 110, 50, 0.8);
  box-shadow: 0 0 18px rgba(255, 90, 31, 0.3);
  animation-delay: 1.75s;
}
.cta-login:hover, .cta-login:focus-visible {
  background: rgba(120, 45, 12, 0.45);
  box-shadow: 0 0 44px rgba(255, 90, 31, 0.75), inset 0 0 18px rgba(255, 90, 31, 0.35);
}

.mark {
  position: fixed;
  top: 22px; left: 24px;
  z-index: 3;
  opacity: 0;
  animation: fadeUp 0.9s 0.3s forwards;
  pointer-events: none;
}
.mark img {
  display: block;
  width: 68px;                                  /* logo size */
  height: 68px;
  filter: drop-shadow(0 0 10px rgba(255, 90, 31, 0.45));
}

/* ---------- lightsaber ---------- */
/* Size and position are set by js/saber.js so the blade runs through the name */
.saber {
  --sw: 600px;
  position: absolute;
  left: 0; top: 0;
  width: var(--sw);
  aspect-ratio: 956 / 212;
  pointer-events: none;
  visibility: hidden;
  z-index: 1;                                   /* behind the letters */
}
#name { position: relative; z-index: 2; }
.saber img {
  display: block;
  width: 100%;
  height: 100%;
  filter: brightness(calc(1 + var(--boost, 0))) saturate(calc(1 + var(--boost, 0) * 0.5));
  /* trim the picture's wide haze so it doesn't wash out the name */
  -webkit-mask-image: linear-gradient(to bottom, transparent 22%, #000 44%, #000 62%, transparent 82%);
  mask-image: linear-gradient(to bottom, transparent 22%, #000 44%, #000 62%, transparent 82%);
}
.saber:not(.ignited) img { clip-path: inset(0 73.6% 0 0); }   /* handle only, until ignited */

/* quick pop-in right before ignition (page loads first, then the saber strikes) */
.saber { opacity: 0; filter: blur(6px); transition: opacity 0.2s ease-out, filter 0.2s ease-out; }
.saber.show { opacity: 1; filter: none; }
.flare {
  position: absolute;
  top: 53.3%;
  left: 26.4%;
  width: calc(var(--sw) * 0.08);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 10%, rgba(150, 255, 150, 0.9) 22%, rgba(60, 255, 60, 0.3) 45%, transparent 70%);
  opacity: 0;
}

/* ---------- "Enter at your own risk" screen ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 50%, rgba(7, 3, 26, 0.35), rgba(7, 3, 26, 0.85) 70%);
  transition: opacity 0.7s ease, visibility 0s 0.7s;
}
html:not(.pre) .gate { opacity: 0; visibility: hidden; pointer-events: none; }
.enter {
  cursor: pointer;
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(0.85rem, 2.2vw, 1.1rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #eaffea;
  padding: 18px 34px;
  border-radius: 999px;
  background: rgba(20, 60, 20, 0.35);
  border: 1.5px solid rgba(120, 255, 120, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 0 12px rgba(80, 255, 80, 0.8);
  animation: enterIn 1s 0.3s cubic-bezier(.2,.8,.2,1) both, enterPulse 2.2s 1.3s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.enter:hover, .enter:focus-visible {
  outline: none;
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(60, 255, 60, 0.7), inset 0 0 18px rgba(60, 255, 60, 0.35);
}
/* while the Enter clip plays */
.enter.entering {
  cursor: default;
  transform: scale(1.06);
  background: rgba(30, 110, 30, 0.45);
  animation: enterGlow 0.7s ease-in-out infinite;
}
@keyframes enterGlow {
  0%, 100% { box-shadow: 0 0 34px rgba(60, 255, 60, 0.6), inset 0 0 16px rgba(60, 255, 60, 0.35); }
  50%      { box-shadow: 0 0 70px rgba(60, 255, 60, 0.95), inset 0 0 28px rgba(60, 255, 60, 0.6); }
}
@keyframes enterIn {
  from { opacity: 0; transform: scale(0.85); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes enterPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(60, 255, 60, 0.3); }
  50%      { box-shadow: 0 0 36px rgba(60, 255, 60, 0.65); }
}

/* behind the Enter screen: hold the page's intro animations */
.pre .ch, .pre .status, .pre .tagline, .pre .cta, .pre .hint { animation-play-state: paused; }

.sound {
  position: fixed;
  top: 14px; right: 16px;
  z-index: 6;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
}
.sound:hover, .sound:focus-visible { outline: none; border-color: rgba(255, 255, 255, 0.6); }
.sound svg { width: 18px; height: 18px; }

/* ---------- interaction hints ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 1s 2s forwards;
}
.hint span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.hint b { color: var(--ink); font-weight: 500; }

/* show mouse hints on computers, touch hints on phones/tablets */
.hint-touch, .only-touch { display: none; }
@media (hover: none) {
  .hint-mouse, .only-mouse { display: none; }
  .hint-touch { display: flex; }
  .only-touch { display: inline; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { to { opacity: 1; } }

@media (max-width: 700px) {
  h1 { font-size: 9vw; gap: 0.12em 0.28em; }
  .mark { top: 14px; left: 16px; }
  .mark img { width: 54px; height: 54px; }
  .ctas { flex-direction: column; align-items: stretch; }
  .ctas .cta { text-align: center; }
  .hint span { font-size: 0.72rem; padding: 5px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ch, .status, .tagline, .cta, .mark, .hint { animation-duration: 0.01s; animation-delay: 0s; }
  .status::before { animation: none; }
  .saber { transition-duration: 0.1s; }
  .enter { animation: none; }
}
