/* Waitlist page layout. Colour, type and controls come from Braid UI (vendor/tokens.css, vendor/braid-ui.css). */

html, body { margin: 0; }

body {
  --frame: var(--space-3);
  --gutter: clamp(16px, 5vw, 72px);
  padding: var(--frame);
  background: var(--app);
}

/* ---------- Page: the inset panel on the app frame, exactly one screen tall ---------- */

.page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: calc(100svh - 2 * var(--frame));
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* Below this height there is no room for one screen; let the page scroll rather than clip the form */
@media (max-height: 439px) {
  .page { height: auto; min-height: calc(100svh - 2 * var(--frame)); }
}

/* Basketweave corner fields */
.weave {
  position: absolute;
  bottom: 0;
  z-index: -1;
  width: min(46%, 594px);
  height: min(58%, 495px);
  background: url("assets/weave-tile.svg") 0 100% / 66px 66px;
}
.weave--left {
  left: 0;
  -webkit-mask-image: linear-gradient(to top right, #000 8%, transparent 50%);
  mask-image: linear-gradient(to top right, #000 8%, transparent 50%);
}
.weave--right {
  right: 0;
  background-position: 100% 100%;
  -webkit-mask-image: linear-gradient(to top left, #000 8%, transparent 50%);
  mask-image: linear-gradient(to top left, #000 8%, transparent 50%);
}

/* ---------- Top bar ---------- */

.top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(var(--space-5), 3.5vh, 36px) 0 var(--space-4);
}

.top__brand { display: flex; align-items: center; gap: var(--space-2); color: var(--text); }
.top__mark { display: block; width: 24px; height: 24px; color: var(--mark); }

/* ---------- Stage: diagram and content, centred in what is left ---------- */

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(var(--space-4), 5vh, 56px);
  padding-bottom: clamp(var(--space-6), 9vh, 96px);
}

/* The hub gives up its height first when the screen is short */
.hub {
  position: relative;
  container-type: size;
  flex: 0 1 300px;
  min-height: 96px;
  width: 100%;
  max-width: 980px;
}

.hub__wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.hub__wires path {
  fill: none;
  stroke: var(--line-control);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.hub__end, .hub__node {
  position: absolute;
  transform: translate(-50%, -50%);
}
.hub__end { width: 8px; height: 8px; background: var(--line-control); }
/* Outcome nodes carry the status colour; the word beside each one names it, so colour is never alone */
.hub__node { width: 10px; height: 10px; background: var(--c, var(--text)); }
.hub__node--info { --c: var(--info-icon); }
.hub__node--good { --c: var(--good-icon); }
.hub__node--warn { --c: var(--warn-icon); }
.hub__node--bad { --c: var(--bad-icon); }

/* Every label is centred over its square */
.hub__label {
  position: absolute;
  --lift: 10px;
  transform: translate(-50%, calc(-100% - var(--lift)));
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-secondary);
}

.hub__tile {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(176px, 62cqh, 22cqw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-lg);
  background: var(--column);
  border: 1px solid var(--line-column);
}
.hub__face {
  position: absolute;
  inset: 10%;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--line-card);
}
.hub__mark { display: block; width: 60%; height: auto; aspect-ratio: 1; color: var(--mark); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Content ---------- */

.content {
  flex: none;
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1 span { white-space: nowrap; }

/* The badge at reading size, so it holds its own above the hero line */
.eyebrow { padding: 6px 12px; font-size: 13px; line-height: 16px; }

/* The hero line: the page-title style (bold, tight tracking) at display size */
h1 {
  margin: var(--space-5) 0 var(--space-4);
  font-size: clamp(28px, min(8.4vw, 6vh), 60px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text);
  text-wrap: balance;
}

.lede {
  margin: 0 0 clamp(var(--space-6), 4vh, 36px);
  max-width: 56ch;
  font-size: 17px;
  line-height: 28px;
  color: var(--ink-secondary);
  text-wrap: pretty;
}

/* ---------- Waitlist form ---------- */

/* The page's one action, so its controls are a step up from the 36px default */
.waitlist { width: 100%; max-width: 480px; text-align: left; }

.waitlist__row { display: flex; align-items: stretch; gap: var(--space-2); }
.waitlist__row .b-field { flex: 1; }
.waitlist__row .b-input { height: 44px; padding-inline: 14px; font-size: 15px; }
.waitlist__row .b-btn { flex: none; height: 44px; padding-inline: 18px; font-size: 15px; }

/* Turnstile takes no room unless Cloudflare asks the visitor to interact */
.turnstile:has(iframe) { margin-top: var(--space-2); }
.turnstile:empty { display: none; }

.waitlist__message { min-height: 18px; margin: var(--space-1-5) 0 0; }

.waitlist.is-success .waitlist__row, .waitlist.is-success .turnstile { display: none; }
.waitlist.is-success { display: flex; justify-content: center; }
.waitlist.is-success .waitlist__message { margin: 0; font-size: 15px; }

/* ---------- Contact dialog ---------- */

.contact__fields { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.contact__done, .contact__error { margin-top: var(--space-4) !important; color: var(--text) !important; }
.contact textarea { resize: none; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  body { --frame: var(--space-2); }
  .hub { flex-basis: 190px; }
  .hub__label { --lift: 8px; font-size: 11px; }
  .hub__node { width: 8px; height: 8px; }
  .weave { width: 60%; height: 30%; background-size: 44px 44px; }
  /* 16px stops iOS zooming the page when the input takes focus */
  .waitlist .b-input, .contact .b-input { font-size: 16px; }
  .lede { font-size: 15px; line-height: 24px; }
}

/* Short screens: drop the diagram before anything is clipped */
@media (max-height: 560px) {
  .hub { display: none; }
}
