/* Fonts are loaded via <link> in index.html (faster than a CSS @import). */

:root {
  --bg-dark: #0f0d0c;
  --bg-dark-rgb: 15, 13, 12;
  --parchment: #f4edd8;
  --gold-primary: #dfb76c;
  --gold-secondary: #c59b4e;
  --diva-magenta: #e03572;
  --diva-violet: #8e2de2;
  --text-light: #f5f0eb;
  --text-muted: #b5a89e;
  --glass-border: rgba(223, 183, 108, 0.15);
  --shadow-gold: rgba(223, 183, 108, 0.25);
  --shadow-diva: rgba(224, 53, 114, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Background Setup with Faded Constitution */
.bg-overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* tracks the real viewport as mobile browser chrome shows/hides */
  z-index: -1;
  overflow: hidden;
}

.bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.38; /* Significantly increased for strong parchment vibes */
  filter: sepia(60%) contrast(115%) brightness(85%);
  transform: scale(1.05);
  animation: slowZoom 60s infinite alternate ease-in-out;
}

.bg-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(var(--bg-dark-rgb), 0.3) 0%,
    rgba(var(--bg-dark-rgb), 0.75) 75%,
    rgba(var(--bg-dark-rgb), 0.95) 100%
  );
}

@keyframes slowZoom {
  0% { transform: scale(1.02) rotate(0deg); }
  100% { transform: scale(1.08) rotate(1deg); }
}

/* Navigation */
header {
  padding: 2rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  position: relative;
}

.logo {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--gold-primary), var(--diva-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 1px;
  font-size: 0.9rem;
  text-transform: uppercase;
  transition: all 0.3s ease;
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-primary), var(--diva-magenta));
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--text-light);
  text-shadow: 0 0 15px rgba(223, 183, 108, 0.3);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hero Section */
main {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
  z-index: 5;
}

.card {
  background: radial-gradient(circle at 30% 20%, #fdfbf7 0%, #f5ebd5 60%, #e9dfc4 100%);
  border: 1px solid rgba(139, 101, 56, 0.25);
  border-radius: 12px;
  padding: 4rem 3rem;
  max-width: 750px;
  width: 100%;
  text-align: center;
  box-shadow: 
    0 15px 35px rgba(45, 33, 21, 0.25), 
    0 0 0 10px rgba(245, 235, 213, 0.45), 
    0 0 0 11px rgba(139, 101, 56, 0.2);
  transform: translateY(20px);
  opacity: 0;
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-secondary), var(--gold-primary), var(--gold-secondary), transparent);
}

@keyframes fadeInUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tagline {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: #8b6538;
  letter-spacing: 2px;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.95;
}

.title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 4px;
  overflow-wrap: break-word; /* never clip a too-long word (card has overflow: hidden) */
  padding-right: 4px;
  margin-bottom: 2rem;
  text-transform: uppercase;
  background: linear-gradient(to right, #1e130c 20%, #7d0552 60%, var(--diva-magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 6s linear infinite;
  background-size: 200% auto;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.description {
  font-size: 1.15rem;
  line-height: 1.7;
  color: #4a3c31;
  max-width: 580px;
  margin: 0 auto 3rem;
  font-weight: 400;
}

/* Button & Call to Action */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.2rem 3rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  background: linear-gradient(135deg, #1e130c 0%, #7d0552 50%, var(--diva-magenta) 100%);
  background-size: 200% auto;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(125, 5, 82, 0.25), 
              0 0 25px rgba(223, 183, 108, 0.15);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  touch-action: manipulation; /* no double-tap zoom delay on mobile */
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: all 0.6s ease;
}

.cta-button:hover {
  transform: translateY(-4px) scale(1.03);
  background-position: right center;
  box-shadow: 0 10px 30px rgba(125, 5, 82, 0.35), 
              0 0 35px rgba(223, 183, 108, 0.25);
  color: #ffffff;
}

.cta-button:hover::before {
  left: 100%;
}

.cta-button:active {
  transform: translateY(-1px) scale(1.01);
}

.cta-button svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.cta-button:hover svg {
  transform: translateX(4px);
}

/* Micro-animations and Features */
.features {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3.5rem;
  border-top: 1px solid rgba(139, 101, 56, 0.15);
  padding-top: 2rem;
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.feature-num {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #7d0552;
}

.feature-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #5c4d3c;
  font-weight: 600;
}

.features-note {
  margin-top: 2.5rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(139, 101, 56, 0.5);
  font-weight: 500;
  text-align: center;
}

.main-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

.poster-container {
  flex: 1;
  max-width: 460px;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.diva-poster {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.5), 
    0 0 0 8px rgba(223, 183, 108, 0.15),
    0 0 35px rgba(224, 53, 114, 0.2);
  border: 1px solid rgba(223, 183, 108, 0.35);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform: rotate(-1deg);
}

.diva-poster:hover {
  transform: rotate(1deg) scale(1.03) translateY(-8px);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.6), 
    0 0 0 10px rgba(223, 183, 108, 0.25),
    0 0 50px rgba(224, 53, 114, 0.4);
}

