/* ============================================================
   CAMERON PARK CHIROPRACTIC — RESPONSIVE OVERRIDES
   Targets className hooks added to the layout. Uses !important
   to override the JSX inline styles.
   ============================================================ */

/* ---------- TABLET (≤ 1024px) ---------- */
@media (max-width: 1024px) {
  .cpc-sect { padding-left: 32px !important; padding-right: 32px !important; }
  .cpc-sect-tall { padding-top: 80px !important; padding-bottom: 80px !important; }

  /* Grids */
  .cpc-row-2 { grid-template-columns: minmax(0, 1fr) !important; gap: 40px !important; }
  .cpc-row-3 { grid-template-columns: repeat(2, 1fr) !important; gap: 24px !important; }
  .cpc-row-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .cpc-row-services-card { grid-template-columns: 1fr !important; gap: 24px !important; padding: 40px 24px !important; }
  .cpc-row-services-list { grid-template-columns: 32px 1fr auto !important; gap: 20px !important; padding: 28px 0 !important; }
  .cpc-row-services-list .cpc-srv-blurb,
  .cpc-row-services-list .cpc-srv-meta { grid-column: 2 / 4 !important; }

  /* Stats: 4 → 2 cols, with proper internal borders */
  .cpc-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .cpc-stats > * { border-left: 0 !important; border-top: 1px solid var(--hairline); }
  .cpc-stats > *:nth-child(odd) { border-left: 0 !important; }
  .cpc-stats > *:nth-child(even) { border-left: 1px solid var(--hairline) !important; }
  .cpc-stats > *:nth-child(-n+2) { border-top: 0; }

  /* Hero */
  .cpc-hero-pad { padding-top: 140px !important; padding-bottom: 32px !important; padding-left: 24px !important; padding-right: 24px !important; }
  .cpc-hero-footer { grid-template-columns: 1fr 1fr !important; gap: 20px !important; }
  .cpc-hero-footer > *:nth-child(2) { display: none !important; }

  /* Sticky positioning has to release on tablet */
  .cpc-sticky-aside { position: static !important; }

  /* Footer */
  .cpc-footer-cta { grid-template-columns: 1fr !important; gap: 32px !important; align-items: start !important; }
  .cpc-footer-cols { grid-template-columns: 1fr 1fr 1fr !important; gap: 40px !important; }
  .cpc-footer-cols > *:first-child { grid-column: 1 / -1 !important; }
  .cpc-footer-meta { grid-template-columns: 1fr !important; gap: 12px !important; text-align: left !important; }
  .cpc-footer-meta > * { text-align: left !important; }

  /* Nav */
  .cpc-nav-desktop { display: none !important; }
  .cpc-nav-mobile-toggle { display: inline-flex !important; }
  .cpc-nav-grid { grid-template-columns: auto 1fr auto !important; padding: 0 20px !important; }
  .cpc-nav-phone { display: none !important; }
  .cpc-wordmark-mobile { font-size: 11px !important; letter-spacing: 4px !important; }

  /* Service detail — spec grid (target the actual inner grid) */
  .cpc-spec-cells { grid-template-columns: repeat(2, 1fr) !important; }
  .cpc-spec-cells > * { border-left: 0 !important; border-top: 1px solid var(--hairline); padding: 24px 16px !important; }
  .cpc-spec-cells > *:nth-child(even) { border-left: 1px solid var(--hairline) !important; }
  .cpc-spec-cells > *:nth-child(-n+2) { border-top: 0 !important; }

  /* Service detail — equipment list */
  .cpc-equip-row { grid-template-columns: 32px 1fr auto !important; gap: 16px 20px !important; }
  .cpc-equip-row .cpc-equip-model { grid-column: 2 / 4 !important; }

  /* Costco band layouts */
  .cpc-costco-band { grid-template-columns: 1fr !important; gap: 24px !important; align-items: start !important; }
  .cpc-costco-band-home { grid-template-columns: 1fr !important; gap: 16px !important; }

  /* FAQ row */
  .cpc-faq-btn { grid-template-columns: auto 1fr auto !important; gap: 20px !important; padding: 24px 0 !important; }
  .cpc-faq-q { font-size: 19px !important; letter-spacing: 1.2px !important; }
  .cpc-faq-answer { padding-left: 32px !important; padding-right: 24px !important; padding-bottom: 24px !important; }
}

