/* ============================================================
   PN₂ — stealth landing page
   near-black / electric cyan · zero dependencies
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg: #05070a;
  --bg-raise: #0a1018;
  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.55);
  --cyan-faint: rgba(0, 229, 255, 0.14);
  --text: #e8f1f5;
  --text-muted: rgba(232, 241, 245, 0.66);
  --text-faint: rgba(232, 241, 245, 0.40);
  --line: rgba(232, 241, 245, 0.08);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: system-ui, "Segoe UI", -apple-system, "Helvetica Neue", sans-serif;
  --space: clamp(1.25rem, 4vw, 3rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  background: var(--bg);
  scrollbar-color: #1c2833 var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0; }

a { color: var(--cyan); }

::selection { background: var(--cyan); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 2px;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1c2833; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #29394a; }

/* ============================================================
   background stack (all fixed, non-interactive)
   ============================================================ */

.bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh; /* immune to mobile URL-bar resize storms */
  z-index: 1;
  pointer-events: none;
  display: block;
}

.grid-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.5; /* static default for touch / no-JS; JS drives it on fine pointers */
  background-image:
    repeating-linear-gradient(0deg,  rgba(232,241,245,0.055) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(232,241,245,0.055) 0 1px, transparent 1px 56px);
  -webkit-mask-image: radial-gradient(circle 280px at var(--mx, 50%) var(--my, 34%), rgba(0,0,0,0.95) 0%, transparent 100%);
          mask-image: radial-gradient(circle 280px at var(--mx, 50%) var(--my, 34%), rgba(0,0,0,0.95) 0%, transparent 100%);
}

.spotlight {
  position: fixed;
  top: 0; left: 0;
  z-index: 3;
  pointer-events: none;
  width: min(80vmax, 1100px);
  aspect-ratio: 1;
  opacity: 0; /* JS drives */
  transform: translate3d(-50vw, -50vh, 0) translate(-50%, -50%);
  will-change: transform, opacity;
  background: radial-gradient(circle closest-side,
    rgba(0, 229, 255, 0.09) 0%,
    rgba(0, 229, 255, 0.03) 42%,
    transparent 68%);
}

.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(90deg, var(--cyan), rgba(0, 229, 255, 0.35));
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

/* ============================================================
   content
   ============================================================ */

main { position: relative; z-index: 10; }

html.js .hero { will-change: transform, opacity; } /* scroll recede layer */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding: calc(var(--space) * 2) var(--space);
  position: relative;
}

/* ---------- status line ---------- */
.status {
  display: flex;
  align-items: center;
  gap: 0.8em;
  font-family: var(--mono);
  font-size: clamp(0.72rem, 0.68rem + 0.3vw, 0.85rem);
  letter-spacing: 0.18em;
  color: var(--cyan-dim);
  user-select: none;
}

.status-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px 1px rgba(0, 229, 255, 0.8);
  flex: none;
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  background: var(--cyan-dim);
  flex: none;
}

@media (prefers-reduced-motion: no-preference) {
  .status-led { animation: led 2.4s ease-in-out infinite; }
  .caret { animation: blink 1.1s steps(1) infinite; }
}

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

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

/* ---------- wordmark ---------- */
.wordmark {
  margin: 0.12em 0 0.05em;
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(4.5rem, 2rem + 16vw, 13rem);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--text);
  user-select: none;
}

.wm {
  position: relative;
  display: inline-block;
  will-change: transform;
}

.wm-base { position: relative; z-index: 2; display: inline-block; }

.wordmark sub {
  font-size: 0.5em;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  bottom: -0.14em;
  margin-left: 0.02em;
  color: var(--cyan);
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.5);
}

/* glitch layers: exact DOM copies, revealed on hover */
.wm-glitch {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

.wm-glitch sub { text-shadow: none; }
.wm-glitch-a { color: #ff3b6b; }
.wm-glitch-a sub { color: #ff3b6b; }
.wm-glitch-b { color: var(--cyan); }
.wm-glitch-b sub { color: var(--cyan); }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .wm:hover .wm-glitch-a { animation: glitch-a 0.42s steps(2, jump-none) infinite; }
  .wm:hover .wm-glitch-b { animation: glitch-b 0.34s steps(2, jump-none) infinite; }
}

@keyframes glitch-a {
  0%   { opacity: 0.75; clip-path: inset(12% -2% 62% -2%); transform: translate(-0.022em, -0.008em); }
  25%  { opacity: 0.75; clip-path: inset(48% -2% 28% -2%); transform: translate(0.016em, 0.006em); }
  50%  { opacity: 0.75; clip-path: inset(72% -2% 6% -2%);  transform: translate(-0.014em, 0.01em); }
  75%  { opacity: 0.75; clip-path: inset(28% -2% 55% -2%); transform: translate(0.02em, -0.006em); }
  100% { opacity: 0.75; clip-path: inset(55% -2% 30% -2%); transform: translate(-0.018em, 0.008em); }
}

@keyframes glitch-b {
  0%   { opacity: 0.7; clip-path: inset(62% -2% 10% -2%); transform: translate(0.02em, 0.006em); }
  25%  { opacity: 0.7; clip-path: inset(8% -2% 74% -2%);  transform: translate(-0.018em, -0.004em); }
  50%  { opacity: 0.7; clip-path: inset(42% -2% 38% -2%); transform: translate(0.014em, -0.01em); }
  75%  { opacity: 0.7; clip-path: inset(80% -2% 4% -2%);  transform: translate(-0.02em, 0.008em); }
  100% { opacity: 0.7; clip-path: inset(20% -2% 58% -2%); transform: translate(0.016em, -0.006em); }
}

/* ---------- tagline ---------- */
.tagline {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 0.9rem + 1.1vw, 1.5rem);
  letter-spacing: 0.02em;
  color: var(--text);
  min-height: 1.6em;
}

.tagline::before {
  content: "> ";
  color: var(--cyan-dim);
  user-select: none;
}

.tagline-inner { display: inline-block; will-change: transform; }

/* ---------- lede / hiring ---------- */
.lede {
  margin-top: calc(var(--space) * 1.1);
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 46ch;
}

.lede-stealth { color: var(--text); }

.hiring {
  margin-top: 0.9em;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.15rem);
  color: var(--text-muted);
  max-width: 52ch;
}

