/* ==========================================================================
   RES STONE MASONRY — Responsive overrides
   Breakpoints: >=1440 large desktop · 1200 desktop · 992 laptop/tablet-lg ·
   768 tablet · 576 mobile-lg · <576 mobile
   Fluid type/spacing (clamp) is handled in style.css — this file reworks
   LAYOUT (grid columns, stacking order, nav mode) per breakpoint.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Large desktop refinement (>=1440px) — slightly wider rhythm
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  :root {
    --container-max: 1440px;
  }
}

/* --------------------------------------------------------------------------
   Laptop / small desktop (<=1199px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .main-nav {
    gap: var(--space-md);
  }

  .nav-list {
    gap: var(--space-md);
  }

  .materials-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .about-media-secondary {
    width: 58%;
  }
}

/* --------------------------------------------------------------------------
   Tablet (<=991px) — collapse to mobile nav, simplify asymmetric grids
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .nav-list,
  .header-cta .btn-outline {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .about-split {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .about-heading {
    max-width: none;
  }

  .about-media {
    padding-right: 0;
    max-width: 30rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-tile--wide {
    grid-column: span 2;
  }

  .svc-card-grid,
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-layout {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .split {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .split-reverse .split-media {
    order: 0;
  }

  .materials-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .principles {
    grid-template-columns: repeat(2, 1fr);
  }

  .principle:nth-child(even) {
    padding-left: var(--space-md);
    border-left: var(--border-thin);
  }

  .principle:nth-child(odd) {
    padding-left: 0;
    border-left: none;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    row-gap: var(--space-xl);
  }

  /* Process: below desktop width the horizontal step-flow gets cramped —
     collapse to a stacked column and drop the connecting line entirely
     (rather than risk it ever crossing text at odd wrap points). */
  .process-row {
    flex-direction: column;
    gap: 0;
    max-width: 30rem;
    margin-inline: auto;
  }

  .process-line {
    display: none;
  }

  .process-step {
    padding-block: var(--space-lg);
  }

  .process-step:first-child {
    padding-top: 0;
  }

  .process-step:last-child {
    padding-bottom: 0;
  }

  .process-step + .process-step {
    border-top: var(--border-thin);
  }
}

/* --------------------------------------------------------------------------
   Tablet portrait / mobile-lg (<=767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .about-media-secondary {
    width: 62%;
  }

  .principles {
    grid-template-columns: 1fr;
  }

  .principle {
    padding-left: 0;
    border-left: none;
    border-top: var(--border-thin);
    padding-top: var(--space-md);
  }

  .principle:first-child {
    border-top: none;
    padding-top: 0;
  }

  .quote-form {
    grid-template-columns: 1fr;
  }

  .quote-form .form-field {
    grid-column: 1 / -1;
  }

  .svc-card-grid,
  .blog-grid {
    grid-template-columns: 1fr;
  }

  /* CTA: stacked, centered, kept compact (not the full section-pad height a
     full redesign might reach for) — text first, then phone + button. */
  .cta-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: var(--space-lg);
  }

  .cta-bar-text {
    max-width: none;
  }

  .cta-bar-action {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .cta-bar-phone {
    justify-content: center;
  }

  .final-cta .btn-primary {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --------------------------------------------------------------------------
   Mobile (<=575px)
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  :root {
    --section-pad: clamp(3.5rem, 3rem + 6vw, 5.5rem);
  }

  .brand-text span {
    display: none;
  }

  .eyebrow::before {
    width: 18px;
  }

  .about-media {
    padding-bottom: 1.5rem;
    max-width: none;
  }

  .about-media-secondary {
    width: 60%;
  }

  .about-index {
    font-size: 5rem;
  }

  .about-facts {
    gap: var(--space-md);
  }

  .materials-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2xs);
  }

  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }

  .floating-actions {
    bottom: 1rem;
  }

  .floating-actions--right {
    right: 1rem;
  }

  .floating-actions--left {
    left: 1rem;
  }

  .fab {
    width: 46px;
    height: 46px;
  }

  .lightbox-dialog {
    padding: var(--space-lg) var(--space-2xs);
    gap: var(--space-xs);
  }

  .lightbox-nav {
    width: 38px;
    height: 38px;
  }

  .lightbox-prev {
    left: var(--space-2xs);
  }

  .lightbox-next {
    right: var(--space-2xs);
  }

  .lightbox-close {
    width: 38px;
    height: 38px;
    top: var(--space-sm);
    right: var(--space-sm);
  }

  .lightbox-frame,
  .lightbox-frame img {
    max-height: 66vh;
  }

  .contact-map {
    aspect-ratio: 4 / 3;
  }
}

/* --------------------------------------------------------------------------
   Fine pointer only — disable hover-only interaction affordances on touch
   -------------------------------------------------------------------------- */
@media (hover: none) {
  .service-slide:hover .service-slide-media img,
  .gallery-tile:hover img,
  .material-tile:hover img {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Floating action buttons must never sit over content people need to tap —
   nudge above a mobile browser's own bottom UI safe area.
   -------------------------------------------------------------------------- */
@supports (bottom: env(safe-area-inset-bottom)) {
  .floating-actions {
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
  }
}
