/* Schreiber AI pre-launch splash: ATLAS. Dark by design (it's space). */
:root {
  --void: #05070f;
  --deep: #0b1430;
  --panel: rgba(14, 26, 58, .42);
  --line: rgba(61, 245, 255, .22);
  --cyan: #3df5ff;
  --cyan-dim: #1aa9bd;
  --amber: #ffb547;
  --red: #ff4d6d;
  --text: #eef4ff;
  --muted: #8fa3c7;
  --display: "Unbounded", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 70% 10%, #10204a 0%, var(--deep) 35%, var(--void) 75%) fixed, var(--void);
  color: var(--text);
  font: 400 16px/1.6 var(--body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--cyan); color: var(--void); }
.mono { font-family: var(--mono); letter-spacing: .04em; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

/* ---------- ambient layers ---------- */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#flash { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0; background: radial-gradient(circle, #fff 0%, #bffcff 35%, var(--cyan) 100%); transition: opacity .25s ease-in; }
#flash.on { opacity: 1; }
/* warp: everything falls away except ATLAS, which the camera dives into */
body.warping .top, body.warping .hero-copy, body.warping .what, body.warping .signal, body.warping .foot, body.warping .floor { opacity: 0; transition: opacity .5s; }
body.warping .hud, body.warping .tag, body.warping .readout { opacity: 0; transition: opacity .4s; }
body.warping { overflow: hidden; }
body.warping .atlas {
  transform: translate(var(--wx, 0), var(--wy, 0)) scale(9); opacity: 0; filter: blur(2px) brightness(1.6);
  transition: transform 1.35s cubic-bezier(.65,0,.85,.2), opacity .45s ease-in .95s, filter 1.35s ease-in;
}
.floor {
  position: fixed; left: -50%; right: -50%; bottom: -10vh; height: 55vh; z-index: 0; pointer-events: none;
  background:
    linear-gradient(to top, transparent, var(--void) 92%),
    repeating-linear-gradient(90deg, rgba(61,245,255,.16) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(61,245,255,.16) 0 1px, transparent 1px 80px);
  background-blend-mode: normal;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  animation: floor 16s linear infinite;
}
@keyframes floor { to { background-position: 0 0, 0 0, 0 80px; } }
.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.4s steps(4) infinite;
}
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -4%); } 75% { transform: translate(-1%, 3%); } }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 80; background: var(--void);
  display: flex; flex-direction: column; justify-content: center; padding: var(--gutter);
  transform-origin: 50% 50%;
}
/* CRT power-off: squash to a bright line, then to a point */
#boot.done { animation: crt .5s cubic-bezier(.7,0,.3,1) forwards; pointer-events: none; }
#boot.done pre, #boot.done .boot-skip { opacity: 0; transition: opacity .12s; }
@keyframes crt {
  0% { transform: scale(1, 1); background: var(--void); }
  55% { transform: scale(1, .004); background: #bffcff; opacity: 1; }
  100% { transform: scale(0, .004); background: #fff; opacity: 0; }
}
#boot pre { margin: 0 auto; width: min(640px, 100%); font: 400 clamp(12px, 2.8vw, 15px)/1.8 var(--mono); color: var(--cyan); white-space: pre-wrap; }
#boot pre .ok { color: #7dffb0; }
#boot pre .warn { color: var(--amber); }
#boot pre::after { content: "▮"; animation: blink 1s steps(1) infinite; }
.boot-skip { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font: 12px var(--mono); color: var(--muted); opacity: .6; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- header ---------- */
.top {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px var(--gutter);
}
.wordmark {
  position: relative; font: 800 clamp(15px, 3.6vw, 20px)/1 var(--display); letter-spacing: .12em;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: default;
  padding: 8px 0 8px 44px;
}
.wm-slash { color: var(--cyan); margin: 0 .15em; text-shadow: 0 0 12px var(--cyan); }
.wm-b { color: var(--cyan); }
.wm-charge { position: absolute; left: 0; top: 50%; width: 34px; height: 34px; transform: translateY(-50%) rotate(-90deg); }
.wm-charge circle { fill: rgba(61,245,255,.06); stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 101; stroke-dashoffset: 101; }
.wordmark::before {
  content: ""; position: absolute; left: 9px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%) rotate(45deg);
  border: 2px solid var(--cyan); box-shadow: 0 0 14px rgba(61,245,255,.6), inset 0 0 8px rgba(61,245,255,.5);
}
.wordmark.charging .wm-charge circle { stroke-dashoffset: 0; transition: stroke-dashoffset 3s linear; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 11px/1 var(--mono); letter-spacing: .1em; color: var(--amber);
  padding: 8px 12px; border: 1px solid rgba(255,181,71,.35); border-radius: 999px; background: rgba(255,181,71,.07);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); animation: pulse 3.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

/* ---------- hero ---------- */
main { position: relative; z-index: 2; }
.hero {
  display: grid; gap: 8px; align-items: center;
  padding: 0 var(--gutter) 40px;
  min-height: calc(100vh - 80px);
  min-height: calc(100svh - 80px);
}
.hero-copy { order: 2; max-width: 620px; }
.eyebrow { font-size: 11px; color: var(--cyan); letter-spacing: .22em; margin: 0 0 14px; opacity: .9; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(32px, 8.4vw, 72px); line-height: 1.02; text-wrap: balance; }
h1 .hl { background: linear-gradient(100deg, #fff 0%, var(--cyan) 45%, #8af9ff 70%, #fff 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: sheen 16s linear infinite; }
@keyframes sheen { to { background-position: -200% 0; } }
h2 { font-size: clamp(28px, 6vw, 52px); line-height: 1.05; }
.lede { color: var(--muted); font-size: clamp(16px, 2.2vw, 19px); max-width: 52ch; margin: 18px 0 0; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 10px; font: 600 14px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--line); cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn-primary { background: var(--cyan); color: var(--void); border-color: var(--cyan); box-shadow: 0 0 0 0 rgba(61,245,255,.5), 0 10px 40px -10px rgba(61,245,255,.7); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(61,245,255,.12), 0 16px 50px -10px rgba(61,245,255,.9); }
.btn-ghost { background: rgba(255,255,255,.03); color: var(--text); }
.btn-ghost:hover { background: rgba(61,245,255,.08); border-color: var(--cyan); }

/* glitch slice on the headline, triggered by JS every 8-12s */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0;
}
.glitch.g::before { opacity: 1; color: var(--cyan); transform: translate(-4px, 0); clip-path: inset(18% 0 58% 0); text-shadow: 2px 0 var(--red); }
.glitch.g::after { opacity: 1; color: var(--red); transform: translate(5px, 0); clip-path: inset(62% 0 12% 0); }
.glitch.g { text-shadow: -2px 0 rgba(61,245,255,.6), 2px 0 rgba(255,77,109,.5); }

.buildlog {
  margin-top: 34px; max-width: 460px; font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: rgba(5,7,15,.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.bl-head { display: flex; justify-content: space-between; color: var(--amber); letter-spacing: .16em; font-size: 10.5px; }
.bl-bar { height: 3px; background: rgba(255,181,71,.15); border-radius: 3px; margin: 8px 0 10px; overflow: hidden; }
.bl-bar i { display: block; height: 100%; width: 87%; background: linear-gradient(90deg, var(--amber), #fff2c4); box-shadow: 0 0 10px var(--amber); transition: width 2.5s; }
#bl-lines { list-style: none; margin: 0; padding: 0; height: 54px; overflow: hidden; }
#bl-lines li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 18px; animation: logIn 1s ease both; }
#bl-lines li:last-child { color: var(--text); }
#bl-lines .ok { color: #7dffb0; }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- ATLAS ---------- */
.atlas {
  order: 1; position: relative; justify-self: center;
  width: min(92vw, 560px); aspect-ratio: 1; margin: 4px 0 10px;
  touch-action: pan-y;
}
#globe { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#globe:active { cursor: grabbing; }
.hud { position: absolute; inset: -6%; width: 112%; height: 112%; pointer-events: none; overflow: visible; }
.hud circle, .hud path { fill: none; stroke: var(--cyan); }
.hud-faint { stroke-opacity: .18; }
.hud-dash { stroke-opacity: .35; stroke-dasharray: 2 7; }
.hud-arc { stroke-width: 2.5; stroke-opacity: .8; filter: drop-shadow(0 0 4px var(--cyan)); }
#ticks line { stroke: var(--cyan); stroke-opacity: .45; }
#ticks line.major { stroke-opacity: .9; }
.hud-spin { animation: spin 200s linear infinite; transform-origin: 0 0; }
.hud-spin-rev { animation: spin 100s linear infinite reverse; transform-origin: 0 0; }
.hud-lock path { stroke-width: 2; stroke-opacity: 0; transition: stroke-opacity .3s; }
@keyframes spin { to { transform: rotate(360deg); } }

.tag {
  --r: 50%;
  position: absolute; left: 50%; top: 50%; z-index: 2;
  transform: rotate(var(--a)) translateX(min(36vw, 230px)) rotate(calc(-1 * var(--a))) translate(-50%, -50%);
  font-size: 10px; letter-spacing: .18em; color: var(--cyan); white-space: nowrap;
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: rgba(5,7,15,.6);
  opacity: 0; animation: tag 24s ease-in-out infinite; animation-delay: var(--d);
  pointer-events: none;
}
@keyframes tag { 0%, 100% { opacity: 0; } 6%, 34% { opacity: 1; } 42% { opacity: 0; } }
.readout { position: absolute; font-size: 10px; line-height: 1.5; color: var(--muted); letter-spacing: .12em; pointer-events: none; }
.readout b { color: var(--cyan); font-weight: 600; }
.r-tl { left: 0; top: 0; } .r-tr { right: 0; top: 0; text-align: right; }
.r-bl { left: 0; bottom: 0; } .r-br { right: 0; bottom: 0; text-align: right; }
#ro-coord.atlas-word { color: var(--amber); text-shadow: 0 0 8px var(--amber); }

/* gate mode: ATLAS turns to face you */
body.locking .hud-lock path { stroke-opacity: .9; }
body.locking .hud-spin, body.locking .hud-spin-rev { animation-play-state: paused; }
body.locking .tag { animation: none; opacity: 0; }
body.denied .atlas { animation: shake .45s; }
body.denied .hud circle, body.denied .hud path, body.denied #ticks line { stroke: var(--red); }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(3px); } }

/* ---------- what we do ---------- */
.what, .signal { position: relative; padding: 80px var(--gutter); max-width: 1240px; margin: 0 auto; }
.what h2 { margin-bottom: 36px; }
.mods { display: grid; gap: 16px; grid-template-columns: 1fr; }
.mod {
  position: relative; overflow: hidden; padding: 22px 22px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(24px);
  transition: opacity 1.4s ease, transform 1.4s cubic-bezier(.2,.7,.2,1), border-color .3s, box-shadow .3s;
}
.mod.in { opacity: 1; transform: none; }
.mod::before, .mod::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--cyan); opacity: .7; transition: all .3s;
}
.mod::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.mod::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.mod:hover { border-color: rgba(61,245,255,.6); box-shadow: 0 0 0 1px rgba(61,245,255,.15), 0 20px 60px -20px rgba(61,245,255,.45); transform: translateY(-4px); }
.mod:hover::before { top: 5px; left: 5px; } .mod:hover::after { bottom: 5px; right: 5px; }
.mod header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mod header .mono { font-size: 11px; color: var(--amber); letter-spacing: .2em; }
.mod svg { width: 44px; height: 44px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(61,245,255,.5)); }
.mod svg * { stroke-dasharray: 160; stroke-dashoffset: 160; transition: stroke-dashoffset 3.2s ease .4s; }
.mod.in svg * { stroke-dashoffset: 0; }
.mod h3 { font-size: 18px; line-height: 1.25; margin-bottom: 8px; }
.mod p { margin: 0; color: var(--muted); }
/* scanline sweep on hover */
.mod .scan { position: absolute; left: 0; right: 0; top: -40%; height: 40%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(61,245,255,.12) 80%, rgba(61,245,255,.45) 99%, transparent); opacity: 0; }
.mod:hover .scan { animation: scan 1.1s ease-out; }
@keyframes scan { 0% { top: -40%; opacity: 1; } 100% { top: 110%; opacity: 1; } }

/* ---------- signal ---------- */
.signal { text-align: center; padding-bottom: 120px; }
.signal .lede { margin-left: auto; margin-right: auto; }
.radar { position: relative; width: 120px; height: 120px; margin: 0 auto 26px; border-radius: 50%;
  border: 1px solid var(--line); background: repeating-radial-gradient(circle, transparent 0 18px, rgba(61,245,255,.14) 18px 19px); overflow: hidden; }
.radar i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(61,245,255,.55), transparent 22%); animation: spin 8s linear infinite; }
.term {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: 560px; margin: 30px auto 0; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5,7,15,.6);
}
.term .prompt { color: var(--cyan); font-size: 18px; padding-left: 10px; }
.term input[type=email] {
  flex: 1 1 200px; min-width: 0; min-height: 48px; background: transparent; border: 0; outline: 0;
  color: var(--text); font: 400 16px var(--mono); caret-color: var(--cyan);
}
.term input::placeholder { color: #50607f; }
.term:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(61,245,255,.1); }
.term .btn { flex: 0 0 auto; }
.term.sending .btn { pointer-events: none; background: transparent; color: var(--cyan); }
.term.sending .btn .t::after { content: "…"; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.wl-msg { min-height: 1.6em; margin-top: 16px; font-size: 13px; color: var(--muted); }
.wl-msg.good { color: #7dffb0; }
.wl-msg.bad { color: var(--red); }

/* ---------- footer ---------- */
.foot {
  position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 24px var(--gutter) 32px; font-size: 11px; color: var(--muted); border-top: 1px solid rgba(61,245,255,.1);
}
.blink { color: var(--amber); animation: blink 1.2s steps(1) infinite; }

/* ---------- gate terminal ---------- */
#gate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: end center; padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(5,7,15,.35), rgba(5,7,15,.85)); }
#gate[hidden] { display: none; }
.gate-box {
  width: min(560px, 100%); border: 1px solid var(--cyan); border-radius: 12px; overflow: hidden;
  background: rgba(3,6,14,.92); box-shadow: 0 0 0 1px rgba(61,245,255,.2), 0 0 60px rgba(61,245,255,.25), inset 0 0 40px rgba(61,245,255,.05);
  animation: rise .45s cubic-bezier(.2,.8,.2,1);
  margin-bottom: max(4vh, env(safe-area-inset-bottom));
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.gate-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 11px; letter-spacing: .2em; color: var(--void); background: var(--cyan); }
.gate-bar button { background: none; border: 0; color: var(--void); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.gate-body { padding: 18px 18px 20px; font-size: 14px; color: var(--cyan); min-height: 150px; }
#gate-log div { line-height: 1.7; white-space: pre-wrap; }
#gate-log .bad { color: var(--red); }
#gate-log .good { color: #7dffb0; }
#gate-log .dim { color: var(--muted); }
#gate-form { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
#gate-form label { white-space: nowrap; }
#gate-key {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text);
  font: 600 16px var(--mono); letter-spacing: .3em; caret-color: var(--cyan);
}
#gate-key:disabled { opacity: .4; }
body.denied .gate-box { border-color: var(--red); box-shadow: 0 0 60px rgba(255,77,109,.35); animation: shake .45s; }
body.denied .gate-bar { background: var(--red); }

/* ---------- wider screens ---------- */
@media (min-width: 640px) {
  .mods { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 32px; padding-top: 10px; }
  .hero-copy { order: 1; }
  .atlas { order: 2; width: min(46vw, 640px); }
  .tag { transform: rotate(var(--a)) translateX(calc(min(23vw, 320px) + 10px)) rotate(calc(-1 * var(--a))) translate(-50%, -50%); }
  .mods { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .mod { padding: 28px 26px 30px; }
  .readout { font-size: 11px; }
}
@media (max-width: 420px) {
  .tag { font-size: 9px; padding: 3px 6px; }
  .readout { font-size: 9px; }
  .chip { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .mod { opacity: 1; transform: none; }
  .mod svg * { stroke-dashoffset: 0; }
  .tag { opacity: .85; }
  .grain { display: none; }
}
