/* Self-esteem test page */

.test-page {
  background:
    radial-gradient(50% 40% at 100% 0%, rgb(79 195 224 / 0.22), transparent 70%),
    linear-gradient(180deg, var(--cielo-claro), var(--blanco) 60%);
}

.test-app [hidden],
#test-dialog [hidden] {
  display: none !important;
}

.test-nojs {
  margin-bottom: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius);
  background: var(--blanco);
  text-align: center;
}

/* Header / footer */

.test-header {
  border-bottom: 1px solid var(--borde);
  background: rgb(255 255 255 / 0.9);
}

.test-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 68px;
}

.test-header__brand img {
  width: auto;
  height: 30px;
}

.test-header__back {
  min-height: 42px;
  white-space: nowrap;
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
}

.test-footer {
  padding-block: var(--space-6);
  font-size: var(--fs-sm);
  text-align: center;
  color: var(--texto-suave);
}

/* Card */

.test-main {
  padding-block: var(--space-6) var(--space-7);
}

.test-app {
  max-width: 760px;
  margin-inline: auto;
}

.test-card {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--blanco);
  border: 1px solid var(--borde);
  box-shadow: var(--shadow);
}

.test-intro {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

.test-intro h1 {
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem);
}

.test-intro .lead {
  margin-top: var(--space-2);
}

.test-intro__art {
  justify-self: center;
  width: min(60%, 220px);
  height: auto;
}

.test-facts {
  display: grid;
  gap: var(--space-3);
}

.test-facts li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--texto-suave);
}

.test-facts .bi {
  font-size: 1.2rem;
  color: var(--azul-medio);
}

/* Form controls */

.test-form {
  display: grid;
  gap: var(--space-4);
}

.test-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.test-fieldset legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-weight: 600;
  color: var(--azul-rey);
}

.test-choices,
.test-options {
  display: grid;
  gap: var(--space-2);
}

.test-choice,
.test-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.test-choice input,
.test-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.test-choice span,
.test-option span {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid #b9cbe0;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.test-option strong {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cielo-claro);
  color: var(--azul-rey);
  font-family: var(--font-titulos);
}

.test-choice input:hover + span,
.test-option input:hover + span {
  border-color: var(--azul-medio);
}

.test-choice input:checked + span,
.test-option input:checked + span {
  border-color: var(--azul-rey);
  background: var(--azul-rey);
  color: var(--blanco);
}

.test-option input:checked + span strong {
  background: var(--blanco);
}

.test-choice input:focus-visible + span,
.test-option input:focus-visible + span {
  outline: 3px solid var(--azul-cielo);
  outline-offset: 2px;
}

.test-check {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.test-check input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--azul-rey);
}

.test-notice {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--cielo-claro);
}

.test-error {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--error);
}

.test-error:empty {
  display: none;
}

.test-form__submit {
  justify-self: start;
}

.test-support {
  padding: var(--space-4);
  border-left: 4px solid var(--azul-cielo);
  border-radius: var(--radius-sm);
  background: #f3f8fd;
  font-size: var(--fs-sm);
}

.test-support ul {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.test-support a {
  font-weight: 600;
}

/* Question step */

.test-progress {
  display: grid;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--azul-medio);
}

.test-progress__bar {
  --progress: 0%;
  height: 8px;
  border-radius: 999px;
  background: var(--cielo-claro);
  overflow: hidden;
}

.test-progress__bar::before {
  content: "";
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--azul-cielo), var(--azul-medio));
  transition: width 0.3s var(--ease);
}

.test-instructions {
  font-size: var(--fs-sm);
  color: var(--texto-suave);
}

.test-question {
  font-family: var(--font-titulos);
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem) !important;
  font-weight: 600;
  line-height: 1.3;
}

.test-question:focus {
  outline: none;
}

.test-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Result step */

.test-result h2 {
  font-size: clamp(2rem, 1.6rem + 2vw, 2.8rem);
}

.test-result h2:focus {
  outline: none;
}

.test-result__score {
  font-family: var(--font-titulos);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  color: var(--azul-medio);
}

.test-result__score small {
  font-size: 1rem;
  color: var(--texto-suave);
}

.test-meter {
  --score: 0%;
  position: relative;
  padding-top: var(--space-4);
}

