/* MCAP Research Labs — styles
   Tokens come from the MCAP design system (tokens.json). Light theme by default,
   dark theme follows the visitor's system setting.
   v2 (UI polish): same palette and spacing scale; refined type, rhythm, controls and states. */
:root {
  --page: #ffffff;
  --panel: #f4f7fa;
  --tint: #e8f0f8;
  --border: #d5dae0;
  --border-strong: #b9c1cb;
  --ink: #0b0b0c;
  --text: #1a1d21;
  --muted: #45494f;
  --blue: #1f5fa8;
  --blue-hover: #1a528f;
  --on-blue: #ffffff;
  --link: #0563c1;
  --red: #b03a2e;
  --ring: rgba(31, 95, 168, .28);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;
  /* Same family as the deck (Arial/Helvetica); Helvetica Neue first where it exists for finer rendering. */
  --sans: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d1117; --panel: #151b24; --tint: #1a2738; --border: #343f4e; --border-strong: #4a5768;
    --ink: #f4f6f9; --text: #dfe5ec; --muted: #a6b0bc; --blue: #7db0ec; --blue-hover: #96c0f0;
    --on-blue: #0d1117; --link: #8cc0f5; --red: #ff8f80; --ring: rgba(125, 176, 236, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute always wins (the .button display rule must not un-hide the Submit button after sending). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  border-top: 4px solid var(--blue);
}
::selection { background: var(--tint); color: var(--ink); }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: var(--radius-sm); }
h1, h2, .lead { text-wrap: balance; }
p { text-wrap: pretty; }

/* Tracked uppercase labels: the trailing letter-space is trimmed so centred labels sit truly centred. */
.eyebrow, .wordmark-sub, .clock, .footer .name, .topbar .section, legend {
  text-transform: uppercase; font-weight: 700;
}

/* ---------- Landing page (index.html) ---------- */
.landing {
  min-height: calc(100vh - 4px); min-height: calc(100dvh - 4px);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 0 var(--space-5);
}
.clock {
  display: flex; justify-content: center; gap: var(--space-5);
  padding-top: var(--space-5);
  font-size: 11px; line-height: 16px; letter-spacing: .12em; color: var(--muted);
  font-weight: 400; font-variant-numeric: tabular-nums;
}
.clock span + span { position: relative; }
.clock span + span::before {
  content: ""; position: absolute; left: calc(var(--space-5) / -2); top: 50%;
  width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; border-radius: 50%; background: var(--border-strong);
}
.hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-8) 0;
}
.wordmark {
  margin: 0; color: var(--ink);
  font-size: clamp(64px, 15vw, 112px); line-height: .9; font-weight: 700; letter-spacing: -.035em;
}
.wordmark-sub {
  margin: var(--space-3) 0 0; color: var(--blue);
  font-size: 15px; line-height: 20px; letter-spacing: .42em;
  margin-right: -.42em; /* trims the trailing tracking */
}
.lead {
  margin: var(--space-6) 0 0; max-width: 38ch;
  font-size: clamp(18px, 2.4vw, 21px); line-height: 1.45; color: var(--muted); font-weight: 400;
}
.lead em { font-style: normal; color: var(--ink); font-weight: 700; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  cursor: pointer; border: 1px solid var(--blue);
  background: var(--blue); color: var(--on-blue); text-decoration: none;
  font: 700 15px/20px var(--sans); letter-spacing: .01em;
  padding: 13px 28px; border-radius: var(--radius-md);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.button:hover { background: var(--blue-hover); border-color: var(--blue-hover); text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.button.secondary { background: transparent; color: var(--blue); border-color: var(--border-strong); }
.button.secondary:hover { background: var(--tint); border-color: var(--blue); color: var(--blue); }
.button .arrow { transition: transform .15s var(--ease); }
.button:hover .arrow { transform: translateX(2px); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-6); }
.actions .button { min-width: 176px; }
@media (max-width: 480px) {
  .actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 320px; }
}

.footer {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-5) 0; text-align: center; border-top: 1px solid var(--border);
}
.footer .name { font-size: 11px; line-height: 16px; letter-spacing: .12em; margin-right: -.12em; color: var(--ink); }
.disclosure { margin: 0; max-width: 70ch; font-size: 12px; line-height: 18px; color: var(--muted); }

