/* ==========================================================
 * PURE STATE · PROJECT IRIS — STYLES
 * ==========================================================
 * Enhanced glassmorphism, state transitions, responsive layout
 * ========================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-outer: oklch(6% 0.01 280);
  --bg-inner: oklch(8% 0.02 280);
  --text: oklch(90% 0.02 270);
  --muted: oklch(65% 0.02 270);
  --accent: oklch(68% 0.18 235);
  --accent-glow: oklch(68% 0.18 235 / 0.4);
  --success: oklch(70% 0.2 145);
  --error: oklch(65% 0.3 29);
  --header-h: 48px;
  --easing: cubic-bezier(.22, .61, .36, 1);
}

html, body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse 150% 150% at 50% 50%, var(--bg-inner), var(--bg-outer));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-y: auto;
}

/* --- Film Grain --- */
.grain-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* --- Canvas --- */
#constellation-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  animation: canvasFadeIn 2.3s var(--easing) forwards;
  pointer-events: none;
  will-change: transform;
}

@keyframes canvasFadeIn {
  to { opacity: 1; }
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.logo {
  width: 24px; height: 24px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* --- Main Layout --- */
main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(var(--header-h) + 2rem) 20px 2rem;
  text-align: center;
}

/* --- Acrylic Glass Container --- */
.container {
  position: relative;
  max-width: 600px;
  width: 100%;
  background: linear-gradient(180deg,
    oklch(14% 0.02 280 / 65%),
    oklch(10% 0.015 280 / 70%),
    oklch(8% 0.01 280 / 65%));
  backdrop-filter: blur(32px) saturate(120%);
  -webkit-backdrop-filter: blur(32px) saturate(120%);
  border: 1px solid oklch(100% 0 0 / 8%);
  border-radius: 24px;
  padding: 0;
  box-shadow:
    /* Deep shadow for lift */
    0 30px 60px -20px oklch(0% 0 0 / 50%),
    /* Softer mid shadow */
    0 10px 30px -10px oklch(0% 0 0 / 30%),
    /* Inner top edge highlight */
    inset 0 1px 0 0 oklch(100% 0 0 / 12%);
  overflow: hidden;
  transition: opacity 0.5s var(--easing);
}

/* Bottom-center light glow */
.container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 50% at 50% 100%,
    oklch(68% 0.18 235 / 12%) 0%,
    oklch(68% 0.18 235 / 4%) 40%,
    transparent 70%);
}

/* Static ambient light - pointing up */
.container::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from -60deg at 50% 100%,
    transparent 0deg,
    oklch(100% 0 0 / 4%) 60deg,
    transparent 120deg,
    transparent 360deg);
  opacity: 0.6;
  transition: opacity 0.3s var(--easing);
}

/* Dim light during view transitions */
.container.transitioning::after {
  opacity: 0.25;
}

/* --- Typography --- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.05;
  margin-bottom: 1rem;
  background: linear-gradient(to bottom right, oklch(98% 0 0), oklch(85% 0.02 280));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 2rem;
  font-weight: 400;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.subtitle strong {
  color: var(--text);
  font-weight: 500;
  display: block;
  margin-bottom: 0.35em;
}

/* --- Triad (Horizontal Flow) --- */
.triad-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 2.5rem;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.triad-sep {
  color: var(--accent);
  font-weight: bold;
  opacity: 0.8;
}

/* --- CTA Button (Acrylic Glass) --- */
.cta-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg,
    oklch(16% 0.02 235 / 80%) 0%,
    oklch(10% 0.015 235 / 90%) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: oklch(85% 0.04 235);
  border: 1px solid oklch(100% 0 0 / 12%);
  border-bottom-color: oklch(68% 0.18 235 / 20%);
  border-radius: 12px;
  padding: 14px 32px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition:
    background 0.25s var(--easing),
    border-color 0.25s var(--easing),
    color 0.25s var(--easing),
    box-shadow 0.25s var(--easing),
    transform 0.25s var(--easing);
  text-decoration: none;
  box-shadow:
    0 4px 16px -4px oklch(0% 0 0 / 60%),
    0 8px 24px -8px oklch(68% 0.18 235 / 15%),
    inset 0 1px 0 0 oklch(100% 0 0 / 10%);
}

