/* ============================================================
   YTTfinder — Main Stylesheet
   Matches yttfinder.com design system exactly.

   Fonts loaded via Google Fonts (enqueued in functions.php):
     - Montserrat (sans/body/headings)
     - Crimson Text (display/serif)

   Design tokens mirror the React app's CSS variables.
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Gilda+Display&family=Questrial&display=swap');

/* ── CSS Variables (design tokens) ───────────────────────── */
:root {
  --background:          hsl(40, 33%, 98%);
  --foreground:          hsl(25, 25%, 15%);
  --card:                hsl(40, 30%, 99%);
  --card-foreground:     hsl(25, 25%, 15%);
  --primary:             hsl(15, 55%, 55%);
  --primary-foreground:  hsl(40, 33%, 98%);
  --secondary:           hsl(145, 20%, 88%);
  --secondary-foreground:hsl(145, 25%, 25%);
  --muted:               hsl(40, 20%, 94%);
  --muted-foreground:    hsl(25, 15%, 45%);
  --accent:              hsl(145, 25%, 75%);
  --accent-foreground:   hsl(145, 30%, 20%);
  --destructive:         hsl(0, 84.2%, 60.2%);
  --border:              hsl(35, 20%, 88%);
  --ring:                hsl(15, 55%, 55%);
  --featured:            hsl(40, 70%, 50%);
  --featured-foreground: hsl(40, 33%, 98%);
  --teal:                hsl(175, 45%, 40%);
  --teal-foreground:     hsl(40, 33%, 98%);
  --radius:              0.75rem;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Questrial', system-ui, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ───────────────────────────────────────────────── */
.yp-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.yp-main { padding: 2rem 0; }

/* ── Header ───────────────────────────────────────────────── */
.yp-header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
}

.yp-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.yp-header__logo img { height: 40px; width: auto; }

.yp-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.yp-header__nav a {
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  transition: background 0.15s, color 0.15s;
}

.yp-header__nav a:hover,
.yp-header__nav a.active {
  background: var(--muted);
  color: var(--primary);
}

.yp-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.yp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1.25rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border: none;
  transition: opacity 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.yp-btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.yp-btn--primary:hover { opacity: 0.9; }

.yp-btn--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.yp-btn--secondary:hover { opacity: 0.85; }

.yp-btn--outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}
.yp-btn--outline:hover { background: var(--muted); }

.yp-btn--ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.yp-btn--ghost:hover { background: var(--muted); color: var(--foreground); }

.yp-btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }
.yp-btn--lg { padding: 0.75rem 1.75rem; font-size: 1rem; }

.yp-btn--teal { background: var(--teal); color: var(--teal-foreground); }
.yp-btn--teal:hover { opacity: 0.9; }

/* ── Badges ───────────────────────────────────────────────── */
.yp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.yp-badge--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.yp-badge--outline {
  background: transparent;
  border: 1px solid var(--teal);
  color: var(--teal);
}

.yp-badge--featured {
  background: var(--featured);
  color: var(--featured-foreground);
}

.yp-badge--destructive {
  background: var(--destructive);
  color: white;
}

.yp-badge--teal {
  background: var(--teal);
  color: var(--teal-foreground);
}

/* ── School Card ──────────────────────────────────────────── */
.yp-school-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid hsl(35, 20%, 88%, 0.5);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.yp-school-card:hover {
  border-color: hsl(15, 55%, 55%, 0.3);
  box-shadow: 0 8px 24px hsl(25, 25%, 15%, 0.1);
}

/* Image */
.yp-school-card__image-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--muted);
}

.yp-school-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.yp-school-card:hover .yp-school-card__image { transform: scale(1.05); }

/* Hover overlay */
.yp-school-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.yp-school-card:hover .yp-school-card__overlay { opacity: 1; }

