/*
 * Recomendador /sin-taladrar/recomendador (views/nodrill/quiz.blade.php + public/js/sin-taladrar/recomendador.js).
 * Todo acotado a .quiz-page. Paleta y tipografía de la marca (Hunter Douglas AGO25):
 *   Dark Wood #4E0E0E  títulos, botones, barra de progreso y antetítulos
 *   Ebony     #402B2B  nombres y descripciones de las opciones, textos de las tarjetas
 *   Ivory     #F7F5EF  fondo (sólido, sin degradados) y texto de los botones
 *   Gelica Regular (400) en los títulos; DM Sans en el resto (Bold en botones)
 */
.quiz-page {
  --wood: #4E0E0E;
  --wood-dark: #3a0a0a;
  --ebony: #402B2B;
  --ivory: #F7F5EF;
  --line: #e3e0d8;
  --peach: #F8C5A8;
  --green: #357257;
  --green-soft: #eaf5ef;
  --red: #9b3442;
  --red-soft: #fff0f2;
  --shadow: 0 8px 28px rgba(64, 43, 43, .08);
  --shadow-hover: 0 14px 36px rgba(64, 43, 43, .13);
  --heading: "Gelica", Georgia, "Times New Roman", serif;
  --body: "DM Sans", Arial, Helvetica, sans-serif;

  min-height: 100vh;
  margin: 0;
  background: var(--ivory);
  color: var(--ebony);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.quiz-page *,
.quiz-page *::before,
.quiz-page *::after { box-sizing: border-box; }
.quiz-page button,
.quiz-page a { font: inherit; }
.quiz-page button { color: inherit; }
.quiz-page a { color: inherit; text-decoration: none; }
.quiz-page img { display: block; max-width: 100%; }
.quiz-page button:focus-visible,
.quiz-page a:focus-visible { outline: 3px solid rgba(78, 14, 14, .3); outline-offset: 3px; }
.quiz-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Ancho: el .container ancho del sitio (newGrid.css: 730/980/1080/1180/1300/1520 px) menos 15 px de padding por lado */
.quiz-page .quiz-top-inner,
.quiz-page .cdq-progress,
.quiz-page .quiz-main { width: calc(100% - 30px); margin: 0 auto; }
@media (min-width: 760px)  { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 700px; } }
@media (min-width: 1000px) { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 950px; } }
@media (min-width: 1100px) { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 1050px; } }
@media (min-width: 1200px) { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 1150px; } }
@media (min-width: 1300px) { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 1270px; } }
@media (min-width: 1520px) { .quiz-page .quiz-top-inner, .quiz-page .cdq-progress, .quiz-page .quiz-main { width: 1490px; } }

/* Cabecera compacta: que las primeras opciones se vean nada más entrar */
.quiz-page .quiz-top { border-bottom: 1px solid var(--line); background: var(--ivory); }
.quiz-page .quiz-top-inner { padding: 18px 0 14px; }
.quiz-page .quiz-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.quiz-page h1 { max-width: 760px; margin: 0 0 4px; color: var(--wood); font-family: var(--heading); font-size: clamp(26px, 3.2vw, 36px); font-weight: 400; letter-spacing: -.01em; line-height: 1.12; }
.quiz-page .intro { max-width: 700px; margin: 0; color: var(--ebony); font-size: 14px; line-height: 1.45; }

/* Botones: Dark Wood con el texto en Ivory (DM Sans Bold); los secundarios, en contorno */
.quiz-page .primary,
.quiz-page .secondary,
.quiz-page .cdq-back,
.quiz-page .reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border: 1px solid var(--wood); border-radius: 999px;
  font-family: var(--body); font-size: 14px; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.quiz-page .primary,
.quiz-page .cdq-back { background: var(--wood); color: var(--ivory); }
.quiz-page .primary:hover,
.quiz-page .cdq-back:hover { background: var(--wood-dark); border-color: var(--wood-dark); }
.quiz-page .secondary,
.quiz-page .reset { background: transparent; color: var(--wood); }
.quiz-page .secondary:hover,
.quiz-page .reset:hover { background: rgba(78, 14, 14, .07); }
.quiz-page .reset { min-height: 38px; padding: 0 16px; font-size: 13px; }
.quiz-page .reset-icon { font-size: 18px; font-weight: 500; line-height: 1; }
.quiz-page .cdq-back-icon { font-size: 18px; line-height: 1; }
.quiz-page .cdq-back[hidden] { display: none; }

/* Progreso */
.quiz-page .cdq-progress { padding-top: 14px; }
.quiz-page .cdq-progress-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.quiz-page .cdq-back { min-height: 40px; padding: 0 18px; }
.quiz-page .cdq-progress-label { color: var(--ebony); font-size: 12px; font-weight: 600; }
.quiz-page .cdq-progress-track { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 100px; background: rgba(78, 14, 14, .12); }
.quiz-page .cdq-progress-bar { display: block; width: 25%; height: 100%; border-radius: inherit; background: var(--wood); transition: width .25s ease; }