/* Button surface highlight - bottom glow */
.cta-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 11px;
  background:
    radial-gradient(ellipse 60% 30% at 50% 100%, oklch(68% 0.18 235 / 15%) 0%, transparent 70%),
    linear-gradient(180deg, oklch(100% 0 0 / 6%) 0%, oklch(100% 0 0 / 0%) 40%);
  pointer-events: none;
}

.cta-btn:hover {
  border-color: oklch(100% 0 0 / 20%);
  border-bottom-color: oklch(68% 0.18 235 / 35%);
  color: oklch(92% 0.04 235);
  box-shadow:
    0 4px 16px -4px oklch(0% 0 0 / 60%),
    0 12px 32px -8px oklch(68% 0.18 235 / 25%),
    inset 0 1px 0 0 oklch(100% 0 0 / 14%);
}

.cta-btn:active {
  background: linear-gradient(180deg,
    oklch(12% 0.015 235 / 90%) 0%,
    oklch(8% 0.01 235 / 95%) 100%);
  border-color: oklch(100% 0 0 / 8%);
  transform: translateY(1px);
  box-shadow:
    0 2px 8px -2px oklch(0% 0 0 / 50%),
    0 4px 12px -4px oklch(68% 0.18 235 / 10%),
    inset 0 1px 0 0 oklch(100% 0 0 / 6%);
}

/* --- Back Button (Icon Only) --- */
.back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: oklch(100% 0 0 / 5%);
  border: 1px solid oklch(100% 0 0 / 8%);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s var(--easing);
}

.back-btn:hover {
  color: var(--text);
  background: oklch(100% 0 0 / 10%);
  border-color: oklch(100% 0 0 / 12%);
}

.back-btn:active {
  background: oklch(100% 0 0 / 6%);
  transform: scale(0.96);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

/* --- Form --- */
.waitlist-form {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.field {
  margin-bottom: 1rem;
}

label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.optional {
  opacity: 0.6;
  font-weight: 400;
  margin-left: 4px;
}

input, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg,
    oklch(0% 0 0 / 20%),
    oklch(0% 0 0 / 10%));
  border: 1px solid oklch(100% 0 0 / 8%);
  border-top-color: oklch(100% 0 0 / 4%);
  border-bottom-color: oklch(100% 0 0 / 12%);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.3s var(--easing);
  box-shadow:
    inset 0 2px 4px -2px oklch(0% 0 0 / 30%),
    0 1px 0 0 oklch(100% 0 0 / 5%);
}

input:focus, textarea:focus {
  outline: none;
  background: linear-gradient(180deg,
    oklch(0% 0 0 / 25%),
    oklch(0% 0 0 / 15%));
  border-color: oklch(68% 0.14 235 / 50%);
  box-shadow:
    inset 0 2px 4px -2px oklch(0% 0 0 / 30%),
    0 0 0 3px oklch(68% 0.18 235 / 12%),
    0 0 20px -5px oklch(68% 0.18 235 / 20%);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button.submit-btn {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg,
    oklch(16% 0.02 235 / 80%) 0%,
    oklch(10% 0.015 235 / 90%) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: oklch(85% 0.04 235);
  border: 1px solid oklch(100% 0 0 / 12%);
  border-bottom-color: oklch(68% 0.18 235 / 20%);
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition:
    background 0.25s var(--easing),
    border-color 0.25s var(--easing),
    color 0.25s var(--easing),
    box-shadow 0.25s var(--easing),
    transform 0.25s var(--easing),
    opacity 0.25s var(--easing);
  margin-top: 0.5rem;
  box-shadow:
    0 4px 16px -4px oklch(0% 0 0 / 60%),
    0 8px 24px -8px oklch(68% 0.18 235 / 15%),
    inset 0 1px 0 0 oklch(100% 0 0 / 10%);
}

/* Submit button surface highlight - bottom glow */
button.submit-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 11px;
  background:
    radial-gradient(ellipse 60% 30% at 50% 100%, oklch(68% 0.18 235 / 15%) 0%, transparent 70%),
    linear-gradient(180deg, oklch(100% 0 0 / 6%) 0%, oklch(100% 0 0 / 0%) 40%);
  pointer-events: none;
}

