/* CL-346: one pattern for every pop-up that has a Close button.
   The heading row (title + Close) is pinned to the top of the pop-up while its body scrolls, so a visitor can always read what it is
   and close it without scrolling back up. Put class "ak-pophead" on the row (it must be a direct child of the scrolling box, or of the form in it).
   The box sets --ak-pop-pt / --ak-pop-px (its own top and side padding) so the row reaches the box edges and nothing shows through;
   --ak-pop-bg is the box's solid colour. js/akarec-pophead.js adds .is-scrolled to the box once it has scrolled: a hairline and a soft shadow appear. */
.modal-box { --ak-pop-pt: 2.25rem; --ak-pop-px: 2.25rem; scroll-padding-top: 5rem; }
.ak-pophead {
  position: sticky; top: calc(var(--ak-pop-pt, 0px) * -1); z-index: 6; box-sizing: border-box;
  margin-top: calc(var(--ak-pop-pt, 0px) * -1); margin-left: calc(var(--ak-pop-px, 0px) * -1); margin-right: calc(var(--ak-pop-px, 0px) * -1);
  padding: var(--ak-pop-pt, 0px) var(--ak-pop-px, 0px) 0.6rem;
  background: var(--ak-pop-bg, var(--ak-surface-elevated, #0E1626));
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ak-pophead--row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.ak-pophead button, .ak-pophead .route-pill { min-height: 44px; flex: none; }
.is-scrolled .ak-pophead { border-bottom-color: var(--ak-border-subtle, rgba(127, 127, 127, 0.3)); box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.6); }
html[data-theme="day"] .is-scrolled .ak-pophead { box-shadow: 0 10px 18px -12px rgba(11, 25, 48, 0.28); }
@media (prefers-reduced-motion: reduce) { .ak-pophead { transition: none; } }
/* phones: the pinned row stays slim (about 62 px: 10 px, a 44 px Close, 8 px); the box gets 1.1rem sides so the title and Close share one line */
@media (max-width: 640px) {
  .modal-box:not(.bk-sheet) { --ak-pop-pt: 0.6rem; --ak-pop-px: 1.1rem; padding: 0.6rem 1.1rem 1.5rem; }
  .ak-whysheet .modal-box { padding-bottom: 1.75rem; }
  .ak-pophead { padding-bottom: 0.5rem; }
  .modal-box .ak-pophead h3 { font-size: 1.05rem !important; line-height: 1.15; margin: 0; }
  .modal-box .ak-pophead .ak-eyebrow, .modal-box .ak-pophead .ak-buy__eyebrow { margin: 0 0 0.15rem !important; font-size: 0.62rem !important; letter-spacing: 0.04em !important; }
}
