/* Compact brand capsules replace the large modal. The site header scrolls normally. */
:root {
  scroll-padding-top: calc(112px + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

.site-head {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
}

/* Shared capsule sizing, brand artwork, focus ring and colours come from the light theme. */
.ledger-sticky.ledger-sticky--top {
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  animation: ledger-top-promo-enter .18s ease-out;
}
.ledger-sticky[hidden] { display: none !important; }
.ledger-sticky__cta,
.ledger-sticky__close,
.nav-toggle { touch-action: manipulation; }

/* Dropdown interaction has priority over either promotion, including keyboard focus. */
body:has(.site-head .nav.open) .ledger-sticky,
body:has(.site-head .toplist-menu[open]) .ledger-sticky {
  display: none !important;
}

/* Defensive guard if the retired fullscreen bonus modal is inserted again. */
body #bonus-pop,
body #bonus-pop[open-state="1"],
body #bonus-pop:not([hidden]) {
  display: none !important;
  visibility: hidden !important;
}

@keyframes ledger-top-promo-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 1060px) {
  /* Base CSS uses a viewport-fixed dropdown; anchor it to the natural header instead. */
  .site-head .nav {
    position: absolute;
    inset: 100% 0 auto;
    width: auto;
    max-height: calc(100dvh - 90px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 61;
  }
  .site-head .toplist-menu-panel[data-astro-cid-5wsejpel] {
    position: static;
    inset: auto;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 8px 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .ledger-sticky.ledger-sticky--top {
    top: calc(12px + env(safe-area-inset-top, 0px));
    bottom: auto;
    animation-name: ledger-top-promo-enter-mobile;
  }
  .site-head .toplist-menu-panel[data-astro-cid-5wsejpel] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
  }
  .site-head .toplist-menu-panel[data-astro-cid-5wsejpel] > * {
    min-width: 0;
  }
  .site-head .toplist-menu-panel[data-astro-cid-5wsejpel] a[data-astro-cid-5wsejpel] {
    display: flex !important;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    max-width: 100%;
    padding: 9px 0;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .site-head .toplist-menu-panel[data-astro-cid-5wsejpel] {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

@keyframes ledger-top-promo-enter-mobile {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .ledger-sticky,
  .ledger-sticky.ledger-sticky--top {
    animation: none;
    transition: none;
  }
}