/* ---------- MOBILE (≤ 640px) ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }

  /* Section padding */
  .cpc-sect { padding-left: 20px !important; padding-right: 20px !important; }
  .cpc-sect-tall { padding-top: 56px !important; padding-bottom: 56px !important; }
  .cpc-sect-tall-lg { padding-top: 72px !important; padding-bottom: 72px !important; }

  /* All multi-col grids become 1 col. minmax(0,1fr) lets the track
     shrink below its content's min-width so a wide/non-wrapping child
     can never blow the grid past the viewport (which the overflow
     guard would otherwise clip). */
  .cpc-row-2, .cpc-row-3, .cpc-row-4 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
  }
  .cpc-row-services-list {
    grid-template-columns: 32px 1fr !important;
    gap: 12px !important;
    padding: 24px 0 !important;
  }
  .cpc-row-services-list .cpc-srv-blurb,
  .cpc-row-services-list .cpc-srv-meta { grid-column: 1 / 3 !important; }
  .cpc-row-services-list .cpc-srv-arrow { display: none !important; }

  /* Hide #'s on FAQ for tighter mobile look */
  .cpc-faq-btn { grid-template-columns: 1fr auto !important; gap: 16px !important; padding: 24px 0 !important; }
  .cpc-faq-num { display: none !important; }
  .cpc-faq-q { font-size: 16px !important; letter-spacing: 1px !important; line-height: 1.3 !important; }
  .cpc-faq-answer { padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 24px !important; }

  /* Stats: 2 col on mobile (was 4) */
  .cpc-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .cpc-stats > * { padding: 28px 16px !important; }

  /* Hero */
  .cpc-hero-pad { padding-top: 120px !important; padding-bottom: 24px !important; padding-left: 20px !important; padding-right: 20px !important; }
  .cpc-hero-h1 { font-size: clamp(44px, 13vw, 72px) !important; line-height: 0.98 !important; }
  .cpc-hero-sub { font-size: 17px !important; line-height: 1.45 !important; }
  .cpc-hero-buttons { flex-wrap: wrap !important; gap: 12px !important; }
  .cpc-hero-buttons > * { flex: 1 1 auto !important; min-width: 140px !important; }
  .cpc-hero-footer { grid-template-columns: 1fr 1fr !important; gap: 16px !important; padding-top: 20px !important; }
  .cpc-hero-footer > *:nth-child(2) { display: none !important; }
  .cpc-hero-footer > *:nth-child(4) { display: none !important; }

  /* Big displays should shrink */
  .cpc-display-xl { font-size: clamp(40px, 11vw, 64px) !important; letter-spacing: 2px !important; }
  .cpc-display-lg { font-size: clamp(32px, 9vw, 48px) !important; letter-spacing: 2px !important; }
  .cpc-display-md { font-size: clamp(26px, 7vw, 36px) !important; letter-spacing: 1.5px !important; }

  /* Cards / large stacked cards */
  .cpc-row-services-card { padding: 32px 20px !important; gap: 18px !important; }

  /* Footer */
  .cpc-footer-cta { grid-template-columns: 1fr !important; gap: 24px !important; padding-bottom: 40px !important; }
  .cpc-footer-cols {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px 24px !important;
    padding: 40px 0 !important;
  }
  .cpc-footer-cols > *:first-child { grid-column: 1 / -1 !important; }
  .cpc-footer-meta { padding-top: 16px !important; }

  /* Costco bands */
  .cpc-costco-band > * h2,
  .cpc-costco-band-home h3 { font-size: clamp(28px, 8vw, 40px) !important; }

  /* Service detail */
  .cpc-spec-cells { grid-template-columns: repeat(2, 1fr) !important; }
  .cpc-spec-cells > * { padding: 20px 12px !important; }

  /* Treats grid → single column */
  .cpc-treats-grid { grid-template-columns: 1fr !important; }
  .cpc-treats-grid > * { border-left: 0 !important; padding-left: 0 !important; padding-right: 0 !important; border-top: 1px solid var(--hairline) !important; }

  /* Equipment list → 2 cols, drop status */
  .cpc-equip-row { grid-template-columns: 32px 1fr !important; }
  .cpc-equip-row .cpc-equip-status { display: none !important; }
  .cpc-equip-row .cpc-equip-model { grid-column: 2 / 3 !important; }

  /* Booking date / time grids */
  .cpc-book-days { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }
  .cpc-book-times { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }

  /* Buttons should grow naturally */
  .cpc-cta-row { flex-wrap: wrap !important; gap: 12px !important; }
  .cpc-cta-row > * { flex: 0 1 auto !important; }

  /* Testimonial cards */
  .cpc-testimonial-card { padding: 28px 20px !important; }
  .cpc-testimonial-quote { font-size: 17px !important; line-height: 1.5 !important; }

  /* Process steps */
  .cpc-step { grid-template-columns: 1fr !important; gap: 14px !important; padding: 28px 0 !important; }

  /* Practitioner teaser */
  .cpc-practitioner { grid-template-columns: 1fr !important; gap: 32px !important; }
  .cpc-practitioner > div:first-child { aspect-ratio: 4 / 5 !important; }

  /* Wide testimonial title row */
  .cpc-section-head { grid-template-columns: 1fr !important; gap: 16px !important; margin-bottom: 32px !important; align-items: start !important; }

  /* Reviews link CTA row */
  .cpc-reviews-cta { justify-content: flex-start !important; margin-top: 24px !important; }

  /* Nav */
  .cpc-nav-grid { grid-template-columns: 1fr auto !important; padding: 0 16px !important; }
  .cpc-nav-center { justify-self: start !important; }
  .cpc-nav-right { display: none !important; }

  /* Megastrip wordmark */
  .cpc-megastrip { padding: 32px 0 24px !important; }
}