.card {
  flex: 1.3;
}

/* Footer */
footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(181, 168, 158, 0.7);
  letter-spacing: 1px;
  z-index: 10;
  position: relative;
}

/* ---- Quiz screen ---- */
.quiz-phrase {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: #7d0552;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quiz-progress {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #000000;
  font-weight: 700;
}

.quiz-meta-dot {
  color: rgba(139, 101, 56, 0.4);
}

.quiz-timer {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8b6538;
  font-variant-numeric: tabular-nums; /* keeps the countdown from jittering */
}

.quiz-timer-low {
  color: var(--diva-magenta);
}

.quiz-question {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.25rem, 1rem + 1.6vw, 1.8rem);
  line-height: 1.4;
  margin-bottom: 2.5rem;
  color: #1e130c;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.quiz-opt {
  background: rgba(139, 101, 56, 0.04);
  border: 1px solid rgba(139, 101, 56, 0.2);
  border-radius: 8px;
  padding: 1.2rem;
  color: #4a3c31;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
  font-weight: 600;
  text-align: left;
  touch-action: manipulation;
}

/* Hover lift only on devices that actually hover — avoids sticky
   hover states after a tap on touch screens. */
@media (hover: hover) {
  .quiz-opt:hover:not(:disabled) {
    background: rgba(139, 101, 56, 0.08);
    border-color: #8b6538;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 101, 56, 0.15);
  }
}

.quiz-opt:disabled {
  cursor: default;
}

.quiz-opt.opt-correct {
  background: #d4edda;
  border: 2px solid #7bb88a;
  color: #1e4620;
  box-shadow: 0 0 20px rgba(123, 184, 138, 0.3);
  font-weight: 800;
}

.quiz-opt.opt-wrong {
  background: #f8d7da;
  border: 1px solid #d98b94;
  color: #721c24;
  box-shadow: 0 0 10px rgba(217, 139, 148, 0.2);
}

.quiz-opt.opt-reveal {
  border: 1px solid #7bb88a;
  background: rgba(123, 184, 138, 0.12);
  color: #1e4620;
}

/* ---- Result popup ---- */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 19, 12, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

.result-popup-box {
  background: radial-gradient(circle at 30% 20%, #fdfbf7 0%, #f5ebd5 60%, #e9dfc4 100%);
  border: 1px solid rgba(139, 101, 56, 0.25);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 85dvh;      /* never taller than the screen... */
  overflow-y: auto;       /* ...long explanations scroll instead */
  text-align: center;
  box-shadow: 0 20px 50px rgba(45, 33, 21, 0.4), 0 0 0 10px rgba(245, 235, 213, 0.45), 0 0 0 11px rgba(139, 101, 56, 0.2);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-overlay.show {
  opacity: 1;
}

.result-overlay.show .result-popup-box {
  transform: translateY(0) scale(1);
}

.result-heading {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.2rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 1.25rem;
}

.result-heading.is-correct { color: #7d0552; }
.result-heading.is-wrong { color: var(--diva-magenta); }

.result-timeout-note {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--diva-magenta);
  font-weight: 700;
  margin-bottom: 1rem;
}

.result-explanation {
  font-size: 1rem;
  line-height: 1.7;
  color: #4a3c31;
  margin-bottom: 2.5rem;
}

.result-next-btn {
  width: 100%;
}

/* ---- Score screen ---- */
.score-tagline {
  color: #8b6538;
}

.score-headline {
  margin-bottom: 1rem;
}

.score-value {
  font-family: 'Cinzel', serif;
  font-size: clamp(3rem, 2.4rem + 2.5vw, 3.8rem);
  font-weight: 800;
  color: #7d0552;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.score-value span {
  font-size: 0.475em;
  color: #8b6538;
}

.score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #8b6538;
  margin-bottom: 2rem;
  font-weight: 700;
}

.score-breakdown {
  max-width: 460px;
  margin: 0 auto 2.5rem;
}

.score-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(139, 101, 56, 0.15);
  font-size: 0.9rem;
}

