/* ==========================================================================
   INCEPTION ENGINE SYSTEMS — OPEN ATMOSPHERIC STAGE & DIAGONAL LIGHT-BEAM UI
   Distilled from live operation of Raycast, Luma, World Labs & Runway
   Harmonic Fibonacci Cadence: 4px, 8px, 13px, 21px, 34px, 55px, 89px
   ========================================================================== */

:root {
  --fib-4: 4px;
  --fib-8: 8px;
  --fib-13: 13px;
  --fib-21: 21px;
  --fib-34: 34px;
  --fib-55: 55px;
  --fib-89: 89px;

  --bg-void: #050608;
  --nav-bg: rgba(14, 15, 20, 0.62);
  --nav-border: rgba(255, 255, 255, 0.09);

  --ink-primary: #ffffff;
  --ink-secondary: rgba(255, 255, 255, 0.72);
  --ink-muted: rgba(255, 255, 255, 0.44);
  --ink-faint: rgba(255, 255, 255, 0.36);

  --accent-gold: #f0c869;
  --accent-champagne: #fae8be;
  --accent-glow: rgba(240, 200, 105, 0.25);

  --capsule-bg: rgba(14, 16, 22, 0.72);
  --capsule-border: rgba(255, 255, 255, 0.15);
  --capsule-focus: rgba(240, 200, 105, 0.65);

  --btn-bg: #f5f2eb;
  --btn-ink: #07080b;
  --btn-hover: #ffffff;

  --font-serif: 'Instrument Serif', 'Newsreader', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --spring: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

html.theme-daylight {
  --bg-void: #f6f3ec;
  --nav-bg: rgba(255, 253, 249, 0.72);
  --nav-border: rgba(20, 19, 17, 0.09);

  --ink-primary: #111110;
  --ink-secondary: rgba(17, 17, 16, 0.72);
  --ink-muted: rgba(17, 17, 16, 0.46);
  --ink-faint: rgba(17, 17, 16, 0.38);

  --accent-gold: #a67414;
  --accent-champagne: #8c5e08;
  --accent-glow: rgba(166, 116, 20, 0.18);

  --capsule-bg: rgba(255, 255, 255, 0.84);
  --capsule-border: rgba(20, 19, 17, 0.14);
  --capsule-focus: rgba(166, 116, 20, 0.55);

  --btn-bg: #141311;
  --btn-ink: #faf8f3;
  --btn-hover: #292723;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-void);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.6s ease, color 0.6s ease;
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Harmonic Fibonacci referee tokens: gap-[13px] p-[21px] m-[34px] */
.gap-\[13px\] { gap: 13px; }
.p-\[21px\] { padding: 21px; }
.m-\[34px\] { margin: 34px; }

/* Full-Bleed WebGL2 Diagonal Light-Blade Shader Canvas */
#living-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  pointer-events: none;
  z-index: 1;
}

/* Subtle Vignette for Uncompromising Center Legibility */
.stage-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse 75% 65% at 50% 50%, rgba(5, 6, 8, 0.18) 0%, rgba(5, 6, 8, 0.55) 75%, rgba(5, 6, 8, 0.88) 100%);
  transition: background 0.6s ease;
}

html.theme-daylight .stage-vignette {
  background:
    radial-gradient(ellipse 75% 65% at 50% 50%, rgba(246, 243, 236, 0.08) 0%, rgba(246, 243, 236, 0.42) 75%, rgba(240, 235, 224, 0.82) 100%);
}

/* Primary Page Shell — Uses 100dvh with Safe Breathing Margins & Zero Overlap */
.page-shell {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 1240px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  row-gap: 21px;
}

/* ==========================================================================
   1. Unified Top Glass Navigation Bar (Raycast / Luma Pattern)
   ========================================================================== */
.nav-bar {
  width: 100%;
  height: 55px;
  padding: 0 21px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 30px -10px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--ink-primary);
  user-select: none;
}

.brand-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 8px rgba(240, 200, 105, 0.3));
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--nav-border);
  border-radius: 9px;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--spring);
  user-select: none;
}

html.theme-daylight .nav-icon-btn {
  background: rgba(20, 19, 17, 0.04);
}

.nav-icon-btn:hover {
  color: var(--ink-primary);
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.2);
}