/* Pasos */
.quiz-page .quiz-main { padding: 22px 0 72px; overflow-anchor: none; }
.quiz-page .step { display: none; }
.quiz-page .step.visible { display: block; }
.quiz-page .step-head { max-width: 820px; margin-bottom: 20px; }
.quiz-page .step-number { display: block; margin-bottom: 6px; color: var(--wood); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.quiz-page h2 { margin: 0; color: var(--wood); font-family: var(--heading); font-size: clamp(26px, 3.2vw, 36px); font-weight: 400; letter-spacing: -.01em; line-height: 1.12; }
.quiz-page .step-help { max-width: 690px; margin: 8px 0 0; color: var(--ebony); font-size: 14px; line-height: 1.5; }

/* Tarjetas de elección (son <button>) */
.quiz-page .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.quiz-page .cards.products { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.quiz-page .cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 900px; }
.quiz-page .choice {
  position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff;
  text-align: left; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.quiz-page .choice:hover { transform: translateY(-4px); border-color: rgba(78, 14, 14, .35); box-shadow: var(--shadow-hover); }
.quiz-page .choice[aria-pressed="true"] { border: 2px solid var(--wood); }
.quiz-page .choice[aria-pressed="true"]::after {
  content: "\2713"; position: absolute; top: 12px; right: 12px; display: grid; place-items: center;
  width: 30px; height: 30px; border: 2px solid #fff; border-radius: 50%;
  background: var(--wood); color: var(--ivory); font-size: 14px; font-weight: 700;
}
.quiz-page .choice-image { position: relative; flex: 0 0 auto; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #eee9df; }
.quiz-page .cards.products .choice-image { aspect-ratio: 1 / 1; }
/* Las fotos son <picture> (WebP + respaldo JPG): el <img> rellena el recuadro y se encuadra casi desde arriba para no cortar el producto */
.quiz-page .choice-image picture { display: block; width: 100%; height: 100%; }
.quiz-page .choice-image img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; transition: transform .4s ease; }
.quiz-page .cards.products .choice-image img { object-position: center top; }
.quiz-page .choice:hover .choice-image img { transform: scale(1.03); }
.quiz-page .choice-body { position: relative; display: block; width: 100%; min-height: 84px; padding: 16px 16px 18px; background: #fff; }
.quiz-page .choice-title { display: block; color: var(--ebony); font-size: 16px; font-weight: 700; line-height: 1.25; }
.quiz-page .choice-desc { display: block; margin-top: 6px; color: var(--ebony); font-size: 12px; line-height: 1.5; }

/* Etiquetas (solo "N opciones compatibles" y "Sin solución") */
.quiz-page .badge { display: inline-flex; padding: 8px 12px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.quiz-page .badge.good { border-color: rgba(53, 114, 87, .15); background: var(--green-soft); color: var(--green); }
.quiz-page .badge.no { background: var(--red-soft); color: var(--red); }

/* Resultados */
.quiz-page .result-overview { max-width: 900px; margin-bottom: 26px; }
.quiz-page .result-overview h3 { margin: 0; color: var(--wood); font-family: var(--heading); font-size: clamp(26px, 3.2vw, 36px); font-weight: 400; letter-spacing: -.01em; line-height: 1.12; }
.quiz-page .result-overview .badge { margin-top: 12px; }
.quiz-page .result-overview p { max-width: 760px; margin: 12px 0 0; color: var(--ebony); font-size: 14px; line-height: 1.6; }
.quiz-page .results-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 24px; align-items: stretch; }
@media (min-width: 931px) { .quiz-page .results-list.single-result { grid-template-columns: minmax(0, calc((100% - 24px) / 2)); justify-content: center; } }
.quiz-page .result-option { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); transition: box-shadow .2s ease; }
.quiz-page .result-option:hover { box-shadow: var(--shadow-hover); }
/* La foto es un enlace a la misma URL que "Ver producto". Cuadrada, como las fotos de producto, sin cortar la parte superior */
.quiz-page .result-option-media { display: block; overflow: hidden; background: #eee9df; }
.quiz-page .result-option-media picture { display: block; }
.quiz-page .result-option-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 15%; transition: transform .4s ease; }
.quiz-page .result-option-media:hover .result-option-image { transform: scale(1.03); }
.quiz-page .result-option-content { display: flex; flex: 1; flex-direction: column; padding: 24px; }
/* Titular del producto: Gelica Regular, más pequeño que la pregunta principal */
.quiz-page .result-option-title { margin: 0; color: var(--wood); font-family: var(--heading); font-size: 22px; font-weight: 400; letter-spacing: -.005em; line-height: 1.2; }
.quiz-page .result-option-reason { margin: 12px 0 0; color: var(--ebony); font-size: 14px; line-height: 1.6; }
.quiz-page .product-info { display: grid; gap: 11px; margin-top: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--ivory); color: var(--ebony); font-size: 13px; line-height: 1.55; }
.quiz-page .product-info-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 11px; }
.quiz-page .product-info-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: rgba(78, 14, 14, .08); color: var(--wood); }
.quiz-page .product-info-icon svg { width: 17px; height: 17px; stroke: currentColor; }
.quiz-page .product-info-text { min-width: 0; }
.quiz-page .product-info-text strong { color: var(--ebony); font-weight: 700; }
.quiz-page .product-info-copy { display: block; margin-top: 8px; }
.quiz-page .check-box { margin-top: 16px; padding: 18px 19px; border-radius: 12px; background: var(--peach); color: var(--ebony); }
.quiz-page .check-box strong { display: block; color: var(--ebony); font-size: 13px; }
.quiz-page .check-box ul { display: grid; gap: 8px; margin: 11px 0 0; padding-left: 19px; color: var(--ebony); font-size: 13px; line-height: 1.5; }
.quiz-page .result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
.quiz-page .result-option .result-actions { margin-top: auto; padding-top: 22px; }
.quiz-page .no-result { max-width: 900px; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.quiz-page .no-result h3 { margin: 16px 0 0; color: var(--wood); font-family: var(--heading); font-size: clamp(26px, 3.2vw, 36px); font-weight: 400; line-height: 1.12; }
.quiz-page .no-result p { max-width: 690px; margin: 12px 0 0; color: var(--ebony); }
.quiz-page .no-result ul { display: grid; gap: 7px; margin: 18px 0 0; padding-left: 20px; color: var(--ebony); font-size: 14px; }

@media (max-width: 930px) {
  .quiz-page .cards.products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quiz-page .results-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .quiz-page .quiz-top-inner { padding: 14px 0 10px; }
  .quiz-page .quiz-title-row { gap: 12px; }
  .quiz-page .reset { min-height: 36px; padding: 0 13px; gap: 6px; font-size: 11px; }
  .quiz-page .reset-icon { font-size: 16px; }
  .quiz-page h1 { margin: 0 0 3px; font-size: 26px; }
  .quiz-page .intro { font-size: 13px; }
  .quiz-page .cdq-progress { padding-top: 12px; }
  .quiz-page .cdq-progress-label { font-size: 11px; }
  .quiz-page .cdq-back { min-height: 38px; padding: 0 15px; font-size: 13px; }
  .quiz-page .quiz-main { padding: 20px 0 calc(48px + env(safe-area-inset-bottom)); }
  .quiz-page .step-head { margin-bottom: 16px; }
  .quiz-page h2,
  .quiz-page .result-overview h3,
  .quiz-page .no-result h3 { font-size: 26px; }
  .quiz-page .step-help { font-size: 13px; }
  .quiz-page .cards,
  .quiz-page .cards.products,
  .quiz-page .cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; max-width: none; }
  .quiz-page .cards.products .choice:last-child:nth-child(odd) { grid-column: 1 / -1; width: calc(50% - 5.5px); justify-self: center; }
  .quiz-page .choice { border-radius: 16px; }
  .quiz-page .choice:hover { transform: none; box-shadow: var(--shadow); }
  .quiz-page .choice-image { aspect-ratio: 1.16 / 1; }
  .quiz-page .cards.products .choice-image { aspect-ratio: 1 / 1; }
  .quiz-page .choice-body { min-height: 66px; padding: 12px 12px 14px; }
  .quiz-page .choice-title { font-size: 13.5px; }
  .quiz-page .choice-desc { display: none; }
  .quiz-page .choice[aria-pressed="true"]::after { top: 9px; right: 9px; width: 26px; height: 26px; font-size: 12px; }
  .quiz-page .result-overview { margin-bottom: 22px; }
  .quiz-page .results-list { grid-template-columns: 1fr; gap: 16px; }
  .quiz-page .result-option { border-radius: 19px; }
  .quiz-page .result-option-content { padding: 21px 18px 19px; }
  .quiz-page .result-option-title { font-size: 21px; }
  .quiz-page .result-option-reason { font-size: 13.5px; }
  .quiz-page .product-info { margin-top: 15px; padding: 14px; font-size: 12.5px; }
  .quiz-page .product-info-item { grid-template-columns: 29px minmax(0, 1fr); gap: 9px; }
  .quiz-page .product-info-icon { width: 29px; height: 29px; }
  .quiz-page .product-info-icon svg { width: 16px; height: 16px; }
  .quiz-page .check-box { margin-top: 15px; padding: 16px; }
  .quiz-page .check-box ul { font-size: 12.5px; }
  .quiz-page .result-actions { display: grid; }
  .quiz-page .result-actions > * { width: 100%; }
  .quiz-page .no-result { padding: 24px 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-page *, .quiz-page *::before, .quiz-page *::after { scroll-behavior: auto; animation-duration: .01ms; animation-iteration-count: 1; transition-duration: .01ms; }
}