.score-q {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  color: #1e130c;
}

.score-status {
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.72rem;
}

.score-status.is-correct { color: #7d0552; }
.score-status.is-wrong { color: var(--diva-magenta); }

.score-time {
  color: #5c4d3c;
  font-size: 0.8rem;
  min-width: 3.5rem;
  text-align: right;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
    gap: 3rem;
  }
  .poster-container {
    max-width: 400px;
  }
  .card {
    width: 100%;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1.5rem 2rem;
  }

  /* Scale with the viewport so long words ("Constitution",
     "Revolutionary") fit the card instead of being clipped. */
  .title {
    font-size: clamp(1.8rem, 5.6vw, 2.6rem);
    letter-spacing: 2px;
  }

  .card {
    padding: 3rem 2rem;
  }

  .features {
    gap: 2rem;
  }
}

/* Phones */
@media (max-width: 480px) {
  header {
    padding: 1.25rem 1.25rem;
  }

  .logo {
    font-size: 1.25rem;
    letter-spacing: 2px;
  }

  main {
    padding: 1rem;
  }

  .main-container {
    gap: 2rem;
  }

  .poster-container {
    max-width: 300px;
  }

  .card {
    padding: 2.25rem 1.25rem;
  }

  .title {
    font-size: clamp(1.1rem, 6vw, 2rem);
    letter-spacing: 1px;
  }

  .description {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .cta-button {
    width: 100%;
    padding: 1.1rem 1.5rem;
    font-size: 1rem;
  }

  .features {
    gap: 1.25rem;
    margin-top: 2.5rem;
  }

  .feature-num {
    font-size: 1.3rem;
  }

  .feature-label {
    font-size: 0.65rem;
    letter-spacing: 1.5px;
  }

  .quiz-question {
    letter-spacing: 1px;
    margin-bottom: 1.75rem;
  }

  .quiz-opt {
    padding: 1rem;
    font-size: 0.9rem;
  }

  .quiz-options {
    margin-bottom: 1.75rem;
  }

  .result-overlay {
    padding: 1rem;
  }

  .result-popup-box {
    padding: 2rem 1.5rem;
  }

  .score-row {
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  footer {
    padding: 1.5rem 1rem;
    font-size: 0.7rem;
  }
}

/* ---- Mobile: diva poster as the hero background ----
   Swap the parchment texture for the poster, framed so the divas' faces
   (and a peek of the fans) sit above the card on the landing screen. */
@media (max-width: 768px) {
  .bg-image {
    display: none; /* hide the constitution parchment on mobile */
  }

  .bg-overlay-container {
    background-image: url('assets/diva-poster.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: top center; /* anchor faces/fans to the top */
  }

  /* Clear up top so faces read, fading to dark behind the card for legibility. */
  .bg-gradient {
    background: linear-gradient(
      to bottom,
      rgba(var(--bg-dark-rgb), 0.12) 0%,
      rgba(var(--bg-dark-rgb), 0.22) 32%,
      rgba(var(--bg-dark-rgb), 0.82) 64%,
      rgba(var(--bg-dark-rgb), 0.97) 100%
    );
  }

  /* The poster is the background now — drop the stacked inline copy. */
  .poster-container {
    display: none;
  }

  /* Push the landing card down to reveal faces + a bit of the fans. */
  main {
    align-items: flex-start;
  }

  .main-container {
    padding-top: 50vh;
    padding-top: 50dvh;
  }

  /* During the quiz/score the card is the focus — pull it back up so the
     questions aren't buried below the fold. */
  body.quiz-active .main-container {
    padding-top: 1.5rem;
  }
}
