/* =========================================================
   Responsive stylesheet — The Mancini Foundation
   Breakpoints: 1280 / 1024 / 768 / 640
   ========================================================= */

/* ---- Container helpers ---- */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ---- Generic grid helpers (classNames replace inline gridTemplateColumns) ---- */
.grid-2         { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.grid-2-hero    { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 64px; align-items: start; }
.grid-2-legacy  { display: grid; grid-template-columns: 1.3fr 1fr; gap: 96px; align-items: start; }
.grid-2-pillars { display: grid; grid-template-columns: 0.9fr 1.6fr; gap: 64px; }
.grid-2-coyt-a  { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.grid-2-coyt-b  { display: grid; grid-template-columns: 0.9fr 1.2fr; gap: 56px; }
.grid-2-coyt-c  { display: grid; grid-template-columns: 1fr 1.3fr; gap: 64px; align-items: start; }
.grid-2-malibu  { display: grid; grid-template-columns: 1fr 1.1fr; gap: 64px; align-items: stretch; }
.grid-2-shop    { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: end; }
.grid-2-cta     { display: grid; grid-template-columns: 1.4fr 1fr; gap: 96px; align-items: start; }
.grid-2-events  { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }

.grid-3-legacy  { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 48px; align-items: center; }
.grid-3-pillars { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.grid-4-legacy  { display: grid; grid-template-columns: repeat(4, 1fr); }
.grid-4-shop    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 56px; }
.grid-5-coyt    { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.grid-5-footer  { display: grid; grid-template-columns: repeat(5, 1fr); gap: 32px; margin-bottom: 64px; }

.grid-malibu-feat { display: grid; grid-template-columns: 60px 1fr 2fr; gap: 20px; padding: 20px 0; }
.grid-event-row   { display: grid; grid-template-columns: 140px 220px 1fr 180px 60px; gap: 32px; padding: 36px 0; }

/* ---- Hero section-specific inner grid ---- */
.hero-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }

/* ---- Base section padding (was previously inline in each section file) ---- */
.section-pad { padding: 140px 0; }

/* =========================================================
   ≤1280  –  small desktop
   ========================================================= */
@media (max-width: 1280px) {
  .container { padding: 0 36px; }
  .grid-2, .grid-2-hero, .grid-2-legacy, .grid-2-pillars,
  .grid-2-coyt-a, .grid-2-coyt-b, .grid-2-coyt-c,
  .grid-2-malibu, .grid-2-shop, .grid-2-cta, .grid-2-events {
    gap: 48px;
  }
  .grid-2-legacy, .grid-2-cta { gap: 64px; }
  .grid-4-shop { gap: 20px; }
}

/* =========================================================
   ≤1024  –  tablet
   ========================================================= */
@media (max-width: 1024px) {
  .container { padding: 0 28px; }

  /* Collapse most 2-col layouts to stacked */
  .grid-2, .grid-2-hero, .grid-2-legacy, .grid-2-pillars,
  .grid-2-coyt-a, .grid-2-coyt-b, .grid-2-coyt-c,
  .grid-2-malibu, .grid-2-cta, .grid-2-events {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .grid-2-shop { gap: 40px; }

  /* 3-col pillars → single column stacked */
  .grid-3-pillars { grid-template-columns: 1fr; }

  /* 5-step COYT → 2 columns */
  .grid-5-coyt { grid-template-columns: repeat(2, 1fr); }

  /* 4-col legacy timeline → 2 columns */
  .grid-4-legacy { grid-template-columns: repeat(2, 1fr); }

  /* 3-col legacy quote band → single column */
  .grid-3-legacy { grid-template-columns: 1fr; gap: 32px; text-align: left; }

  /* Shop products 4 → 2 */
  .grid-4-shop { grid-template-columns: repeat(2, 1fr); }

  /* Footer links 5 → 3 */
  .grid-5-footer { grid-template-columns: repeat(3, 1fr); gap: 28px; }

  /* Event row gets simpler */
  .grid-event-row {
    grid-template-columns: 140px 1fr 60px;
    gap: 20px;
    padding: 28px 0;
  }
  .grid-event-row .event-date-range,
  .grid-event-row .event-venue {
    display: none;
  }

  /* Malibu feature rows */
  .grid-malibu-feat { grid-template-columns: 50px 1fr; gap: 12px; }
  .grid-malibu-feat .feat-desc { grid-column: 2; }

  /* Nav: hide desktop link row, show hamburger */
  .nav-links-desktop { display: none !important; }
  .nav-hamburger { display: flex !important; }

  /* Shrink header lockup on mobile so panel doesn't overlap menu items */
  .nav-inner { padding: 12px 20px !important; }
  .nav-logo { width: 52px !important; }
  .nav-wordmark-title { font-size: 16px !important; white-space: nowrap; }
  .nav-wordmark-meta { font-size: 9px !important; letter-spacing: 0.15em !important; white-space: nowrap; }

  /* Footer big wordmark shrinks */
  .footer-wordmark { font-size: clamp(48px, 10vw, 120px) !important; }
}

/* =========================================================
   ≤768  –  large phone / small tablet
   ========================================================= */
@media (max-width: 768px) {
  .container { padding: 0 20px; }

  /* Section padding tighter */
  section, .section-pad {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Collapse big internal gaps */
  .grid-2, .grid-2-hero, .grid-2-legacy, .grid-2-pillars,
  .grid-2-coyt, .grid-2-malibu, .grid-2-cta, .grid-2-events {
    gap: 28px !important;
  }
  .grid-3-pillars { gap: 16px !important; }

  /* Pillar cards: kill the 420px minHeight meant for desktop equal-height columns.
     Add a divider between stacked cards and tighter internal padding. */
  .grid-3-pillars > [data-pillar-index] {
    min-height: 0 !important;
    padding: 36px 4px 40px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--rule);
  }
  .grid-3-pillars > [data-pillar-index]:last-child { border-bottom: none; }

  /* Any large marginBottom blocks — clip vertical rhythm */
  [data-mb-xl] { margin-bottom: 40px !important; }

  /* Shop products 2 → 2 (keep) but gap tighter */
  .grid-4-shop { gap: 12px; }

  /* Footer links 3 → 2 */
  .grid-5-footer { grid-template-columns: repeat(2, 1fr); }

  /* Hero meta row stacks */
  .hero-meta-row { grid-template-columns: 1fr; gap: 16px; }

  /* Typography scales for mobile */
  .display-xl { font-size: clamp(44px, 11vw, 72px) !important; line-height: 1.0 !important; }
  .display-lg { font-size: clamp(36px, 9vw, 56px) !important; line-height: 1.05 !important; }
  .display-md { font-size: clamp(28px, 7vw, 44px) !important; line-height: 1.1 !important; }
  .body-lg    { font-size: 16px !important; }

  /* Buttons full-width stack */
  .btn-stack {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .btn-stack .btn { justify-content: center; width: 100%; }

  /* Hero min-height — let it breathe naturally instead of forcing 100vh */
  .hero-section { min-height: auto !important; padding-top: 96px !important; padding-bottom: 48px !important; }

  /* Hero stat card on mobile: anchor to right edge, don't spill past left */
  .hero-stat-card {
    left: auto !important;
    right: 0 !important;
    bottom: -24px !important;
    width: min(280px, 78%) !important;
    padding: 20px 22px !important;
  }
}

/* COYT: desktop 5-col row vs mobile accordion */
.coyt-steps-mobile { display: none; }
@media (max-width: 768px) {
  .coyt-steps-desktop { display: none !important; }
  .coyt-detail-desktop { display: none !important; }
  .coyt-steps-mobile { display: block; margin-top: 8px; }
}

/* Image aspect ratios — wider/shorter on mobile so they don't dominate viewport */
@media (max-width: 768px) {
  .img-hero,
  .img-coyt-hero { aspect-ratio: 4/3 !important; max-height: 60vh !important; }
  .img-malibu    { aspect-ratio: 16/10 !important; max-height: 50vh !important; }
  .img-shop      { aspect-ratio: 1/1 !important; }

  /* COYT caption: tighten so name doesn't wrap/clip */
  .coyt-caption {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    padding: 12px 14px !important;
    gap: 8px !important;
  }
  .coyt-caption .serif { font-size: 17px !important; white-space: nowrap; }
  .coyt-caption .mono { font-size: 8px !important; }

  /* COYT step detail (accordion): remove the 70px indent that overflows on mobile */
  .coyt-step-detail {
    padding-left: 0 !important;
  }
}

/* =========================================================
   ≤640  –  phone
   ========================================================= */
@media (max-width: 640px) {
  .container { padding: 0 16px; }

  /* Everything single-col including shop */
  .grid-4-shop { grid-template-columns: 1fr; gap: 16px; }
  .grid-5-footer { grid-template-columns: 1fr; }
  .grid-5-coyt { grid-template-columns: 1fr; }
  .grid-4-legacy { grid-template-columns: 1fr; }

  /* Event row: just title + arrow */
  .grid-event-row {
    grid-template-columns: 1fr 40px;
    gap: 12px;
    padding: 22px 0;
  }
  .grid-event-row .event-num { display: none; }

  /* Footer wordmark stacks under tagline */
  .footer-header { grid-template-columns: 1fr !important; }
  .footer-wordmark {
    font-size: clamp(44px, 14vw, 72px) !important;
    text-align: left !important;
  }

  /* Hide some decorative meta on phones */
  .hide-phone { display: none !important; }
}

/* =========================================================
   Hamburger nav — hidden by default, shown ≤1024
   ========================================================= */
.nav-logo {
  width: 88px;
  height: auto;
  display: block;
}
.nav-wordmark-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--ink);
  transition: all 250ms ease;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-mobile-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--cream);
  border-left: 1px solid var(--rule);
  padding: 100px 32px 40px;
  transform: translateX(100%);
  transition: transform 400ms cubic-bezier(.2,.7,.2,1);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-mobile-panel.open { transform: translateX(0); }
.nav-mobile-panel a {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 28px;
  font-weight: 300;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  transition: color 250ms ease, padding-left 250ms ease;
}
.nav-mobile-panel a:hover { color: var(--accent); padding-left: 8px; }
.nav-mobile-panel .mobile-cta {
  margin-top: 32px;
  justify-content: center;
  padding: 18px;
  font-size: 14px;
  background: var(--accent);
  color: var(--cream);
  border: none;
  text-align: center;
}
.nav-mobile-panel .mobile-cta:hover { color: var(--cream); padding-left: 18px; background: var(--accent-deep); }

.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  z-index: 80;
}
.nav-scrim.open { opacity: 1; pointer-events: auto; }
