/* JD language toggle: Miracle Law header */

/* Backup only. Turn the floating switcher off in JurisLingo if possible (Step 6). */
.jurislingo-floating-switcher { display: none !important; }

/* Toggle pill */
.jd-lang { display: flex; align-items: center; gap: 16px; }
.jd-lang__divider { width: 1px; height: 28px; background: #E2DCDA; flex: none; }
.jd-lang .jd-lang__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 13px; box-sizing: border-box;
  border: 1.5px solid #BDB4B1; border-radius: 999px; background: #fff;
  color: #1A1A1A; font: 700 13px/1 Inter, system-ui, sans-serif;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-decoration: none;
  transition: border-color .15s, background-color .15s, color .15s;
}
.jd-lang .jd-lang__toggle:hover { border-color: #7B1214; background: #FBF4F4; color: #7B1214; }
.jd-lang .jd-lang__toggle:focus-visible,
.jd-lang-menu__seg a:focus-visible { outline: 2px solid #7B1214; outline-offset: 3px; }
.jd-lang__globe { width: 17px; height: 17px; flex: none; color: #7B1214; }
.jd-lang__short { display: none; }
.jd-lang-menu { display: none; }

/* Header items */
.jd-hdr-lang,
.jd-hdr-cta { flex: 0 0 auto !important; width: auto !important; max-width: none !important; }
.jd-hdr-cta .elementor-button { width: auto !important; white-space: nowrap; }

/* 1200px and up: logo, nav, toggle, CTA */
@media (min-width: 1200px) {
  .jd-hdr-logo { order: 1 !important; }
  .jd-hdr-nav {
    order: 2 !important; flex: 1 1 auto !important; width: auto !important; max-width: none !important;
    --container-widget-width: auto; --container-widget-flex-grow: 1;
  }
  .jd-hdr-nav .elementor-nav-menu--main > .elementor-nav-menu { justify-content: center; flex-wrap: nowrap !important; }
  .jd-hdr-lang { order: 3 !important; }
  .jd-hdr-cta { order: 4 !important; }
}
@media (min-width: 1366px) {
  .jd-hdr-row { gap: 16px !important; }
  .jd-hdr-nav .elementor-nav-menu--main .elementor-item { font-size: 15px !important; padding-left: 6px !important; padding-right: 6px !important; }
  .jd-hdr-cta .elementor-button { font-size: 16px !important; padding: 10px 20px !important; }
}
@media (min-width: 1200px) and (max-width: 1365px) {
  .jd-hdr-row { padding-left: 20px !important; padding-right: 20px !important; gap: 16px !important; }
  .jd-hdr-logo, .jd-hdr-logo img { width: 150px !important; max-width: 150px !important; }
  .jd-hdr-nav .elementor-nav-menu--main .elementor-item { font-size: 14px !important; padding-left: 6px !important; padding-right: 6px !important; }
  .jd-lang { gap: 12px; }
  .jd-lang .jd-lang__toggle { padding: 0 12px 0 10px; }
  .jd-hdr-cta .elementor-button { font-size: 15px !important; padding: 10px 16px !important; }
}

/* 1025 to 1199px: force the hamburger (Elementor's own switch is at 1024px) */
@media (min-width: 1025px) and (max-width: 1199px) {
  .jd-hdr-nav .elementor-nav-menu--main { display: none !important; }
  .jd-hdr-nav .elementor-menu-toggle { display: flex !important; }
  .jd-hdr-nav nav.elementor-nav-menu--dropdown { display: block !important; margin-top: 20px !important; }
}

/* Under 1200px: logo, toggle, CTA, hamburger */
@media (max-width: 1199px) {
  .jd-hdr-row { gap: 10px !important; }
  .jd-hdr-logo { order: 1 !important; margin-right: auto !important; }
  .jd-hdr-lang { order: 2 !important; }
  .jd-hdr-cta { order: 3 !important; }
  .jd-hdr-nav {
    order: 4 !important; flex: 0 0 auto !important; width: fit-content !important; max-width: fit-content !important;
    --container-widget-width: auto; --container-widget-flex-grow: 0;
  }
  .jd-hdr-nav .elementor-menu-toggle { margin: 0 !important; }
  .jd-lang__divider { display: none; }
  .jd-lang .jd-lang__toggle { height: 44px; }

  /* Language switch at the top of the hamburger menu */
  .jd-lang-menu { display: block; padding: 14px 16px 6px; background: #fff; font-family: Inter, system-ui, sans-serif; }
  .jd-lang-menu__label { margin: 0 0 8px; font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; color: #6B6B6B; }
  .jd-lang-menu__seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; max-width: 440px; padding: 3px; border: 1.5px solid #BDB4B1; border-radius: 999px; }
  .jd-lang-menu__seg a {
    display: flex !important; align-items: center; justify-content: center; height: 44px; padding: 0 !important;
    border-radius: 999px; background: transparent !important; color: #1A1A1A !important;
    font-size: 14px !important; font-weight: 700; letter-spacing: .03em; text-decoration: none !important;
  }
  .jd-lang-menu__seg a[aria-current="true"] { background: #7B1214 !important; color: #fff !important; }
}
@media (min-width: 600px) and (max-width: 1199px) {
  .jd-hdr-row { padding-left: 24px !important; padding-right: 24px !important; }
}

/* Under 600px: pill condenses to globe + ES / EN */
@media (max-width: 599px) {
  .jd-hdr-row { flex-wrap: nowrap !important; gap: 8px !important; }
  .jd-lang__full { display: none; }
  .jd-lang__short { display: inline; }
  .jd-lang .jd-lang__toggle { padding: 0 10px 0 9px; gap: 5px; }
  .jd-lang__globe { width: 16px; height: 16px; }
}
@media (max-width: 389px) {
  .jd-hdr-logo, .jd-hdr-logo img { width: 92px !important; max-width: 92px !important; }
  .jd-lang .jd-lang__toggle { padding: 0 8px 0 7px; }
  .jd-hdr-cta .elementor-button { padding-left: 8px !important; padding-right: 8px !important; }
}

/* Under 360px: CTA becomes a full-width bar under the header row */
@media (max-width: 359px) {
  .jd-hdr-row { flex-wrap: wrap !important; row-gap: 8px !important; }
  .jd-hdr-cta { order: 5 !important; flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; }
  .jd-hdr-cta .elementor-button {
    display: flex !important; width: 100% !important; min-height: 44px; justify-content: center; align-items: center;
    font-size: 12px !important; padding-top: 0 !important; padding-bottom: 0 !important;
  }
  .jd-hdr-cta .elementor-button br { display: none; }
}


/* Existing bug, fixed here: the closed mobile dropdown sticks out past the right edge and made the page scroll sideways
   (about 100px at 768px, 38px at 1024px). Nothing on the page needs to scroll sideways, so clip it. */
@media (max-width: 1199px) {
  html { overflow-x: clip; }
}
