/* =========================================================================
   Starlight Valley Quiz — quiz.css
   Loads AFTER styles.css, so it inherits the site's colors, fonts, header,
   footer, and button styles. Everything here is quiz-specific.
   ========================================================================= */

/* ---------- Layout shell ---------- */
.quiz-main {
  position: relative;
  background: var(--cream);
  min-height: 70vh;
  overflow: hidden;
  padding: clamp(3rem, 7vw, 5rem) 1.5rem clamp(4rem, 9vw, 7rem);
}

.quiz-shell {
  position: relative;
  z-index: 2;
  max-width: 46rem;
  margin: 0 auto;
  text-align: center;
}

/* ---------- Decorative backdrop (mountains + stars) ---------- */
.quiz-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.quiz-mountains {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(90px, 18vw, 220px);
  color: var(--dusty-light);
}

.quiz-stars .qstar {
  position: absolute;
  color: var(--gold);
  opacity: 0.5;
  font-size: 0.9rem;
  animation: qtwinkle 4s ease-in-out infinite;
}
.qstar-1 { top: 8%;  left: 12%; animation-delay: 0s; }
.qstar-2 { top: 15%; right: 18%; animation-delay: 1s; font-size: 0.7rem; }
.qstar-3 { top: 30%; left: 6%;  animation-delay: 2s; font-size: 0.7rem; }
.qstar-4 { top: 6%;  right: 8%; animation-delay: 3s; }
.qstar-5 { top: 38%; right: 5%; animation-delay: 1.5s; font-size: 0.65rem; }

@keyframes qtwinkle {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%      { opacity: 0.7;  transform: scale(1.15); }
}

/* ---------- Screens & transitions ---------- */
.quiz-screen {
  animation: screenIn 0.45s ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Respect reduced-motion preferences (styles.css also disables animations
   globally, this is belt-and-braces for the quiz) */
@media (prefers-reduced-motion: reduce) {
  .quiz-screen, .result-reveal, .result-card, .quiz-question-card,
  .quiz-stars .qstar { animation: none !important; }
}

/* ---------- Type ---------- */
.quiz-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.quiz-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.5rem);
  color: var(--navy);
  line-height: 1.12;
}

.quiz-lede {
  max-width: 38rem;
  margin: 0 auto 1.1rem;
}

.quiz-start-btn { margin-top: 1.5rem; }

/* Visually-hidden helper (screen readers still announce it) */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Progress ---------- */
.quiz-progress { margin-bottom: 2rem; }

.quiz-progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 0.6rem;
}

.quiz-progress-track {
  height: 8px;
  background: var(--dusty-light);
  border-radius: 999px;
  overflow: hidden;
  max-width: 24rem;
  margin: 0 auto;
}

.quiz-progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--dusty-blue), var(--gold));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ---------- Question card ---------- */
.quiz-question-card {
  background: var(--white);
  border-radius: var(--radius);
  border-top: 3px solid var(--gold);
  box-shadow: 0 4px 18px rgba(31, 51, 82, 0.1);
  padding: clamp(1.75rem, 5vw, 2.75rem);
  text-align: left;
  animation: screenIn 0.35s ease both;
}

.quiz-question-text {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  color: var(--navy);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ---------- Answers ---------- */
.quiz-answers {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.quiz-answer {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--dusty-light);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
  width: 100%;
}

.quiz-answer:hover {
  border-color: var(--dusty-blue);
  background: var(--dusty-light);
  transform: translateY(-1px);
}

.quiz-answer[aria-checked="true"] {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.quiz-answer[aria-checked="true"]::before {
  content: "✦ ";
  color: var(--gold-soft);
}

/* ---------- Prev / Next ---------- */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
}

.quiz-nav-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Keep "Next" from acting clickable when nothing is selected */
.quiz-nav-btn[disabled]:hover { background: var(--navy); border-color: var(--navy); }
#btn-prev[disabled]:hover { background: transparent; color: var(--navy); }

/* ---------- Result reveal ---------- */
.result-reveal { animation: revealPop 0.7s ease both; }

@keyframes revealPop {
  0%   { opacity: 0; transform: translateY(18px) scale(0.97); }
  60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.result-your-establishment {
  margin-top: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.result-name-top {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  color: var(--gold);
  margin-bottom: 2rem;
}

/* ---------- Main result card ---------- */
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  border-top: 3px solid var(--gold);
  box-shadow: 0 6px 24px rgba(31, 51, 82, 0.12);
  padding: clamp(2rem, 5vw, 3rem);
  text-align: left;
  animation: screenIn 0.6s ease 0.25s both;
}

.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--gold);
}
.result-icon svg { width: 100%; height: 100%; }

