:root {
  --bg: #070d1a;
  --ink: #e4e8ee;
  --muted: rgba(214, 221, 232, .56);
  --faint: rgba(214, 221, 232, .16);
  --hair: rgba(214, 221, 232, .1);
  --glow: #7f9fe0;
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.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;
}

/* ---------- Atmosphere ---------- */

.bg, .spot, .grain, .corners { position: fixed; inset: 0; pointer-events: none; }

.bg {
  z-index: -3;
  background:
    radial-gradient(1100px 760px at 78% -12%, rgba(64, 98, 164, .42), transparent 62%),
    radial-gradient(900px 700px at 8% 112%, rgba(18, 34, 68, .9), transparent 60%),
    radial-gradient(1400px 900px at 50% 50%, transparent 40%, rgba(2, 5, 12, .7) 100%),
    linear-gradient(180deg, #0e1c37 0%, #0a1428 45%, #060b16 100%);
  animation: breathe 14s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { filter: brightness(1); }
  to   { filter: brightness(1.12); }
}

.spot {
  z-index: -2;
  --x: 50%; --y: 45%;
  background: radial-gradient(520px 420px at var(--x) var(--y), rgba(120, 150, 210, .09), transparent 70%);
}

.grain {
  z-index: -1;
  inset: -50%;
  opacity: .16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Architectural corner ticks */
.corners { inset: 14px; z-index: 0; }
.corners i {
  position: absolute; width: 18px; height: 18px;
  border: 0 solid var(--faint);
  opacity: 0; animation: fade 1.2s var(--ease) 1.4s forwards;
}
.corners i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.corners i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.corners i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.corners i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- Reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 1.1s var(--ease) var(--d, 0s) forwards;
}

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }

/* ---------- Header / footer ---------- */

.top, .bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(var(--gutter) * .8) var(--gutter);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.loc { display: flex; gap: 18px; flex-wrap: wrap; }
.coords { color: rgba(214, 221, 232, .32); font-variant-numeric: tabular-nums; }

.lang { display: flex; gap: 2px; }
.lang button {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; letter-spacing: .2em; color: rgba(214, 221, 232, .38);
  padding: 8px 8px 8px 10px;
  position: relative;
  transition: color .4s var(--ease);
}
.lang button::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); }
.lang button[aria-pressed="true"]::after { transform: scaleX(1); }
.lang button:focus-visible { outline: 1px solid var(--faint); outline-offset: 2px; }

.bottom { letter-spacing: .16em; }
.bottom .tagline { text-transform: none; letter-spacing: .04em; font-size: 12px; color: rgba(214, 221, 232, .4); }

.social { display: flex; gap: 6px; }
.social a {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--hair); color: var(--muted);
  transition: color .4s var(--ease), border-color .4s var(--ease), background .4s var(--ease);
}
.social a:hover { color: var(--ink); border-color: var(--faint); background: rgba(255, 255, 255, .03); }
.social svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.social .dot { fill: currentColor; }

/* ---------- Stage ---------- */

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px var(--gutter) 40px;
}

.status {
  display: inline-flex; align-items: center; gap: 12px;
  margin: 0 0 clamp(36px, 6vh, 64px);
  font-size: 11px; letter-spacing: .38em; text-transform: uppercase;
  color: var(--muted);
}

