/* ============================================
   randomcharity.com — Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,700&display=swap');

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --bg-elevated: #232328;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.12);
  --accent-glow: rgba(52, 211, 153, 0.25);
  --gold: #f59e0b;
  --gold-dim: rgba(245, 158, 11, 0.12);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(52, 211, 153, 0.15);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --max-w: 1200px;
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === GRAIN OVERLAY === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #6ee7b7; }

/* === LAYOUT === */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section { padding: 100px 0; }

/* === NAV === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 24px;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo .logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 12px var(--accent-glow);
}
.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* === HERO === */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; max-width: 720px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hero h1 { margin-bottom: 20px; }
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  position: relative;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 48px;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}
.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn-primary:hover {
  background: #6ee7b7;
  color: #0a0a0b;
  transform: translateY(-2px);
  box-shadow: 0 0 40px var(--accent-glow);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.btn-outline:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.btn-sm { padding: 8px 20px; font-size: 0.85rem; }
.btn-lg { padding: 18px 40px; font-size: 1.1rem; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }

/* === CATEGORY PICKER === */
.categories { padding: 80px 0; }
.categories-header { text-align: center; margin-bottom: 48px; }
.categories-header p { margin-top: 12px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-width: 900px;
  margin: 0 auto 32px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.category-card:hover, .category-card.active {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.category-card.active { border-color: var(--accent); }
.category-icon { font-size: 1.75rem; line-height: 1; }
.category-name { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); line-height: 1.3; }
.category-card:hover .category-name, .category-card.active .category-name { color: var(--text-primary); }
.surprise-btn-wrap { text-align: center; margin-top: 16px; }

/* === LOCAL HEROES TOGGLE === */
.local-toggle {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.local-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.local-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }
.local-chip.active { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); }

/* === SPIN / WHEEL SECTION === */
.spin-section {
  padding: 60px 0 100px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.wheel-wrap {
  position: relative;
  width: 380px;
  height: 380px;
  margin: 0 auto;
}
.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 28px solid var(--accent);
  filter: drop-shadow(0 2px 6px rgba(52, 211, 153, 0.5));
}
#wheel-canvas {
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--bg-elevated), 0 0 60px rgba(52, 211, 153, 0.15);
  cursor: pointer;
  transition: filter 0.3s;
}
#wheel-canvas:hover { filter: brightness(1.05); }
#wheel-canvas.spinning { cursor: not-allowed; }
#spin-btn {
  margin-top: 8px;
}
#spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.spin-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === CHARITY CARD === */
.charity-card-wrap {
  display: none;
  max-width: 520px;
  margin: 0 auto;
  animation: card-reveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.charity-card-wrap.visible { display: block; }
@keyframes card-reveal {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.charity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.charity-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cat-color, var(--accent));
}
.charity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.charity-card-icon { font-size: 2rem; }
.charity-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-category { background: color-mix(in srgb, var(--cat-color, var(--accent)) 15%, transparent); color: var(--cat-color, var(--accent)); }
.badge-scope { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-local { background: var(--gold-dim); color: var(--gold); }
.charity-card h3 { font-family: var(--font-display); margin-bottom: 12px; font-size: 1.5rem; }
.charity-card-mission { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.charity-card-hook {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 16px;
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 8%, transparent);
  border-left: 3px solid var(--cat-color, var(--accent));
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 16px;
  line-height: 1.5;
}
.charity-card-region {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.charity-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.charity-card-actions .btn { flex: 1; min-width: 120px; }

/* === SHARE MODAL === */
.share-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.share-modal.visible { display: flex; }
.share-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  animation: card-reveal 0.3s ease;
}
.share-modal h3 { margin-bottom: 20px; text-align: center; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition);
}
.share-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.share-close {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.share-close:hover { color: var(--text-primary); }

/* === DIRECTORY / BROWSE ALL === */
.directory { padding: 80px 0; }
.directory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}
.directory-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: 280px;
  max-width: 100%;
}
.directory-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  width: 100%;
}
.directory-search input::placeholder { color: var(--text-muted); }
.directory-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-chip {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-chip.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.dir-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat-color, var(--accent));
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.dir-card:hover { border-color: var(--border-hover); border-left-color: var(--cat-color, var(--accent)); transform: translateY(-2px); box-shadow: 0 4px 20px color-mix(in srgb, var(--cat-color, var(--accent)) 15%, transparent); }
.dir-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dir-card-icon { font-size: 1.25rem; }
.dir-card-name { font-weight: 700; font-size: 0.95rem; flex: 1; }
.dir-card-mission { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dir-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.dir-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.dir-card .btn-sm { flex-shrink: 0; }
.dir-card .btn-primary { background: var(--cat-color, var(--accent)); box-shadow: none; }
.dir-card .btn-primary:hover { background: var(--cat-color, var(--accent)); filter: brightness(1.2); }
.no-results { text-align: center; padding: 60px 0; color: var(--text-muted); }

/* === HOW IT WORKS === */
.how-it-works { padding: 80px 0; }
.how-it-works-header { text-align: center; margin-bottom: 48px; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
.step {
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.step-num {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
}
.step h3 { font-size: 1.1rem; margin-bottom: 8px; font-family: var(--font-body); font-weight: 700; }
.step p { font-size: 0.85rem; }

/* === FOOTER === */
.footer {
  padding: 48px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy { font-size: 0.75rem; color: var(--text-muted); }

/* === PAGE CONTENT (about, contact, etc.) === */
.page-hero {
  padding: 140px 24px 60px;
  text-align: center;
}
.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.page-content h2 { margin: 40px 0 16px; font-size: 1.5rem; }
.page-content p { margin-bottom: 16px; font-size: 0.95rem; line-height: 1.7; }
.page-content ul, .page-content ol { margin: 0 0 16px 24px; color: var(--text-secondary); }
.page-content li { margin-bottom: 8px; font-size: 0.95rem; }
.page-content a { text-decoration: underline; text-underline-offset: 3px; }

/* === CONTACT FORM === */
.contact-form { max-width: 520px; margin: 0 auto; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent);
}
.form-group textarea { min-height: 120px; resize: vertical; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 3000;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* === ANIMATIONS === */
.fade-in { opacity: 0; transform: translateY(20px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }
  .nav-mobile-toggle { display: block; }
  .steps { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .directory-grid { grid-template-columns: 1fr; }
  .directory-header { flex-direction: column; align-items: stretch; }
  .directory-search { width: 100%; }
  .share-buttons { grid-template-columns: 1fr; }
  .charity-card { padding: 24px; }
  .charity-card-actions { flex-direction: column; }
  .charity-card-actions .btn { min-width: unset; }
  #spin-btn { width: 150px; height: 150px; font-size: 1.25rem; }
  .wheel-wrap { width: 300px; height: 300px; }
  #wheel-canvas { width: 300px; height: 300px; }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-card { padding: 14px 8px; }
  .category-icon { font-size: 1.4rem; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
