/* =========================================================================
   Nigah — coming-soon landing
   Deep near-black canvas, luminous aperture aura, precision-instrument type.
   ========================================================================= */

/* ---- Self-hosted fonts --------------------------------------------------- */

/* Chakra Petch — DISPLAY only (squarish, geometric "precision optics").
   Three separate static weights. */
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra-petch-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra-petch-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra-petch-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* IBM Plex Sans — BODY/UI. Single variable file spanning 100–700. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens -------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* canvas */
  --canvas: #08090c;
  --canvas-2: #0a0b0f;

  /* brand light (matches the logo mark's brightened gradient) */
  --brand-blue: #3b82f6;
  --brand-cyan: #22d3ee;
  --brand-blue-deep: #1d4ed8;
  --brand-cyan-deep: #0891b2;

  /* ink */
  --ink: #f8fafc;
  --ink-muted: #9aa6bd;
  --ink-faint: #66708a;

  /* surfaces */
  --field-bg: rgba(255, 255, 255, 0.04);
  --field-border: rgba(148, 178, 224, 0.18);
  --field-border-focus: rgba(80, 190, 235, 0.75);

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
}

/* ---- Reset / base -------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---- Stage --------------------------------------------------------------- */

.stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  overflow: hidden;
  isolation: isolate;
  /* faint vertical lift from pure black so the aura falloff has somewhere to go */
  background:
    radial-gradient(120% 90% at 50% 8%, var(--canvas-2) 0%, var(--canvas) 60%);
}

/* subtle vignette to focus the eye toward center */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    130% 120% at 50% 50%,
    transparent 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* =========================================================================
   Background field: drifting neural-node constellation (canvas)
   ========================================================================= */

.field {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* fade in once JS has painted a couple of frames */
  opacity: 0;
  transition: opacity 1.2s ease 0.35s;
}

.field.is-live {
  opacity: 1;
}

/* =========================================================================
   Signature: the aperture aura
   An abstracted, blown-up echo of the logo mark — luminous core + concentric
   iris rings + a single diagonal sightline, NOT a stretched copy of the icon.
   ========================================================================= */

.aura {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  z-index: 1;
  width: min(125vh, 1150px);
  aspect-ratio: 1;
  pointer-events: none;
  /* luminous core: brand blue → cyan, radiating outward and dissolving to black */
  background: radial-gradient(
    circle at 50% 50%,
    rgba(59, 130, 246, 0.55) 0%,
    rgba(45, 175, 235, 0.32) 20%,
    rgba(34, 211, 238, 0.12) 38%,
    rgba(34, 211, 238, 0) 60%
  );
  will-change: transform, opacity;
}

/* concentric iris rings — the instrument structure, masked to dissolve at edges */
.aura::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0 34px,
    rgba(150, 200, 255, 0.07) 34px 35px
  );
  -webkit-mask: radial-gradient(
    circle at 50% 50%,
    #000 8%,
    rgba(0, 0, 0, 0.85) 34%,
    transparent 58%
  );
  mask: radial-gradient(
    circle at 50% 50%,
    #000 8%,
    rgba(0, 0, 0, 0.85) 34%,
    transparent 58%
  );
}

/* directional sightline — a soft diagonal streak echoing the logo's up-right vector */
.aura::after {
  content: "";
  position: absolute;
  inset: 0;
  rotate: -32deg;
  background: radial-gradient(
    58% 5% at 50% 50%,
    rgba(90, 210, 240, 0.4) 0%,
    rgba(34, 211, 238, 0) 72%
  );
  filter: blur(6px);
}

/* ---- Content ------------------------------------------------------------- */

