/* =========================================================
   Responsive breakpoints
   ========================================================= */

/* Large tablet and down */
@media (max-width: 1024px) {
  section { padding: 64px 0; }

  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-visual { margin-left: 0; max-width: 100%; }
  .hero-card-1 { top: 4%; left: -20px; }
  .hero-card-2 { bottom: 6%; right: -20px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }

  .how-steps { grid-template-columns: repeat(2, 1fr); }

  .causes-grid { grid-template-columns: repeat(2, 1fr); }

  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .about-image { max-width: 520px; margin: 0 auto; }

  .testimonials-grid { grid-template-columns: repeat(2, 1fr); }

  .prize-grid { grid-template-columns: 1fr; gap: 24px; }
  .prize-amount { text-align: left; }
  .prize-banner { padding: 40px 32px; }

  .footer-grid { grid-template-columns: repeat(3, 1fr); gap: 36px; }

  .campaign-hero .container { grid-template-columns: 1fr; gap: 32px; }
  .donation-sidebar { position: static; }

  .campaign-content { grid-template-columns: 1fr; gap: 32px; }

  .donate-grid { grid-template-columns: 1fr; gap: 20px; }
  .donate-recap { position: static; }
  .donate-form-col { padding: 24px; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .tip-grid { grid-template-columns: repeat(3, 1fr); }

  .team-grid { grid-template-columns: repeat(3, 1fr); }

  .values-grid { grid-template-columns: 1fr; }
}

/* Tablet and down */
@media (max-width: 768px) {
  :root { --container: 100%; }

  section { padding: 56px 0; }
  .section-head { margin-bottom: 36px; }

  .nav-links a { padding: 14px 16px; border-radius: 10px; }

  .hero { padding: 48px 0 64px; }
  .hero h1 { font-size: 2.25rem; }
  .hero .lead { font-size: 1rem; }

  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }

  .campaigns-grid { grid-template-columns: 1fr; gap: 20px; }

  .testimonials-grid { grid-template-columns: 1fr; }

  .causes-grid { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 36px; }

  .footer-bottom { flex-direction: column; text-align: center; }

  .how-steps { grid-template-columns: 1fr; }

  .team-grid { grid-template-columns: repeat(2, 1fr); }

  .filters-bar { padding: 14px; }
  .filters-bar .search-input { min-width: 100%; }

  .page-hero { padding: 56px 0 40px; }

  .prize-amount { font-size: 5rem; }
  .prize-banner { padding: 32px 24px; }

  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
  .timeline-year { font-size: 1.375rem; }

  .campaign-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; }

  .amount-options { grid-template-columns: repeat(2, 1fr); }

  .hero-card { padding: 12px 14px; }
  .hero-card-value { font-size: 1rem; }

  .donate-form-col { padding: 20px; }
  .donate-heading { font-size: 1.375rem; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .tip-grid { grid-template-columns: repeat(3, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* Phone */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .stat-item .value { font-size: 1.75rem; }

  .causes-grid { grid-template-columns: 1fr; }

  .hero-card-1 { left: -10px; top: 4%; transform: scale(0.85); transform-origin: top left; }
  .hero-card-2 { right: -10px; bottom: 4%; transform: scale(0.85); transform-origin: bottom right; }

  .prize-amount { font-size: 4rem; }

  .modal { border-radius: var(--radius); }
  .modal-head, .modal-body { padding: 20px; }

  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* =========================================================
   Sidebar — mobile defaults (before media queries kick in).
   On mobile the sidebar is a continuation of cd-card (edge-to-edge,
   white background, no rounded corners). On desktop a media query
   below repositions it as a sticky right-column card.
   ========================================================= */
.cd-sidebar {
  margin: 0 -16px;
}
.cd-sidebar-card {
  background: #fff;
  padding: 18px 20px 22px;
  box-shadow: 0 1px 2px rgba(10, 37, 64, 0.04), 0 6px 18px rgba(10, 37, 64, 0.06);
}
.cd-sidebar-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 18px 0 14px;
}
.cd-card { margin-bottom: 0; }
.cd-sidebar { margin-bottom: 16px; }

/* =========================================================
   Desktop polish (≥ 880px)
   The base CSS was authored mobile-first; this block undoes
   the mobile-only patterns so the layout looks proper on
   wider screens.
   ========================================================= */
@media (min-width: 880px) {
  /* ---------- header: horizontal nav, hide hamburger ---------- */
  .menu-toggle,
  .nav-spacer { display: none !important; }

  .nav-bar { padding: 18px 0; gap: 24px; }

  .nav-links {
    display: flex !important;
    position: static;
    flex-direction: row;
    align-items: center;
    background: transparent;
    box-shadow: none;
    border-bottom: 0;
    padding: 0;
    gap: 6px;
    width: auto;
    max-height: none;
    overflow: visible;
    margin-left: auto;
  }
  .nav-links li { width: auto; }
  .nav-links a {
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
  }
  .nav-links a:hover { background: var(--brand-soft); color: var(--brand-deep); }
  .nav-links a.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }

  /* brand stays on the left */
  .brand-icon { width: 38px; height: 38px; }
  .brand-name { font-size: 1rem; }
  .brand-tag  { font-size: 0.75rem; }

  /* ---------- campaign detail: 2-col layout with grid-areas ---------- */
  .cd-shell {
    max-width: 1160px;
    padding: 32px 24px 80px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas:
      "card    sidebar"
      "main    sidebar"
      "related related";
    column-gap: 32px;
    row-gap: 18px;
    align-items: start;
  }
  .cd-card    { grid-area: card; margin: 0; }
  .cd-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 90px;
    align-self: start;
    margin: 0;
  }
  .cd-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
  }
  .cd-related-section {
    grid-area: related;
    margin: 24px 0 0;
  }
  .cd-sidebar-card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(10, 37, 64, 0.04), 0 10px 32px rgba(10, 37, 64, 0.10);
  }

  .cd-card { border-radius: 18px; margin: 0; }
  .cd-section {
    border-radius: 18px;
    margin: 0;
    padding: 28px 32px;
  }

  /* hero on desktop: keep landscape but cap height */
  .cd-hero { aspect-ratio: 4 / 3; max-height: 540px; }
  .cd-hero-title { font-size: 1.75rem; }

  /* sidebar inner styling */
  .cd-sidebar .cd-stats-row {
    gap: 18px;
    align-items: center;
  }
  .cd-sidebar .cd-ring { width: 64px; height: 64px; }
  .cd-sidebar .cd-ring-pct { font-size: 0.875rem; }
  .cd-sidebar .cd-raised-amt { font-size: 1.625rem; }
  .cd-sidebar .cd-raised-suffix { font-size: 0.9375rem; }

  .cd-sidebar .cd-actions { margin-top: 18px; gap: 10px; }
  .cd-sidebar .cd-btn { height: 50px; font-size: 1rem; }
  .cd-sidebar .cd-btn-share { width: 50px; }

  .cd-sidebar-divider {
    height: 1px;
    background: var(--line-soft);
    margin: 22px 0 18px;
  }

  /* donor list inside sidebar */
  .cd-sidebar .cd-recent-row {
    color: var(--brand-darker);
    font-weight: 600;
    margin-bottom: 8px;
  }
  .cd-sidebar .cd-donor-list { margin-top: 4px; }
  .cd-sidebar .cd-donor-row { padding: 10px 0; gap: 12px; }
  .cd-sidebar .cd-donor-avatar { width: 36px; height: 36px; font-size: 0.875rem; }

  /* related grid → 2 columns on desktop */
  .cd-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  /* story spacing */
  .cd-story-body p { font-size: 1rem; line-height: 1.7; margin-bottom: 14px; }
  .cd-story-body p.cd-story-lead { font-size: 1.0625rem; }

  /* ---------- footer polish ---------- */
  .site-footer { padding: 80px 0 32px; }
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 64px;
    margin-bottom: 48px;
  }
  .footer-col h4 {
    font-size: 0.875rem;
    color: #fff;
    margin-bottom: 22px;
    letter-spacing: 0.06em;
  }
  .footer-col ul { list-style: none; padding: 0; margin: 0; }
  .footer-col li { margin-bottom: 12px; }
  .footer-col a {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color var(--transition);
  }
  .footer-col a:hover { color: #fff; }
  .footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 24px;
  }
  .footer-locale { margin: 0; padding: 0; border: 0; }
  .footer-bottom {
    margin-top: 24px;
    padding-top: 0;
    border-top: 0;
    justify-content: flex-start;
  }
  .footer-bottom > div { font-size: 0.8125rem; color: rgba(255, 255, 255, 0.6); }

  /* ---------- causes (categories) grid breathing room ---------- */
  .causes-grid { gap: 24px; }

  /* ---------- contact form: cap width like donate ---------- */
  .contact-grid { padding: 16px 0; }

  /* ---------- campaigns list: wider container, larger search ---------- */
  .filters-bar { padding: 12px; gap: 14px; }
  .filters-bar .search-input { padding: 14px 18px 14px 48px; }
}

/* =========================================================
   Wider desktop (≥ 1200px) — extra breathing room
   ========================================================= */
@media (min-width: 1200px) {
  .cd-shell { max-width: 1200px; padding: 40px 32px 100px; gap: 40px; }
  .hero-clean { padding: 96px 0 120px; }
}

/* Print */
@media print {
  .site-header, .site-footer, .cta-final, .donation-sidebar, .share-row { display: none; }
  body { background: #fff; color: #000; }
}
