/* AL138 responsive overrides — desktop, tablet, and phone */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

/* Fluid media */
.ed-element.ed-image img,
.ed-image img,
.ed-element.ed-image picture,
.ed-element.ed-image svg,
.wv-boxed img {
  max-width: 100%;
  height: auto !important;
}

/* Readable line length on large screens */
@media (min-width: 1200px) {
  .ed-text:not(.full-width) {
    max-width: 72ch;
  }
}

/* Boxed layout side padding */
@media (max-width: 991px) {
  .wv-boxed > .inner,
  .wv-boxed .inner {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Site logo */
#ed-598214966 img {
  width: auto !important;
  max-width: min(585px, 92vw) !important;
}

/* Google Calendar embeds */
.ed-element.ed-iframe,
.ed-iframe {
  width: 100% !important;
  max-width: 100% !important;
}

.ed-element.ed-iframe iframe,
.ed-iframe iframe {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
  border: 0;
}

@media (max-width: 575px) {
  .ed-element.ed-iframe iframe,
  .ed-iframe iframe {
    height: 520px !important;
    min-height: 520px !important;
  }
}

@media (min-width: 576px) and (max-width: 991px) {
  .ed-element.ed-iframe iframe,
  .ed-iframe iframe {
    height: 680px !important;
    min-height: 680px !important;
  }
}

@media (min-width: 992px) {
  .ed-element.ed-iframe iframe,
  .ed-iframe iframe {
    height: 820px !important;
    min-height: 820px !important;
  }
}

/* Prevent scaled/sticky elements from breaking small screens */
@media (max-width: 767px) {
  #ed-624651092,
  #ed-624651089,
  #ed-598215005 {
    transform: none !important;
    position: static !important;
    left: auto !important;
    bottom: auto !important;
  }

  #ed-598215032,
  [class*="ed-container"] [style*="margin"] {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #ed-598214984 {
    min-height: auto !important;
  }

  #ed-598215029 img {
    max-height: 280px;
    object-fit: contain;
  }
}

/* Footer stacks on narrow viewports */
@media (max-width: 991px) {
  .footer-heimdall-content > .inner {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .footer-heimdall-box {
    width: 100% !important;
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
}

/* Touch-friendly controls */
.menu-level-0 > li > a,
.menu-level-0 .sub a,
.button,
.ed-button a,
a.al138-login-btn {
  min-height: 44px;
}

.menu-level-0 a.al138-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 767px) {
  .open-menu .menu-level-0 a.al138-login-btn,
  body.open-menu .menu-level-0 a.al138-login-btn {
    display: flex;
    width: calc(100% - 1rem);
    margin: 0.5rem 0.75rem 0;
    text-align: center;
  }
}

/* Scrollable tables in page content */
.ed-text table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Legion officers list injected by portal JS */
#al138-officers-list {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 576px) {
  #al138-officers-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  #al138-officers-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#al138-officers-list .al138-officer-card {
  word-break: break-word;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d7dde5;
  border-radius: 0.5rem;
  padding: 0.85rem 0.75rem;
}

#al138-officers-list .al138-officer-card p {
  margin: 0.15rem 0;
}

/* Embedded maps */
.ed-element.ed-map,
.ed-map,
iframe[src*="google.com/maps"] {
  max-width: 100% !important;
}