/* Badges top-left */
.yp-school-card__badges-tl {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.yp-school-card__badge-lastspot {
  animation: yp-pulse 1.5s ease-in-out infinite;
}

@keyframes yp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Wishlist top-right */
.yp-school-card__wishlist {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
}

.yp-wishlist-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  transition: background 0.15s, color 0.15s;
}
.yp-wishlist-btn:hover { background: white; color: var(--destructive); }
.yp-wishlist-btn.active { color: var(--destructive); }
.yp-wishlist-btn svg { width: 1rem; height: 1rem; }

/* Offer strip - bottom of image */
.yp-school-card__offer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  padding: 0.5rem 0.75rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.yp-school-card__offer-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Compare button - bottom of image, shows on hover */
.yp-school-card__compare {
  position: absolute;
  left: 0.75rem;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s;
}
.yp-school-card__compare.has-offer { bottom: 3rem; }
.yp-school-card__compare.no-offer  { bottom: 0.75rem; }
.yp-school-card:hover .yp-school-card__compare,
.yp-school-card__compare.in-compare { opacity: 1; }

/* Content */
.yp-school-card__content { padding: 1rem; }

/* Badge row */
.yp-school-card__meta-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

/* School name */
.yp-school-card__name {
  font-family: 'Questrial', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--foreground);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}
.yp-school-card:hover .yp-school-card__name { color: var(--primary); }

/* Location */
.yp-school-card__location {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}
.yp-school-card__location svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }

/* Scores row */
.yp-school-card__scores {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.yp-score-trust {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
  cursor: help;
}
.yp-score-trust svg { width: 0.875rem; height: 0.875rem; }
.yp-score-trust--excellent { color: #16a34a; }
.yp-score-trust--verygood  { color: #059669; }
.yp-score-trust--good      { color: #ca8a04; }
.yp-score-trust--emerging  { color: #ea580c; }

.yp-score-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--featured);
  font-weight: 500;
  cursor: help;
}
.yp-score-rating svg { width: 0.875rem; height: 0.875rem; }
.yp-score-rating__count { color: var(--muted-foreground); font-size: 0.75rem; font-weight: 400; }

/* Date row */
.yp-school-card__date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}
.yp-school-card__date svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }

/* Price */
.yp-school-card__price {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}
.yp-school-card__price-from { font-size: 0.875rem; color: var(--muted-foreground); }
.yp-school-card__price-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
}
.yp-school-card__price-currency { font-size: 0.875rem; color: var(--muted-foreground); }

/* ── School Grid ──────────────────────────────────────────── */
.yp-schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ── Tooltip ──────────────────────────────────────────────── */
.yp-tooltip {
  position: relative;
  display: inline-flex;
}

.yp-tooltip__content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--foreground);
  color: var(--background);
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 260px;
  white-space: normal;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.yp-tooltip:hover .yp-tooltip__content { opacity: 1; }

/* ── Wishlist localStorage state ──────────────────────────── */
.yp-wishlist-btn[data-wishlisted="true"] { color: var(--destructive); }

/* ── Spinner ──────────────────────────────────────────────── */
.yp-spinner {
  width: 2rem; height: 2rem;
  border: 3px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: yp-spin 0.7s linear infinite;
}
@keyframes yp-spin { to { transform: rotate(360deg); } }

/* ── No results ───────────────────────────────────────────── */
.yp-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--muted-foreground);
}

/* ── Responsive ───────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

html { overflow-x: hidden; max-width: 100%; }
body { overflow-x: clip; max-width: 100%; }

/* ── Weather bar responsive ───────────────────────────────── */
.yp-wb-region { display: inline; }
.yp-wb-extra  { display: flex; }
.yp-wb-humid  { display: inline; }

@media (max-width: 640px) {
  .yp-wb-region { display: none; }
  .yp-wb-extra  { display: none !important; }
  .yp-wb-humid  { display: none !important; }
  .yp-weather-bar { gap: 8px !important; }
}

