/* Chilliwack Children's Dentistry — shared responsive layer.
   Loaded on every page alongside the page's own inline styles.
   Inline styles set the desktop design; the rules below adapt it
   for tablet/mobile and add the mobile nav + touch-friendly dropdown. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, iframe { max-width: 100%; }

/* ---------- header / primary nav ---------- */
.ccd-header { position: relative; z-index: 200; }

/* On wide monitors the 1600px content cap left a large empty gutter
   beside the header/hero/section content. Widen every page's header,
   footer and main content layout the same amount, so the gutter is
   unified site-wide. Paragraph text inside the article/contact
   layouts is un-capped right below so it fills that same width
   instead of leaving a gap beside it (see next rule). Mobile/tablet
   (below 1025px) is untouched. */
@media (min-width: 1025px) {
  .ccd-header,
  .ccd-footer,
  .ccd-article-grid,
  .ccd-contact-grid,
  .ccd-hero-inner,
  .ccd-services-grid,
  .ccd-doctor-band,
  .ccd-reviews-faq,
  .ccd-cta-band {
    max-width: 1920px !important;
  }

  /* Article/contact page paragraphs were capped at ~600-640px for
     reading comfort, which looked fine at the old 1600px cap but left
     an increasingly large dead gap beside the (already full-width)
     photos as the container above got wider. Match the text to the
     column width instead. The outer grid's own 1920px cap still
     bounds how long a line can get even on very wide monitors. */
  .ccd-article-grid p,
  .ccd-contact-grid p {
    max-width: none !important;
  }
}

.ccd-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  flex: none;
}
.ccd-nav-toggle svg { width: 26px; height: 26px; display: block; }

.ccd-nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(61, 42, 20, .35);
  z-index: 150;
}

/* Services dropdown: click-to-open on all devices (works for touch,
   still opens on hover for mouse users via the page's own :hover rule). */
.ccd-dd.ccd-dd-open .ccd-dd-menu { display: block; }

@media (max-width: 1024px) {
  .ccd-header { padding-left: 20px !important; padding-right: 20px !important; }

  .ccd-nav-toggle { display: inline-flex; }

  .ccd-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw);
    background: #fff;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 84px 28px 28px;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: -12px 0 32px rgba(61,42,20,.18);
  }
  body.ccd-nav-open .ccd-nav { transform: translateX(0); }
  body.ccd-nav-open .ccd-nav-scrim { display: block; }
  body.ccd-nav-open { overflow: hidden; }

  .ccd-nav > a,
  .ccd-nav > .ccd-dd > a:first-child {
    width: 100%;
    padding: 15px 4px !important;
    border-bottom: 1px solid #efe9dc;
    font-size: 17px !important;
  }
  .ccd-nav > a:last-of-type { border-bottom: none; }

  .ccd-nav > .ccd-dd { width: 100%; }
  .ccd-nav .ccd-dd-menu {
    display: none;
    position: static;
    transform: none;
    padding-top: 0;
  }
  .ccd-nav .ccd-dd.ccd-dd-open .ccd-dd-menu { display: block; }
  .ccd-nav .ccd-dd-inner {
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 4px 0 4px 14px;
    min-width: 0;
  }
  .ccd-nav .ccd-dd-inner a { padding: 12px 8px; font-size: 15.5px; white-space: normal; }

  .ccd-nav a[href^="tel:"] {
    text-align: center;
    margin-top: 14px;
    border: 2px solid #572806 !important;
  }
  .ccd-nav a[style*="background:#572806"] {
    text-align: center;
    margin-top: 10px;
  }
}

