/* ===================================
   RESPONSIVE — YCF Website
   Mobile-first breakpoints
   =================================== */

/* ── Mobile defaults are in components.css ── */
/* Everything below is progressive enhancement */

/* ═══════════════════════════════════
   TABLET — 768px+
   ═══════════════════════════════════ */

@media (min-width: 768px) {

  /* Layout */
  .section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  /* Let body text breathe wider on tablets */
  .body-text {
    max-width: 100%;
  }

  /* Section Intro becomes 2-column */
  .section-intro {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-lg);
    align-items: start;
  }

  .section-intro--with-action {
    grid-template-columns: 1fr 1.5fr 1fr;
  }

  /* Card grid → 2 columns */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stats → 3 columns */
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

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

  /* Footer top → 2 columns */
  .footer__top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }

  /* Footer bottom → row */
  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  /* Newsletter form → row */
  .footer__newsletter-form {
    flex-direction: row;
  }

  .footer__input {
    flex: 1;
  }

  /* Contact page two-col */
  .contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }

  /* Donate button visible */
  .nav__donate {
    display: inline-flex;
  }
}


/* ═══════════════════════════════════
   DESKTOP — 1024px+
   ═══════════════════════════════════ */

@media (min-width: 1024px) {

  /* Spacing goes larger */
  .section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }

  /* Container padding */
  :root {
    --container-padding: 40px;
  }

  /* Restore body text constraint in 3-col layouts */
  .body-text {
    max-width: 480px;
  }

  /* Nav links visible, hide burger */
  .nav__links {
    display: flex;
  }

  .nav__burger {
    display: none;
  }

  /* Card grid → 4 columns */
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Card grid 2-col modifier stays at 2 */
  .card-grid--2col {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Team grid → 4 columns */
  .team-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Section intro → full 3-column */
  .section-intro {
    grid-template-columns: 1fr 1.5fr 1.2fr;
  }

  .section-intro--two-col {
    grid-template-columns: 1fr 2fr;
  }

  /* Pillar header → side-by-side */
  .pillar__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .pillar__status {
    min-width: 240px;
    text-align: right;
    align-items: flex-end;
  }

  /* Registry items → 2 columns */
  .registry {
    grid-template-columns: repeat(2, 1fr);
    column-gap: var(--space-xl);
  }

  /* Hide bottom border on last two registry items (same row in 2-col) */
  .registry__item:nth-last-child(2),
  .registry__item:last-child {
    border-bottom: none;
  }

  /* Footer → 3 columns */
  .footer__top {
    grid-template-columns: 1fr 1fr 1.2fr;
  }

  /* Logo carousel items wider */
  .logo-carousel__item {
    flex: 0 0 240px;
    height: 140px;
  }
}


/* ═══════════════════════════════════
   LARGE DESKTOP — 1440px+
   ═══════════════════════════════════ */

@media (min-width: 1440px) {

  :root {
    --container-padding: 60px;
  }
}


/* ═══════════════════════════════════
   MOBILE LANDSCAPE — 480px+
   ═══════════════════════════════════ */

@media (min-width: 480px) and (max-width: 767px) {

  :root {
    --container-padding: 24px;
  }

  .body-text {
    max-width: 100%;
  }

  /* Team grid → 2 columns on landscape phones */
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Card images less tall on mobile landscape */
  .card__image-wrap {
    aspect-ratio: 3 / 3.5;
  }

  /* Stats → 3 across even on landscape phones */
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ═══════════════════════════════════
   TABLET ONLY — 768px to 1023px
   ═══════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1023px) {

  :root {
    --container-padding: 24px;
  }

  /* Restore max-width on body text inside 3-col layout on desktop only */
  .body-text {
    max-width: 100%;
  }
}


/* ═══════════════════════════════════
   SMALL MOBILE — below 480px
   ═══════════════════════════════════ */

@media (max-width: 479px) {

  :root {
    --container-padding: 20px;
  }

  .section {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  .cta-block {
    padding: var(--space-2xl) 0;
  }

  .hero {
    min-height: 85vh;
  }

  /* Card images less portrait on narrow phones */
  .card__image-wrap {
    aspect-ratio: 4 / 4;
  }

  /* Pillar header — remove min-width that causes overflow */
  .pillar__status {
    min-width: 0;
    width: 100%;
  }

  /* Funding row label + shortfall stack on tiny screens */
  .funding-row__header {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Registry items — tighter on small screens */
  .registry__item {
    gap: var(--space-sm);
  }

  .registry__name {
    font-size: 16px;
  }

  .registry__amount {
    font-size: 16px;
  }

  /* Stack newsletter form */
  .footer__newsletter-form {
    flex-direction: column;
  }

  /* Footer submit full width on mobile */
  .footer__submit {
    align-self: stretch;
    text-align: center;
  }

  /* Team member bio slightly larger on phones for readability */
  .team-member__bio {
    font-size: 14px;
    line-height: 1.6;
  }

  /* Director feature image full width on phones */
  .director-feature__image-wrap {
    width: 140px;
  }

  /* Stat numbers slightly smaller on narrow phones */
  .stat__number {
    font-size: clamp(36px, 12vw, 48px);
  }

  /* CTA buttons full-width on mobile */
  .cta-block__button {
    width: 100%;
    justify-content: center;
  }

  .cta-block__button--outline {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}


/* ═══════════════════════════════════
   SAFE AREA INSETS — Notched devices
   ═══════════════════════════════════ */

@supports (padding: env(safe-area-inset-bottom)) {
  .nav__inner {
    padding-left: max(var(--container-padding), env(safe-area-inset-left));
    padding-right: max(var(--container-padding), env(safe-area-inset-right));
  }

  .footer {
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  }

  .mobile-menu {
    padding-bottom: env(safe-area-inset-bottom);
  }
}


/* ═══════════════════════════════════
   MOBILE-WIDE — Prevent horizontal overflow
   ═══════════════════════════════════ */

@media (max-width: 767px) {

  /* Ensure no horizontal scroll on any mobile */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* body-text fills available width on mobile */
  .body-text {
    max-width: 100%;
  }

  /* Section intro always stacks on mobile */
  .section-intro {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Pillar header always stacks on mobile */
  .pillar__header {
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Full-width buttons in pillar actions */
  .pillar__action .cta-block__button,
  .pillar__action .cta-block__button--outline {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Mobile menu takes full viewport */
  .mobile-menu {
    padding: var(--space-xl) var(--container-padding);
  }

  /* Reduce heading sizes slightly for mobile */
  .heading-page {
    font-size: clamp(28px, 7vw, 48px);
  }

  /* Contact form inputs 16px minimum (prevents iOS zoom) */
  .form__input,
  .form__textarea {
    font-size: 16px;
  }

  /* Footer newsletter full-width submit */
  .footer__submit {
    width: 100%;
  }
}