@media (max-width: 768px) and (min-width: 641px) {
  .yp-wb-humid { display: none !important; }
}

/* ── Tablet (≤ 1024px) ────────────────────────────────────── */
@media (max-width: 1024px) {
  .yp-single-grid { grid-template-columns: 1fr !important; }
  .yp-single-grid > div:last-child {
    position: static !important;
    top: auto !important;
    width: 100% !important;
    max-width: 600px;
    margin: 0 auto;
  }
}

/* ── Mobile (≤ 768px) ─────────────────────────────────────── */
@media (max-width: 768px) {

  .yp-container { padding: 0 1rem; }
  .yp-main { padding: 1rem 0; }

  /* Header */
/* Header */
  .yp-header { height: auto; }
  .yp-header__inner { padding: 0 1rem; flex-wrap: nowrap; gap: 0.5rem; min-height: 56px; align-items: center; }
  .yp-header__nav { display: none; }
  .yp-header__actions { gap: 0.375rem; }

  /* Hide Compare + List Your School, keep search + wishlist + hamburger */
  .yp-header__actions .yp-btn--outline { display: none !important; }
  .yp-header__actions .yp-btn--primary { display: none !important; }

  #yp-mobile-toggle { display: flex !important; }

  /* Schools grid */
  .yp-schools-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

  /* Always show compare button on touch */
  .yp-school-card__compare { opacity: 1 !important; }

  /* Filter bar */
  .yp-filter-bar > div { flex-direction: column !important; align-items: stretch !important; }
  .yp-filter-item { width: 100%; }
  .yp-filter-item select { width: 100% !important; min-width: unset !important; box-sizing: border-box; }

  /* Single school grids */
  .yp-quick-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .yp-ai-grid { grid-template-columns: 1fr !important; min-height: auto !important; }
  .yp-ai-grid > div:last-child {
    border-left: none !important;
    border-top: 1px solid hsl(175,45%,40%,0.2) !important;
    height: 320px !important;
  }

  /* Footer */
  .yp-footer-grid { grid-template-columns: 1fr 1fr !important; gap: 2rem !important; }

  /* Tooltip */
  .yp-tooltip__content { left: 0 !important; right: 0; transform: none !important; }

  /* Tables */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

  /* Staff & policies */
  .yp-staff-grid    { grid-template-columns: repeat(2, 1fr) !important; }
  .yp-policies-grid { grid-template-columns: 1fr !important; }

  .yp-container, .yp-single-grid, .yp-single-grid > div { max-width: 100%; overflow-x: hidden; }
}

