/* =============================================================================
   Elementary Music Success Scorecard: styles (mobile-first)
   Palette: mint #CDEAE7 (panels/accents only, never text or thin lines on white),
   near-black #1C2120 (text, buttons), white.
   ============================================================================= */

/* Heading font: Arial Black where installed, else self-hosted Archivo Black (SIL OFL).
   Self-hosted so headings stay heavy even if Google Fonts is blocked. */
@font-face {
  font-family: "Archivo Black";
  src: url("/fonts/ArchivoBlack-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --mint: #cdeae7;
  --mint-deep: #b5ddd8;      /* decorative only */
  --ink: #1c2120;
  --white: #ffffff;
  --grey: #586260;           /* secondary text: 6.4:1 on white */
  --rule: #d9dfde;           /* hairlines between sections (decorative) */
  --control: #6f7977;        /* control borders: 4.6:1 on white (WCAG 1.4.11) */

  --font-head: "Arial Black", "Archivo Black", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --gutter: 16px;
  --radius: 14px;
  --cookie-h: 0px;           /* set by JS while the cookie bar is visible */
  --safe-b: env(safe-area-inset-bottom, 0px);

  --step-0: 1rem;                                          /* body, never below 16px */
  --step-h1: clamp(1.3rem, 0.95rem + 1.9vw, 2.35rem);      /* screen headings */
  --step-hero: clamp(1.9rem, 1.1rem + 4vw, 3.6rem);        /* intro title */
  --step-h2: clamp(1.1rem, 0.95rem + 0.8vw, 1.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--white);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-x: clip;
  padding-bottom: calc(var(--cookie-h));
}

img, svg { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 400;          /* Arial Black / Archivo Black are already heavy; avoid faux bold */
  font-synthesis: none;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.12;
  margin: 0 0 0.5em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

h1:focus, h2:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

p { margin: 0 0 1em; }

a { color: var(--ink); text-underline-offset: 0.18em; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* --- Decorative mint shapes (tablet and up) ------------------------------ */
.decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  display: none;
}
.decor span { position: absolute; background: var(--mint); }
.decor .d-circle { border-radius: 50%; }

@media (min-width: 768px) {
  .decor { display: block; }
  .decor .d-circle--a { width: 220px; height: 220px; top: -90px; right: -70px; }
  .decor .d-circle--b { width: 90px; height: 90px; bottom: 12%; left: -45px; }
  .decor .d-block { width: 14px; height: 38vh; top: 22vh; left: 0; }
}
@media (min-width: 1100px) {
  .decor .d-circle--a { width: calc((100vw - 720px) / 2 + 40px); height: auto; aspect-ratio: 1; max-width: 520px; top: -10vh; right: calc(-1 * min(14vw, 180px)); }
  .decor .d-circle--b { width: 200px; height: 200px; bottom: -60px; left: calc((100vw - 720px) / 2 - 260px); }
  .decor .d-block { width: calc((100vw - 720px) / 2 - 120px); max-width: 300px; height: 46vh; top: 30vh; left: 0; }
  .decor .d-block--b { display: block; width: 120px; height: 12px; right: 6vw; bottom: 22vh; left: auto; top: auto; }

  /* Results are wider (~1040px); keep shapes in the margins. */
  body[data-screen="results"] .decor .d-circle--a { width: 300px; top: -120px; right: -120px; }
  body[data-screen="results"] .decor .d-block { width: 18px; }
  body[data-screen="results"] .decor .d-circle--b { left: -100px; }
}
.decor .d-block--b { display: none; }

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 1;
  padding: 14px var(--gutter);
  padding-top: max(14px, env(safe-area-inset-top));
}
.site-header__inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; }
.logo { display: inline-flex; line-height: 0; }
.logo img { height: 28px; width: auto; }
@media (min-width: 768px) { .logo img { height: 34px; } }
body[data-screen="intro"] .site-header .logo { display: none; } /* intro shows the larger logo */

/* --- Main / screens ------------------------------------------------------ */
main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  padding: 8px var(--gutter) 40px;
}
main:focus { outline: none; }

.screen { max-width: 720px; margin: 0 auto; }
.screen--results { max-width: 1040px; }

