/* ==========================================================================
   media.css — responsive layer for MS Park Construction.
   Loaded after style.css (the fixed 1920px desktop "canvas").

   Breakpoint plan:  1920 | 1536 | 1440 – 1280 | 1024 – 768 | 475 – 360

   Strategy
   --------
   • 1025–1919px  : the pixel-perfect 1920 canvas is proportionally scaled with
                    `zoom`, tuned so the named widths (1536/1440/1280) render
                    full-bleed. Layout is left-aligned so the fixed header keeps
                    aligning with the content.
   • ≤1024px      : the canvas is dropped (zoom:1) and the design reflows fluidly
                    (tablet → 2 columns, mobile → 1 column).
   ========================================================================== */

/* ==========================================================================
   1) DESKTOP — scale the fixed canvas (full-bleed at 1536 / 1440 / 1280)
   ========================================================================== */
@media (min-width: 1681px) and (max-width: 1919px) {
  body { zoom: 0.875; }
}

@media (min-width: 1536px) and (max-width: 1680px) {
  body { zoom: 0.8; } /* 1920 × 0.8 = 1536 → full-bleed at 1536 */
}

@media (min-width: 1440px) and (max-width: 1535px) {
  body { zoom: 0.75; } /* 1920 × 0.75 = 1440 → full-bleed at 1440 */
}

@media (min-width: 1280px) and (max-width: 1439px) {
  body { zoom: 0.6667; } /* 1920 × 0.6667 ≈ 1280 → full-bleed at 1280 */
}

@media (min-width: 1025px) and (max-width: 1279px) {
  body { zoom: 0.5333; } /* bridge 1279→1024 before the tablet reflow */
}

/* ==========================================================================
   2) TABLET — 1024px down to 768px: fluid reflow, two-column grids
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --pad: 32px;
    --content: 100%;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body {
    zoom: 1; /* cancel any inherited desktop scaling */
  }

  .site-header,
  .hero,
  .hero-grid,
  .hero-actions,
  .about-section,
  .partners-section,
  .projects-section,
  .progress-section,
  .contact-section,
  .site-footer {
    width: 100%;
  }

  .about-section,
  .partners-section,
  .projects-section,
  .progress-section,
  .contact-section,
  .site-footer {
    height: auto;
  }

  /* Header stays inline (fits at ≥768) but tighter. */
  .site-header {
    height: 72px;
    padding: 0 24px;
  }

  .nav {
    font-size: 15px;
  }

  .nav-left ul {
    gap: 24px;
  }

  .nav-right ul {
    gap: 20px;
  }

  .brand,
  .brand img {
    width: 220px;
  }

  /* Hero → 2×2 image grid filling the band. */
  .hero {
    height: 560px;
  }

  .hero-grid,
  .hero-actions {
    height: 560px;
  }

  .hero-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
    background: #111;
  }

  .hero-grid img:nth-child(1),
  .hero-grid img:nth-child(2),
  .hero-grid img:nth-child(3),
  .hero-grid img:nth-child(4) {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .hero-subcontractor {
    left: 24px;
    bottom: 28px;
    width: auto;
    min-width: 360px;
    height: 68px;
    min-height: 68px;
  }

  .hero-project-card {
    right: 24px;
    bottom: 28px;
  }

  /* About keeps two columns, softened. */
  .about-row,
  .about-row-first {
    min-height: 0;
  }

  .about-image {
    min-height: 340px;
  }

  .about-copy {
    padding: 48px 32px;
  }

  .about-copy h1,
  .about-copy h2,
  .projects-section h2,
  .progress-section h2,
  .contact-panel h2,
  .partners-section h2,
  .section-head h2 {
    font-size: clamp(34px, 4.6vw, 44px);
  }

  .about-copy p {
    font-size: 18px;
  }

  /* Partners. */
  .partners-section {
    padding: 56px 0 96px;
  }

  .photo-track img {
    width: 320px;
    height: 360px;
  }

  .partner-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-left: 24px;
    margin-right: 24px;
  }

  .partner-grid div {
    min-height: 170px;
  }

  /* Projects / progress → two columns. */
  .projects-section,
  .progress-section {
    padding: 42px 24px 70px;
  }

  .section-head {
    margin-bottom: 28px;
  }

  .section-head > p {
    margin-top: 24px;
    font-size: 18px;
  }

  .project-grid,
  .progress-track {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
  }

  .project-card,
  .project-card img {
    min-height: 0;
    height: 380px;
  }

  .progress-carousel {
    max-width: none;
  }

  /* Contact panel leaves the absolute 1920 frame and flows. */
  .contact-section {
    height: auto;
  }

  .contact-bg {
    position: absolute;
    inset: 0;
  }

  .contact-panel {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    max-width: 760px;
    height: auto;
    margin: 48px 24px;
    padding: 36px 32px 40px;
  }

  .contact-panel .eyebrow,
  .contact-panel h2,
  .contact-intro,
  .contact-intro:nth-of-type(2),
  .contact-intro:nth-of-type(3),
  .contact-panel h3,
  .contact-form {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    height: auto;
  }

  .contact-panel h2 {
    margin-top: 12px;
  }

  .contact-intro {
    margin-top: 16px;
  }

  .contact-panel h3 {
    margin-top: 24px;
  }

  .contact-form {
    margin-top: 20px;
  }

  .contact-logo {
    display: none;
  }

  /* Footer keeps three columns at tablet, tighter gutters. */
  .site-footer {
    gap: 40px;
    padding: 48px 24px 40px;
  }
}