button.submit-btn:hover {
  border-color: oklch(100% 0 0 / 20%);
  border-bottom-color: oklch(68% 0.18 235 / 35%);
  color: oklch(92% 0.04 235);
  box-shadow:
    0 4px 16px -4px oklch(0% 0 0 / 60%),
    0 12px 32px -8px oklch(68% 0.18 235 / 25%),
    inset 0 1px 0 0 oklch(100% 0 0 / 14%);
}

button.submit-btn:active {
  background: linear-gradient(180deg,
    oklch(12% 0.015 235 / 90%) 0%,
    oklch(8% 0.01 235 / 95%) 100%);
  border-color: oklch(100% 0 0 / 8%);
  transform: translateY(1px);
  box-shadow:
    0 2px 8px -2px oklch(0% 0 0 / 50%),
    0 4px 12px -4px oklch(68% 0.18 235 / 10%),
    inset 0 1px 0 0 oklch(100% 0 0 / 6%);
}

button.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: linear-gradient(180deg,
    oklch(14% 0.01 280) 0%,
    oklch(10% 0.01 280) 100%);
  box-shadow:
    0 2px 6px -2px oklch(0% 0 0 / 30%),
    inset 0 1px 0 0 oklch(100% 0 0 / 4%);
}

.hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.disclaimer {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.6;
  margin-top: auto;
  padding-top: 1.5rem;
  text-align: center;
}

.error-msg {
  font-size: 12px;
  color: var(--error);
  min-height: 1.5em;
  margin-top: 0.5rem;
  text-align: center;
}

/* --- Container Inner (Grid Stack) --- */
.container-inner {
  position: relative;  /* anchor absolute views */
}

/* --- View States --- */
/* Default: views do NOT affect layout */
.view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 3rem 2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition:
    opacity 0.3s var(--easing),
    transform 0.3s var(--easing),
    visibility 0s 0.3s;
}

/* Active view DOES affect layout */
.view.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition:
    opacity 0.3s var(--easing),
    transform 0.3s var(--easing),
    visibility 0s 0s;
}

/* Exiting: stays visible during fade-out but out of flow */
.view.exiting {
  position: absolute;
  visibility: visible;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.25s var(--easing),
    transform 0.25s var(--easing);
}

/* Manifesto view uses flex for disclaimer positioning */
#manifestoView {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Form view needs top padding for back button */
#formView {
  padding-top: 4rem;
}

#formView.active,
#formView.exiting {
  padding-top: 4rem;
}

.view--success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

/* --- Container height transition --- */
.container {
  transition:
    opacity 0.5s var(--easing),
    height 0.3s var(--easing);  /* no delay */
}

.container.transitioning {
  overflow: hidden;
}

.success-icon {
  width: 56px; height: 56px;
  color: var(--success);
  margin-bottom: 0.5rem;
}

.reference-code {
  background: oklch(100% 0 0 / 5%);
  border: 1px solid oklch(100% 0 0 / 10%);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-family: monospace;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-top: 1rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .container {
    border-radius: 20px;
  }

  .view {
    padding: 2rem 1.5rem;
  }

  #formView,
  #formView.active,
  #formView.exiting {
    padding-top: 3.5rem;
  }

  h1 {
    font-size: 24px;
  }

  .kicker {
    margin-bottom: 1rem;
  }

  .back-btn {
    top: 0.75rem;
    left: 0.75rem;
    width: 32px;
    height: 32px;
  }

  /* Reduce spacing on mobile for the horizontal triad */
  .triad-container {
    gap: 10px;
    font-size: 13px;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}