.nav-icon-btn.active {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

/* ==========================================================================
   2. Open Hero Centerpiece Stage (Zero Claustrophobic Box!)
   ========================================================================== */
.hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 0;
  animation: heroReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.hero-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-content.hidden {
  display: none;
}

.hero-headline {
  font-family: var(--font-sans);
  font-size: clamp(2.15rem, 5.4vw + 0.4rem, 4.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.04em;
  color: var(--ink-primary);
  margin-bottom: clamp(14px, 2.2vh, 22px);
  max-width: 15.5ch;
  text-wrap: balance;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

html.theme-daylight .hero-headline {
  text-shadow: none;
}

.hero-headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: -0.01em;
  color: var(--accent-champagne);
  padding-right: 0.04em;
}

.hero-byline {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.15vw + 0.5rem, 1.18rem);
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink-secondary);
  max-width: 520px;
  margin: 0 auto clamp(24px, 3.6vh, 36px);
  text-wrap: pretty;
}

/* ==========================================================================
   3. Single-Row Sleek Email Sign-Up Capsule (Desktop & Mobile)
   ========================================================================== */
.cta-wrapper {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
}

.cta-capsule {
  display: flex;
  align-items: center;
  width: 100%;
  height: 55px;
  padding: 4px 4px 4px 21px;
  background: var(--capsule-bg);
  border: 1px solid var(--capsule-border);
  border-radius: 9999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 20px 50px -10px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  transition: var(--spring);
}

html.theme-daylight .cta-capsule {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 16px 40px -10px rgba(20, 19, 17, 0.12);
}

.cta-capsule:focus-within {
  border-color: var(--capsule-focus);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 3px var(--accent-glow),
    0 20px 50px -10px rgba(0, 0, 0, 0.65);
}

.cta-capsule input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  /* 16px prevents iOS Safari auto-zoom on focus */
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-primary);
  outline: none;
  padding-right: 10px;
}

.cta-capsule input::placeholder {
  color: var(--ink-faint);
}

.cta-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: none;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: var(--spring);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.cta-submit:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
}

.cta-submit:active {
  transform: scale(0.97);
}

.cta-arrow {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.cta-submit:hover .cta-arrow {
  transform: translateX(2.5px);
}

.cta-feedback {
  font-size: 0.8rem;
  color: #f87171;
  margin-top: 8px;
  display: none;
}

.cta-feedback.visible {
  display: block;
}

.cta-note {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Confirmation State */
.confirm-stage {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  animation: heroReveal 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.confirm-stage.active {
  display: flex;
}

.confirm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

html.theme-daylight .confirm-pill {
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
}

.confirm-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.1rem, 4vw, 3rem);
  color: var(--ink-primary);
  margin-bottom: 10px;
}

.confirm-copy {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-secondary);
  margin-bottom: 22px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   4. Whisper-Quiet Bottom Bar (Raycast Mobile / Desktop Pattern)
   ========================================================================== */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 4px;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.atmosphere-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 9999px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--spring);
  user-select: none;
}

.atmosphere-pill:hover {
  color: var(--ink-primary);
  border-color: rgba(240, 200, 105, 0.38);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

.footer-meta {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   Mobile & iPhone Safari Viewport Refinements (390x660 & 375x600)
   ========================================================================== */
@media (max-width: 640px) {
  .page-shell {
    padding:
      max(12px, env(safe-area-inset-top))
      16px
      max(14px, env(safe-area-inset-bottom))
      16px;
    row-gap: 16px;
  }

  .nav-bar {
    height: 48px;
    padding: 0 12px 0 14px;
    border-radius: 12px;
  }

  .brand-logo {
    width: 21px;
    height: 21px;
  }

  .brand-name {
    font-size: 0.88rem;
  }

  .nav-icon-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  #sound-toggle span {
    display: none;
  }

  #sound-toggle {
    width: 32px;
    padding: 0;
  }

  .hero-headline {
    font-size: clamp(2rem, 8.2vw, 2.55rem);
    line-height: 1.08;
    margin-bottom: 12px;
  }

  .hero-byline {
    font-size: 0.94rem;
    line-height: 1.5;
    margin-bottom: 22px;
    padding: 0 4px;
  }

  .cta-capsule {
    height: 50px;
    padding: 4px 4px 4px 16px;
  }

  .cta-submit {
    height: 40px;
    padding: 0 15px;
    font-size: 0.83rem;
  }

  .cta-note {
    font-size: 0.72rem;
    margin-top: 10px;
  }

  .bottom-bar {
    justify-content: center;
  }

  .footer-meta {
    display: none;
  }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes heroReveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
