/* ==========================================================================
   JAX TRAVEL SCAVENGER HUNT — STYLES
   Mobile-first. Theme colors/fonts are set as CSS custom properties at
   runtime from HUNT_CONFIG.theme (see js/app.js applyTheme()). Fallback
   values below match this sample's palette — deliberately coordinated
   with the companion "Jania's 46th Birthday Escape" Master Digital
   Itinerary (deep aubergine/plum, champagne gold, warm ivory, Fraunces +
   Inter) so the two feel like one trip experience.
   ========================================================================== */

:root {
  --gradient-1: #2D1638;
  --gradient-2: #3B1F4A;
  --gradient-3: #492659;
  --gradient-4: #5A2A6E;
  --plum-mid: #713687;
  --accent-gold: #C5A46D;
  --gold-deep: #9C7D48;
  --gold-pale: #E2CDA2;
  --gold-tint: #F4EAD7;
  --lavender: #CDBDD8;
  --surface: #FFFDFB;
  --surface-muted: #F7F2EA;
  --ink: #211820;
  --ink-muted: #8A7690;
  --danger: #A8453F;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 20px 50px -28px rgba(45, 22, 56, 0.4);
  --shadow-lift: 0 16px 36px -14px rgba(45, 22, 56, 0.32);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-muted);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- HERO ---------- */

.hero {
  position: relative;
  padding: 44px 24px 64px;
  overflow: hidden;
  color: #fff;
  text-align: center;
}

/* Layered background, first-listed = topmost:
   1. Brand-tinted scrim (always on top) — keeps hero text readable over any
      photo and ties the photo into the aubergine/plum/gold palette.
   2. --hero-image (the real destination photo — see HUNT_CONFIG.heroImage
      in js/config.js for exactly where to place the file).
   3. The original brand gradient, as a graceful fallback for whenever the
      photo isn't configured/present — nothing looks broken either way. */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(165deg, rgba(33, 24, 32, 0.7) 0%, rgba(73, 38, 89, 0.4) 45%, rgba(33, 24, 32, 0.78) 100%),
    var(--hero-image, none),
    linear-gradient(160deg, var(--gradient-1) 0%, var(--gradient-2) 38%, var(--gradient-3) 68%, var(--gradient-4) 100%);
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-pale);
}

.hero-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 8vw, 40px);
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-wrap: balance;
  color: #fff;
}

.hero-subtitle {
  margin: 0;
  font-size: 15px;
  opacity: 0.92;
  font-weight: 400;
  color: var(--lavender);
}

/* ---------- MAIN / GAME INTRO / DASHBOARD ---------- */

.main {
  flex: 1;
  padding: 0 16px 24px;
}

/* Floats up over the hero photo's bottom edge — the first "premium card
   breaking out of the photo" moment the traveler sees. */
.game-intro {
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.game-intro-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 22px 20px 20px;
  text-align: center;
}

.game-intro-headline {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(17px, 4.6vw, 20px);
  line-height: 1.35;
  color: var(--ink);
}

.game-intro-stats {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.game-intro-dot {
  color: var(--lavender);
  margin: 0 1px;
}

.game-intro-copy {
  margin: 0 auto;
  max-width: 46ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.dashboard {
  margin-top: 16px;
}

.dashboard-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 20px 20px 18px;
}

.dashboard-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--gradient-3);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-sep {
  margin: 0 3px;
  opacity: 0.4;
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(45, 22, 56, 0.12);
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gradient-1), var(--gradient-4));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-caption {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* ---------- CATEGORIES ---------- */

.categories {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.category-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: transparent;
  border: none;
  text-align: left;
}

.category-header:active {
  background: var(--surface-muted);
}

.category-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface-muted);
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-name {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.category-desc {
  display: block;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.mini-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gradient-2), var(--gradient-4));
  transition: width 0.4s ease;
}

.category-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.category-count.is-complete {
  color: var(--gold-deep);
}

.category-chevron {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--ink-muted);
  transition: transform 0.25s ease;
}

.category-card.is-open .category-chevron {
  transform: rotate(180deg);
}

.category-card.is-complete .category-icon {
  background: var(--gold-tint);
}

.category-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.category-card.is-open .category-body {
  grid-template-rows: 1fr;
}

.category-body-inner {
  overflow: hidden;
}

