:root {
  --navy: #1f3a5f;
  --teal: #2e7d6b;
  --light: #eaf1ee;
  --gray: #5b5b5b;
  --bg: #faf9f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #1a1a1a;
}

header {
  background: linear-gradient(135deg, var(--navy), var(--teal));
  color: white;
  padding: 48px 24px 40px;
  text-align: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  max-width: 900px;
  margin-inline: auto;
  flex-wrap: wrap;
}

.mango-hero {
  width: 200px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.3));
  animation: mango-hero-in 0.6s ease-out;
}

@keyframes mango-hero-in {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.header-text {
  text-align: center;
}

@media (min-width: 641px) {
  .header-text {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .mango-hero {
    width: 130px;
  }
}

header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
}

header p {
  margin: 0;
  font-size: 18px;
  opacity: 0.9;
  max-width: 480px;
}

.prompt-hint {
  margin-top: 20px;
  font-size: 15px;
  opacity: 0.85;
}

main {
  max-width: 900px;
  margin: -24px auto 60px;
  padding: 0 20px;
}

.search-panel {
  background: white;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  padding: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.search-panel input[type="text"] {
  flex: 1 1 260px;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.search-panel select {
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background: white;
}

#subcategory-select {
  border-color: var(--teal);
}

#results-header {
  margin-bottom: 12px;
}

.back-link {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}

.back-link:hover {
  text-decoration: underline;
}

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.category-card {
  background: white;
  border-radius: 14px;
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  border: 1px solid #eee;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.category-card:hover,
.category-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
  outline: none;
}

.category-card .cat-icon {
  display: block;
  font-size: 34px;
  margin-bottom: 10px;
}

.category-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--navy);
}

.category-card .cat-count {
  font-size: 13px;
  color: var(--gray);
}

.card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border: 1px solid #eee;
}

.card.recommended {
  border-color: #e0b029;
  box-shadow: 0 2px 14px rgba(224,176,41,0.25);
}

/* Membership tiers — Premium stands out the most, Standard noticeably less,
   Free stays the plain default card above. These rules come after
   .recommended on purpose: a Premium or Standard listing that's ALSO
   flagged recommended should still show the stronger membership treatment,
   not get overridden by the plain gold "recommended" border. Both tiers also
   get a corner award-medal-and-ribbon graphic — see .tier-badge below. */
.card.card-premium {
  position: relative;
  overflow: visible;
  border: 2px solid #b8860b;
  background: linear-gradient(180deg, #fff8e8 0%, #ffffff 70%);
  box-shadow: 0 8px 26px rgba(184, 134, 11, 0.35);
}

.card.card-standard {
  position: relative;
  overflow: visible;
  border: 1.5px solid var(--teal);
  box-shadow: 0 4px 16px rgba(46, 125, 107, 0.2);
}

/* Leave a little room in the top-right corner so the medal badge (below)
   doesn't sit on top of the "Sourced"/"Recommended" pill. */
.card.card-premium .card-top,
.card.card-standard .card-top {
  padding-right: 20px;
}

/* Corner "you won" medal — a circular medal with two ribbon tails hanging
   below it, pinned to the top-right corner of the card at a jaunty angle,
   like an actual award ribbon rather than a plain text banner. Offset up and
   out past the card's edge so it reads as pinned onto the corner. */
.tier-badge {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 42px;
  z-index: 2;
  transform: rotate(12deg);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

.tier-badge svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Premium's medal glows and pulses to draw the eye; Standard's stays still
   (per the "stand out, but not as much as Premium" spec). */
.tier-badge-premium {
  animation: tier-badge-glow 1.5s ease-in-out infinite;
}

@keyframes tier-badge-glow {
  0%, 100% {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 3px rgba(224, 176, 41, 0.5));
    transform: rotate(12deg) scale(1);
  }
  50% {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 12px rgba(255, 215, 102, 1));
    transform: rotate(12deg) scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tier-badge-premium {
    animation: none;
  }
}

.card-linkable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card-linkable:hover,
.card-linkable:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  outline: none;
}

.card-visit {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
}

.card-visit:hover {
  text-decoration: underline;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--navy);
}

.card-cat {
  margin: 2px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-desc {
  margin: 0 0 10px;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

.card-meta {
  margin: 2px 0;
  font-size: 13px;
  color: var(--gray);
}

.card-meta a {
  color: var(--teal);
  text-decoration: none;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}

.badge-high { background: var(--light); color: var(--teal); }
.badge-medium { background: #fdf1dc; color: #9a6b12; }
.badge-recommended { background: #fdf1d0; color: #8a5e00; white-space: nowrap; }

.empty {
  grid-column: 1 / -1;
  color: var(--gray);
  text-align: center;
  padding: 40px 0;
}

.call-card {
  grid-column: 1 / -1;
  background: white;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  border: 1px solid #eee;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.call-card h3 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--navy);
}

.call-card .card-cat {
  margin-bottom: 10px;
}

.call-button {
  display: inline-block;
  margin-top: 14px;
  padding: 16px 28px;
  background: var(--teal);
  color: white;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(46,125,107,0.35);
  transition: transform 0.1s ease;
}

.call-button:active {
  transform: scale(0.97);
}

.call-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--gray);
}

footer {
  text-align: center;
  color: var(--gray);
  font-size: 13px;
  padding: 30px 20px 50px;
}

elevenlabs-convai {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

/* Mango mascot badge — top-right corner from page load on */
.mango-badge {
  position: fixed;
  top: 10px;
  right: 16px;
  width: 110px;
  height: auto;
  z-index: 9998;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
  pointer-events: none;
  animation: mango-badge-in 0.6s ease-out;
}

@keyframes mango-badge-in {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 640px) {
  .mango-badge {
    width: 76px;
    top: 6px;
    right: 10px;
  }
}

/* Mango Fetch animation — brief overlay shown when a visitor taps
   "Tap to Open Website"; auto-dismisses itself (see app.js). */
.mango-fetch-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
  animation: mango-fetch-fade-in 0.25s ease-out;
}

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

.mango-fetch-overlay video {
  width: min(90vw, 480px);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  display: block;
}

@keyframes mango-fetch-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

