/* Large desktop: add breathing room without letting lines become too wide. */
@media (min-width: 1440px) {
  :root {
    --container: 1280px;
    --section-space: 8rem;
  }

  .project-masonry.expanded {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  }
}

/* Laptop and small desktop refinement. */
@media (max-width: 1200px) {
  .service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* 1024px tablets and compact laptops. */
@media (max-width: 1024px) {
  :root {
    --section-space: 5.5rem;
    --button-height: 3rem;
    --button-x: 1.2rem;
  }

  .nav-links {
    gap: 18px;
  }

  .split-grid,
  .about-grid,
  .contact-grid {
    gap: 2.5rem;
  }

  .service-grid,
  .service-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-masonry,
  .project-masonry.expanded {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }

  .hero-video {
    background-image:
      radial-gradient(circle at 74% 22%, rgba(198, 167, 107, 0.14), transparent 34%),
      linear-gradient(135deg, rgba(6, 21, 16, 0.34), rgba(16, 41, 29, 0.4)),
      url("assets/images/hero-tablet.jpeg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: background-position 0.3s ease;
  }

  .hero-video .hero-media {
    display: none;
  }
}

/* 768px and below: mobile navigation, stacked layouts, and touch-first spacing. */
@media (max-width: 768px) {
  :root {
    --gutter: 1rem;
    --section-space: 4.5rem;
    --header-height: 4.6rem;
    --button-height: 2.875rem;
    --button-x: 1.05rem;
    --icon-size: 1.7rem;
  }

  .site-header {
    background: rgba(7, 26, 19, 0.82);
    backdrop-filter: blur(16px);
  }

  .logo span:last-child {
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    right: var(--gutter);
    left: var(--gutter);
    display: grid;
    gap: 0.25rem;
    max-height: calc(100svh - var(--header-height) - 2rem);
    padding: 0.75rem;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(7, 26, 19, 0.97);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-links a {
    min-height: 50px;
    padding: 0 1rem;
    border-radius: 8px;
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(255, 255, 255, 0.08);
  }

  .hero {
    min-height: 100svh;
  }

  @supports (min-height: 100dvh) {
    .hero {
      min-height: 100dvh;
    }
  }

  .page-hero {
    min-height: 50svh;
  }

  .hero-overlay {
    background:
      linear-gradient(180deg, rgba(7, 26, 19, 0.88) 0%, rgba(9, 31, 22, 0.68) 48%, rgba(7, 26, 19, 0.74) 100%),
      radial-gradient(circle at 70% 22%, rgba(198, 167, 107, 0.12), transparent 34%);
  }

  .hero-media {
    object-fit: cover;
    object-position: center center;
    opacity: 0.82;
  }

  .hero-video {
    background-image:
      radial-gradient(circle at 70% 22%, rgba(198, 167, 107, 0.12), transparent 34%),
      linear-gradient(180deg, rgba(7, 26, 19, 0.2), rgba(7, 26, 19, 0.36)),
      url("assets/images/hero-mobile.jpeg");
    background-position: center center;
  }

  .hero-inner {
    min-height: inherit;
    padding-block: calc(var(--header-height) + 1.25rem) 3rem;
  }

  h1 {
    font-size: clamp(2.35rem, 10.5vw, 4.2rem);
  }

  h2 {
    font-size: clamp(2rem, 8vw, 3.1rem);
  }

  .hero p:not(.eyebrow),
  .page-hero p:not(.eyebrow),
  .lead,
  .section-copy p {
    font-size: 1rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .split-grid,
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .service-grid,
  .service-detail-grid,
  .value-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .project-masonry,
  .project-masonry.expanded {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 100%;
    padding: 0 var(--gutter);
  }

  .project-card,
  .project-card1,
  .before-after-card {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  .image-stack {
    order: -1;
  }

  .image-stack img {
    height: clamp(320px, 70vw, 460px);
  }

  .experience-badge {
    right: 1rem;
    bottom: 1rem;
    width: min(170px, 48vw);
    padding: 1.1rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 2rem clamp(1rem, 5vw, 2rem);
  }

  .footer-grid > div {
    min-width: 0;
  }

  .footer-grid h3 {
    margin-bottom: 0.7rem;
  }

  .footer-grid a,
  .footer-grid span,
  .footer-grid p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .footer-logo {
    max-width: 100%;
  }
}

/* 480px phones: single-column buttons and compact premium spacing. */
@media (max-width: 480px) {
  :root {
    --gutter: 0.875rem;
    --section-space: 4rem;
    --button-height: 2.75rem;
    --button-x: 0.95rem;
    --icon-size: 1.6rem;
  }

  .logo-mark {
    width: 40px;
    height: 40px;
  }

  .hero {
    min-height: 100svh;
  }

  @supports (min-height: 100dvh) {
    .hero {
      min-height: 100dvh;
    }
  }

  .hero-inner {
    padding-block: calc(var(--header-height) + 1rem) 2.5rem;
  }

  .hero-video {
    background-position: 48% center;
  }

  .logo span:last-child {
    max-width: 9.5rem;
  }

  .hero-actions,
  .contact-actions {
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
  }

  .btn {
    width: auto;
    max-width: 100%;
    min-height: var(--button-height);
    padding: 0 var(--button-x);
    font-size: 0.9rem;
  }

  .contact-form .btn {
    width: 100%;
  }

  .hero-actions .btn {
    width: min(100%, 18rem);
  }

  .section-heading {
    margin-bottom: 2rem;
  }

  .service-image,
  .detail-image,
  .project-card img,
  .project-card1 img,
  .project-card.wide img,
  .project-card.tall img,
  .project-card1.tall img {
    height: 240px;
  }

  .comparison {
    height: 300px;
  }

  .contact-panel,
  .contact-form {
    padding: 1.25rem;
  }

  .site-footer {
    padding-top: 3.5rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.55rem 0.9rem;
  }

  .footer-grid h3 {
    font-size: 0.88rem;
  }

  .footer-grid a,
  .footer-grid span,
  .footer-grid p {
    margin-bottom: 0.55rem;
    font-size: clamp(0.78rem, 3.4vw, 0.9rem);
    line-height: 1.55;
  }

  .footer-logo {
    gap: 0.55rem;
    margin-bottom: 0.8rem;
    font-size: clamp(0.78rem, 3.5vw, 0.92rem);
  }

  .footer-logo .logo-mark {
    width: 34px;
    height: 34px;
  }

  .footer-logo span:last-child {
    max-width: min(7.5rem, 30vw);
    white-space: normal;
  }

  .social-icons {
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
  }

  .social-icons a {
    width: 2.35rem;
    height: 2.35rem;
    margin-bottom: 0;
    font-size: 0.68rem;
  }

  .footer-bottom {
    margin-top: 2rem;
    padding: 1.1rem var(--gutter);
    font-size: 0.78rem;
    line-height: 1.55;
  }
}

/* 320px narrow phones: protect text and controls from overflow. */
@media (max-width: 360px) {
  :root {
    --gutter: 0.75rem;
    --button-height: 2.7rem;
    --button-x: 0.85rem;
    --icon-size: 1.5rem;
  }

  .logo span:last-child {
    max-width: 7.5rem;
  }

  .hero {
    min-height: 100svh;
  }

  .hero-video {
    background-position: 45% center;
  }

  @supports (min-height: 100dvh) {
    .hero {
      min-height: 100dvh;
    }
  }

  h1 {
    font-size: clamp(2.05rem, 12vw, 2.8rem);
  }

  h2 {
    font-size: clamp(1.85rem, 10vw, 2.35rem);
  }

  .service-card-content,
  .detail-card-content,
  .project-card div,
  .project-card1 div,
  .project-info,
  .stat-card {
    padding: 1.1rem;
  }

  .map-section iframe {
    height: 320px;
  }

  .site-footer {
    padding-top: 2.8rem;
  }

  .footer-grid {
    gap: 1.35rem 0.7rem;
  }

  .footer-grid h3 {
    font-size: 0.82rem;
  }

  .footer-grid a,
  .footer-grid span,
  .footer-grid p {
    font-size: clamp(0.72rem, 3.8vw, 0.82rem);
  }

  .footer-logo {
    align-items: flex-start;
  }

  .footer-logo .logo-mark {
    width: 30px;
    height: 30px;
  }

  .social-icons a {
    width: 2.1rem;
    height: 2.1rem;
  }
}

@media (max-width: 320px) {
  .nav-links a {
    min-height: 48px;
    padding: 0 0.85rem;
  }

  .hero-actions,
  .contact-actions {
    gap: 0.55rem;
  }

  .btn {
    font-size: 0.86rem;
  }

  .service-image,
  .detail-image,
  .project-card img,
  .project-card1 img,
  .project-card.wide img,
  .project-card.tall img,
  .project-card1.tall img {
    height: 220px;
  }
}
