/* Louisville ADHD quiz, round 1 punch-up.
   Brand: voice/brand-identity-v1.md (purple #523A8F, green #9FCE6A, gold #EDD684 sparingly,
   dark purple #382861; Open Sans bold H1, Montserrat headings and body).
   Green is graphic ink only: it fails contrast as text on light grounds (design.md). */
:root {
  --purple: #523A8F;
  --purple-dark: #382861;
  --green: #9FCE6A;
  --green-text: #567329;
  --gold: #EDD684;
  --ink: #2b2438;
  --muted: #5a5470;
  --line: #e6e1ef;
  --tint: #f6f3fb;   /* purple at ~5% on white, for selected and hover states */
  --bg: #ffffff;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 Montserrat, -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#labPill {
  position: fixed; right: 12px; bottom: 12px; z-index: 50;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; opacity: .8;
}

#brandHeader { max-width: 680px; margin: 28px auto 0; padding: 0 16px; text-align: center; }
#brandHeader img { height: 56px; width: auto; }
body.inQuiz #brandHeader { margin-top: 16px; }
body.inQuiz #brandHeader img { height: 36px; }

#surveyContainer { max-width: 680px; margin: 0 auto; padding: 8px 16px 48px; }

/* ---- SurveyJS reset onto the brand ---- */
.sd-root-modern {
  --sjs-font-family: Montserrat, -apple-system, system-ui, sans-serif;
  --sjs-primary-backcolor: var(--purple);
  --sjs-primary-backcolor-dark: var(--purple-dark);
  --sjs-primary-backcolor-light: var(--tint);
  --sjs-general-backcolor-dim: transparent;
  --sjs-general-forecolor: var(--ink);
  --sjs-corner-radius: var(--radius);
  background: transparent !important;
}
.sd-root-modern .sd-container-modern { margin: 0; }
/* the empty survey title still draws a purple rule; the welcome screen replaces it */
.sd-container-modern__title { display: none !important; }
.sd-body.sd-body--responsive, .sd-body.sd-body--static { padding: 8px 0 0 !important; max-width: none !important; }
.sd-page { padding: 0 !important; }

/* progress: our own step tracker (#steps), SurveyJS's is turned off.
   Steps behind you purple, the question you are on a green dot, the rest gray. */
#steps { display: none; max-width: 680px; margin: 18px auto 0; padding: 0 16px; }
body.inQuiz #steps { display: block; }
#steps ol { list-style: none; display: flex; margin: 0; padding: 0 9px; }
#steps li { flex: 1; position: relative; height: 18px; }
#steps li:last-child { flex: 0 0 0; }
#steps li::after {              /* the segment from this dot to the next */
  content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line);
}
#steps li:last-child::after { display: none; }
#steps li i {                   /* the dot */
  position: absolute; left: 0; top: 9px; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: #d6d0e2; z-index: 1; transition: all .3s ease;
}
#steps li.done::after, #steps li.done i { background: var(--purple); }
#steps li.now i {
  width: 16px; height: 16px; margin: -8px 0 0 -8px; background: var(--green);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--green);
  animation: here 2.4s ease-in-out infinite;
}
@keyframes here {
  0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--green), 0 0 0 4.5px rgba(159,206,106,.5); }
  50%      { box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--green), 0 0 0 11px rgba(159,206,106,0); }
}
@media (prefers-reduced-motion: reduce) { #steps li.now i { animation: none; } }
#steps .count { text-align: right; margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.sd-progress__text {
  position: static !important; display: block; text-align: right; margin: 0 0 16px; padding: 0;
  font-size: 13px; font-weight: 600; color: var(--muted);
}

/* question card */
.sd-element--with-frame {
  box-shadow: none !important; border: 1px solid var(--line);
  border-radius: var(--radius) !important; padding: 28px 28px 24px !important;
  animation: rise .9s cubic-bezier(.22,.61,.36,1) both;
}
/* page change: fade out (550ms, see index.html), then the new card eases in */
#surveyContainer { transition: opacity .55s ease, transform .55s ease; }
#surveyContainer.fadeOut { opacity: 0; transform: translateY(-4px); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sd-element--with-frame { animation: none; }
  #surveyContainer, #surveyContainer.fadeOut { transition: none; transform: none; }
}

