/* Tokens: the palette, type, radii and shadows of the AI Documentation
   Accelerator (cx-ai-docs-accelerator), as custom properties — the same
   sheet as hr-new-hire-form, laid out as one page rather than one question
   at a time, minus file uploads, plus the rating scale. Hand-written rather
   than Tailwind so the public form ships no third-party script and a strict
   Content-Security-Policy (see main.py). */
:root {
  --ink: #020D23;
  --canvas: #F7F7F8;
  --divider: #E8EAED;
  --secondary: #687285;
  --disabled: #949FB2;
  --pigment: #0355F3;
  --pigment-dark: #0038A4;
  --pigment-tint: #F0F5FF;
  --pigment-mid: #95B9FF;
  --positive: #1A9F1A;
  --negative: #D02B41;
  --warning: #F3B921;
  --radius-panel: 12px;
  --radius: 8px;
  --shadow-card: 0 2px 17px -1px rgb(2 13 35 / 0.08);
  --ring: 0 0 0 3px rgb(3 85 243 / 0.2);
  --gradient: linear-gradient(111deg, #E3FEF6 14%, #E4F6FC 47%, #E5F5FE 86%);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* ---- Frame ---- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  height: 3.5rem; padding: 0 1.5rem;
  background: #fff; border-bottom: 1px solid rgb(2 13 35 / 0.08);
}
.brand img { display: block; height: 1.5rem; width: auto; }
.topbar-divider { width: 1px; height: 1.25rem; background: rgb(2 13 35 / 0.1); }
.topbar-title {
  font-size: .875rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 2.5rem 1.5rem 3rem; }
.form { width: 100%; max-width: 44rem; }
.card {
  background: #fff;
  border: 1px solid rgb(2 13 35 / 0.08);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
  padding: 2.5rem 2.75rem;
  outline: none;
}
/* The end of the journey gets the theme's mint-to-blue wash. */
.card-ending { background: var(--gradient); }

.card.is-entering { animation: rise .24s ease-out; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.footer { padding: 1.25rem 1.5rem 2rem; text-align: center; font-size: .8125rem; color: var(--secondary); }
.footer a { color: var(--pigment); }

/* ---- Intro and questions ---- */
.intro { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--divider); }
.welcome-title {
  margin: 0 0 1rem; font-size: 2rem; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em;
}
.question + .question { margin-top: 2.25rem; }
.question-title {
  margin: 0; font-size: 1.125rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em;
}
.optional {
  display: inline-block; vertical-align: middle; margin-left: .25rem;
  font-size: .75rem; font-weight: 500; letter-spacing: 0; color: var(--secondary);
  background: var(--canvas); border: 1px solid var(--divider); border-radius: 999px; padding: .05rem .5rem;
}
.question-desc { margin-top: .5rem; }
.question-body { margin-top: .875rem; }

/* Rendered markdown (descriptions, intro, ending). */
.prose { font-size: .9375rem; line-height: 1.65; color: var(--secondary); max-width: 62ch; }
.intro .prose, .card-ending .prose { color: var(--ink); }
.prose p { margin: .6em 0; }
.prose p:first-child { margin-top: 0; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--pigment); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { margin: .6em 0; padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose code {
  font-family: var(--font-mono); font-size: .85em;
  background: rgb(2 13 35 / 0.04); border-radius: 4px; padding: .1em .35em;
}
.prose blockquote { margin: .8em 0; padding-left: 1em; border-left: 3px solid var(--divider); }
.prose table { border-collapse: collapse; margin: .8em 0; width: 100%; }
.prose th, .prose td { border: 1px solid var(--divider); padding: .4em .8em; text-align: left; }
.prose th { background: var(--canvas); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--divider); margin: 1.5em 0; }

/* ---- Inputs ---- */
.input {
  display: block; width: 100%; height: 2.75rem; padding: 0 .875rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid var(--divider); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--disabled); }