.result-establishment {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.5vw, 2.2rem);
  color: var(--navy);
  text-align: center;
}

.result-personality-title {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--gold);
  text-align: center;
  margin: 0.25rem 0 1.5rem;
}

.result-description p { margin-bottom: 1rem; }

.result-subhead {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--navy);
  margin: 1.75rem 0 0.75rem;
}

.result-found-list {
  list-style: none;
  padding: 0;
}

.result-found-list li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.45rem;
}

.result-found-list li::before {
  content: "✦";
  position: absolute;
  left: 0.2rem;
  color: var(--gold);
  font-size: 0.8em;
  top: 0.25em;
}

.result-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0 0.5rem;
}

.result-fact {
  background: var(--cream);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.result-fact dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

.result-fact dd {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
}

.result-day { margin-bottom: 0.5rem; }

.result-ps {
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--dusty-light);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

/* ---------- Shareable resident card ---------- */
.resident-card-wrap { margin: 3rem auto 0; }

.resident-card {
  max-width: 340px;
  margin: 0 auto;
  background: var(--navy-deep);
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: 0 10px 30px rgba(22, 38, 62, 0.35);
  text-align: center;
}

.resident-card-eyebrow {
  color: var(--gold-soft);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.resident-card-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 1rem;
}

.resident-card-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.75rem;
  color: var(--gold-soft);
}
.resident-card-icon svg { width: 100%; height: 100%; }

.resident-card-establishment {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--gold-soft);
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.resident-card-tagline {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--dusty-blue);
  margin-bottom: 1.25rem;
}

.resident-card-facts {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.resident-card-facts dt {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dusty-blue);
  margin-bottom: 0.2rem;
}

.resident-card-facts dd {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cream);
}

.resident-card-footer {
  border-top: 1px solid rgba(201, 165, 92, 0.35);
  padding-top: 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.resident-card-note {
  margin-top: 1rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink);
}

/* ---------- Share buttons ---------- */
.share-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.share-social-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.share-social-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--dusty-blue);
  border-radius: 999px;
  padding: 0.45rem 1.15rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.share-social-btn:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.share-feedback {
  min-height: 1.5rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Result links ---------- */
.result-links {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.result-characters-link {
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 4px;
}
.result-characters-link:hover { color: var(--gold); }

/* ---------- Welcome packet ---------- */
.welcome-packet {
  margin-top: 3.5rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(31, 51, 82, 0.08);
  padding: clamp(1.75rem, 5vw, 2.5rem);
}

.packet-title { margin-top: 0; text-align: center; }

.packet-copy {
  max-width: 34rem;
  margin: 0 auto 1.5rem;
}

.packet-bonus {
  max-width: 34rem;
  margin: -0.5rem auto 1.5rem;
  font-size: 0.95rem;
  color: var(--navy);
}

.packet-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 30rem;
  margin: 0 auto 1.25rem;
  text-align: left;
}

.packet-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.packet-field input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--dusty-light);
  border-radius: 6px;
  background: var(--cream);
  color: var(--ink);
}

.packet-field input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--dusty-blue);
}

.packet-confirmation {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--dusty-light);
  border-radius: 8px;
  font-weight: 600;
  color: var(--navy);
}

/* ---------- Restart ---------- */
.restart-row { margin-top: 2.5rem; }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .quiz-nav { flex-direction: row; }
  .quiz-nav .btn { flex: 1; padding-left: 1rem; padding-right: 1rem; }
  .resident-card { max-width: 100%; }
}
