@import url("./index-responsive-core.css");

/*
 * Responsive sticky actions remain horizontally scrollable, while their menus
 * render as viewport-fixed overlays. None of the menu ancestors may establish
 * a transformed/filter containing block, otherwise overflow-x:auto also clips
 * the menu vertically.
 */
@media (max-width: 1180px) {
  body.oap-index-page #stickyActionsBar.sticky-actions-bar,
  body.oap-index-page #stickyActionsBar.sticky-actions-bar:not(.is-visible),
  body.oap-index-page #stickyActionsBar.sticky-actions-bar.is-visible {
    transform: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: opacity 0.22s ease, background 0.25s ease, border-color 0.25s ease !important;
  }

  body.oap-index-page #stickyActionsBar .admin-inline-btn,
  body.oap-index-page #stickyActionsBar .admin-inline-btn:hover,
  body.oap-index-page #stickyActionsBar .admin-inline-btn:focus-within {
    transform: none !important;
  }

  body.oap-index-page #stickyActionsBar .admin-dropdown-menu {
    position: fixed !important;
    top: 64px !important;
    left: 50vw !important;
    right: auto !important;
    width: min(320px, calc(100vw - 16px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 72px) !important;
    box-sizing: border-box !important;
    overflow-x: visible !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    transform: translate(-50%, -6px) !important;
    z-index: 2147483647 !important;
  }

  body.oap-index-page #stickyActionsBar .admin-dropdown.is-open .admin-dropdown-menu {
    transform: translate(-50%, 0) !important;
  }
}

/* Narrow zoom viewports: reserve the fixed action bar when the words section is scrolled into view. */
@media (orientation: landscape) and (max-width: 560px) and (max-height: 620px) {
  body.oap-index-page #oapWordsScreen {
    scroll-margin-top: clamp(88px, 36svh, 112px) !important;
  }
}

/* Canonical compact-landscape profile. This entry point owns the final cascade. */
@media (orientation: landscape) and (min-width: 561px) and (max-width: 900px) and (max-height: 620px) {
  body.oap-index-page #oapWordsScreen .oap-words-screen-inner {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 0 !important;
    transform: none !important;
  }

  body.oap-index-page #oapWordsScreen .oap-words-screen-line,
  body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(2),
  body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(3) {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: clamp(48px, 9.2vw, 78px) !important;
    line-height: 1.12 !important;
    transform: none !important;
  }
}

/* Match the FDC second-screen font size and letter spacing only. */
body.oap-index-page #oapWordsScreen .oap-words-screen-line,
body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(2),
body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(3) {
  font-size: clamp(102px, 16.95vw, 330px) !important;
  letter-spacing: 0.012em !important;
}

@media (max-width: 900px) {
  body.oap-index-page #oapWordsScreen .oap-words-screen-line,
  body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(2),
  body.oap-index-page #oapWordsScreen .oap-words-screen-line:nth-child(3) {
    font-size: clamp(50px, 18.8vw, 124px) !important;
    letter-spacing: 0.012em !important;
  }
}
