:root {
  --bg: #000;
  --fg: #f2f2f2;
  --muted: #6a6a6a;
  --line: #1c1c1c;
  --accent: #ff2a2a;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-ar: "Reem Kufi", "Noto Kufi Arabic", system-ui, sans-serif;
  --font-brand: "Unbounded", "Space Mono", system-ui, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100svh;
  overflow-x: hidden;
  overscroll-behavior: none;
}

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grainShift 8s steps(8) infinite;
}

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

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  padding:
    calc(56px + var(--safe-t))
    calc(28px + var(--safe-r))
    calc(40px + var(--safe-b))
    calc(28px + var(--safe-l));
  gap: 32px;
}

.ticker {
  position: fixed;
  top: 0;
  right: calc(10px + var(--safe-r));
  height: 100svh;
  width: 14px;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
}

.ticker-track {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: tickerY 38s linear infinite;
}

.ticker-track span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #2e2e2e;
  white-space: nowrap;
  flex-shrink: 0;
}

@keyframes tickerY {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

.brandmark {
  position: fixed;
  top: calc(20px + var(--safe-t));
  left: calc(22px + var(--safe-l));
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--fg);
  z-index: 5;
  user-select: none;
  animation: rise 1.4s cubic-bezier(.2,.8,.2,1) both;
}

.bleed {
  --px: 0px;
  --py: 0px;
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  transform: translate3d(var(--px), var(--py), 0);
  will-change: transform;
}

.bleed-text {
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: clamp(140px, 30vw, 420px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: #fff;
  opacity: 0.05;
  user-select: none;
  transform-origin: center;
  animation: drift 22s ease-in-out infinite alternate, bleedIn 1.6s ease-out both;
  will-change: transform;
}

.bleed::after {
  content: "بنكربت";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: clamp(140px, 30vw, 420px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.09);
  pointer-events: none;
  transform: translate(6px, 4px);
  opacity: 1;
  animation: ghostIn 2s ease-out 0.2s both;
}

@keyframes bleedIn {
  from { opacity: 0; }
  to   { opacity: 0.05; }
}

@keyframes ghostIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-1vw, -1.2vh) scale(1.012); }
  100% { transform: translate(1vw, 1vh) scale(1); }
}

.hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
  align-self: center;
  grid-row: 1;
}

.hero::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(280px, 42vmin, 420px);
  height: clamp(280px, 42vmin, 420px);
  transform: translate(-50%, calc(-50% - 22px));
  background: radial-gradient(circle at center, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.7) 40%, rgba(0,0,0,0) 75%);
  pointer-events: none;
  z-index: 0;
  animation: fadeIn 1.4s ease-out both;
}

.logo {
  width: clamp(200px, 30vmin, 300px);
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
  animation: logoRise 1.4s cubic-bezier(.2,.8,.2,1) 0.1s both;
}

@keyframes logoRise {
  from { opacity: 0; transform: translate(3.75%, 8px); }
  to   { opacity: 1; transform: translateX(3.75%); }
}

.wordmark {
  margin: 0;
  font-family: var(--font-ar);
  font-weight: 500;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0;
  color: var(--fg);
  position: relative;
  z-index: 1;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.9);
  animation: rise 1.4s cubic-bezier(.2,.8,.2,1) 0.25s both;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  line-height: 1;
}

.wordmark::before,
.wordmark::after {
  content: "";
  display: block;
  width: clamp(12px, 2vw, 22px);
  height: 1px;
  background: var(--fg);
  opacity: 0.5;
  flex: none;
}

.wordmark .ar {
  display: inline-block;
  line-height: 1.1;
}

.waitlist {
  position: relative;
  z-index: 3;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: end;
  grid-row: 2;
  animation: rise 1.4s cubic-bezier(.2,.8,.2,1) 0.5s both;
}

.waitlist-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}

.waitlist-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid #2a2a2a;
  transition: border-color 0.3s ease;
}
.waitlist-row:focus-within { border-color: var(--fg); }

.waitlist input {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.04em;
  padding: 14px 0;
  width: 100%;
  caret-color: var(--accent);
  border-radius: 0;
}
.waitlist input::placeholder { color: #404040; }

.waitlist button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.waitlist button:hover { transform: translateX(4px); }
.waitlist button:active { transform: translateX(6px); }
.waitlist button:disabled { opacity: 0.4; cursor: default; transform: none; }

.waitlist-msg {
  margin: 0;
  min-height: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.25s ease;
}
.waitlist-msg.error { color: var(--accent); }
.waitlist-msg.ok    { color: var(--fg); }

.waitlist.is-done .waitlist-row,
.waitlist.is-done .waitlist-label { display: none; }
.waitlist.is-done .waitlist-msg {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
  text-align: left;
  padding: 14px 0;
  border-bottom: 1px solid var(--fg);
}

.visually-hidden,
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.hp { pointer-events: none; opacity: 0; }

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (max-width: 900px) {
  .bleed-text,
  .bleed::after {
    font-size: clamp(160px, 40vw, 380px);
  }
}

@media (max-width: 640px) {
  .stage {
    padding:
      calc(56px + var(--safe-t))
      calc(20px + var(--safe-r))
      calc(28px + var(--safe-b))
      calc(20px + var(--safe-l));
    gap: 24px;
  }
  .brandmark {
    top: calc(16px + var(--safe-t));
    left: calc(18px + var(--safe-l));
    font-size: 12px;
  }
  .hero { gap: 18px; }
  .logo { width: clamp(150px, 42vw, 200px); }
  .wordmark {
    font-size: 18px;
    letter-spacing: 0;
    text-indent: 0;
  }
  .wordmark::before, .wordmark::after { width: 10px; }
  .bleed-text,
  .bleed::after {
    font-size: 50vw;
    line-height: 0.9;
    letter-spacing: -0.02em;
  }
  .ticker { display: none; }
  .waitlist { gap: 8px; }
  .waitlist-label { font-size: 9.5px; letter-spacing: 0.3em; }
}

@media (max-width: 380px) {
  .stage { padding-top: calc(48px + var(--safe-t)); gap: 18px; }
  .logo { width: 140px; }
  .wordmark { font-size: 16px; letter-spacing: 0; text-indent: 0; }
  .bleed-text, .bleed::after { font-size: 56vw; }
}

@media (max-height: 640px) {
  .stage {
    padding-top: calc(40px + var(--safe-t));
    padding-bottom: calc(20px + var(--safe-b));
    gap: 18px;
  }
  .hero { gap: 14px; }
  .logo { width: clamp(110px, 18vh, 160px); }
  .bleed-text, .bleed::after { font-size: clamp(140px, 36vw, 380px); }
}

@media (max-height: 480px) {
  .brandmark { font-size: 11px; }
  .logo { width: clamp(90px, 16vh, 130px); }
  .wordmark { font-size: 16px; }
}

@media (hover: none) {
  .waitlist button:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}
