/* Energy state quiz, "night sky": a deep violet panel with the logo's gold line work.
   Every selector starts with .ecq so nothing leaks into the shop. Shop (ACSS) variables with fallbacks;
   px because the shop sets html to 62.5%.
   Button modifiers are ecq-btn-primary / -secondary, never "btn--": the shop's Automatic.css styles every
   [class*="btn--"] (colours, hover, min-width) and would override these. */

.ecq {
  --ecq-night: var(--primary-ultra-dark, #250033);
  --ecq-tile: #3a1650;
  --ecq-tile-hover: #4a1e64;
  --ecq-ink: #f7f0fb;
  --ecq-soft: #d2bfdd; /* secondary text on the panel, tinted from it (9:1 on the night) */
  --ecq-gold: var(--secondary, #cca24a);
  --ecq-gold-light: var(--secondary-light, #eee1c3);
  --ecq-lilac: var(--primary-ultra-light, #f8e6ff);
  --ecq-ease: cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--base, #404040);
  font-family: var(--text-font-family, Urbanist, sans-serif);
  font-size: 17px;
  line-height: 1.5;
}
.ecq [hidden] { display: none !important; }
.ecq :is(h1, h2, h3) { font-family: var(--heading-font-family, Raleway, sans-serif); line-height: 1.2; text-wrap: balance; }
.ecq :is(h2, h3, p):focus { outline: none; }
.ecq :is(h2, h3, p):focus-visible { outline: 2px solid var(--ecq-gold); outline-offset: 4px; }
/* headings and messages the script moves focus to (announced by the live region) need no ring */
.ecq .ecq-panel [tabindex="-1"]:focus-visible { outline: none; }

.ecq-sr {
  position: absolute;
  width: 1px;
  height: 1px; /* taste-skill-ignore: visually hidden text, not a rule */
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- The panel ---------------------------------------------------------------------- */

.ecq-panel {
  background: var(--ecq-night);
  color: var(--ecq-ink);
  border-radius: var(--radius, 5px);
  padding: clamp(28px, 5vw, 64px);
  scroll-margin-top: 110px; /* clears the shop's sticky header when quiz.js scrolls back to the panel */
}
.ecq-panel ::selection { background: var(--ecq-gold); color: var(--ecq-night); }
.ecq-panel a { color: var(--ecq-gold-light); text-underline-offset: 3px; }

/* Intro: text left, the figure large on the right. Once started it shrinks to a header row. */
.ecq-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
}
.ecq-intro__text { order: -1; max-width: 600px; }
.ecq .ecq-panel .ecq-title { margin: 0 0 16px; color: var(--ecq-ink); font-size: clamp(32px, 4.4vw, 52px); letter-spacing: -0.02em; }
.ecq .ecq-panel .ecq-lead { margin: 0 0 28px; color: var(--ecq-soft); font-size: 19px; max-width: 46ch; }

.ecq-figure { width: clamp(150px, 22vw, 280px); aspect-ratio: 1; }
.ecq-figure svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ecq-figure circle {
  fill: none;
  stroke: var(--ecq-gold);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: 0.22;
  transition: opacity 0.6s var(--ecq-ease), stroke-width 0.6s var(--ecq-ease);
}
.ecq-figure circle.is-lit { opacity: 1; stroke-width: 1.8; }
/* before the test starts the whole figure shows, quietly */
.ecq-panel:not(.is-started) .ecq-figure circle { opacity: 0.85; }

.ecq-panel.is-started .ecq-intro {
  grid-template-columns: auto minmax(0, 1fr) auto; /* figure, title, Restart (results only) */
  gap: 18px;
  margin-bottom: clamp(24px, 3.5vw, 40px);
}
.ecq-panel.is-started .ecq-intro__text { order: 0; }
.ecq-panel.is-started .ecq-figure { width: 64px; }
.ecq .ecq-panel.is-started .ecq-title { margin: 0; font-size: 18px; letter-spacing: 0; color: var(--ecq-gold-light); }
.ecq-panel.is-started .ecq-lead { display: none; }

/* waiting for results: the figure turns slowly; complete: it rests lit */
.ecq-panel.is-loading .ecq-figure svg { animation: ecq-turn 2.4s linear infinite; }
@keyframes ecq-turn { to { transform: rotate(360deg); } }

/* ---- Buttons ------------------------------------------------------------------------ */

.ecq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  border: 0;
  border-radius: var(--radius, 5px);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ecq-ease);
}
.ecq-btn:active { transform: translateY(1px); }
.ecq-btn:focus-visible { outline: 2px solid var(--ecq-gold-light); outline-offset: 3px; }
.ecq-btn-primary { background: var(--ecq-gold); color: var(--ecq-night); }
.ecq-btn-primary:hover { background: color-mix(in srgb, var(--ecq-gold) 72%, var(--ecq-ink)); color: var(--ecq-night); }
.ecq-btn-secondary { background: transparent; color: var(--ecq-soft); padding-inline: 4px; }
.ecq-btn-secondary:hover { color: var(--ecq-ink); text-decoration: underline; text-underline-offset: 4px; }

/* ---- A question --------------------------------------------------------------------- */

.ecq-stage { max-width: 920px; }
.ecq-stage > * { animation: ecq-rise 0.5s var(--ecq-ease) both; }
.ecq-stage > :nth-child(2) { animation-delay: 40ms; }
.ecq-stage > :nth-child(3) { animation-delay: 80ms; }
.ecq-stage > :nth-child(n + 4) { animation-delay: 120ms; }
@keyframes ecq-rise { from { opacity: 0; transform: translateY(12px); } }

.ecq .ecq-progress { margin: 0 0 10px; font-size: 15px; color: var(--ecq-soft); }
.ecq-progress strong { color: var(--ecq-gold); font-weight: 600; }
.ecq .ecq-panel .ecq-question { margin: 0; color: var(--ecq-ink); font-size: clamp(26px, 3vw, 36px); letter-spacing: -0.015em; max-width: 24ch; }
.ecq .ecq-help { margin: 12px 0 0; color: var(--ecq-soft); }

.ecq-answers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 10px;
  margin-top: 28px;
}
.ecq-answer {
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 18px;
  text-align: start;
  background: var(--ecq-tile);
  color: var(--ecq-ink);
  font-weight: 500;
}
.ecq-answer:hover { background: var(--ecq-tile-hover); }
.ecq-answer::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ecq-gold);
  opacity: 0;
  transform: scale(0.5);
  transition: transform 0.3s var(--ecq-ease), opacity 0.3s var(--ecq-ease);
}
.ecq-answer[aria-pressed="true"] { background: var(--ecq-lilac); color: var(--ecq-night); font-weight: 600; }
.ecq-answer[aria-pressed="true"]::after { opacity: 1; transform: scale(1); }

