/* ============================================================
   Mobile / responsive layer for Estevez Realtor site.
   Retrofits responsiveness onto an inline-styled static site.
   Rules use attribute selectors + !important to override the
   per-element inline styles. Desktop (>900px) is unaffected.
   ============================================================ */

/* never allow horizontal scroll on small screens */
html, body { max-width: 100%; }
img, iframe, video, image-slot, svg { max-width: 100%; }

/* hamburger elements are hidden until the mobile breakpoint */
.mnav-toggle, .mnav-panel, .mnav-backdrop { display: none; }

/* ---------- TABLET / SMALL LAPTOP ---------- */
@media (max-width: 900px) {
  body { overflow-x: hidden; }

  /* multi-column grids step down */
  [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2,1fr) !important; }
  [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: repeat(2,1fr) !important; }
  [style*="grid-template-columns:1.5fr 1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }

  /* two-column hero / content splits stack */
  [style*="grid-template-columns:0.9fr 1.1fr"],
  [style*="grid-template-columns:1.1fr 1fr"],
  [style*="grid-template-columns:1.3fr 1fr"],
  [style*="grid-template-columns:1.2fr 0.8fr"],
  [style*="grid-template-columns:0.8fr 1.2fr"] { grid-template-columns: 1fr !important; }

  /* ------- header: swap desktop nav for a hamburger ------- */
  header nav { display: none !important; }
  header > div > a[href="/contact"] { display: none !important; } /* desktop CTA */

  .mnav-toggle {
    display: inline-flex !important;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 9px; margin-left: auto;
    background: none; border: none; cursor: pointer; flex-shrink: 0;
  }
  .mnav-toggle span { display: block; width: 100%; height: 2px; background: #2E2E2C; border-radius: 2px; transition: transform .3s, opacity .3s; }
  body.mnav-open .mnav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.mnav-open .mnav-toggle span:nth-child(2) { opacity: 0; }
  body.mnav-open .mnav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .mnav-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 9998;
  }
  body.mnav-open .mnav-backdrop { opacity: 1; pointer-events: auto; }

  .mnav-panel {
    display: flex; flex-direction: column; position: fixed; top: 0; right: 0;
    height: 100%; width: 82%; max-width: 340px; background: #15140F;
    transform: translateX(100%); transition: transform .32s ease; z-index: 9999;
    padding: 90px 30px 40px; overflow-y: auto;
    box-shadow: -20px 0 50px rgba(0,0,0,.4);
  }
  body.mnav-open .mnav-panel { transform: translateX(0); }
  body.mnav-open { overflow: hidden; }

  .mnav-link {
    display: block !important; color: #EFECE6 !important; background: none !important;
    font-family: 'Jost', sans-serif; font-size: 17px; letter-spacing: .04em;
    padding: 15px 2px; border-bottom: 1px solid rgba(239,236,230,.12); text-decoration: none !important;
  }
  .mnav-link:active { color: #C2A96B !important; }
  .mnav-cta {
    display: block !important; margin-top: 26px; text-align: center; padding: 15px;
    background: linear-gradient(135deg,#7c5f2c 0%,#caa961 55%,#7c5f2c 100%) !important;
    color: #15140F !important; border-radius: 2px; text-decoration: none !important;
    font-family: 'Jost', sans-serif; font-weight: 600; letter-spacing: .04em;
  }
}

/* ---------- PHONE ---------- */
@media (max-width: 600px) {
  /* collapse everything to a single column */
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(2,1fr)"],
  [style*="grid-template-columns:1.5fr 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* tighten the 40px side padding used site-wide */
  [style*="px 40px"], [style*=":0 40px"] { padding-left: 20px !important; padding-right: 20px !important; }

  /* cap oversized display headings */
  [style*="font-size:120px"] { font-size: 58px !important; }
  [style*="font-size:78px"], [style*="font-size:74px"], [style*="font-size:72px"] { font-size: 42px !important; }
  [style*="font-size:64px"], [style*="font-size:60px"] { font-size: 38px !important; }
  [style*="font-size:56px"], [style*="font-size:50px"], [style*="font-size:48px"] { font-size: 34px !important; }
  [style*="font-size:46px"], [style*="font-size:44px"], [style*="font-size:42px"] { font-size: 30px !important; }
  [style*="font-size:38px"], [style*="font-size:36px"] { font-size: 26px !important; }

  /* specialty cards had a hard max-width:calc(33% ) — let them fill */
  [style*="max-width:calc(33.333% - 15px)"] { max-width: 100% !important; flex-basis: 100% !important; }
}
