/* SMEX iter 25 - cursor restructure (outer position / inner spin), per-letter SMEX parallax, mouse-reactive gradient angle, breathing camera dolly. */

:root {
  --bg: #040409;
  --fg: #F0EFEC;
  --fg-dim: rgba(240, 239, 236, 0.55);
  --fg-faint: rgba(240, 239, 236, 0.22);
  --fg-line: rgba(240, 239, 236, 0.10);

  --cool: #2EE8C4;
  --cool-soft: rgba(46, 232, 196, 0.55);
  --warm: #FF6B9D;
  --warm-soft: rgba(255, 107, 157, 0.55);
  --violet: #B388FF;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-serif: "Fraunces", "Tiempos", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-cinema: cubic-bezier(0.32, 0.72, 0, 1);

  /* JS will update --mx, --my (range -1..1) on pointer move */
  --mx: 0;
  --my: 0;
}

html, body { cursor: none; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01" on, "cv11" on;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}
@media (max-width: 920px) {
  html, body { cursor: auto; }
  body { height: auto; min-height: 100vh; overflow-y: auto; }
}

button, input { font: inherit; color: inherit; }

/* CANVAS */
#canvas-wrap { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#canvas { width: 100%; height: 100%; display: block; }

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, transparent 35%, rgba(0,0,0,0.55) 95%),
    radial-gradient(ellipse 1100px 700px at 50% 50%, rgba(46, 232, 196, 0.04) 0%, transparent 60%);
}

/* CURSOR - two-element structure to avoid transform conflicts */
.cursor-x {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 220ms var(--ease-expo);
  will-change: transform;
  /* Position is set via inline style.transform from JS. */
}
.cursor-x.visible { opacity: 0.95; }

.cursor-x-glyph {
  display: block;
  position: relative;
  font-family: var(--font-sans);
  font-weight: 200;
  font-size: 22px;
  line-height: 1;
  color: var(--cool);
  mix-blend-mode: screen;
  text-shadow: 0 0 12px rgba(46, 232, 196, 0.55), 0 0 24px rgba(46, 232, 196, 0.20);
  transform: translate(-50%, -50%) rotate(0deg);
  transition: font-size 280ms var(--ease-expo), color 220ms var(--ease-expo), text-shadow 220ms var(--ease-expo);
  will-change: transform;
}

/* TRAIL CANVAS - smooth ghost trail behind cursor */
#trail-canvas {
  position: fixed; inset: 0;
  z-index: 150;
  pointer-events: none;
  mix-blend-mode: screen;
}

.cursor-x.spinning .cursor-x-glyph {
  font-size: 34px;
  color: var(--warm);
  text-shadow: 0 0 14px rgba(255, 107, 157, 0.70), 0 0 30px rgba(255, 107, 157, 0.30);
  animation: cursorSpin 1.4s linear infinite;
}

@keyframes cursorSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* TOPBAR */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
@media (max-width: 720px) { .topbar { padding: 20px; } }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: color 200ms var(--ease-expo);
}
.status:hover { color: var(--cool); }
.status-dot {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--cool);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(46, 232, 196, 0.7);
  animation: pulse 2.4s var(--ease-expo) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); background: var(--cool); }
  50%      { opacity: 1;   transform: scale(1.3); background: var(--warm); box-shadow: 0 0 12px rgba(255, 107, 157, 0.7); }
}
.locale { color: var(--fg-faint); }
@media (max-width: 720px) { .locale { display: none; } }

/* STAGE */
.stage {
  position: relative;
  z-index: 5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 80px 40px;
  text-align: center;
}
@media (max-width: 720px) { .stage { padding: 80px 20px; min-height: 100vh; height: auto; } }

/* SMEX HALO - subtle radial glow behind the wordmark, breathes + reacts to mouse */
.smex-halo {
  position: absolute;
  z-index: 4;
  width: min(900px, 92vw);
  height: min(540px, 60vw);
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(46, 232, 196, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(255, 107, 157, 0.12) 0%, transparent 60%);
  filter: blur(40px);
  opacity: 0;
  transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 8px));
  transition: transform 360ms var(--ease-expo);
  animation: haloIn 2200ms var(--ease-expo) 600ms forwards, haloPulse 9s ease-in-out 2800ms infinite;
}
@keyframes haloIn {
  from { opacity: 0; transform: translate(0, 0) scale(0.85); }
  to   { opacity: 1; transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 8px)) scale(1); }
}
@keyframes haloPulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1.0; }
}

