/* Cookie scrolling: explicit text height also works after iOS rotation. */
.siteCookies.siteCookies--bottom {
  max-height: calc(100vh - 16px) !important;
  max-height: calc(100svh - 16px - env(safe-area-inset-bottom, 0px)) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.siteCookies .siteCookies__text,
.cookiesDialog .cookiesSetting__data {
  min-height: 0 !important;
  overflow-y: auto !important;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #81956b #edf2e7;
}
.siteCookies .siteCookies__text::-webkit-scrollbar,
.cookiesDialog .cookiesSetting__data::-webkit-scrollbar { width: 6px; }
.siteCookies .siteCookies__text::-webkit-scrollbar-thumb,
.cookiesDialog .cookiesSetting__data::-webkit-scrollbar-thumb { background: #81956b; border-radius: 6px; }
.siteCookies .siteCookies__text::-webkit-scrollbar-track,
.cookiesDialog .cookiesSetting__data::-webkit-scrollbar-track { background: #edf2e7; }
@media (max-width: 767px) {
  .siteCookies .siteCookies__form { max-height: none !important; grid-template-rows: auto auto auto; }
  .siteCookies .siteCookies__text {
    max-height: max(96px, min(280px, calc(55vh - 144px))) !important;
    max-height: max(96px, min(280px, calc(55svh - 144px))) !important;
    padding-right: 8px !important;
  }
}
/* Short viewports need three actions in one row and room for readable text. */
@media (max-height: 500px) and (min-width: 480px) {
  .siteCookies.siteCookies--bottom {
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    padding: 12px 16px !important;
    transform: none !important;
  }
  .siteCookies .siteCookies__form {
    max-height: none !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 8px;
  }
  .siteCookies .siteCookies__text {
    grid-row: 1;
    max-height: calc(100vh - 108px) !important;
    max-height: calc(100svh - 108px - env(safe-area-inset-bottom, 0px)) !important;
    padding-right: 8px !important;
    font-size: 14px;
    line-height: 1.45;
  }
  .siteCookies .siteCookies__links { grid-column: 1 !important; grid-row: 2 !important; }
  .siteCookies .siteCookies__buttonWrap button[value="reject"] { grid-column: 2 !important; grid-row: 2 !important; }
  .siteCookies .siteCookies__buttonWrap button[value="all"] { grid-column: 3 !important; grid-row: 2 !important; }
}

/* Anchor mobile settings to the viewport, including after rotation. */
@media (max-width: 767px), (max-height: 500px) {
  #colorbox:has(.cookiesDialog) {
    top: max(12px, env(safe-area-inset-top, 0px)) !important;
    transform: translateX(-50%) !important;
    max-height: calc(100svh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
  }
  .cookiesDialog .cookiesSetting__form {
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100svh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
}