.content {
  position: relative;
  z-index: 6;
  width: min(100%, 34rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  width: clamp(150px, 42vw, 200px);
  height: auto;
  filter: drop-shadow(0 6px 26px rgba(34, 130, 210, 0.35));
}

.headline {
  margin: clamp(1.75rem, 5vw, 2.75rem) 0 0;
  font-family: "Chakra Petch", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  /* faint gradient sheen so it feels lit by the aura, not a flat white block */
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #eaf3ff 55%,
    #bfe6f4 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  margin: clamp(0.9rem, 3vw, 1.35rem) auto 0;
  max-width: 30rem;
  font-size: clamp(0.98rem, 2.6vw, 1.1rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink-muted);
  text-wrap: balance;
}

/* ---- Subscribe form ------------------------------------------------------ */

.subscribe {
  margin-top: clamp(1.75rem, 5vw, 2.5rem);
  width: 100%;
  display: flex;
  gap: 0.6rem;
}

.subscribe input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.9rem 1.05rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.subscribe input[type="email"]::placeholder {
  color: var(--ink-faint);
}

.subscribe input[type="email"]:hover {
  border-color: rgba(148, 178, 224, 0.32);
}

.subscribe input[type="email"]:focus-visible {
  border-color: var(--field-border-focus);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(45, 175, 235, 0.22);
}

.subscribe button {
  flex: 0 0 auto;
  padding: 0.9rem 1.5rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #04121f;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--brand-blue) 0%,
    var(--brand-cyan) 100%
  );
  box-shadow: 0 8px 22px rgba(34, 150, 220, 0.32);
  transition: transform 0.14s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.subscribe button:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(34, 170, 230, 0.42);
}

.subscribe button:active {
  transform: translateY(1px);
}

.subscribe button:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 3px;
}

/* ---- Form status --------------------------------------------------------- */

.form-status {
  min-height: 1.4em;
  margin: 0.95rem 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.form-status[data-kind="error"] {
  color: #ff9b9b;
}

.form-status[data-kind="success"] {
  color: #7fe3c0;
}

/* ---- Utilities ----------------------------------------------------------- */

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---- Responsive: stack the form on narrow screens ------------------------ */

@media (max-width: 32rem) {
  .subscribe {
    flex-direction: column;
    gap: 0.65rem;
  }

  .subscribe button {
    width: 100%;
    padding: 0.95rem 1.5rem;
  }
}

/* =========================================================================
   Iris scan-rings — soft "aperture pulse" emitted from the eye
   ========================================================================= */

.rings {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  z-index: 1;
  width: min(70vh, 640px);
  aspect-ratio: 1;
  pointer-events: none;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(120, 205, 240, 0.5);
  opacity: 0;
  will-change: transform, opacity;
}

/* =========================================================================
   Detection scan-line + momentary tracking boxes
   ========================================================================= */

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(34, 211, 238, 0.05) 15%,
    rgba(120, 220, 245, 0.55) 50%,
    rgba(34, 211, 238, 0.05) 85%,
    transparent 100%
  );
  box-shadow: 0 0 22px 2px rgba(34, 211, 238, 0.35);
}

.scanline.is-sweeping {
  animation: scan-sweep 2.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.detections {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* A single momentary tracking box (spawned + removed from JS) */
.det-box {
  position: absolute;
  border: 1.5px solid rgba(120, 220, 245, 0.7);
  border-radius: 3px;
  opacity: 0;
  animation: det-register 2.2s ease forwards;
}

/* Corner ticks so it reads as a detection bracket, not a plain box */
.det-box::before,
.det-box::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--brand-cyan);
}
.det-box::before {
  top: -1.5px;
  left: -1.5px;
  border-right: 0;
  border-bottom: 0;
}
.det-box::after {
  bottom: -1.5px;
  right: -1.5px;
  border-left: 0;
  border-top: 0;
}

/* =========================================================================
   Film grain — barely-there animated texture to kill gradient banding
   ========================================================================= */