/* When SMEX is hovered, halo intensifies + scales up subtly */
.smex-hover .smex-halo {
  filter: blur(34px);
  transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 8px)) scale(1.08);
  animation-play-state: running;
}
.smex-hover .smex-halo {
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(46, 232, 196, 0.30) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(255, 107, 157, 0.22) 0%, transparent 60%);
}

/* WORDMARK - per-letter parallax + mouse-reactive gradient */
.wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(120px, 22vw, 320px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 144;
  margin: 0;
  opacity: 0;
  animation: wordmarkIn 1800ms var(--ease-expo) 320ms forwards, wordmarkBreathe 11s ease-in-out 2s infinite;
  perspective: 800px;
  perspective-origin: 50% 50%;
}
@keyframes wordmarkBreathe {
  0%, 100% { font-variation-settings: "opsz" 144, "wght" 300; }
  50%      { font-variation-settings: "opsz" 110, "wght" 340; }
}
@keyframes gradientSweep {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.wordmark-em {
  font-style: italic;
  font-variation-settings: "opsz" 144;
  display: inline-block;
  filter:
    drop-shadow(calc(var(--mx) * 1.8px) calc(var(--my) * 0.9px) 0 rgba(46, 232, 196, 0.35))
    drop-shadow(calc(var(--mx) * -1.8px) calc(var(--my) * -0.9px) 0 rgba(255, 107, 157, 0.35));
  transition: filter 240ms var(--ease-expo);
}
.ltr {
  display: inline-block;
  /* Each letter has its own gradient, same colours - so the wordmark reads as one mark while letters move independently. */
  background: linear-gradient(
    calc(135deg + (var(--mx) * 35deg)),
    var(--cool) 0%,
    var(--fg) calc(35% + (var(--mx) * 8%)),
    var(--fg) calc(65% + (var(--mx) * 8%)),
    var(--warm) 100%
  );
  background-size: 220% 100%;
  animation: gradientSweep 12s ease-in-out infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Per-letter parallax - amplitude grows slightly along the word so 'X' moves more than 'S'. */
  transform: translate3d(
    calc(var(--mx) * (6px + var(--li) * 2px)),
    calc(var(--my) * (3px + var(--li) * 1px)),
    0
  ) rotateY(calc(var(--mx) * 4deg)) rotateX(calc(var(--my) * -2deg));
  transition: transform 280ms var(--ease-expo), filter 220ms var(--ease-expo);
  will-change: transform;
  cursor: none;
}
.ltr:hover {
  filter: drop-shadow(0 0 24px rgba(46, 232, 196, 0.55)) drop-shadow(0 0 32px rgba(255, 107, 157, 0.35));
}
@keyframes wordmarkIn {
  from { opacity: 0; transform: translateY(14px); letter-spacing: -0.02em; }
  to   { opacity: 1; transform: translateY(0);    letter-spacing: -0.04em; }
}

.under {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  opacity: 0;
  animation: fadeUp 900ms var(--ease-expo) 1100ms forwards;
}

/* SIGNUP */
.signup {
  margin-top: 64px;
  position: relative;
  display: flex;
  align-items: center;
  width: min(420px, 100%);
  opacity: 0;
  animation: fadeUp 900ms var(--ease-expo) 1500ms forwards;
}
#email-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  padding: 14px 0;
  font-size: 14px;
  font-family: var(--font-sans);
  letter-spacing: 0.005em;
  outline: none;
  text-align: center;
}
#email-input::placeholder { color: var(--fg-faint); font-style: italic; font-family: var(--font-serif); font-size: 15px; }
.signup-submit {
  background: transparent;
  border: none;
  color: var(--cool);
  font-size: 18px;
  padding: 14px 8px;
  margin-left: 10px;
  transition: transform 240ms var(--ease-expo), color 200ms var(--ease-expo);
}
.signup-submit:hover { transform: translateX(4px); color: var(--warm); }
.signup-line {
  position: absolute;
  left: 0; right: 36px;
  bottom: 0;
  height: 1px;
  background: var(--fg-line);
  transition: background 200ms var(--ease-expo);
}
.signup:focus-within .signup-line {
  background: linear-gradient(90deg, var(--cool), var(--warm));
}

.meta {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  min-height: 14px;
  opacity: 0;
  animation: fadeIn 800ms var(--ease-expo) 2000ms forwards;
}
.meta.success { color: var(--cool); }
.meta.error { color: var(--warm); }

/* ANIMATIONS */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .wordmark, .under, .signup, .meta { opacity: 1; transform: none; }
  .ltr { transform: none; }
}
