/* ==========================================================================
   Test card (includes/front/tools/test.php) + test page (pages/test.php).
   Loaded only on pages that actually show a test, not part of styles.min.css.
   Colours come from the site's own variables (see :root in styles.css):
   text and buttons use --accent-dark / --accent-deep, the plain coral --accent
   fails contrast on these backgrounds.
   ========================================================================== */

/* ---- Test page ---- */
.test-page { background: var(--bg-base); font-family: var(--font); padding: 64px 24px 80px; }
/* Title and contents span the same width as the header nav; only the card is narrowed (below) */
.test-page__inner { max-width: var(--content-max-width); margin: 0 auto; }
/* Same look as the blog article's categories line, with its own classes */
.test-page__categories { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-dark); margin: 0 0 10px; }
.test-page__category-link { color: inherit; text-decoration: none; transition: color 0.2s; }
.test-page__category-link:hover { color: var(--accent); text-decoration: underline; }
.test-page__title { font-family: var(--font-serif); font-size: clamp(28px, 4.5vw, 40px); line-height: 1.2; font-weight: 600; color: var(--text-primary); margin: 0 0 20px; }
.test-page__content.blog-article__content { padding: 0; }
/* The card itself is always 100% of its container (so it fills an article's column); on its own
   page this wrapper is what keeps it at a comfortable reading width, centered. */
.test-page__card { max-width: 780px; margin: 40px auto; }

@media (max-width: 600px) {
  .test-page { padding: 48px 16px 64px; }
}

/* ---- Card ---- */
.tc-test {
  margin: 32px 0;
  padding: 32px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 56px -32px rgba(107,37,48,0.35);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  text-align: left;
}
.test-page__card .tc-test { margin: 0; }

.tc-test__admin-flag {
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed var(--accent-dark);
  background: var(--bg-base);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
}
.tc-test__admin-flag strong { color: var(--accent-deep); text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; }

/* ---- Progress ---- */
.tc-test__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; font-size: 13px; }
.tc-test__progress-text { font-weight: 700; color: var(--text-secondary); }
.tc-test__duration { color: var(--text-muted); }

.tc-test__bar { height: 5px; border-radius: 999px; background: var(--bg-card-hover); overflow: hidden; margin-bottom: 28px; }
.tc-test__bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent-dark); transition: width 0.3s ease; }

/* ---- Steps ---- */
.tc-test__step { display: none; border: 0; padding: 0; margin: 0; min-width: 0; }
.tc-test__step.is-active { display: block; }

.tc-test .tc-test__question {
  display: block;
  width: 100%;
  float: none;
  padding: 0;
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(21px, 3vw, 26px);
  line-height: 1.25;
  font-weight: 600;
  color: var(--text-primary);
}
.tc-test .tc-test__help { margin: 0 0 20px; font-size: 15px; color: var(--text-secondary); }
.tc-test__question + .tc-test__options { margin-top: 20px; }

.tc-test__options { display: flex; flex-direction: column; gap: 12px; }

.tc-test__option {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 16px 18px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.tc-test__option:hover { border-color: var(--accent-light); }
.tc-test__option input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.tc-test__option-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #B0868A;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}
.tc-test__option-mark::after {
  content: '';
  width: 6px;
  height: 10px;
  margin-top: -2px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.tc-test__option.is-selected { border-color: var(--accent-dark); background: var(--bg-base); }
.tc-test__option.is-selected .tc-test__option-mark { border-color: var(--accent-dark); background: var(--accent-dark); }
.tc-test__option.is-selected .tc-test__option-mark::after { opacity: 1; }
.tc-test__option:focus-within { box-shadow: 0 0 0 3px var(--accent-glow); border-color: var(--accent-dark); }

/* ---- Name + email step ---- */
/* Two columns while each one can keep at least 240px, otherwise they stack: this follows the
   card's own width (narrow article column, phone), not the viewport's. */
.tc-test__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 18px; }
.tc-test__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tc-test__label { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0; }
.tc-test__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #B0868A;
  background: #FFFFFF;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
}
.tc-test__input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px var(--accent-glow); }
.tc-test__input.has-error { border-color: var(--accent-deep); }

