/* The landing (PLAN, Phase S, S8.5): همگام and a door. Everything here is served by the hub itself (its CSP allows
   nothing else): Vazirmatn's Persian glyphs (Saber Rastikerdar, SIL Open Font License, fonts/Vazirmatn-OFL.txt), no
   third party, nothing inline. */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-NL.woff2") format("woff2-variations"), url("/static/fonts/Vazirmatn-NL.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f4ef;
  --ink: #141722;
  --muted: #6c7080;
  --glass: rgba(255, 255, 255, 0.58);
  --edge: rgba(20, 23, 34, 0.10);
  --ring: rgba(31, 42, 90, 0.18);
  --orb-a: #f4bfa0;
  --orb-b: #b4c4ff;
  --orb-c: #bfeedd;
  --door: #1f2a5a;
  --door-ink: #ffffff;
  --mark-to: #46507e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d17;
    --ink: #eef0f8;
    --muted: #979eb4;
    --glass: rgba(255, 255, 255, 0.06);
    --edge: rgba(255, 255, 255, 0.12);
    --ring: rgba(180, 196, 255, 0.22);
    --orb-a: #5634d1;
    --orb-b: #0d6a88;
    --orb-c: #9c2f68;
    --door: #eef0f8;
    --door-ink: #0a0d17;
    --mark-to: #b9c4ee;
  }
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }

.orb {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  animation: drift 30s ease-in-out infinite alternate;
}
.orb.a { background: var(--orb-a); top: -26vmax; right: -16vmax; }
.orb.b { background: var(--orb-b); bottom: -32vmax; left: -22vmax; animation-duration: 36s; }
.orb.c { background: var(--orb-c); top: 38%; left: 38%; width: 34vmax; height: 34vmax; opacity: 0.35; animation-duration: 44s; }

@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); } }

main {
  position: relative;
  width: min(440px, 100% - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 6vh, 52px);
  padding-bottom: 6vh;
}

.mark {
  font-weight: 250;
  font-size: clamp(84px, 26vw, 176px);
  line-height: 1.15;
  color: var(--ink);
  background: linear-gradient(165deg, var(--ink) 35%, var(--mark-to));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rise 1.3s cubic-bezier(.2, .7, .2, 1) both;
  user-select: none;
}

.door {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.35);
  transition: box-shadow .25s, border-color .25s;
  animation: rise 1.3s .18s cubic-bezier(.2, .7, .2, 1) both;
}
.door:focus-within { border-color: var(--ring); box-shadow: 0 0 0 5px var(--ring), 0 18px 50px -22px rgba(0, 0, 0, 0.35); }

.door input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  padding: 12px 18px;
  text-align: center;
  outline: none;
}
.door input::placeholder { color: var(--muted); font-weight: 300; opacity: 1; }

.door button {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--door);
  color: var(--door-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), opacity .2s;
}
.door button:hover { transform: scale(1.06); }
.door button:active { transform: scale(0.96); }
.door button:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.door button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.note {
  min-height: 1.7em;
  color: var(--muted);
  font-size: 15px;
  font-weight: 350;
  text-align: center;
  opacity: 0;
  transition: opacity .5s;
}
.note.shown { opacity: 1; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

[hidden] { display: none !important; }

/* S8.6: the request to join the test group. The page scrolls while it is open (a phone's height is shorter than the
   form), the mark steps back, and the sign-in waits behind "back". */
.join {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  padding: 6px 10px;
  margin-top: calc(-1 * clamp(14px, 3vh, 30px));
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--edge);
  text-underline-offset: 6px;
  animation: rise 1.3s .3s cubic-bezier(.2, .7, .2, 1) both;
}
.join:hover, .join.lit { color: var(--ink); text-decoration-color: currentColor; }
.join:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 8px; }

body.applying { overflow-y: auto; place-items: start center; }
body.applying main { gap: 18px; padding: 28px 0 48px; }
body.applying .mark { font-size: clamp(56px, 16vw, 88px); animation: none; }
body.applying .door, body.applying #note, body.applying main > .join { display: none; }

.apply {
  width: 100%;
  padding: 22px 20px 18px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.35);
  animation: rise .8s cubic-bezier(.2, .7, .2, 1) both;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.apply h2 { font-size: 21px; font-weight: 600; line-height: 1.5; }
.apply .lead { color: var(--muted); font-size: 15px; line-height: 1.9; font-weight: 350; }
.apply form { display: flex; flex-direction: column; gap: 14px; }
.apply label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 500; }
.apply .hint { color: var(--muted); font-size: 13px; font-weight: 350; }
.apply .pair { display: flex; gap: 10px; }
.apply .pair > label { flex: 1; min-width: 0; }

.apply input:not([type=checkbox]), .apply select {
  width: 100%;
  font: inherit;
  font-size: 16px;                                  /* 16px or more: iOS does not zoom into the field */
  font-weight: 400;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.apply input:focus, .apply select:focus { border-color: var(--ring); box-shadow: 0 0 0 4px var(--ring); }
.apply [aria-invalid=true] { border-color: #c2410c; }
.apply select option { color: #141722; background: #ffffff; }

.apply .consent { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 350; color: var(--muted); font-size: 14px;
                  line-height: 1.8; }
.apply .consent input { flex: none; width: 20px; height: 20px; margin-top: 4px; accent-color: var(--door); }

.apply .send {
  border: 0;
  border-radius: 999px;
  background: var(--door);
  color: var(--door-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), opacity .2s;
}
.apply .send:hover { transform: scale(1.02); }
.apply .send:disabled { opacity: .55; cursor: progress; transform: none; }
.apply .send:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.apply .note { min-height: 1.5em; }
.apply .thanks { font-size: 18px; line-height: 1.9; font-weight: 500; text-align: center; padding: 18px 0 6px; }
.apply .back { margin: 0 auto; animation: none; }
/* the hidden field, clipped where it stands: moved off to the left, it is overflow a right-to-left page scrolls to
   (measured: a page 10,373 px wide on a phone) */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .mark, .door, .join, .apply { animation: none; }
}