.input:focus { outline: none; border-color: var(--pigment); box-shadow: var(--ring); }
.textarea { height: auto; min-height: 6rem; padding: .75rem .875rem; resize: vertical; line-height: 1.5; }
.has-error .input:invalid { border-color: var(--negative); }
.hint-above { margin: 0 0 .75rem; color: var(--secondary); font-size: .8125rem; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { grid-column: span 2; }
.field-half { grid-column: span 1; }
.field-label { display: block; margin-bottom: .375rem; font-size: .8125rem; font-weight: 500; }

/* Choices: a row per option. */
.choices { display: flex; flex-direction: column; gap: .5rem; }
.choice {
  position: relative; display: flex; align-items: center; gap: .75rem;
  padding: .75rem .875rem; border: 1px solid var(--divider); border-radius: var(--radius);
  background: #fff; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.choice:hover { background: var(--canvas); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.choice-key {
  flex: none; width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  font-size: .6875rem; font-weight: 600; color: var(--secondary);
  border: 1px solid var(--divider); border-radius: 4px; background: #fff;
  transition: background .12s, color .12s, border-color .12s;
}
.choice-text { font-size: .9375rem; }
.choice input:checked ~ .choice-key { background: var(--pigment); border-color: var(--pigment); color: #fff; }
.choice:has(input:checked) { background: var(--pigment-tint); border-color: var(--pigment); }
.choice:has(input:focus-visible) { border-color: var(--pigment); box-shadow: var(--ring); }

/* Rating: one row of numbered boxes, equal width whatever the count. */
.scale-options { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .375rem; }
.scale-option {
  position: relative; display: grid; place-items: center; height: 3rem;
  border: 1px solid var(--divider); border-top-width: 3px; border-radius: var(--radius);
  background: #fff; cursor: pointer; user-select: none;
  font-size: .9375rem; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.scale-option:hover { background: var(--canvas); }
.scale-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
/* NPS bands as a tinted top edge: detractors, passives, promoters. */
.scale-coded .is-detractor { border-top-color: rgb(208 43 65 / 0.35); }
.scale-coded .is-passive { border-top-color: rgb(243 185 33 / 0.55); }
.scale-coded .is-promoter { border-top-color: rgb(26 159 26 / 0.4); }
.scale-option:has(input:checked) { background: var(--pigment); border-color: var(--pigment); color: #fff; }
.scale-option:has(input:focus-visible) { border-color: var(--pigment); box-shadow: var(--ring); }
.scale-ends {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: .5rem; font-size: .8125rem; color: var(--secondary);
}

/* ---- Feedback and submission ---- */
.question-error { margin: .75rem 0 0; font-size: .875rem; color: var(--negative); }
.alert {
  margin: 0 0 1.5rem; padding: .875rem 1rem; font-size: .875rem; color: var(--negative);
  border: 1px solid rgb(208 43 65 / 0.25); background: rgb(208 43 65 / 0.05); border-radius: var(--radius);
}

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: 2.25rem; }
.form-error { margin: 0; font-size: .875rem; color: var(--negative); text-align: right; }
.btn {
  font: inherit; font-size: .9375rem; font-weight: 500;
  padding: .625rem 1.375rem; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: background .12s, color .12s;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--pigment); color: #fff; }
.btn-primary:hover { background: var(--pigment-dark); }
.btn-primary:disabled { background: var(--disabled); cursor: progress; }

.ending-mark svg { width: 2.5rem; height: 2.5rem; color: var(--positive); margin-bottom: 1rem; }
.reference { margin: 1.5rem 0 0; font-size: .75rem; color: var(--secondary); }
.reference code {
  font-family: var(--font-mono); font-size: .75rem;
  background: rgb(2 13 35 / 0.05); padding: .1em .35em; border-radius: 4px;
}

/* Honeypot: present in the DOM, absent from the page. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---- Small screens: the card becomes the page ---- */
@media (max-width: 640px) {
  .topbar { padding: 0 1rem; }
  .topbar-divider, .topbar-title { display: none; }
  .stage { padding: 0 0 2rem; }
  .card { border: 0; border-radius: 0; box-shadow: none; padding: 1.75rem 1.25rem; }
  .question-title { font-size: 1.0625rem; }
  .welcome-title { font-size: 1.625rem; }
  .field-half { grid-column: span 2; }
  .actions { flex-direction: column; align-items: stretch; }
  .form-error { text-align: left; }
  .scale-options { gap: .25rem; }
  .scale-option { height: 2.5rem; border-radius: 6px; font-size: .8125rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card.is-entering { animation: none; }
  .choice, .choice-key, .scale-option, .input, .btn { transition: none; }
}
