/* 
   NSO Launch Landing Page - Visual Language
   Ref: https://nso-landing-page-77.web.app/
*/

:root {
  --bg: #F4F1EC;
  --bg-dark: #000000;
  --ink: #0D0D0D;
  --ink-soft: #888888;
  --accent: #000000;
  --accent-dim: rgba(0, 0, 0, 0.05);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.02);
  --border: rgba(13, 13, 13, 0.08); /* Even lighter border */
  --serif: 'EB Garamond', serif;
  --mono: 'DM Mono', monospace;
  
  /* Spacing */
  --safe-area: 3rem; /* More breath */
  --transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 2s cubic-bezier(0.16, 1, 0.3, 1);
}

body.spectral-state {
  background-color: var(--bg-dark);
  color: #FFFFFF;
}

/* ── OVERLAYS ── */

.neural-noise-overlay {
  display: none; /* Paper grain avoided at all costs */
}

.pulse-marker {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
  height: 0;
  background: linear-gradient(to bottom, transparent, var(--ink), transparent);
  opacity: 0.1;
  z-index: 5;
  transition: height 2s ease;
}

body.resolving .pulse-marker {
  height: 100vh;
  animation: corePulse 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes corePulse {
  0%, 100% { opacity: 0.4; filter: blur(0px); }
  50% { opacity: 1; filter: blur(2px); }
}

/* ── HEADER & LOGO ── */

.main-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 3rem;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.logo-container {
  width: 53px;
  height: 53px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.logo-container:hover {
  transform: scale(1.05);
}

.brand-subheadline {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink);
  opacity: 0.5;
  margin-top: 1.2rem; /* Align with logo center visually */
  transition: color 2s ease, opacity 2s ease;
}

body.spectral-state .brand-subheadline {
  color: #FFFFFF;
  opacity: 0.8;
}

.nso-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 1s ease;
}

.nso-logo.hidden {
  display: none;
}

main {
  width: 100%;
  max-width: 1400px;
  padding: 8rem var(--safe-area) 8rem; /* Increased top padding for absolute header */
  text-align: center;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.5rem; /* Increased vertical rhythm */
}

/* ── TYPOGRAPHY ── */

.headline {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
  max-width: 1000px;
  margin: 0 auto;
  transition: color 2s ease;
}

.headline em {
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.04em; /* Optical kerning for italics */
}


/* ── FORM ── */

.cta-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 500px;
}

.email-input {
  flex: 1;
  height: 52px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 24px;
  padding: 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.01);
}

.email-input::placeholder {
  color: #999;
  font-weight: 300;
}

.email-input:focus {
  border-color: var(--ink);
  background: rgba(13, 13, 13, 0.02);
}

.submit-button {
  height: 52px;
  background: var(--ink);
  color: #FFFFFF;
  border: none;
  border-radius: 26px; /* Pill shape */
  padding: 0 2rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  filter: brightness(1.2);
}

.submit-button:active {
  transform: translateY(0);
}

.sweep-line {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}

.sweep-line.active {
  animation: sweepAction 1.5s infinite ease-in-out;
}

/* ── PHASE 2: MECHANISM VIEW ── */

.mechanism-view {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 4rem;
  text-align: left;
  position: relative;
  z-index: 10;
}

.latent-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.8;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

.hidden { display: none; }

.resolution-header {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 2rem;
}

.origin-label {
  font-size: 0.6rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

body.spectral-state .origin-label { color: #FFFFFF; opacity: 0.8; }

.resolution-title {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.mechanism-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.mech-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s ease, 
              background 0.4s ease,
              box-shadow 0.4s ease,
              filter 0.4s ease;
  position: relative;
  overflow: hidden;
}

.mechanism-grid:has(.mech-card:hover) .mech-card:not(:hover) {
  opacity: 0.35;
  filter: blur(1px) grayscale(0.5);
  transform: scale(0.98);
}

.mech-card:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
              0 0 20px rgba(255, 255, 255, 0.05);
  z-index: 2;
}

/* Data-stream glow effect */
.mech-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg, 
    transparent, 
    rgba(255, 255, 255, 0.05), 
    rgba(255, 255, 255, 0.1), 
    rgba(255, 255, 255, 0.05), 
    transparent
  );
  transform: skewX(-15deg);
  transition: none;
}

.mech-card:hover::after {
  animation: dataStream 2s infinite linear;
}

@keyframes dataStream {
  0% { left: -150%; }
  100% { left: 150%; }
}

.fade-in .mech-card {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) var(--d) forwards;
}

.mono-idx {
  font-size: 0.6rem;
  opacity: 0.5;
}

.mech-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
}

.mech-card p {
  font-size: 0.95rem;
  font-style: italic;
  opacity: 0.7;
  line-height: 1.4;
}

.blinking { animation: blink 1s infinite step-start; margin-right: 0.5rem; }

/* ── ANIMATIONS ── */

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

.fade-in {
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in-delayed {
  opacity: 0;
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.fade-in-delayed-more {
  opacity: 0;
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.fade-out {
  animation: fadeOutDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes sweepAction {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── RESPONSIVE ── */

@media (max-width: 768px) {
  :root {
    --safe-area: 1.5rem;
  }

  .main-header {
    padding: 1.5rem;
  }

  .logo-container {
    width: 40px;
    height: 40px;
  }

  .brand-subheadline {
    font-size: 0.6rem;
    margin-top: 0.8rem;
    max-width: 100px;
    text-align: right;
  }

  main {
    padding-top: 10rem;
    padding-bottom: 4rem;
  }

  .headline {
    font-size: 2.8rem;
  }

  .cta-form {
    flex-direction: column;
    gap: 0.8rem;
  }

  .email-input, .submit-button {
    width: 100%;
    height: 48px;
  }

  .resolution-title {
    font-size: 2rem;
  }

  .mechanism-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .mech-card {
    padding: 1.5rem;
  }
}
