/*
 * HSA phone-landscape adaptation.
 * Deliberately limited to the two approval widths (and nearby phones) so the
 * existing portrait, tablet, desktop, and wide-screen layouts are untouched.
 */
@media (orientation: landscape) and (min-width: 800px) and (max-width: 950px) and (max-height: 500px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    min-width: 0;
  }

  /* Boundlearn ecosystem header */
  .bl-unified-header {
    position: relative !important;
    top: auto !important;
    z-index: 500 !important;
    min-height: 54px !important;
    padding: 6px 16px !important;
    transform: none !important;
  }

  .bl-unified-header .bl-bar-nav,
  #hsa-toggle:checked ~ .bl-mnav-legacy,
  .bl-unified-header .bl-mnav-legacy {
    display: none !important;
  }

  .bl-unified-header .hsa-burger {
    display: inline-flex !important;
  }

  #hsa-toggle:checked ~ .bl-mnav-mobile-unified {
    display: flex !important;
  }

  .bl-unified-panel {
    flex-direction: column !important;
    align-items: stretch !important;
    top: calc(100% + 6px) !important;
    right: 12px !important;
    width: min(330px, calc(100vw - 28px)) !important;
    max-height: calc(100svh - 68px) !important;
    padding: 10px 16px 14px !important;
  }

  .bl-unified-panel > a,
  .bl-unified-panel > details > summary {
    min-height: 38px !important;
    padding: 7px 4px !important;
    font-size: 15px !important;
  }

  .bl-unified-panel > details a {
    min-height: 31px !important;
    padding: 6px 4px 6px 14px !important;
    font-size: 12px !important;
  }

  .bl-unified-panel .bl-mobile-apply,
  .bl-unified-panel > .bl-mobile-apply {
    min-height: 40px !important;
    margin-top: 9px !important;
    padding: 9px 14px !important;
  }

  /* The HSA row becomes the only sticky header after Boundlearn scrolls away. */
  .bl-unified-header + header {
    position: sticky !important;
    top: 0 !important;
    z-index: 460 !important;
    height: 54px !important;
    margin-bottom: -54px !important;
    background: linear-gradient(180deg, rgba(8, 13, 11, .9), rgba(8, 13, 11, .58)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(10px);
  }

  .bl-unified-header + header > .hsa-pad {
    min-height: 54px;
    padding: 7px 16px !important;
  }

  .bl-unified-header + header > .hsa-pad > a img {
    width: auto !important;
    height: 32px !important;
    max-width: 150px;
    object-fit: contain;
  }

  .hsa-subnav-links {
    display: none !important;
  }

  .hsa-program-mobile-menu {
    position: relative !important;
    display: block !important;
    margin-left: auto !important;
  }

  .hsa-program-mobile-menu > summary {
    display: flex !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    align-items: center !important;
    justify-content: center !important;
    border-color: rgba(255, 255, 255, .52) !important;
    border-radius: 9px !important;
    background: rgba(11, 18, 33, .42) !important;
  }

  .hsa-program-mobile-panel {
    top: calc(100% + 6px) !important;
    right: 0 !important;
    width: min(330px, calc(100vw - 24px)) !important;
    max-height: calc(100svh - 122px) !important;
    padding: 10px 16px 14px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 20px 42px rgba(0, 0, 0, .32) !important;
    color: var(--ink) !important;
    text-align: left !important;
  }

  .hsa-program-mobile-panel > a,
  .hsa-program-mobile-panel > details > summary {
    display: flex !important;
    min-height: 38px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 8px 4px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line-soft) !important;
    background: transparent !important;
    color: var(--ink) !important;
    font-family: var(--font-body) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    text-align: left !important;
  }

  .hsa-program-mobile-panel > details > summary {
    justify-content: space-between !important;
  }

  .hsa-program-mobile-panel > details a {
    display: block !important;
    padding: 6px 4px 6px 14px !important;
    color: var(--ink-soft) !important;
    font-family: var(--font-body) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
  }

  .hsa-program-mobile-panel .bl-program-mobile-brand {
    min-height: 38px !important;
    padding: 0 0 7px !important;
  }

  .hsa-program-mobile-panel .bl-program-mobile-brand img {
    height: 28px !important;
    max-width: 172px !important;
  }

  /* Opening viewport: both headers, headline, explanation, CTA, and proof. */
  #top {
    min-height: calc(100svh - 54px) !important;
    height: calc(100svh - 54px) !important;
    max-height: none !important;
  }

  #top > .hsa-pad {
    max-width: 880px !important;
    padding: 56px 34px 10px !important;
  }

  #top .hsa-h1 {
    font-size: clamp(29px, 4.15vw, 35px) !important;
    line-height: .98 !important;
    letter-spacing: -.02em !important;
  }

  #top .hsa-h1 + p {
    max-width: 58em !important;
    margin-top: 9px !important;
    font-size: 12.5px !important;
    line-height: 1.35 !important;
  }

  #top .hsa-h1 + p + div {
    margin-top: 11px !important;
  }

  #top .hsa-h1 + p + div a {
    min-height: 38px;
    padding: 9px 22px !important;
    font-size: 13px !important;
  }

  #top .hsa-h1 + p + div + div {
    gap: 22px !important;
    margin-top: 11px !important;
  }

  #top .hsa-h1 + p + div + div > div:not([style*="width:1px"]) > div:first-child {
    font-size: 22px !important;
  }

  #top .hsa-h1 + p + div + div > div:not([style*="width:1px"]) > div:last-child {
    margin-top: 2px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
  }

  #top .hsa-h1 + p + div + div > div[style*="width:1px"] {
    height: 30px !important;
  }

  /* The Academies introduction was consuming several landscape viewports. */
  #academies {
    padding: 38px 0 42px !important;
  }

  #academies > .hsa-pad {
    max-width: 940px !important;
    padding: 0 24px !important;
  }

  #academies > .hsa-pad > div:first-child {
    max-width: 760px !important;
  }

  #academies > .hsa-pad > div:first-child h2 {
    font-size: 27px !important;
    line-height: 1.12 !important;
  }

  #academies > .hsa-pad > div:first-child p {
    margin-top: 9px !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  #academies .hsa-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
    margin-top: 20px !important;
  }

  #academies .hsa-two-col > div {
    min-height: 238px !important;
    padding: 20px !important;
  }

  #academies .hsa-two-col h3 {
    font-size: 19px !important;
  }

  #academies .hsa-two-col p {
    margin: 7px 0 12px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  #academies .hsa-two-col a {
    min-height: 38px;
    padding: 9px 18px !important;
    font-size: 12px !important;
  }

  /* Keep the rest of the page landscape-native instead of phone-portrait stacks. */
  .hsa-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .hsa-feat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #spotlight .spot-slide {
    min-height: calc(100svh - 54px) !important;
    height: calc(100svh - 54px) !important;
    max-height: none !important;
  }

  #spotlight .spot-slide .hsa-pad {
    max-width: 760px !important;
    padding: 0 70px !important;
  }

  #spotlight .spot-slide h2 {
    font-size: 31px !important;
  }

  #spotlight .spot-slide p {
    margin-top: 8px !important;
    font-size: 12.5px !important;
    line-height: 1.4 !important;
  }

  #spotlight .spot-slide h2 + div,
  #spotlight .spot-slide div[style*="font-family:var(--font-mono)"] {
    margin-top: 8px !important;
    font-size: 10px !important;
  }

  #spotlight .spot-slide p + div {
    margin-top: 12px !important;
  }

  #spotlight .spot-slide p + div a {
    min-height: 38px;
    padding: 9px 20px !important;
    font-size: 12.5px !important;
  }

  #spotlight .spot-prev,
  #spotlight .spot-next {
    width: 40px !important;
    height: 40px !important;
  }

  #spotlight .spot-prev {
    left: 14px !important;
  }

  #spotlight .spot-next {
    right: 14px !important;
  }

  /* Brand first, then three equal link columns. */
  footer.hsa-pad {
    padding: 30px 26px 22px !important;
  }

  footer.hsa-pad > div {
    max-width: 940px !important;
  }

  footer .aca-foot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px 28px !important;
    padding-bottom: 20px !important;
  }

  footer .aca-foot-grid > div:first-child {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  footer .aca-foot-grid > div:first-child > img {
    height: 20px !important;
  }

  footer [data-bl-footer-copy] {
    max-width: 520px !important;
    margin-top: 8px !important;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
  }

  footer .aca-foot-grid > div:first-child > div {
    justify-content: center !important;
    margin-top: 10px !important;
  }

  footer .aca-foot-grid > div:not(:first-child) {
    text-align: left;
  }

  footer .aca-foot-grid > div:not(:first-child) > div:first-child {
    margin-bottom: 8px !important;
  }

  footer .aca-foot-grid > div:not(:first-child) > div:last-child {
    gap: 5px !important;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
  }

  footer .aca-foot-grid + div {
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding-top: 14px !important;
    text-align: center !important;
  }

  footer [data-bl-footer-slogan],
  footer [data-bl-footer-copyright] {
    width: 100%;
    font-size: 10.5px !important;
  }
}
