/* ===================================================================
   Encore Law Group — responsive layer
   The site is authored with fixed desktop inline styles. These rules
   override the inline layouts at tablet/phone widths (hence !important,
   which is required to beat inline styles). Desktop (>1024px) is
   untouched. Targets are structural (semantic tags) + attribute-contains
   selectors, since the inline-styled elements carry no classes.
   =================================================================== */

/* Never allow sideways scrolling on small screens. */
@media (max-width: 1024px) {
  html, body { overflow-x: hidden !important; max-width: 100% !important; }
  img, svg, image-slot { max-width: 100%; }
}

/* Grid children must be allowed to shrink below their content width, or a
   wide child (e.g. a portrait image-slot) blows the track past the viewport. */
@media (max-width: 1024px) {
  main [style*="grid-template-columns"] > * { min-width: 0 !important; }
  footer [style*="grid-template-columns"] > * { min-width: 0 !important; }
}

/* ---------- TABLET: cap content grids at two columns ---------- */
@media (max-width: 1024px) {
  main [style*="grid-template-columns"] { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; }
}

/* ---------- PHONE: stack everything ---------- */
@media (max-width: 640px) {
  main [style*="grid-template-columns"] { grid-template-columns: minmax(0,1fr) !important; }

  /* Footer: 4-column → single column, and the bottom bar stacks. */
  footer [style*="grid-template-columns"] { grid-template-columns: minmax(0,1fr) !important; gap: 34px !important; }
  footer [style*="justify-content:space-between"] { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }

  /* Tighten oversized fixed portrait heights so bios/teams aren't huge. */
  image-slot[style*="height:500px"] { height: 420px !important; }

  /* Keep buttons from overflowing their row. */
  a[style*="align-self:flex-start"], button[style*="align-self:flex-start"] { width: 100%; text-align: center; }
}

/* ===================================================================
   NAV → hamburger (≤ 860px). The two desktop <nav> groups hide; a
   hamburger button (injected by responsive-nav.js) and a slide-down
   menu take over. Wordmark stays centered.
   =================================================================== */
@media (max-width: 860px) {
  header > div { position: relative !important; grid-template-columns: 1fr !important; justify-items: center !important; }
  header > div > nav { display: none !important; }
  .elg-burger { display: flex !important; }
  .elg-mobile-menu.open { display: flex !important; }
}

/* Hamburger button — hidden on desktop, shown by the media query above. */
.elg-burger {
  display: none;
  position: absolute; right: clamp(16px, 4vw, 40px); top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0; z-index: 10;
}
.elg-burger span { display: block; position: relative; width: 24px; height: 2px; background: oklch(0.28 0.02 50); transition: transform 160ms, opacity 160ms; }
.elg-burger span::before, .elg-burger span::after { content: ''; position: absolute; left: 0; width: 24px; height: 2px; background: oklch(0.28 0.02 50); transition: transform 160ms; }
.elg-burger span::before { top: -7px; }
.elg-burger span::after { top: 7px; }
.elg-burger.open span { background: transparent; }
.elg-burger.open span::before { transform: translateY(7px) rotate(45deg); }
.elg-burger.open span::after { transform: translateY(-7px) rotate(-45deg); }

/* Slide-down mobile menu (injected). */
.elg-mobile-menu {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  flex-direction: column; background: oklch(0.975 0.008 85);
  border-bottom: 1px solid oklch(0.89 0.015 80); box-shadow: 0 18px 44px oklch(0.25 0.02 50 / 0.14);
  padding: 8px clamp(20px, 6vw, 40px) 24px; z-index: 9;
}
.elg-mobile-menu a {
  font-family: 'Mulish', Helvetica, Arial, sans-serif;
  font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase;
  color: oklch(0.28 0.02 50); text-decoration: none;
  padding: 16px 0; border-bottom: 1px solid oklch(0.91 0.012 80);
}
.elg-mobile-menu a:last-child { border-bottom: none; }
.elg-mobile-menu a.elg-cta {
  margin-top: 16px; border: 1px solid oklch(0.28 0.02 50); text-align: center;
  padding: 15px; letter-spacing: 0.12em;
}
