/* Dream Greener – mobile layout overrides (load AFTER styles.css).
   Goal: less vertical scrolling on phones.
   - Services, reviews and gallery become swipeable rows (CSS scroll-snap, no library).
   - "How can we help?" quote cards sit side by side.
   - "Why choose us" features become a compact 2 x 2 grid.
   Desktop/tablet layouts are untouched (everything is inside max-width:640px). */

/* Arrows only appear on phones */
.swipe-arrow { display: none; }

@media (max-width: 640px) {

  /* ---------- Left / right arrows (added by mobile.js) ---------- */
  .swipe-wrap { position: relative; }
  .swipe-arrow {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 38px; height: 38px; padding: 0; border-radius: 999px;
    border: 1px solid rgba(27, 42, 30, .12);
    background: #fff; color: #1b2a1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    cursor: pointer; transition: opacity .2s ease;
  }
  .swipe-arrow--prev { left: -6px; }
  .swipe-arrow--next { right: -6px; }
  .swipe-arrow--next svg { transform: rotate(180deg); }
  .swipe-arrow[hidden] { display: none; }
  .swipe-arrow:disabled { opacity: 0; pointer-events: none; }
  .swipe-arrow:focus-visible { outline: 3px solid #9cc256; outline-offset: 2px; }

  /* ---------- Shared swipe row ---------- */
  body .swipe {
    display: flex !important;
    grid-template-columns: none !important;
    columns: auto !important;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 2px 2px 6px;
    margin-bottom: 0;
  }
  body .swipe::-webkit-scrollbar { display: none; }
  body .swipe > * {
    flex: 0 0 84%;            /* next card peeks in so people know to swipe */
    max-width: 84%;
    scroll-snap-align: start;
    margin: 0 !important;
    break-inside: auto;
  }

  /* ---------- Services (image 1) ---------- */
  body .grid-4.swipe > .service-card { flex-basis: 78%; max-width: 78%; display: flex; flex-direction: column; }
  body .grid-4.swipe .service-card__img img { aspect-ratio: 4 / 3; height: auto; width: 100%; object-fit: cover; }
  body .grid-4.swipe .service-card__body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
  body .grid-4.swipe .service-card__body h3 { margin: 0 0 6px; }
  body .grid-4.swipe .service-card__body p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
  body .grid-4.swipe .service-card__body .text-link { margin-top: auto; }

  /* ---------- Gallery (image 2): featured, full-bleed-style photo swiper ---------- */
  body .gallery.swipe > figure {
    flex-basis: 88%; max-width: 88%;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .14);
  }
  body .gallery.swipe img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; display: block; }
  body .section--paper .section-head .lead { font-size: 16px; }

  /* ---------- Reviews (home + testimonial page) ---------- */
  /* Each review card is only as tall as its own text (no empty gap above the name) */
  body .grid-3.swipe,
  body .masonry.swipe { align-items: flex-start; }
  body .grid-3.swipe > .review,
  body .masonry.swipe > .review { flex-basis: 86%; max-width: 86%; height: auto; }
  body .swipe > .review blockquote { margin: 0 0 14px; }

  /* ---------- Swipe dots (added by mobile.js) ---------- */
  .swipe-dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; padding: 0; }
  .swipe-dots button {
    width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px;
    background: currentColor; opacity: .25; cursor: pointer;
    transition: width .2s ease, opacity .2s ease;
  }
  /* bigger invisible tap target without changing the look */
  .swipe-dots button { position: relative; }
  .swipe-dots button::after { content: ""; position: absolute; inset: -10px -6px; }
  .swipe-dots button[aria-current="true"] { width: 22px; opacity: .9; }

  /* ---------- "How can we help?" – side by side (image 3) ---------- */
  body .grid-2.paths {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px;
  }
  body .paths .path-card {
    padding: 16px 12px;
    border-radius: 16px;
    display: flex; flex-direction: column;
  }
  body .paths .path-card h3 { font-size: 17px; line-height: 1.2; margin: 0 0 6px; }
  body .paths .path-card p  { font-size: 13px; line-height: 1.45; margin: 0 0 12px; flex: 1; }
  body .paths .path-card .btn {
    width: 100%;
    white-space: normal;
    font-size: 13.5px;
    line-height: 1.25;
    padding: 11px 10px;
    min-height: 48px;
    text-align: center;
    justify-content: center;
  }
  body .section--dark .section-head .lead { font-size: 15px; }

  /* ---------- "Why choose us" – compact 2 x 2 ---------- */
  body .grid-4.features {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px;
  }
  body .features .feature { padding: 14px 12px; }
  body .features .feature__icon { width: 36px; height: 36px; margin-bottom: 8px; }
  body .features .feature__icon svg { width: 20px; height: 20px; }
  body .features .feature h3 { font-size: 15px; line-height: 1.25; margin: 0 0 4px; }
  body .features .feature p  { font-size: 13px; line-height: 1.45; margin: 0; }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  body .swipe { scroll-behavior: auto; }
}

/* ---------- Sticky call / quote bar (mobile) ---------- */
@keyframes dg-quote-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(156, 194, 86, .65), 0 0 14px 2px rgba(156, 194, 86, .45); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(156, 194, 86, 0),  0 0 26px 8px rgba(156, 194, 86, .75); }
}
@keyframes dg-fade-up {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes dg-icon-pop {
  0%   { transform: scale(.6) rotate(-12deg); }
  60%  { transform: scale(1.15) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (max-width: 640px) {
  /* No white strip behind the buttons – they float over the page */
  body .mobile-bar {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Call button gets its own background so it stays readable while floating */
  body .mobile-bar .btn--outline {
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  }
  /* Free Quote: zooms in and out with a glowing edge */
  body .mobile-bar .btn--primary {
    animation: dg-quote-pulse 2s ease-in-out infinite;
    will-change: transform, box-shadow;
  }

  /* "Why choose us" – boxes fade up one after another as they scroll into view */
  .dg-anim .features .feature { opacity: 0; }
  .dg-anim .features .feature.is-visible { animation: dg-fade-up .6s cubic-bezier(.2, .7, .2, 1) both; }
  .dg-anim .features .feature.is-visible .feature__icon { animation: dg-icon-pop .6s .15s cubic-bezier(.2, .7, .2, 1) both; }
  .dg-anim .features .feature:nth-child(2).is-visible { animation-delay: .12s; }
  .dg-anim .features .feature:nth-child(3).is-visible { animation-delay: .24s; }
  .dg-anim .features .feature:nth-child(4).is-visible { animation-delay: .36s; }
}

/* Respect people who turn off motion on their phone */
@media (prefers-reduced-motion: reduce) {
  body .mobile-bar .btn--primary { animation: none; box-shadow: 0 0 18px 4px rgba(156, 194, 86, .6); }
  .dg-anim .features .feature { opacity: 1 !important; animation: none !important; }
  .dg-anim .features .feature__icon { animation: none !important; }
}