.pulse {
  position: relative; width: 6px; height: 6px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 12px var(--glow);
}
.pulse::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--glow); opacity: 0;
  animation: ping 2.6s var(--ease) infinite;
}
@keyframes ping {
  0%   { transform: scale(.4); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Logo */
.brand {
  width: min(760px, 100%);
  container-type: inline-size;
}
.logo {
  margin: 0;
  width: 100%;
  line-height: 0;
}
.logo svg {
  width: 100%; height: auto; overflow: visible;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, .06))
    drop-shadow(0 3px 2px rgba(0, 0, 0, .55))
    drop-shadow(0 18px 30px rgba(0, 0, 0, .45));
}
.trace path {
  fill: none;
  stroke: #fff;
  stroke-width: 36;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
  animation: draw 1.5s cubic-bezier(.65, 0, .35, 1) calc(.25s + var(--i) * .11s) forwards;
}
.settle { opacity: 0; animation: fade .5s ease 2.1s forwards; }
@keyframes draw {
  0%   { stroke-dashoffset: 1; opacity: 0; }
  8%   { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.gleam { opacity: 0; mix-blend-mode: overlay; animation: fade 1s ease 2.2s forwards; }

/* Letter meanings — sit under each letter, brushed silver like the mark */
.meanings {
  --fs: clamp(7px, 1.45cqw, 11px);
  --ls: .32em;
  position: relative;
  height: calc(var(--fs) * 1.3 + 12px);
  margin: clamp(10px, 2.2cqw, 18px) 0 0;
}
.meanings span,
.meanings b {
  background-image:
    linear-gradient(100deg, transparent 42%, rgba(255, 255, 255, .85) 50%, transparent 58%),
    linear-gradient(180deg, #b9bdc4 0%, #969aa2 55%, #767b84 100%);
  background-size: 300% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 0% 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: glint 7.5s linear var(--glint) infinite;
}
.meanings span {
  position: absolute;
  top: 12px;
  left: var(--x);
  transform: translateX(-50%);
  padding-left: var(--ls); /* balance trailing tracking */
  white-space: nowrap;
  font: 500 var(--fs)/1.3 "Manrope", system-ui, sans-serif;
  letter-spacing: var(--ls);
  text-transform: uppercase;
  animation:
    meaning-in 1.2s var(--ease) var(--in) both,
    glint 7.5s linear var(--glint) infinite;
}
.meanings b {
  font-weight: 700;
  background-image:
    linear-gradient(100deg, transparent 42%, rgba(255, 255, 255, .9) 50%, transparent 58%),
    linear-gradient(180deg, #f1f3f6 0%, #c6cbd2 55%, #a3a9b2 100%);
}
.meanings i {
  position: absolute;
  top: -12px;
  left: calc(50% + var(--ls) / 2);
  width: 1px;
  height: 7px;
  background: linear-gradient(180deg, rgba(200, 208, 222, .55), transparent);
  transform-origin: top;
  animation: tick .8s var(--ease) calc(var(--in) - .15s) both;
}

/* Narrow logo: stagger every other word onto a second row so nothing collides */
@container (max-width: 500px) {
  .meanings { --ls: .2em; height: calc(var(--fs) * 2.9 + 12px); }
  .meanings span:nth-child(even) { top: calc(12px + var(--fs) * 1.6); }
  .meanings span:nth-child(even) i {
    top: calc(-12px - var(--fs) * 1.6);
    height: calc(7px + var(--fs) * 1.6);
  }
}

@keyframes meaning-in {
  from { opacity: 0; letter-spacing: .8em; filter: blur(4px); }
  to   { opacity: 1; letter-spacing: var(--ls); filter: blur(0); }
}
@keyframes tick {
  from { opacity: 0; transform: scaleY(0); }
  to   { opacity: 1; transform: scaleY(1); }
}
/* A bright band crosses each word as the logo's own shine passes above it */
@keyframes glint {
  0%        { background-position: 100% 0, 0 0; }
  8%, 100%  { background-position: 0% 0, 0 0; }
}

.horizon {
  width: min(900px, 100%);
  height: 1px;
  margin: clamp(20px, 3.5vh, 36px) 0 clamp(22px, 4vh, 36px);
  background: linear-gradient(90deg, transparent, rgba(200, 212, 232, .35) 50%, transparent);
  transform: scaleX(0);
  animation: stretch 1.8s var(--ease) 1.3s forwards;
}
@keyframes stretch { to { transform: scaleX(1); } }

.kicker {
  margin: 0 0 22px;
  font-size: 12px; font-weight: 500;
  letter-spacing: .5em; text-transform: uppercase;
  color: var(--muted);
  padding-left: .5em; /* balance trailing tracking */
}

.headline {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -.005em;
  color: var(--ink);
  text-wrap: balance;
}

/* Cipher line */
.cipher {
  display: flex; align-items: center; gap: 16px;
  margin: clamp(26px, 4.5vh, 40px) 0 clamp(34px, 6vh, 56px);
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(214, 221, 232, .38);
  font-variant-numeric: tabular-nums;
}
.cipher .rule { width: 40px; height: 1px; background: var(--faint); }
.cipher .idx b { font-weight: 500; color: var(--muted); }
.cipher .word {
  min-width: 9.5em; text-align: center;
  color: var(--ink); font-weight: 500; letter-spacing: .42em;
  font-family: "Manrope", ui-monospace, monospace;
}
.cipher .word .noise { color: rgba(127, 159, 224, .75); }

/* Signup */
.signup { width: min(420px, 100%); }
.signup label {
  display: block; margin-bottom: 14px;
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted);
}
.field {
  position: relative; display: flex; align-items: center;
  border-bottom: 1px solid var(--faint);
  transition: border-color .4s var(--ease);
}
.field::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink), transparent);
  transform: scaleX(0); transition: transform .7s var(--ease);
}
.field:focus-within::after { transform: scaleX(1); }

.field input {
  flex: 1; min-width: 0;
  appearance: none; border: 0; background: transparent; outline: 0;
  padding: 14px 4px; color: var(--ink);
  font: 400 15px/1.2 "Manrope", system-ui, sans-serif; letter-spacing: .02em;
}
.field input::placeholder { color: rgba(214, 221, 232, .32); }

.field button {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 4px 14px 12px; color: var(--muted);
  font: 500 11px/1 "Manrope", system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase;
  transition: color .4s var(--ease);
  white-space: nowrap;
}
.field button svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .5s var(--ease);
}
.field button:hover, .field button:focus-visible { color: var(--ink); outline: 0; }
.field button:hover svg, .field button:focus-visible svg { transform: translateX(4px); }
.field button[disabled] { opacity: .5; cursor: progress; }

.msg {
  min-height: 1.4em; margin: 14px 0 0;
  font-size: 12px; letter-spacing: .06em; color: var(--muted);
  transition: opacity .4s var(--ease);
}
.msg.error { color: #e3a4a4; }
.msg.ok { color: var(--ink); }

.signup.done .field { border-color: transparent; }
.signup.done .field input,
.signup.done .field button { opacity: 0; pointer-events: none; transition: opacity .5s var(--ease); }
.signup.done .msg {
  position: relative; top: -44px; margin-bottom: -44px;
  font-size: 13px; letter-spacing: .12em;
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .bottom { flex-direction: column-reverse; gap: 14px; text-align: center; }
  .bottom .tagline { order: 1; }
}

@media (max-width: 560px) {
  .coords { display: none; }
  .top { font-size: 10px; }
  .status { letter-spacing: .3em; }
  .kicker { letter-spacing: .34em; font-size: 10.5px; }
  .cipher { gap: 10px; letter-spacing: .22em; }
  .cipher .rule { width: 18px; }
  .cipher .word { letter-spacing: .3em; }
  .field button span { display: none; }
  .corners { inset: 8px; }
}

@media (max-height: 640px) and (min-width: 561px) {
  .status { margin-bottom: 28px; }
  .horizon { margin: 22px 0 18px; }
  .cipher { margin: 20px 0 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .grain { animation: none; }
  .gleam { display: none; }
}