/* Strategy dialog */
dialog.info {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  padding: var(--space-6); margin: auto;
  background: var(--page); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px -16px rgba(11, 11, 12, .35);
}
dialog.info:focus { outline: none; }
dialog.info[open] { animation: rise .22s var(--ease); }
dialog.info::backdrop { background: rgba(11, 11, 12, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.info[open]::backdrop { animation: fade .22s var(--ease); }
dialog.info .eyebrow { margin: 0 0 var(--space-2); font-size: 11px; line-height: 16px; letter-spacing: .12em; color: var(--blue); }
dialog.info h2 { margin: 0 0 var(--space-5); font-size: 26px; line-height: 1.2; letter-spacing: -.01em; color: var(--ink); }
dialog.info p { margin: 0 0 var(--space-4); font-size: 16px; line-height: 1.6; }
dialog.info p.fine { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); font-size: 12px; line-height: 18px; color: var(--muted); }
dialog.info .dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-5); }
body.modal-open { overflow: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Waiting list page ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 0 var(--space-5) var(--space-8); }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-5) 0; border-bottom: 1px solid var(--border); margin-bottom: var(--space-7);
}
.topbar a.brand { color: var(--ink); font-weight: 700; font-size: 20px; line-height: 1; letter-spacing: -.02em; text-decoration: none; }
.topbar .section { color: var(--muted); font-size: 11px; line-height: 16px; letter-spacing: .12em; margin-right: -.12em; }
.page h1 { margin: 0; font-size: clamp(32px, 6vw, 44px); line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.page h1 span { color: var(--blue); }
.rule { width: 40px; height: 3px; background: var(--blue); margin: var(--space-5) 0; border: 0; border-radius: 2px; }
.intro p { margin: 0 0 var(--space-3); max-width: 60ch; font-size: 17px; line-height: 1.6; }
.intro .note { margin-top: var(--space-4); font-size: 14px; line-height: 1.55; color: var(--muted); }

form.waitlist { margin-top: var(--space-7); display: grid; gap: var(--space-5); }
fieldset {
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-lg);
  padding: var(--space-5); margin: 0; display: grid; gap: var(--space-5); min-width: 0;
}
/* Legend sits inside the card as a header instead of cutting through its border. */
legend {
  float: left; width: 100%; padding: 0 0 var(--space-3); margin: 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px; line-height: 16px; letter-spacing: .12em; color: var(--blue);
}
legend + * { clear: both; }
.row { display: grid; gap: var(--space-5) var(--space-4); grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
label, .q { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink); }
.optional { font-weight: 400; color: var(--muted); }
.help { font-size: 13px; line-height: 18px; color: var(--muted); font-weight: 400; max-width: 62ch; }

input[type=text], input[type=email], input[type=tel], input[type=date], select, textarea {
  width: 100%; min-height: 46px; font: 400 16px/24px var(--sans); color: var(--text);
  background: var(--page); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 10px 14px; margin: 0;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--muted); opacity: .7; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--ring); }
select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2345494f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
@media (prefers-color-scheme: dark) {
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a6b0bc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
}
/* After a submit attempt, missing answers turn red (not before: no red on a fresh form). */
form.tried input:invalid, form.tried select:invalid { border-color: var(--red); }
form.tried .field:has(input[type=radio]:invalid) .choices label { border-color: var(--red); }

/* Yes / No answers as a segmented pair: bigger targets, clear selected state. */
.choices { display: flex; gap: var(--space-2); margin-top: var(--space-1); }
.choices label {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2);
  min-width: 96px; padding: 10px 16px; cursor: pointer;
  font-size: 15px; font-weight: 400; color: var(--text);
  background: var(--page); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}
.choices label:hover { border-color: var(--muted); }
.choices label:has(input:checked) { border-color: var(--blue); background: var(--tint); color: var(--ink); font-weight: 700; }
.choices label:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.choices input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); flex: none; }
.choices input:focus-visible { outline: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--tint); font-size: 15px; line-height: 22px; }
.status[hidden] { display: none; }
.status.error { color: var(--red); border-color: currentColor; background: var(--page); }
.status.ok { color: var(--ink); border-color: var(--blue); }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.submit-row .fine { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.submit-row .button { min-width: 176px; }
@media (max-width: 560px) { .submit-row .button { width: 100%; } }
button[disabled] { opacity: .6; cursor: progress; }
.back { display: inline-flex; gap: 6px; margin-top: var(--space-6); font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