.ecq-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 32px; }
.ecq-nav .ecq-btn-primary { margin-inline-start: auto; }
.ecq .ecq-msg { margin: 16px 0 0; }
.ecq .ecq-msg--error { color: var(--ecq-gold-light); font-weight: 600; }
.ecq .ecq-loading { color: var(--ecq-soft); font-size: 19px; }

/* ---- Results ------------------------------------------------------------------------ */

.ecq-stage:has(.ecq-results-box) { max-width: none; }
.ecq .ecq-panel .ecq-results__title { margin: 0 0 8px; color: var(--ecq-ink); font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -0.02em; }
.ecq .ecq-panel h3 { margin: 28px 0 12px; color: var(--ecq-gold-light); font-size: 18px; font-weight: 600; }

.ecq-panel .ec-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ecq-panel .ec-chip {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ecq-tile);
  color: var(--ecq-ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s;
}
.ecq-panel .ec-chip:hover, .ecq-panel .ec-chip:focus-visible { background: var(--ecq-tile-hover); color: var(--ecq-ink); }
.ecq-panel .ec-chip:focus-visible { outline: 2px solid var(--ecq-gold); outline-offset: 2px; }

.ecq-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ecq-type {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius, 5px);
  background: var(--ecq-tile);
  transition: background-color 0.2s;
}
.ecq-type:hover { background: var(--ecq-tile-hover); }
.ecq-type__name {
  color: var(--ecq-gold);
  font-family: var(--heading-font-family, Raleway, sans-serif);
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
}
.ecq-type__name::after { content: ""; position: absolute; inset: 0; } /* the whole tile is the link */
.ecq-type__name:focus-visible { outline: none; }
.ecq-type:has(.ecq-type__name:focus-visible) { outline: 2px solid var(--ecq-gold); outline-offset: 2px; }
.ecq-type__why { font-size: 15px; color: var(--ecq-soft); }

.ecq-results__jump { margin-top: 28px; text-decoration: none; }
.ecq-panel a.ecq-results__jump { color: var(--ecq-night); }
.ecq-restart { order: 1; }

/* Products: moved below the panel by quiz.js, back on the page's own white. */
.ecq-results__more { margin-top: clamp(32px, 4vw, 56px); scroll-margin-top: 110px; animation: ecq-rise 0.6s var(--ecq-ease) 0.15s both; }
.ecq .ecq-results__more h3 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); color: var(--base-ultra-dark, #1a1a1a); }

/* ---- Phone -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .ecq-panel { padding: 28px 20px; }
  .ecq-intro { grid-template-columns: 1fr; gap: 20px; }
  .ecq-intro__text { order: 0; }
  .ecq-figure { width: 120px; }
  .ecq-panel.is-started .ecq-figure { width: 48px; }
  .ecq .ecq-panel.is-started .ecq-title { font-size: 16px; }
  .ecq .ecq-panel .ecq-question { max-width: none; }
  .ecq-nav .ecq-btn-primary { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ecq-stage > *, .ecq-results__more { animation: none; }
  .ecq-panel.is-loading .ecq-figure svg { animation: none; }
  .ecq-figure circle, .ecq-answer::after, .ecq-btn { transition: none; }
}