/* ---------- CHALLENGE CARDS ----------
   Structural inspiration: the JazzeeXscapes Nolarette Hunt's challenge-card
   grid. Lives INSIDE each category accordion's expanded body — the
   accordion still controls overall page length; this only changes how an
   OPEN category's challenges are presented (individual tappable cards
   instead of one-line rows). 1 column on mobile, 2 on tablet, 3 on desktop. */

.challenge-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 4px 10px 12px;
}

@media (min-width: 640px) {
  .challenge-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (min-width: 1020px) {
  .challenge-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

.challenge-card {
  position: relative;
}

.challenge-card-btn {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
  text-align: left;
  background: var(--surface-muted);
  border: 1px solid rgba(45, 22, 56, 0.08);
  border-radius: var(--radius-md);
  font-family: inherit;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, transform 0.15s ease;
}

.challenge-card-btn:active {
  transform: scale(0.98);
}

.challenge-card-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--lavender);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.challenge-card-check svg {
  width: 13px;
  height: 13px;
}

.challenge-card-icon {
  font-size: 24px;
  line-height: 1;
}

.challenge-card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15.5px;
  line-height: 1.3;
  color: var(--ink);
  padding-right: 24px;
}

.challenge-card-desc {
  margin-top: -4px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.challenge-card-points {
  margin-top: auto;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--gold-deep);
}

.challenge-card.is-complete .challenge-card-btn {
  background: linear-gradient(150deg, var(--surface) 0%, var(--gold-tint) 160%);
  border-color: rgba(197, 164, 109, 0.5);
  box-shadow: var(--shadow-soft);
}

.challenge-card.is-complete .challenge-card-check {
  background: var(--accent-gold);
  border-color: var(--gold-deep);
  color: #fff;
  transform: scale(1.06);
}

.challenge-card.is-complete .challenge-card-title,
.challenge-card.is-complete .challenge-card-desc {
  opacity: 0.85;
}

.challenge-card.is-complete .challenge-card-points {
  color: var(--gold-deep);
}

/* Bonus / 2X — reuses the same aubergine/plum gradient already established
   for the hero, toasts, and Trip Memories CTA, so "special" still reads as
   part of this app's own design language rather than a foreign accent. */
.challenge-card--bonus .challenge-card-btn {
  background: linear-gradient(155deg, var(--gradient-1) 0%, var(--gradient-3) 100%);
  border-color: rgba(197, 164, 109, 0.4);
  box-shadow: 0 0 0 1px rgba(197, 164, 109, 0.15), var(--shadow-soft);
}

.challenge-card--bonus .challenge-card-title {
  color: #fff;
}

.challenge-card--bonus .challenge-card-desc {
  color: var(--lavender);
}

.challenge-card--bonus .challenge-card-points {
  color: var(--gold-pale);
}

.challenge-card--bonus .challenge-card-check {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(226, 205, 162, 0.55);
}

.challenge-card--bonus.is-complete .challenge-card-btn {
  background: linear-gradient(155deg, var(--gradient-3) 0%, var(--gold-deep) 170%);
}

.challenge-card--bonus.is-complete .challenge-card-check {
  background: var(--accent-gold);
  border-color: var(--gold-pale);
  color: var(--ink);
}

.challenge-card-badge {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--accent-gold);
  padding: 3px 8px;
  border-radius: 999px;
}

.challenge-card--bonus .challenge-card-icon {
  margin-top: 16px;
}

/* ---------- TRIP MEMORIES (photo-proof tie-in) ----------
   One dedicated section after Achievements, as the closing social/photo
   call to action — not attached to
   individual challenges. Structural/copy inspiration: the JazzeeXscapes
   Nolarette Hunt's "Trip Memories" tie-in. Visual treatment matches the
   companion Master Itinerary's own Shared Trip Album card (gold-tinted
   gradient, gold border, centered, pill CTA) so it reads as the same
   product family. */

.trip-memories {
  margin-top: 24px;
}