.lead { font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); line-height: 1.55; }
.muted { color: var(--grey); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 52px;
  padding: 0.8em 1.6em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font: 700 1rem/1.2 var(--font-body);
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn--ghost { background: var(--white); color: var(--ink); }
.btn--block { width: 100%; }
.btn[disabled] { background: #e6eaea; border-color: #e6eaea; color: #6b7472; cursor: not-allowed; }
@media (hover: hover) {
  .btn:not([disabled]):hover { background: #3a4140; border-color: #3a4140; }
  .btn--ghost:not([disabled]):hover { background: var(--mint); border-color: var(--ink); color: var(--ink); }
}

.link-btn {
  background: none;
  border: 0;
  padding: 12px 4px;
  min-height: 44px;
  color: var(--ink);
  font: 600 1rem var(--font-body);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* --- Intro --------------------------------------------------------------- */
.screen--intro {
  display: flex;
  flex-direction: column;
  padding: 0 0 32px;
}
@media (min-width: 768px) {
  /* Vertically centred on larger screens; top-aligned on phones so nothing is pushed below the fold. */
  .screen--intro { min-height: calc(100dvh - 300px); justify-content: center; padding-top: 24px; }
}
body[data-screen="intro"] .site-header { padding-bottom: 0; }
.intro__logo { height: clamp(44px, 9vw, 72px); width: auto; margin-bottom: clamp(28px, 6vw, 48px); align-self: flex-start; }
.intro__title { font-size: var(--step-hero); line-height: 1.04; margin-bottom: 0.45em; max-width: 12em; }
.intro__panel {
  position: relative;
  background: var(--mint);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  margin-bottom: clamp(24px, 5vw, 40px);
}
.intro__panel p { margin: 0; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem); line-height: 1.5; font-weight: 500; }
.intro .btn { align-self: flex-start; min-width: min(100%, 280px); font-size: 1.05rem; }
@media (max-width: 479px) { .intro .btn { width: 100%; } }

/* --- About / instructions ----------------------------------------------- */
.screen--about { padding-top: clamp(4px, 2vw, 16px); }
.about__copy p { font-size: clamp(1.05rem, 1rem + 0.3vw, 1.175rem); line-height: 1.6; }
.about__copy p:first-child { font-weight: 600; }
.about__grid { display: grid; gap: 16px; margin: 28px 0 8px; }
@media (min-width: 768px) { .about__grid { grid-template-columns: 1fr 1fr; } }
.about__panel { background: var(--mint); border-radius: var(--radius); padding: clamp(20px, 3.5vw, 28px); }
.about__panel--outline { background: var(--white); border: 2px solid var(--ink); }
.about__panel h2 { font-size: 1rem; margin-bottom: 14px; }
.about__pillars, .about__steps { margin: 0; padding: 0; list-style: none; counter-reset: n; display: grid; gap: 12px; }
.about__pillars li, .about__steps li { counter-increment: n; position: relative; padding-left: 40px; line-height: 1.45; }
.about__pillars li { font-weight: 600; padding-top: 3px; }
.about__pillars li::before, .about__steps li::before {
  content: counter(n);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--white);
  display: grid; place-items: center;
  font: 700 0.85rem var(--font-body);
}
.about__steps li::before { background: var(--mint); color: var(--ink); }
@media (min-width: 768px) { .screen--about .quiz-nav [data-action="begin"] { margin-left: auto; } }

/* --- Progress ------------------------------------------------------------ */
.progress { margin: 4px 0 clamp(20px, 4vw, 32px); }
.progress__label { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
.progress__track { height: 10px; border-radius: 999px; background: var(--mint); overflow: hidden; }
.progress__fill { height: 100%; background: var(--ink); border-radius: 999px; transition: width 0.3s ease; }

/* --- Question screen ----------------------------------------------------- */
.pillar-title { font-size: var(--step-h1); }
.pillar-desc { color: var(--grey); margin-bottom: 1.25em; }
.scale-hint {
  background: var(--mint);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.statements { list-style: none; margin: 0; padding: 0; }
.statement { border: 0; margin: 0; padding: 22px 0 20px; min-width: 0; border-bottom: 1px solid var(--rule); }
.statements li:last-child .statement { border-bottom: 0; }
.statement legend { padding: 0; margin-bottom: 14px; font-weight: 600; font-size: 1.0625rem; line-height: 1.45; display: flex; gap: 10px; float: left; width: 100%; }
.statement legend + * { clear: both; }
.statement__num {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--mint);
  display: inline-grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: -1px;
}

/* Rating row spans the question text: starts after the number badge (28px + 10px gap), ends at the text's right edge. */
.rating {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 8px;
  margin-left: 38px;
}
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.rating label {
  display: grid;
  place-items: center;
  min-height: 52px;
  min-width: 44px;
  border: 2px solid var(--control);
  border-radius: 12px;
  background: var(--white);
  font: 700 1.15rem/1 var(--font-body);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.rating input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--white); }
.rating input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) {
  .rating input:not(:checked) + label:hover { background: var(--mint); border-color: var(--ink); }
}
.rating__ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 0 38px;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--grey);
}
.rating__ends span { max-width: 45%; }
.rating__ends span:last-child { text-align: right; }

