/* The flow's layout and parts, for every tenant. Colours, fonts and corners come from the tenant's theme
   (/t/<id>/theme.css: --bg, --fg, --muted, --accent, --on-accent, --panel, --line, --button, --font, …). */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --t-xl: clamp(2.5rem, 1.3rem + 4.6vw, 5.25rem);
  --t-q: clamp(1.75rem, 1.15rem + 2.3vw, 3.1rem);
  --t-l: clamp(1.4rem, 1.1rem + 1.1vw, 2rem);
  --t-m: clamp(1.125rem, 1.04rem + 0.35vw, 1.3rem);
  --t-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --t-s: 0.875rem;
  --t-xs: 0.75rem;
  --gutter: clamp(1.25rem, 0.7rem + 2.4vw, 3rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg, #fff);
  color: var(--fg, #111);
  font: 400 var(--t-body) / 1.5 var(--font, system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* --- top bar -------------------------------------------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem var(--gutter);
  background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; min-height: 2.25rem; }
.brand__logo { display: block; height: 1.5rem; width: auto; }
.brand__mark { display: block; height: 1.15rem; width: auto; }
.brand__word { font: var(--display-weight) 1.125rem / 1 var(--font-display); letter-spacing: var(--display-tracking); }
.bar__end { display: inline-flex; align-items: center; gap: 1.25rem; min-width: 0; }
.langs { display: inline-flex; gap: 0.75rem; }
.leave { display: inline-block; font-size: var(--t-s); color: var(--muted); text-decoration: none; padding: 0.5rem 0; text-align: right; }
.leave:hover { color: var(--fg); text-decoration: underline; }
.progress { position: absolute; inset: auto 0 0 0; height: 2px; background: var(--line); }
.progress > span {
  display: block; height: 100%; width: var(--p, 0%);
  background: var(--accent);
  transition: width 0.5s var(--ease);
}

/* --- the stage ------------------------------------------------------------------------------------------------ */
.main { padding: clamp(2rem, 9vh, 6.5rem) var(--gutter) clamp(3rem, 10vh, 6rem); }
.flow { width: 100%; max-width: 48rem; margin: 0 auto; }
.step { border: 0; padding: 0; margin: 0; min-width: 0; display: none; }
.step.is-current { display: block; animation: step-in 0.55s var(--ease) both; }
.step.is-back.is-current { animation-name: step-back; }
@keyframes step-in { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes step-back { from { opacity: 0; transform: translateY(-1.5rem); } }

.kicker {
  margin: 0 0 1.25rem;
  font: 500 var(--t-xs) / 1.2 var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.display {
  margin: 0;
  font: var(--display-weight) var(--t-xl) / 1.02 var(--font-display);
  letter-spacing: var(--display-tracking);
  text-wrap: balance;
  max-width: 18ch;
}
.display--m { font-size: var(--t-q); max-width: 22ch; }
.lede { margin: 1.25rem 0 0; font-size: var(--t-m); line-height: 1.5; color: var(--muted); max-width: 38rem; text-wrap: pretty; }
.points { list-style: none; margin: 2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; font-size: var(--t-s); }
.points li { display: inline-flex; align-items: center; gap: 0.6rem; }
.points li::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); flex: none; }
.noscript-note { display: none; }
.direct { margin: 2rem 0 0; font-size: var(--t-s); color: var(--muted); }
.direct a { color: var(--fg); white-space: nowrap; }
.suggest {
  display: block; margin-top: 0.5rem; padding: 0.35rem 0; min-height: 1.75rem;
  font: 500 var(--t-s) / 1.3 var(--font); color: inherit; text-align: left;
  background: none; border: 0; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
  overflow-wrap: anywhere;
}

/* A question */
.q { display: block; padding: 0; margin: 0; width: 100%; }
.count {
  display: block; margin-bottom: 1.1rem;
  font: 500 var(--t-xs) / 1.2 var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.q__text {
  display: block; margin: 0;
  font: var(--display-weight) var(--t-q) / 1.08 var(--font-display);
  letter-spacing: var(--display-tracking);
  text-wrap: balance;
  max-width: 24ch;
}
.opt { font: 400 var(--t-s) / 1 var(--font); letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.hint { margin: 0.9rem 0 0; color: var(--muted); max-width: 36rem; }

/* Options: real radio buttons and checkboxes, drawn as cards with a letter key. */
.options {
  display: grid; gap: 0.625rem; margin-top: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
.options--many { grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr)); }
.option {
  position: relative;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.9rem;
  min-height: 3.6rem; padding: 0.8rem 1rem 0.8rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option:hover { border-color: var(--fg); }
.option:active { transform: scale(0.992); }
.option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.key {
  display: inline-grid; place-items: center;
  width: 1.65rem; height: 1.65rem;
  font: 600 var(--t-xs) / 1 var(--font);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) * 0.75);
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.option__text { display: grid; gap: 0.15rem; min-width: 0; }
.option__label { font-weight: 500; line-height: 1.3; }
.option__hint { font-size: var(--t-s); color: var(--muted); line-height: 1.35; }
.tick { width: 1.1rem; height: 1.1rem; opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.2s var(--ease); }
.tick::after {
  content: ''; display: block; width: 0.45rem; height: 0.8rem; margin: 0 auto;
  border: solid var(--accent-text); border-width: 0 2px 2px 0; transform: translateY(-0.1rem) rotate(45deg);
}
.option:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.option:has(input:checked) .key { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.option:has(input:checked) .tick { opacity: 1; transform: none; }
.other { margin-top: 0.75rem; max-width: 30rem; }

/* Text */
.input {
  width: 100%;
  font: inherit; color: inherit;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted); opacity: 0.75; }
.input:hover { border-color: var(--fg); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input[aria-invalid="true"] { border-color: var(--error, #c4321c); }
.input--big { margin-top: 2rem; font-size: var(--t-m); padding: 1rem 1.1rem; }
.input--area { margin-top: 2rem; min-height: 9rem; resize: vertical; line-height: 1.5; }

/* Contact */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1.1rem 1rem; margin-top: 2rem; }
.field label { display: block; margin-bottom: 0.4rem; font-size: var(--t-s); font-weight: 500; }
.field .opt { font-weight: 400; }
.field .error { margin-top: 0.4rem; }
.privacy-note { margin: 1.5rem 0 0; font-size: var(--t-s); color: var(--muted); }

.error { margin: 1rem 0 0; font-size: var(--t-s); font-weight: 500; color: var(--error, #c4321c); }
.error::before { content: '! '; font-family: var(--font-mono); }
.form-alert {
  margin: 0 0 2.5rem; padding: 0.9rem 1rem;
  border: 1px solid var(--error, #c4321c); border-radius: var(--radius);
  color: var(--error, #c4321c); font-weight: 500;
}

/* Buttons */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.nav--intro, .nav--done { justify-content: flex-start; }
.nav__end { display: inline-flex; align-items: center; gap: 1rem; margin-left: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3rem; padding: 0.75rem 1.35rem;
  font: 500 var(--t-body) / 1 var(--font);
  color: inherit; background: transparent;
  border: 1px solid transparent; border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--button); color: var(--on-button); }
.btn--primary:hover { background: color-mix(in srgb, var(--button) 86%, var(--bg)); }
.btn--primary .arrow { transition: transform 0.2s var(--ease); }
.btn--primary:hover .arrow { transform: translateX(3px); }
.btn--big { min-height: 3.5rem; padding-inline: 1.75rem; font-size: var(--t-m); }
.btn--ghost { padding-inline: 0.25rem; color: var(--muted); }
.btn--ghost:hover { color: var(--fg); }
.btn--ghost.btn:not(:first-child) { padding-inline: 1.35rem; border-color: var(--line-strong); color: var(--fg); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.enter-hint { display: none; font-size: var(--t-xs); color: var(--muted); }
.enter-hint kbd {
  font: 500 var(--t-xs) / 1 var(--font-mono);
  padding: 0.2rem 0.35rem; border: 1px solid var(--line-strong); border-radius: 4px;
}
@media (hover: hover) and (pointer: fine) { .enter-hint { display: inline; } }
/* Letter keys only mean something with a keyboard. */
@media (pointer: coarse) {
  .key { display: none; }
  .option { grid-template-columns: 1fr auto; padding-left: 1rem; }
}
.step--intro .nav .enter-hint { margin-left: 0.5rem; }

/* Done */
.done__mark {
  display: grid; place-items: center;
  width: 3.5rem; height: 3.5rem; margin-bottom: 2rem;
  border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  animation: pop 0.6s var(--ease) 0.1s both;
}
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.reply-time { margin: 1.25rem 0 0; font-weight: 600; max-width: 38rem; }
.label {
  margin: 2.75rem 0 1rem;
  font: 500 var(--t-xs) / 1.2 var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.next { margin: 0; padding: 0; list-style: none; counter-reset: next; display: grid; gap: 0; max-width: 38rem; }
.next li {
  counter-increment: next;
  display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.5rem;
  padding: 0.9rem 0; border-top: 1px solid var(--line);
}
.next li:last-child { border-bottom: 1px solid var(--line); }
.next li::before { content: counter(next, decimal-leading-zero); font: 500 var(--t-s) / 1.5 var(--font-mono); color: var(--muted); }

/* Text pages (privacy) */
.prose { max-width: 40rem; margin: 0 auto; }
.prose h2 { margin: 2.25rem 0 0.5rem; font: 600 var(--t-body) / 1.3 var(--font); }
.prose p { margin: 0 0 0.75rem; }
.prose .btn { margin-top: 2rem; }
.more { margin-top: 2rem !important; }
.more a { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Footer */
.foot {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 1.25rem var(--gutter);
  font-size: var(--t-xs); color: var(--muted);
  border-top: 1px solid var(--line);
}
.foot a { color: inherit; }

@media (max-width: 40rem) {
  .leave { font-size: var(--t-xs); }
  .nav { margin-top: 2rem; }
  .nav .btn--primary { flex: 1 1 auto; }
  .nav__end { flex: 1 1 auto; }
  .nav__end .btn { width: 100%; }
  /* Several answers can be picked here, so Next isn't reached by picking: keep it in sight on a long list. */
  .step--multi .nav { position: sticky; bottom: 0; z-index: 4; margin-inline: calc(var(--gutter) * -1); padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
  .bar__end { gap: 0.75rem; }
  /* No room for both: the language stays, and the logo still leads back to the site. */
  .bar__end:has(.langs) > .leave { display: none; }
  .nav--done .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