/* ---------- footer ---------- */
@media (max-width: 640px) {
  .ccd-footer {
    flex-direction: column !important;
    text-align: center;
    gap: 14px;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  .ccd-footer > div { justify-content: center; flex-wrap: wrap; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .ccd-footer { padding-left: 28px !important; padding-right: 28px !important; }
}

/* ---------- article / sidebar layout ---------- */
@media (max-width: 1024px) {
  .ccd-article-grid {
    grid-template-columns: 1fr !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    gap: 40px !important;
  }
  .ccd-sidebar { position: static !important; }

  .ccd-contact-grid {
    grid-template-columns: 1fr !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  .ccd-intro-band { padding-left: 20px !important; padding-right: 20px !important; }
}

/* ---------- generic content grids ---------- */
@media (max-width: 760px) {
  .ccd-grid-2, .ccd-grid-3 {
    grid-template-columns: 1fr !important;
  }
}
@media (min-width: 761px) and (max-width: 1024px) {
  .ccd-grid-3 { grid-template-columns: 1fr 1fr !important; }
}

/* ---------- doctor / meet-the-dentist band ---------- */
@media (max-width: 700px) {
  .ccd-doctor-band {
    grid-template-columns: 1fr !important;
    padding: 26px !important;
  }
  /* the "object-position:top" crop was tuned for the desktop card
     (260x300, close to the photo's own portrait ratio); squeezing the
     same photo into a much shorter, full-width mobile box left mostly
     blank headroom showing instead of Dr. Anu's face. Taller box +
     a lower focal point keeps the face in frame and centered. */
  .ccd-doctor-band img {
    height: 300px !important;
    object-position: center 20% !important;
  }
}

/* ---------- CTA strip ---------- */
@media (max-width: 640px) {
  .ccd-cta-strip {
    padding: 30px 26px !important;
    text-align: center;
    justify-content: center !important;
  }
  .ccd-cta-strip > div { text-align: center; }
}

/* ---------- headline sizing ---------- */
@media (max-width: 640px) {
  .ccd-h1 { font-size: 36px !important; }
}

/* ---------- home page hero ---------- */
@media (max-width: 1024px) {
  .ccd-hero-inner {
    grid-template-columns: 1fr !important;
    padding: 48px 32px 40px !important;
  }
  .ccd-hero-gallery {
    order: -1;
    width: 100%;
    max-width: 460px;
    margin: 0 auto 32px;
  }
  /* the collage was built from fixed 262px-wide columns/photos for the
     desktop canvas; make them fluid so they fill the mobile column
     instead of floating as a narrow strip with empty space beside it */
  .ccd-hero-col {
    width: auto !important;
    height: auto !important;
    flex: 1 1 0 !important;
    min-width: 0;
  }
  .ccd-hero-col > div {
    width: 100% !important;
    height: 300px !important;
  }
  .ccd-hero-col > div + div {
    height: 210px !important;
  }
}
@media (max-width: 640px) {
  .ccd-hero-inner { padding: 36px 20px 32px !important; }
  .ccd-hero h1 { font-size: 38px !important; }
  .ccd-hero-inner p { font-size: 16px !important; }
  .ccd-hero-ctas { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; }
  .ccd-hero-ctas a { text-align: center; }
  .ccd-hero-stats { flex-direction: column !important; gap: 12px !important; margin-top: 28px !important; }
  /* one clean full-width photo reads better on a phone than a cropped
     four-photo collage; also drop the decorative 3D tooth/sparkle
     layer so it doesn't clutter the now much-shorter hero */
  .ccd-3d { display: none; }
  .ccd-hero-gallery { max-width: 320px; margin: 0 auto 28px; }
  .ccd-hero-gallery .ccd-hero-col:last-child { display: none !important; }
  .ccd-hero-col > div + div { display: none !important; }
  .ccd-hero-col > div { height: 240px !important; }
}

@media (max-width: 1024px) {
  .ccd-services-grid {
    grid-template-columns: 1fr !important;
    padding: 56px 32px 64px !important;
  }
  .ccd-services-grid .ccd-services-intro { position: static !important; }
  .ccd-service-row { grid-template-columns: 44px 1fr !important; }
  .ccd-service-row .ccd-service-name { grid-column: 2; }
  .ccd-service-row .ccd-service-blurb { grid-column: 1 / -1; }

  .ccd-reviews-faq {
    grid-template-columns: 1fr !important;
    padding: 56px 32px !important;
  }
}
@media (max-width: 640px) {
  .ccd-services-grid { padding: 44px 20px 48px !important; }
  .ccd-reviews-faq { padding: 48px 20px !important; }
}

@media (max-width: 900px) {
  .ccd-cta-band {
    grid-template-columns: 1fr !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
  }
}
@media (max-width: 640px) {
  .ccd-cta-band { padding: 48px 20px !important; }
  .ccd-cta-facts { flex-direction: column !important; gap: 14px !important; }
  .ccd-form-row-2 { grid-template-columns: 1fr !important; }
  #book form { padding: 28px 22px !important; }
}

/* ---------- global side-padding relief on small screens ---------- */
@media (max-width: 640px) {
  .ccd-px-72 { padding-left: 20px !important; padding-right: 20px !important; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .ccd-px-72 { padding-left: 32px !important; padding-right: 32px !important; }
}