.sd-question__title, .sd-question__title .sv-string-viewer {
  font: 600 22px/1.35 Montserrat, sans-serif !important; color: var(--purple-dark);
}
.sd-question__header { padding-bottom: 26px !important; }   /* room between the question and its answers */
.sd-question__header .sd-description { margin-top: 8px !important; }
.sd-question__required-text { display: none !important; }  /* every question is required; the asterisks only added caution */
.sd-description { color: var(--muted) !important; font-size: 15px !important; }

/* answers as full-width tappable rows */
.sd-selectbase__item, .sd-item { width: 100%; margin: 0 0 12px !important; padding: 0 !important; }
.sd-selectbase__label { width: 100%; }
.sd-item__control-label { flex: 1; font-size: 16px; line-height: 1.45; }
.sd-selectbase__label {
  display: flex !important; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.sd-selectbase__label:hover { border-color: #c9bfe0; background: var(--tint); }
.sd-item--checked .sd-selectbase__label { border-color: var(--purple); background: var(--tint); }
.sd-item__decorator { margin-top: 1px; flex: none; box-shadow: inset 0 0 0 1.5px #b9aed3 !important; background: #fff !important; }
.sd-item--checked .sd-item__decorator { background: var(--purple) !important; box-shadow: none !important; }
.sd-item--checked .sd-radio__decorator::after { background: #fff !important; }
.sd-item--checked .sd-checkbox__svg use { fill: #fff !important; }
.sd-item--checked .sd-item__control-label { color: var(--purple-dark); font-weight: 500; }

.sd-input { border-radius: 10px !important; box-shadow: inset 0 0 0 1.5px var(--line) !important; font-size: 17px !important; }
.sd-input:focus { box-shadow: inset 0 0 0 2px var(--purple) !important; }

/* page title on the contact step ("One last step!") */
.sd-page__title, .sd-page__title .sv-string-viewer { font: 800 26px/1.2 "Open Sans", sans-serif !important; color: var(--purple); }
.sd-page__description, .sd-page__description .sv-string-viewer {
  white-space: pre-line;
  font: 400 17px/1.55 Montserrat, sans-serif !important; color: var(--ink) !important; max-width: 40em; margin-top: 10px !important;
}
.sd-page__title + .sd-page__description, .sd-page > .sd-title { margin-bottom: 22px !important; }

/* halfway interlude: flashes between questions 7 and 8, no action needed */
#stage { position: relative; }
#interlude {
  position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-start;
  padding-top: 110px; pointer-events: none; opacity: 0; transform: scale(.96);
  transition: opacity .5s ease, transform .9s cubic-bezier(.22,.61,.36,1);
}
#interlude.show { opacity: 1; transform: scale(1); }
#interlude p { margin: 0; font: 800 clamp(30px, 6vw, 44px)/1.15 "Open Sans", sans-serif; color: var(--purple); text-align: center; }
@media (prefers-reduced-motion: reduce) { #interlude { transform: none; transition: opacity .3s; } }

/* navigation */
.sd-body__navigation { padding: 20px 0 0 !important; gap: 12px; }
.sd-btn {
  font: 600 16px Montserrat, sans-serif !important; border-radius: 10px !important;
  padding: 14px 28px !important; box-shadow: none !important;
}
.sd-btn--action, .sd-navigation__start-btn, .sd-navigation__next-btn, .sd-navigation__complete-btn { background: var(--purple) !important; color: #fff !important; }
.sd-btn--action:hover, .sd-navigation__start-btn:hover, .sd-navigation__next-btn:hover, .sd-navigation__complete-btn:hover { background: var(--purple-dark) !important; }
.sd-navigation__start-btn { padding: 16px 36px !important; font-size: 17px !important; }
.nav-restart { margin-left: auto !important; }
.sd-navigation__prev-btn, input[value="Back"], .nav-restart-btn {
  background: transparent !important; color: var(--muted) !important; border: 1.5px solid var(--line) !important;
}

/* ---- welcome (start page) ---- */
.welcome { text-align: center; padding: 8px 4px 4px; }
.sd-element--with-frame:has(.welcome) { border: 0; padding: 0 !important; }
.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 5px 12px; border-radius: 999px;
  background: var(--tint); color: var(--purple); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.welcome h1, .rHero h1 {
  font: 800 clamp(34px, 7vw, 52px)/1.08 "Open Sans", sans-serif; color: var(--purple);
  margin: 0 0 16px; letter-spacing: -.01em;
}
.welcome h1 .sub { display: block; font-size: .5em; font-weight: 700; color: var(--purple); margin-top: 10px; letter-spacing: 0; }
.welcome .lede { font-size: 18px; color: var(--ink); max-width: 30em; margin: 30px auto 30px; }
.welcome .core {
  display: inline-block; margin: 0 auto 26px; padding-bottom: 4px; font-weight: 600; color: var(--purple-dark);
  border-bottom: 3px solid var(--green);
}
.facts { list-style: none; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 0; margin: 0 0 8px; }
.facts li { border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 16px; font-size: 13px; line-height: 1.25; color: var(--muted); }
.facts li { font-size: 15px; font-weight: 500; white-space: nowrap; }
.facts b { font-size: 17px; color: var(--purple); margin-right: 2px; }
/* start button: our own, two lines, pulsing green dot pinned to the top-right corner */
.sd-root-modern:has(.welcome) .sd-body__navigation { display: none !important; }
.startBtn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 0;
  margin: 22px auto 0; border: 0; border-radius: 10px; cursor: pointer;
  font: 600 17px/1.25 Montserrat, sans-serif; transition: background .2s;
}
/* SurveyJS styles buttons inside html questions; these win over it */
.welcome .startBtn { background: var(--purple) !important; color: #fff !important; box-shadow: none !important;
  padding: 10px 32px 15px !important; line-height: 1.25 !important; }
.welcome .startBtn:hover { background: var(--purple-dark) !important; }
.welcome .startBtn small { color: #fff !important; }
.startBtn:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.startBtn small { font-size: 13px; line-height: 1.1; font-weight: 500; opacity: .8; }
.startBtn::after {
  content: ""; position: absolute; right: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--green);
  animation: orbitPulse 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .startBtn::after { animation: none; } }
@keyframes orbitPulse {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--green), 0 0 0 3px rgba(159,206,106,.5); }
  50%      { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--green), 0 0 0 9px rgba(159,206,106,0); }
}
/* center the start button under the welcome block */
.sd-root-modern:has(.welcome) .sd-body__navigation { justify-content: center; }

/* ---- result ---- */
#result { display: none; max-width: 680px; margin: 0 auto; padding: 32px 16px 64px; }
.rHero { text-align: center; padding: 0 0 8px; }
.rLogo { display: block; height: 40px; width: auto; margin: 0 auto 20px; }
.rHero h1 { font-size: clamp(28px, 6vw, 40px); }
.rMeta { font-weight: 600; color: var(--muted); margin: 0 0 22px; }
#rScale { max-width: 560px; margin: 0 auto; }
#rScale .track { position: relative; height: 10px; border-radius: 999px; margin: 0 0 10px;
  background: linear-gradient(90deg, var(--green) 0 23%, #c4b9e0 23% 43%, #8f7cc4 43% 70%, var(--purple) 70% 100%); }
#rMarker { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: #fff; border: 4px solid var(--purple-dark); box-shadow: 0 2px 6px rgba(43,36,56,.25); transition: left .6s ease; }
#rScale .bands { display: flex; gap: 6px; }
#rScale .b { flex: 1; padding: 8px 2px; border-radius: 8px; color: var(--muted); opacity: .7; }
#rScale .b .n { font-weight: 700; font-size: 14px; }
#rScale .b .r { font-size: 12px; }
#rScale .b.me { opacity: 1; background: var(--tint); color: var(--purple-dark); }
#rScale .note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

#rCopy { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 8px; }
#rCopy h3 { font: 700 22px/1.3 Montserrat, sans-serif; color: var(--purple); margin: 32px 0 10px; }
#rCopy h4 { font: 600 18px/1.4 Montserrat, sans-serif; color: var(--purple-dark); margin: 18px 0 8px; }
#rCopy p { margin: 10px 0; }
#rCopy hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
#rCopy a { color: var(--purple); font-weight: 600; }
#rCopy .cta { display: inline-block; background: var(--purple); color: #fff; padding: 14px 26px; border-radius: 10px; text-decoration: none; margin: 8px 0 0; }
#rCopy .cta:hover { background: var(--purple-dark); }
.rDoc { text-align: center; margin: 28px 0 8px; }
.rDoc img { width: 200px; max-width: 70%; height: auto; border-radius: 14px; }
#rRef { margin-top: 32px; font-size: 13px; color: var(--muted); text-align: center; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .sd-element--with-frame { padding: 20px 16px 18px !important; }
  .sd-question__title, .sd-question__title .sv-string-viewer { font-size: 19px !important; }
  .sd-body__navigation .sd-btn { width: 100%; }
}