.grain {
  position: absolute;
  inset: -50%;
  z-index: 4;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =========================================================================
   Detection corner-brackets that register around the content on load
   ========================================================================= */

.bracket {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid rgba(120, 220, 245, 0.55);
  opacity: 0;
  pointer-events: none;
}

.bracket--tl {
  top: -18px;
  left: -18px;
  border-right: 0;
  border-bottom: 0;
}
.bracket--tr {
  top: -18px;
  right: -18px;
  border-left: 0;
  border-bottom: 0;
}
.bracket--bl {
  bottom: -18px;
  left: -18px;
  border-right: 0;
  border-top: 0;
}
.bracket--br {
  bottom: -18px;
  right: -18px;
  border-left: 0;
  border-top: 0;
}

/* =========================================================================
   Staged entrance — the "impact on initial load"
   Everything animates in on first paint via CSS (no JS dependency).
   ========================================================================= */

@media (prefers-reduced-motion: no-preference) {
  /* --- ambient loops --- */
  .aura {
    animation: aperture-breathe 11s ease-in-out infinite;
    animation-delay: 0.2s;
  }

  .ring {
    animation: aperture-pulse 7s ease-out infinite;
  }
  .ring:nth-child(2) {
    animation-delay: 2.33s;
  }
  .ring:nth-child(3) {
    animation-delay: 4.66s;
  }

  .grain {
    animation: grain-shift 0.7s steps(3) infinite;
  }

  /* --- one-time entrance --- */
  .aura {
    animation:
      aura-bloom 1.4s cubic-bezier(0.16, 1, 0.3, 1) both,
      aperture-breathe 11s ease-in-out 1.6s infinite;
  }

  .bracket {
    animation: bracket-register 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .bracket--tl {
    animation-delay: 0.5s;
  }
  .bracket--tr {
    animation-delay: 0.58s;
  }
  .bracket--bl {
    animation-delay: 0.66s;
  }
  .bracket--br {
    animation-delay: 0.74s;
  }

  .content > .logo,
  .content > .headline,
  .content > .tagline,
  .content > .subscribe,
  .content > .form-status {
    opacity: 0;
    animation: rise-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .content > .logo {
    animation-delay: 0.35s;
  }
  .content > .headline {
    animation-delay: 0.55s;
  }
  .content > .tagline {
    animation-delay: 0.72s;
  }
  .content > .subscribe {
    animation-delay: 0.88s;
  }
  .content > .form-status {
    animation-delay: 1s;
  }

  /* one-time sheen sweep across the gradient headline */
  .headline {
    position: relative;
  }
  .headline::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      105deg,
      transparent 40%,
      rgba(255, 255, 255, 0.55) 50%,
      transparent 60%
    );
    background-size: 260% 100%;
    background-position: 180% 0;
    -webkit-mask: linear-gradient(#000, #000);
    mix-blend-mode: overlay;
    animation: headline-sheen 1.1s ease 1.15s 1 both;
  }
}

/* =========================================================================
   Keyframes
   ========================================================================= */

@keyframes aperture-breathe {
  0%,
  100% {
    scale: 1;
    opacity: 0.9;
    translate: -50% -50%;
  }
  50% {
    scale: 1.05;
    opacity: 1;
    translate: -50% -52%;
  }
}

@keyframes aura-bloom {
  0% {
    scale: 0.72;
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    scale: 1;
    opacity: 0.9;
  }
}

@keyframes aperture-pulse {
  0% {
    transform: scale(0.28);
    opacity: 0;
  }
  12% {
    opacity: 0.5;
  }
  70% {
    opacity: 0.12;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes scan-sweep {
  0% {
    top: 8%;
    opacity: 0;
  }
  12%,
  88% {
    opacity: 1;
  }
  100% {
    top: 92%;
    opacity: 0;
  }
}

@keyframes det-register {
  0% {
    opacity: 0;
    transform: scale(1.12);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes bracket-register {
  0% {
    opacity: 0;
    scale: 1.35;
  }
  55% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.55;
    scale: 1;
  }
}

@keyframes rise-in {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes headline-sheen {
  0% {
    background-position: 180% 0;
  }
  100% {
    background-position: -80% 0;
  }
}

@keyframes grain-shift {
  0% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(-6%, 4%);
  }
  66% {
    transform: translate(4%, -5%);
  }
  100% {
    transform: translate(-3%, 2%);
  }
}

/* =========================================================================
   Reduced motion — quiet, respectful fallback
   Entrance collapses to a simple fade; no ambient loops; canvas stays dark.
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .field,
  .rings,
  .scanline,
  .detections,
  .grain {
    display: none;
  }

  .aura {
    animation: none;
  }

  .content > .logo,
  .content > .headline,
  .content > .tagline,
  .content > .subscribe,
  .content > .form-status {
    animation: fade-in-quiet 0.6s ease both;
  }
  .bracket {
    animation: fade-in-quiet 0.6s ease 0.2s forwards;
  }
}

@keyframes fade-in-quiet {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