/* ---------- MOBILE DRAWER (always present, hidden by default) ---------- */
.cpc-mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.cpc-mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.cpc-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(92vw, 420px);
  background: var(--canvas);
  border-left: 1px solid var(--hairline);
  z-index: 210;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 80px 32px 40px;
  gap: 8px;
}
.cpc-mobile-drawer.open { transform: translateX(0); }
.cpc-mobile-drawer a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cpc-mobile-drawer a.is-sub {
  font-family: var(--font-text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--body);
  padding: 12px 0 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.cpc-mobile-drawer a:hover { opacity: 0.7; }
.cpc-mobile-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cpc-nav-mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  align-items: center;
  justify-content: center;
}
.cpc-mobile-cta {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- HORIZONTAL OVERFLOW GUARD ---------- */
html, body { max-width: 100vw; overflow-x: hidden; }
img, video { max-width: 100%; }

/* ---------- HEADING WRAP GUARD ----------
   Display headings often sit inside grid/flex containers with
   justify-items:center or align:end, which size the item to its
   max-content width. On narrow screens that makes a long heading
   wider than the viewport — and the overflow-x:hidden guard then
   CLIPS it (the "cut off" text). Forcing max-width + wrapping makes
   them break to multiple lines instead of being clipped. */
@media (max-width: 1024px) {
  h1, h2, h3,
  .cpc-display-xl, .cpc-display-lg, .cpc-display-md, .cpc-hero-h1 {
    max-width: 100% !important;
    overflow-wrap: break-word;
    min-width: 0;
  }
}
@media (max-width: 640px) {
  /* tighten tracking so long uppercase words fit the line */
  .cpc-display-xl, .cpc-display-lg, .cpc-hero-h1 { letter-spacing: 1px !important; }
  /* let the long footer / location meta line wrap instead of clipping */
  .cpc-footer-meta span,
  .cpc-megastrip span { white-space: normal !important; }
}

/* ---------- LARGER TOUCH TARGETS ---------- */
@media (max-width: 1024px) {
  button, a { min-height: 0; }
}