.test-meter__track {
  display: flex;
  overflow: hidden;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.test-meter__seg {
  flex-basis: 0;
  min-width: 4.2em;
  padding: var(--space-2) var(--space-1);
  overflow-wrap: anywhere;
}

.test-meter__seg--0 {
  background: #dbe7f6;
  color: var(--azul-rey);
}

.test-meter__seg--1 {
  background: #b9dcf2;
  color: var(--azul-rey);
}

.test-meter__seg--2 {
  background: var(--azul-medio);
  color: var(--blanco);
}

.test-meter__marker {
  position: absolute;
  top: 0;
  left: clamp(0%, var(--score), 100%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 12px solid var(--azul-rey);
  transform: translateX(-50%);
}

.test-result__text {
  font-size: var(--fs-lg);
}

.test-result__disclaimer {
  font-size: var(--fs-sm);
  color: var(--texto-suave);
}

.test-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.test-share {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius);
  background: var(--cielo-claro);
}

.test-share h3 {
  font-size: 1.3rem;
}

.test-share__preview {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--blanco);
  border: 1px dashed var(--azul-cielo);
  font-family: var(--font-texto);
  font-size: var(--fs-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

.test-share__note {
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.test-share .btn {
  justify-self: start;
}

.test-restart {
  justify-self: start;
  padding: var(--space-2) 0;
  border: 0;
  background: none;
  color: var(--azul-medio);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.test-citation {
  font-size: 0.75rem;
  color: var(--texto-suave);
}

.test-header__extra {
  display: none;
}

@media (min-width: 600px) {
  .test-header__extra {
    display: inline;
  }

  .test-card {
    padding: var(--space-7);
  }

  .test-intro {
    grid-template-columns: 1fr auto;
  }

  .test-intro__art {
    width: 170px;
  }

  .test-choices {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .test-choice span {
    justify-content: center;
    text-align: center;
  }
}

/* Embedded test on the home page */

.test-section {
  position: relative;
  background:
    radial-gradient(45% 60% at 100% 0%, rgb(79 195 224 / 0.2), transparent 70%),
    var(--blanco);
}

.test-section__grid {
  align-items: center;
}

.test-section__intro .credentials .bi {
  background: var(--cielo-claro);
}

.test-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.test-card__head .medallion {
  --size: 56px;
}

.test-card__head h3 {
  font-size: 1.6rem;
}

.test-card__sub {
  font-size: var(--fs-sm);
  color: var(--texto-suave);
}

.test-result__title {
  font-size: clamp(1.8rem, 1.5rem + 1.6vw, 2.4rem);
}

.test-result__title:focus {
  outline: none;
}

.test-share h4 {
  font-size: 1.25rem;
}

@media (min-width: 960px) {
  .test-section__grid {
    grid-template-columns: 1fr 1fr;
  }

}

/* Test window */

.test-dialog {
  width: min(100% - 2 * var(--gutter), 680px);
  max-width: none;
  height: min(92dvh, 860px);
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--blanco);
  box-shadow: 0 30px 80px rgb(6 20 46 / 0.45);
}

.test-dialog[open] {
  display: flex;
  flex-direction: column;
}

.test-dialog::backdrop {
  background: rgb(6 20 46 / 0.6);
  backdrop-filter: blur(3px);
}

.test-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
  background: linear-gradient(140deg, var(--azul-medio), var(--azul-rey));
  color: var(--blanco);
}

.test-dialog__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-titulos);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.test-dialog__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.16);
  color: var(--blanco);
  font-size: 1.1rem;
}

.test-dialog__close:hover {
  background: rgb(255 255 255 / 0.3);
}

.test-dialog__close:focus-visible {
  outline-color: var(--blanco);
}

.test-dialog__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4);
  background: var(--cielo-claro);
}

.test-dialog .test-app {
  max-width: none;
}

.test-dialog .test-card {
  border: 0;
  box-shadow: var(--shadow-sm);
}

@media (prefers-reduced-motion: no-preference) {
  .test-dialog[open] {
    animation: test-pop 0.35s var(--ease);
  }
}

@keyframes test-pop {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
}

@media (max-width: 599.98px) {
  .test-dialog {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
}

/* ---------- Tests hub (home page) ---------- */

.test-rows {
  display: grid;
  gap: var(--space-2);
}

.test-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--borde);
  border-radius: var(--radius);
  transition: background-color 0.25s var(--ease);
}

.test-row:last-child {
  border-bottom: 0;
}