/* ---------- CTA ---------- */
.cta-anchor {
  margin-top: calc(var(--space) * 1.1);
  align-self: flex-start;
}

.cta {
  display: inline-flex;
  align-items: center;
  position: relative;
  font-family: var(--mono);
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
  letter-spacing: 0.06em;
  color: var(--cyan);
  text-decoration: none;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background-color: rgba(7, 12, 16, 0.78); /* mostly opaque: lattice only ghosts through */
  background-image: linear-gradient(rgba(0, 229, 255, 0.04), rgba(0, 229, 255, 0.04));
  padding: 1em 1.6em;
  will-change: transform;
  transition: border-color 0.3s ease, background-image 0.3s ease;
}

.cta::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 34px rgba(0, 229, 255, 0.35), inset 0 0 20px rgba(0, 229, 255, 0.1);
  transition: opacity 0.35s ease;
}

.cta:hover, .cta:focus-visible {
  border-color: rgba(0, 229, 255, 0.85);
  background-image: linear-gradient(rgba(0, 229, 255, 0.09), rgba(0, 229, 255, 0.09));
}

.cta:hover::after, .cta:focus-visible::after { opacity: 1; }

.cta-label { display: inline-block; will-change: transform; }

.cta-arrow { display: inline-block; margin-right: 0.6em; }

@media (prefers-reduced-motion: no-preference) {
  .cta:hover .cta-arrow { animation: nudge 1s var(--ease-out) infinite; }
}

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(0.25em); }
}

/* ---------- scroll hint ---------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--space) * 0.8);
  translate: -50% 0;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text-faint);
  text-decoration: none;
  user-select: none;
}

@media (prefers-reduced-motion: no-preference) {
  html.js .scroll-hint {
    opacity: 0;
    animation: hint-in 0.8s ease 2s forwards, bob 2.4s ease-in-out 2s infinite;
  }
}

@keyframes hint-in { to { opacity: 1; } }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@media (max-height: 560px) {
  .scroll-hint { display: none; }
}

/* ---------- signals ---------- */
.signals {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding: calc(var(--space) * 2.4) var(--space);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.4rem, 4vw, 4rem);
  justify-content: space-between;
}

.signal {
  display: flex;
  gap: 1.1em;
  font-family: var(--mono);
  font-size: clamp(0.72rem, 0.68rem + 0.3vw, 0.85rem);
  letter-spacing: 0.18em;
  color: var(--text-faint);
  white-space: nowrap;
}

.signal-idx { color: var(--cyan-dim); user-select: none; }

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding: calc(var(--space) * 1.4) var(--space) calc(var(--space) * 1.6);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.9em;
}

.hex-mark { flex: none; opacity: 0.9; }

.footer-line {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 0.68rem + 0.25vw, 0.8rem);
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.footer-line a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 229, 255, 0.35);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.footer-line a:hover, .footer-line a:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* ============================================================
   intro + scroll reveals (JS-gated: no-JS users see everything)
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {
  html.js .status   { animation: rise 0.7s var(--ease-out) both; }
  html.js .wordmark { animation: rise 0.9s var(--ease-out) 0.1s both; }
  html.js .tagline  { animation: rise 0.9s var(--ease-out) 0.25s both; }

  html.js [data-reveal] {
    opacity: 0;
    translate: 0 26px;
    transition:
      opacity 0.9s var(--ease-out) var(--reveal-delay, 0ms),
      translate 0.9s var(--ease-out) var(--reveal-delay, 0ms);
  }

  html.js [data-reveal].in-view {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes rise {
  from { opacity: 0; translate: 0 18px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ============================================================
   custom cursor (fine pointers, JS-enabled, motion allowed)
   ============================================================ */

.cursor-dot, .cursor-ring { display: none; }

@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }

  html.has-cursor .cursor-dot {
    display: block;
    position: fixed;
    top: 0; left: 0;
    z-index: 9999;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.9);
    pointer-events: none;
    opacity: 0;
    will-change: transform;
  }

  html.has-cursor .cursor-ring {
    display: block;
    position: fixed;
    top: 0; left: 0;
    z-index: 9998;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 255, 0.45);
    pointer-events: none;
    opacity: 0;
    will-change: transform;
  }
}

/* ============================================================
   reduced motion: everything static, everything visible
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html.js [data-reveal] { opacity: 1; translate: none; }
  .scroll-hint { opacity: 1; }
  .spotlight, .cursor-dot, .cursor-ring, .scroll-progress { display: none; }
}

/* ============================================================
   breakpoints
   ============================================================ */

@media (max-width: 640px) {
  .hero { padding-block: calc(var(--space) * 1.6); }
  .signals { flex-direction: column; gap: 1.1rem; }
  .cta { width: 100%; justify-content: center; }
  .cta-anchor { align-self: stretch; }
}

@media (min-width: 1920px) {
  :root { --space: 3.4rem; }
}