/* Narrow tablets / large phones (≤900): drop project grids to a single column
   so cards don't get too cramped before the mobile breakpoint. */
@media (max-width: 900px) {
  .partner-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   3) MOBILE — 767px down to 360px: single column, burger menu
   ========================================================================== */
@media (max-width: 767px) {
  :root {
    --pad: 20px;
    --content: 100%;
  }

  /* Header → fixed bar with a burger that reveals the primary menu. */
  .site-header {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    width: 100vw;
    padding: 0 18px;
    background: rgba(84, 86, 90, 0.92);
  }

  .brand{
    position: static;
    transform: none;
  }

  .brand,
  .brand img {
    width: 188px;
    height: auto;
  }

  .nav {
    font-size: 13px;
    line-height: 1.15;
    letter-spacing: -0.13px;
  }

  .menu-toggle {
    position: fixed;
    top: 20px;
    left: clamp(232px, calc(100vw - 56px), 336px);
    z-index: 1002;
    display: inline-flex;
    width: 34px;
    height: 30px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 0;
    background: transparent;
  }

  .menu-toggle span {
    display: block;
    width: 34px;
    height: 2px;
    background: var(--white);
    transition: transform var(--ease), opacity var(--ease);
  }

  .site-header.menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .site-header.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .site-header.menu-open .menu-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .nav-left {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 72px;
    display: none;
    padding: 18px 0 22px;
    background: rgba(84, 86, 90, 0.96);
  }

  .nav-left ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .site-header.menu-open {
    height: 244px;
  }

  .site-header.menu-open .nav-left {
    display: block;
  }

  .nav-right {
    display: none;
  }

  /* Hero collapses to a single cover image. */
  .hero,
  .hero-grid,
  .hero-actions {
    height: 320px;
  }

  .hero {
    overflow: hidden;
    background: #111;
  }

  .hero-grid {
    display: block;
    grid-template-columns: none;
    background: #111;
  }

  .hero-grid img {
    display: none;
  }

  .hero-grid img:nth-child(1) {
    display: block;
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .hero-overlay {
    background: rgba(38, 38, 38, 0.28);
  }

  .hero-subcontractor {
    left: 20px;
    bottom: 24px;
    width: calc(100% - 40px);
    min-width: 0;
    height: 64px;
    min-height: 64px;
    padding: 0 24px;
    justify-content: space-between;
    font-size: 22px;
  }

  .hero-project-card {
    display: none;
  }

  /* About → stacked; image always on top regardless of side. */
  .about-section {
    height: auto;
  }

  .about-row,
  .about-row-first {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .about-row-image-right {
    flex-direction: column-reverse;
  }

  .about-image {
    height: 280px;
    min-height: 0;
  }

  .about-copy,
  .about-copy-left,
  .about-copy-right {
    padding: 40px 20px;
  }

  .about-copy h1,
  .about-copy h2,
  .projects-section h2,
  .progress-section h2,
  .contact-panel h2,
  .partners-section h2,
  .section-head h2 {
    font-size: 32px;
    line-height: 1.08;
  }

  .about-copy p,
  .section-head > p,
  .project-card p,
  .contact-intro,
  .site-footer address,
  .site-footer a {
    font-size: 16px;
    line-height: 1.45;
  }

  .button {
    font-size: 20px;
  }

  /* Partners. */
  .partners-section {
    padding: 42px 0 56px;
  }

  .photo-carousel {
    margin-bottom: 40px;
  }

  .photo-track {
    gap: 16px;
    padding: 0;
  }

  .photo-track img {
    width: min(78vw, 320px);
    height: 260px;
  }

  .carousel-button {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .carousel-prev {
    left: 12px;
  }

  .carousel-next {
    right: 12px;
  }

  .partners-section .eyebrow {
    font-size: 16px;
  }

  .partners-section h2 {
    margin-top: 14px;
    padding: 0 20px;
  }

  .partner-grid {
    grid-template-columns: repeat(2, 1fr);
    margin: 36px 20px 0;
  }

  .partner-grid div {
    min-height: 132px;
  }

  .partner-grid img {
    top: 0;
    left: 0 !important;
    width: 108px;
    height: auto;
  }

  /* Projects / progress → single column. */
  .projects-section,
  .progress-section {
    padding: 42px 20px 64px;
  }

  .section-head {
    display: block;
    margin: 0 0 26px;
  }

  .section-head h2 {
    margin-top: 12px;
  }

  .section-head > p {
    margin-top: 14px;
  }

  .project-grid,
  .progress-track {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .project-card,
  .project-card img {
    height: 300px;
  }

  .project-size {
    top: 14px;
    right: 14px;
    font-size: 18px;
  }

  .project-card > div {
    left: 16px;
    right: 16px;
    bottom: 20px;
  }

  .project-card h3 {
    font-size: 24px;
  }

  .load-more,
  .projects-section .load-more,
  .progress-section .load-more {
    width: 100%;
    height: 62px;
    min-height: 62px;
    margin: 22px 0 0;
    padding-left: 0;
    justify-content: center;
  }

  /* Contact. */
  .contact-section {
    height: auto;
  }

  .contact-panel {
    margin: 36px 20px;
    padding: 30px 20px 34px;
    max-width: none;
  }

  .contact-panel h2 {
    margin-top: 12px;
  }

  .contact-intro {
    margin-top: 16px;
  }

  .contact-intro + .contact-intro {
    margin-top: 8px;
  }

  .contact-panel h3 {
    margin-top: 24px;
  }

  .contact-form {
    margin-top: 20px;
  }

  /* Footer → single column. */
  .site-footer {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 36px 20px 40px;
  }

  .footer-col h2 {
    font-size: 18px;
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  .site-footer p {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .site-footer p:not(:first-of-type) {
    margin-top: 22px;
  }

  .site-footer a {
    margin-bottom: 14px;
  }

  .footer-logo {
    width: min(100%, 340px);
    height: auto;
    margin-top: 28px;
  }
}

/* ==========================================================================
   4) SMALL PHONES — 475px down to 360px: final tightening
   ========================================================================== */
@media (max-width: 475px) {
  :root {
    --pad: 16px;
  }

  .site-header {
    height: 64px;
    padding: 0 16px;
  }

  .brand,
  .brand img {
    width: 160px;
  }

  .menu-toggle {
    top: 18px;
    left: auto;
    right: 16px;
  }

  .nav-left {
    left: 12px;
    right: 12px;
    top: 64px;
  }

  .site-header.menu-open {
    height: 232px;
  }

  .hero,
  .hero-grid,
  .hero-actions {
    height: 260px;
  }

  /* Single mobile background image from the ACF field (overlay stays). */
  .hero-grid {
    background-image: var(--hero-mobile-bg, none);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
  }

  .hero-grid img,
  .hero-grid img:nth-child(1) {
    display: none;
  }

  .hero-subcontractor {
    left: 16px;
    bottom: 18px;
    width: calc(100% - 32px);
    height: 56px;
    min-height: 56px;
    padding: 0 18px;
    font-size: 18px;
  }

  .about-copy,
  .about-copy-left,
  .about-copy-right {
    padding: 32px 16px;
  }

  .about-copy h1,
  .about-copy h2,
  .projects-section h2,
  .progress-section h2,
  .contact-panel h2,
  .partners-section h2,
  .section-head h2 {
    font-size: 27px;
  }

  .about-image {
    height: 220px;
  }

  .photo-track img {
    width: 84vw;
    height: 220px;
  }

  .partner-grid {
    margin: 28px 16px 0;
  }

  .partner-grid div {
    min-height: 112px;
  }

  .partner-grid img {
    width: 92px;
  }

  .projects-section,
  .progress-section {
    padding: 36px 16px 56px;
  }

  .project-card,
  .project-card img {
    height: 260px;
  }

  .project-card h3 {
    font-size: 21px;
  }

  .contact-panel {
    margin: 28px 16px;
    padding: 24px 16px 28px;
  }

  .site-footer {
    padding: 32px 16px 36px;
  }

  .contact-section{
    padding: 36px 0;
  }

  .footer-logo{
    order: -1;
    margin-bottom: 40px;
  }
}

/* ==========================================================================
   5) CONTACT FORM — single column + full-width buttons on small screens
   ========================================================================== */
@media (max-width: 767px) {
  .contact-form .frm_fields_container {
    gap: 22px;
  }

  .contact-form .frm_form_field.frm6 {
    width: 100%;
  }

  .contact-form input[type="text"],
  .contact-form input[type="email"],
  .contact-form input[type="tel"],
  .contact-form input[type="url"],
  .contact-form input[type="number"],
  .contact-form input[type="password"],
  .contact-form select,
  .contact-form textarea {
    font-size: 16px;
  }

  .contact-form .frm_submit {
    flex-wrap: wrap;
    gap: 14px 18px;
    margin-top: 26px;
  }

  .contact-form .frm_button_submit {
    min-width: 0;
    width: 100%;
    height: 58px;
    font-size: 22px;
  }

  .contact-form .frm-page-counter {
    font-size: 18px;
  }
}

/* ==========================================================================
   6) TEXT SECTION — responsive padding / type
   ========================================================================== */
@media (max-width: 1024px) {
  .text-section {
    padding: 72px 32px;
  }

  .text-body {
    font-size: 18px;
  }
}

@media (max-width: 767px) {
  .text-section {
    padding: 56px 20px;
  }

  .text-title {
    font-size: 32px;
    line-height: 1.08;
  }

  .text-body {
    margin-top: 18px;
    font-size: 16px;
  }
}