.trip-memories-card {
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(150deg, var(--surface) 0%, var(--gold-tint) 145%);
  border: 1px solid rgba(197, 164, 109, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.trip-memories-headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(19px, 5vw, 23px);
  color: var(--ink);
}

.trip-memories-copy {
  margin: 0;
  max-width: 38ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.trip-memories-cta {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, var(--gradient-1) 0%, var(--gradient-3) 100%);
  color: #fff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--shadow-lift);
  transition: transform 0.2s ease;
}

.trip-memories-cta:active {
  transform: scale(0.97);
}

/* ---------- ACHIEVEMENTS ---------- */

.achievements-section {
  margin-top: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 12px 4px;
  color: var(--ink);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.achievement-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: transform 0.2s ease;
}

.achievement-card.is-locked {
  opacity: 0.5;
  filter: grayscale(0.7);
}

.achievement-card.is-unlocked {
  background: linear-gradient(150deg, var(--surface) 0%, var(--gold-tint) 145%);
  box-shadow: 0 0 0 1px rgba(197, 164, 109, 0.35), 0 10px 26px -14px rgba(197, 164, 109, 0.55), var(--shadow-soft);
}

.achievement-icon {
  font-size: 26px;
}

.achievement-name {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.achievement-desc {
  font-size: 10.5px;
  color: var(--ink-muted);
  line-height: 1.3;
}

.achievement-card.is-unlocked .achievement-name {
  color: var(--gold-deep);
}

/* ---------- RESET ---------- */

.reset-section {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.btn-reset {
  background: transparent;
  border: 1.5px solid rgba(45, 22, 56, 0.16);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
}

.btn-reset:active {
  background: var(--surface-muted);
}

/* ---------- BRAND FOOTER ----------
   Standard JazzeeXscapes footer — same design/structure as the companion
   Master Itinerary and every other JazzeeXscapes digital product. Unlike
   the rest of this stylesheet's colors (which key off the swappable
   HUNT_CONFIG.theme), these values are intentionally fixed so the brand
   mark reads identically no matter what destination theme is loaded. */

.site-footer {
  padding: 22px 16px 26px;
  background: var(--gradient-1);
  color: rgba(229, 219, 235, 0.65);
}

.footer-line {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footer-line .dot {
  color: rgba(229, 219, 235, 0.3);
}

.footer-line .brand-link {
  color: var(--gold-pale);
  font-weight: 600;
  text-decoration: none;
}

.footer-line .brand-link[href] { cursor: pointer; }
.footer-line .brand-link:not([href]) { cursor: default; }

.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: 2px;
}

.footer-social a,
.footer-social span {
  display: inline-flex;
  color: rgba(229, 219, 235, 0.55);
  transition: color 0.3s ease;
}

.footer-social a:hover { color: var(--gold-pale); }
.footer-social svg { width: 15px; height: 15px; }

@media (max-width: 380px) {
  .footer-line { font-size: 11.5px; }
}

/* ---------- MODAL ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(33, 24, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 22px 20px;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-lift);
  transform: scale(0.94) translateY(6px);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.is-visible .modal {
  transform: scale(1) translateY(0);
}

.modal h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
}

.modal p {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.btn-secondary, .btn-danger {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

.btn-secondary {
  background: var(--surface-muted);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Trip Memories sample/demo explainer modal — a centered variant of the
   same .modal used for Reset, with an icon badge and an italic footnote. */
.modal--centered {
  text-align: center;
}

.modal-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: var(--gold-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.modal-note {
  margin: -8px 0 20px;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-muted);
}

.modal-dismiss-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px;
  background: linear-gradient(120deg, var(--gradient-1) 0%, var(--gradient-3) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- TOAST / ACHIEVEMENT UNLOCK ---------- */

.toast-container {
  position: fixed;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(120deg, var(--gradient-1) 0%, var(--gradient-3) 100%);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
  font-size: 13px;
  font-weight: 500;
  max-width: 420px;
  opacity: 0;
  transform: translateY(-14px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-icon {
  font-size: 19px;
}

.toast-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.toast-eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-pale);
}

.toast-name {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
}

/* ---------- CHALLENGE COMPLETE MICRO-CELEBRATION ---------- */

@keyframes pop-check {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.challenge-card.is-complete .challenge-card-check {
  animation: pop-check 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- RESPONSIVE (tablet / desktop) ---------- */

@media (min-width: 720px) {
  .app {
    max-width: 720px;
  }

  .achievements-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .hero {
    padding: 56px 32px 76px;
  }
}

@media (min-width: 480px) {
  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Wider shell at true desktop widths only — gives the 3-column challenge
   card grid (see CHALLENGE CARDS above) genuine room to stay comfortable
   to read, rather than cramming 3 columns into the 720px tablet shell. */
@media (min-width: 1020px) {
  .app {
    max-width: 960px;
  }
}

/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