.tc-test__check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--text-primary); }
.tc-test__check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent-deep); cursor: pointer; }
.tc-test__check label { margin: 0; cursor: pointer; }
.tc-test__check a { color: var(--accent-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.tc-test__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Error + nav ---- */
.tc-test .tc-test__error { margin: 16px 0 0; font-size: 14px; font-weight: 600; color: var(--accent-deep); }
.tc-test .tc-test__error:empty { display: none; }

.tc-test__nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; }

.tc-test__prev {
  padding: 8px 0;
  border: 0;
  background: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}
.tc-test__prev:hover:not(:disabled) { color: var(--text-primary); }
.tc-test__prev:disabled { opacity: 0.4; cursor: default; }

.tc-test__next,
.tc-test__repeat {
  padding: 14px 30px;
  border-radius: 999px;
  border: 0;
  background: var(--accent-deep);
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 12px 24px -14px rgba(107,37,48,0.6);
}
.tc-test__next:hover:not(:disabled) { opacity: 0.9; }
.tc-test__next:disabled { background: var(--bg-card-hover); color: var(--text-muted); box-shadow: none; cursor: default; }
.tc-test__next.is-loading { cursor: wait; opacity: 0.75; }

.tc-test__prev:focus-visible,
.tc-test__next:focus-visible,
.tc-test__repeat:focus-visible { outline: 3px solid var(--text-primary); outline-offset: 2px; }

/* ---- Result ---- */
.tc-test__result { outline: none; }
.tc-test__result[hidden] { display: none; }

.tc-test .tc-test__eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dark); }

.tc-test__result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.tc-test .tc-test__result-title { margin: 0; font-family: var(--font-serif); font-size: clamp(24px, 3.6vw, 32px); line-height: 1.2; font-weight: 600; color: var(--text-primary); }
.tc-test .tc-test__score { margin: 0; flex: none; white-space: nowrap; line-height: 1; }
.tc-test__score strong { font-size: clamp(34px, 5vw, 44px); font-weight: 800; color: var(--accent-deep); }
.tc-test__score span { margin-left: 4px; font-size: 18px; font-weight: 700; color: var(--text-muted); }

.tc-test__meter { position: relative; height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 50%, var(--footer-bg) 100%); }
.tc-test__meter-marker {
  position: absolute;
  top: -5px;
  width: 6px;
  height: 22px;
  margin-left: -3px;
  border-radius: 4px;
  background: var(--text-primary);
  box-shadow: 0 0 0 3px #FFFFFF;
}

.tc-test__meter-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.tc-test__meter-labels span { flex: 1; text-align: center; }
.tc-test__meter-labels span:first-child { text-align: left; }
.tc-test__meter-labels span:last-child { text-align: right; }
.tc-test__meter-labels .is-active { font-weight: 700; color: var(--text-primary); }

.tc-test .tc-test__result-desc { margin: 22px 0 0; font-size: 16px; line-height: 1.65; color: var(--text-secondary); }

.tc-test__result-content { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 16px; line-height: 1.65; color: var(--text-secondary); }
.tc-test__result-content > *:first-child { margin-top: 0; }
.tc-test__result-content > *:last-child { margin-bottom: 0; }
.tc-test__result-content h2,
.tc-test__result-content h3,
.tc-test__result-content h4 { margin: 24px 0 12px; font-family: var(--font); font-size: 17px; font-weight: 800; color: var(--text-primary); }
.tc-test__result-content p { margin: 0 0 14px; }
.tc-test__result-content a { color: var(--accent-deep); }

/* A bulleted list written in the range's editor becomes the tips checklist */
.tc-test__result-content ul { list-style: none; margin: 0 0 16px; padding: 0; }
.tc-test__result-content ul li { position: relative; margin: 0 0 12px; padding-left: 36px; }
.tc-test__result-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card-hover);
}
.tc-test__result-content ul li::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 6px;
  width: 6px;
  height: 11px;
  border: solid var(--accent-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tc-test__result-content ol { margin: 0 0 16px; padding-left: 22px; }
.tc-test__result-content ol li { margin-bottom: 8px; }

.tc-test__result-actions { display: flex; justify-content: flex-end; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.tc-test__repeat { background: #FFFFFF; color: var(--text-primary); border: 1.5px solid var(--border); box-shadow: none; padding: 12px 24px; }
.tc-test__repeat:hover { border-color: var(--accent-dark); }

@media (max-width: 600px) {
  .tc-test { padding: 22px 18px; border-radius: 16px; }
  .tc-test__option { padding: 14px; font-size: 15px; }
  .tc-test__result-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tc-test__nav { margin-top: 22px; }
  .tc-test__next { padding: 13px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-test__bar-fill, .tc-test__option, .tc-test__option-mark, .tc-test__next { transition: none; }
}