/* ── Small mobile (≤ 480px) ───────────────────────────────── */
@media (max-width: 480px) {
  .yp-schools-grid  { grid-template-columns: 1fr; }
  .yp-quick-stats   { grid-template-columns: 1fr !important; }
  .yp-footer-grid   { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
  .yp-header__inner { padding: 0 0.75rem; gap: 0.375rem; }
}

/* ── Extra small (≤ 400px) ────────────────────────────────── */
@media (max-width: 400px) {
  .yp-staff-grid { grid-template-columns: 1fr !important; }
}
.yp-wb-select option {
  background-color: #2d8c7c !important;
  color: white !important;
}
/* ── Hero filter bar — mobile 2-column grid ───────────────── */
@media (max-width: 768px) {
  .yp-hero-filter-wrap > div {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .yp-hero-filter-wrap select {
    min-width: unset !important;
    width: 100% !important;
    height: 2.75rem !important;
    box-sizing: border-box;
  }

  /* Search button spans full width */
  .yp-hero-filter-wrap .yp-btn--primary {
    grid-column: 1 / -1;
    width: 100%;
    height: 2.75rem;
    font-size: 0.9375rem;
  }
}
/* ── How It Works — 2 col on mobile ──────────────────────── */
@media (max-width: 768px) {
  .yp-how-it-works {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }
}
/* ── Course offering cards — mobile stack ─────────────────── */
@media (max-width: 640px) {
  .yp-course-card-inner {
    flex-direction: column !important;
  }
  .yp-course-price-col {
    text-align: left !important;
    min-width: unset !important;
    width: 100% !important;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
  }
}
/* ── Schools page title — single line on mobile ───────────── */
@media (max-width: 768px) {
  #main h1[style*="1.75rem"] {
    font-size: 1.25rem !important;
    white-space: nowrap;
  }
}
/* ── Section 5 filter — mobile 2-col grid ─────────────────── */
@media (max-width: 768px) {
  .yp-section5-filter .yp-filter-desktop {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .yp-section5-filter .yp-filter-desktop select {
    min-width: unset !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  .yp-section5-filter .yp-filter-desktop button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* ── Search: icon on mobile, full bar on desktop ──────────── */
.yp-search-icon-btn { display: none; }

@media (max-width: 768px) {
  .yp-search-icon-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .yp-search-icon-btn:hover { background: var(--secondary); }
  .yp-search-icon-btn svg   { width: 1rem; height: 1rem; }
  #yp-search-wrap { display: none !important; }
}
/* ── Make weather bar sticky too so header stays at top ────── */
.yp-weather-bar {
  position: sticky;
  top: 0;
  z-index: 101;
}

.yp-header {
  top: 32px; /* height of weather bar */
}

@media (max-width: 640px) {
  .yp-header { top: 32px; }
}
/* ── Mobile nav — slide in from right premium ─────────────── */
#yp-mobile-nav {
  position: fixed !important;
  top: 0;
  right: -100%;
  bottom: 0;
  width: 82%;
  max-width: 340px;
  z-index: 999;
  background: var(--background);
  box-shadow: -12px 0 48px rgba(0,0,0,0.18);
  padding: 0 !important;
  border-top: none !important;
  overflow-y: auto;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: block !important;
}

#yp-mobile-nav.open { right: 0; }

#yp-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 998;
  transition: opacity 0.3s;
}
#yp-nav-overlay.open { display: block; }
/* ── Homepage headline sizes — mobile ─────────────────────── */
@media (max-width: 768px) {
  /* "All Yoga Training Programs" */
  #results h2[style*="clamp"] {
    font-size: 1.75rem !important;
  }

  /* "Helping You Make Informed..." */
  #main section h2[style*="clamp"] {
    font-size: 1.375rem !important;
  }

  /* "How It Works", "Browse by Location" etc — general section h2 */
  #main h2[style*="1.75rem"] {
    font-size: 1.375rem !important;
  }

  /* "Browse Programs" badge — keep small */
  #main section > div > span[style*="0.875rem"] {
    font-size: 0.8125rem !important;
  }
}
/* ── Global font override — replaces all inline Crimson Text/Montserrat ── */
[style*="Crimson Text"],
[style*="'Crimson Text'"] {
  font-family: 'Gilda Display', Georgia, serif !important;
}

[style*="Montserrat"],
[style*="'Montserrat'"] {
  font-family: 'Questrial', system-ui, sans-serif !important;
}
/* ── Unified heading style — match schools archive ─────────── */
[style*="Crimson Text"],
[style*="'Crimson Text'"],
[style*="Georgia,serif"] {
  font-family: 'Questrial', system-ui, sans-serif !important;
  font-style: normal !important;
}
/* ── How We Score hero h1 — fix mobile wrap ───────────────── */
@media (max-width: 768px) {
  .yp-container h1[style*="clamp(2rem"] {
    font-size: 1.75rem !important;
  }
}
/* ── SEO content block typography ─────────────────────────── */
.yp-seo-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 2rem 0 0.75rem;
}
.yp-seo-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 1.5rem 0 0.5rem;
}
.yp-seo-content p { margin-bottom: 1rem; }
.yp-seo-content a { color: var(--primary); text-decoration: underline; }
.yp-seo-content strong { color: var(--foreground); }