.test-row:hover {
  background: var(--cielo-claro);
}

.test-row .medallion {
  --size: 56px;
}

.test-row h3 {
  font-size: 1.3rem;
}

.test-row__chip {
  display: inline-block;
  margin-top: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: 999px;
  background: var(--cielo-claro);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--azul-rey);
}

.test-row:hover .test-row__chip {
  background: var(--blanco);
}

.test-row__body > p:not(.test-row__chip) {
  margin-top: var(--space-2);
  color: var(--texto-suave);
}

.test-row__cta {
  margin-top: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
}

/* ---------- Questionnaire inside the window ---------- */

.test-card__text {
  color: var(--texto);
}

.test-facts li span {
  min-width: 0;
}

.test-consents:empty {
  display: none;
}

.test-consents {
  display: grid;
  gap: var(--space-3);
}

.test-choice span,
.test-option span {
  overflow-wrap: anywhere;
}

.test-hint {
  margin: 0 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: #fff8e6;
  border: 1px solid #f3dca2;
}

.test-hint summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #7a5200;
  cursor: pointer;
  list-style: none;
}

.test-hint summary::-webkit-details-marker {
  display: none;
}

.test-hint summary::after {
  content: "\25BE";
  margin-left: auto;
  transition: transform 0.2s var(--ease);
}

.test-hint[open] summary::after {
  transform: rotate(180deg);
}

.test-hint p {
  padding: 0 var(--space-3) var(--space-3);
  font-weight: 500;
  color: #5c3d00;
}

.test-counter {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--azul-medio);
}

.test-checklist {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: indicator;
}

.test-checklist li {
  counter-increment: indicator;
}

.test-checklist label {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  min-height: 52px;
  padding: var(--space-3);
  border: 1.5px solid #b9cbe0;
  border-radius: var(--radius);
  background: var(--blanco);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.test-checklist input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--azul-rey);
}

.test-checklist span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.test-checklist span::before {
  content: counter(indicator) ". ";
  font-weight: 600;
  color: var(--azul-medio);
}

.test-checklist em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--texto-suave);
  white-space: nowrap;
}

.test-checklist label:has(input:checked) {
  border-color: var(--azul-rey);
  background: var(--cielo-claro);
}

.test-checklist label:has(input:checked) em {
  color: var(--azul-rey);
}

.test-result__note {
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--azul-cielo);
  border-radius: var(--radius-sm);
  background: #f3f8fd;
  font-size: var(--fs-sm);
}

/* Navigation buttons: side by side when they fit, stacked on narrow phones */
.test-nav {
  flex-wrap: wrap;
}

.test-nav .btn {
  flex: 1 1 auto;
}

.test-result__actions .btn,
.test-share .btn {
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 399.98px) {
  .test-nav {
    flex-direction: column-reverse;
  }

  .test-card {
    padding: var(--space-5) var(--space-4);
  }

  .test-dialog__body {
    padding: var(--space-3);
  }

  .test-option span,
  .test-choice span {
    padding: var(--space-2) var(--space-3);
  }

  .test-result__score {
    font-size: 2.4rem;
  }

  .test-checklist label {
    grid-template-columns: 22px 1fr;
  }

  .test-checklist em {
    display: none;
  }
}

@media (min-width: 960px) {
  .test-section__grid {
    align-items: start;
  }
}

@media (min-width: 960px) {
  .test-section__intro {
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
  }
}

/* Long tests: several activities per step */
.test-page-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.test-item {
  padding: var(--space-3);
  border: 1.5px solid #dbe6f2;
  border-radius: var(--radius);
  background: var(--blanco);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.test-item:has(input:checked) {
  border-color: #b9cbe0;
  background: #f3f8fd;
}

.test-item legend {
  float: left;
  width: 100%;
  margin-bottom: var(--space-3);
  overflow-wrap: anywhere;
}

.test-item legend + * {
  clear: both;
}

.test-item__num {
  color: var(--azul-medio);
}

.test-options--inline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.test-options--inline .test-option span {
  justify-content: center;
  min-height: 46px;
  padding: var(--space-2) var(--space-3);
  text-align: center;
  font-size: var(--fs-sm);
}

/* Area result (vocational test) */
.test-area {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--cielo-claro);
}

.test-area__name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.2rem;
  color: var(--azul-rey);
}

.test-area__careers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.test-area__careers li {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--blanco);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--azul-rey);
}