/* Back / Next. Sticky at the bottom on phones, above the cookie bar and home indicator. */
.quiz-nav {
  position: sticky;
  bottom: var(--cookie-h);
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px calc(-1 * var(--gutter)) 0;
  padding: 12px var(--gutter) calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--rule);
}
.quiz-nav .btn { flex: 1 1 0; }
.quiz-nav .btn--ghost { flex: 0 0 auto; }
.quiz-nav__status { display: none; }
body.has-cookie-bar .quiz-nav { padding-bottom: 12px; }
@media (min-width: 768px) {
  .quiz-nav {
    position: static;
    margin: 24px 0 0;
    padding: 24px 0 0;
    background: none;
  }
  .quiz-nav .btn { flex: 0 0 auto; min-width: 160px; }
  .quiz-nav__status { display: block; margin: 0 0 0 auto; color: var(--grey); font-size: 0.95rem; }
}
.answer-count { font-size: 0.9rem; color: var(--grey); margin: 12px 0 0; }
@media (min-width: 768px) { .answer-count { display: none; } }

/* --- Gate ---------------------------------------------------------------- */
.screen--gate { padding-top: clamp(8px, 4vw, 40px); }
.gate__panel {
  background: var(--mint);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  margin: 24px 0;
}
.gate__form:empty, .gate__form:has(.fd-container:empty) { min-height: 0; }
.gate__form .fd-container { width: 100%; max-width: 100%; overflow: hidden; }
/* Keep whatever Flodesk renders inside the column and easy to tap. */
.gate__form .fd-container * { max-width: 100%; box-sizing: border-box; }
.gate__form .fd-container input,
.gate__form .fd-container button { font-size: 16px !important; min-height: 44px; }
.gate__loading { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.gate__loading::before {
  content: "";
  width: 18px; height: 18px;
  border: 3px solid var(--ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gate__blocked { background: var(--white); border-radius: 10px; padding: 16px; }
.gate__blocked p { margin-bottom: 12px; }

/* --- Results ------------------------------------------------------------- */
.results-hero { padding: clamp(4px, 2vw, 16px) 0 8px; }
.eyebrow {
  display: inline-block;
  background: var(--mint);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.results-hero h1 { font-size: var(--step-h1); }
.results-hero h1 .pillar-name { display: block; font-size: 1.25em; margin-top: 0.15em; }

.results-chart {
  display: grid;
  gap: 8px 40px;
  align-items: center;
  margin: 16px 0 32px;
}
.chart-wrap { width: 100%; max-width: 560px; margin: 0 auto; }
.radar { display: block; width: 100%; height: auto; overflow: visible; }
.radar-grid { fill: none; stroke: #c9d1cf; stroke-width: 1; }
.radar-grid--outer { stroke: var(--ink); stroke-width: 1.5; }
.radar-spoke { stroke: #c9d1cf; stroke-width: 1; }
.radar-shape { fill: var(--mint); fill-opacity: 0.85; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.radar-dot { fill: var(--ink); }
.radar-tick { font: 500 10px var(--font-body); fill: var(--grey); }
.radar-label { font-family: var(--font-body); font-weight: 700; fill: var(--ink); letter-spacing: 0.02em; }
.radar-label-score { font-weight: 500; fill: var(--grey); }

.score-list h2 { font-size: var(--step-h2); }
.score-list ul { list-style: none; margin: 0; padding: 0; }
.score-list li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.score-list li:last-child { border-bottom: 0; }
.score-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; }
.score-row strong { font-family: var(--font-head); font-weight: 400; font-size: 1.1rem; white-space: nowrap; }
.score-bar { height: 8px; border-radius: 999px; background: #eef2f1; margin-top: 8px; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--mint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 2px;
}

@media (min-width: 1000px) {
  .results-chart { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}

.cards { display: grid; gap: 20px; margin-bottom: 40px; }
.card { border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); border: 2px solid var(--ink); background: var(--white); }
.card--growth { background: var(--mint); border-color: var(--mint); }
.card h2 { font-size: var(--step-h2); }
.card h2 .pillar-name { display: block; margin-top: 0.2em; }
.card h3 { font-size: 1rem; margin-top: 1.6em; }
.also { background: var(--white); border-radius: 10px; padding: 12px 14px; font-size: 0.95rem; }
.trainings { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: t; }
.training { background: var(--white); border-radius: 12px; padding: 16px 18px 16px 58px; position: relative; counter-increment: t; }
.training::before {
  content: counter(t);
  position: absolute; left: 16px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--white);
  display: grid; place-items: center;
  font: 700 0.9rem var(--font-body);
}
.training__title { font-weight: 700; margin: 0 0 2px; }
.training__clinician { color: var(--grey); font-size: 0.92rem; margin: 0 0 6px; }
.training__desc { margin: 0; }
@media (min-width: 900px) {
  .trainings { grid-template-columns: repeat(3, 1fr); }
  .training { padding: 58px 18px 18px; }
}

.support {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 48px);
  margin-bottom: 40px;
}
.support::after { /* soft mint circle accent */
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: var(--mint);
  opacity: 0.18;
  right: -70px; top: -90px;
}
.support h2 { color: var(--white); font-size: var(--step-h2); }
.support p { max-width: 60ch; }
.support .btn { background: var(--mint); border-color: var(--mint); color: var(--ink); position: relative; z-index: 1; }
@media (hover: hover) { .support .btn:hover { background: var(--white); border-color: var(--white); } }
@media (max-width: 479px) { .support .btn { width: 100%; } }

.download { border-top: 1px solid var(--rule); padding-top: 32px; margin-bottom: 8px; }
.download h2 { font-size: var(--step-h2); }
.field { display: grid; gap: 6px; max-width: 420px; margin-bottom: 16px; }
.field label { font-weight: 600; }
.field input {
  font: 400 1rem var(--font-body); /* 16px so iOS doesn't zoom */
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--control);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
  width: 100%;
}
.field input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-color: var(--ink); }
.field small { color: var(--grey); font-size: 0.875rem; }
.download-status { min-height: 1.5em; margin-top: 8px; color: var(--grey); font-size: 0.95rem; }
.retake { margin-top: 24px; }

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 28px var(--gutter) calc(28px + var(--safe-b));
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--grey);
  border-top: 1px solid var(--rule);
  background: var(--white);
}
.site-footer__inner { max-width: 1040px; margin: 0 auto; text-align: center; }
.site-footer p { margin: 0 0 0.35em; }
.site-footer nav { margin-top: 0.9em; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 0; }
.site-footer nav a { color: var(--grey); padding: 6px 4px; }
.site-footer nav span[aria-hidden] { padding: 6px 4px; }

/* --- Cookie bar ---------------------------------------------------------- */
.cookie-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--ink);
  color: var(--white);
  padding: 12px var(--gutter) calc(12px + var(--safe-b));
  font-size: 0.875rem;
  line-height: 1.45;
}
.cookie-bar__inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; justify-content: space-between; }
.cookie-bar p { margin: 0; flex: 1 1 260px; }
.cookie-bar a { color: var(--white); }
.cookie-bar .btn { min-height: 44px; padding: 0.5em 1.4em; background: var(--mint); border-color: var(--mint); color: var(--ink); }

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