/*
 * The AppKit cookie consent card (partials/cookie.blade.php + js/rm-cookie.js). It looks the SAME on all four AppKit layouts (public, page/error, auth, signed-in).
 * SELF-CONTAINED: this file styles the card, the text, the link, BOTH buttons and the close button, with their hover / focus / active states, light and dark. It
 * depends on no other stylesheet: not appkit.css, rm-public.css, style.css, dashboard.css, rm-prose.css or bootstrap button classes. Why it must not: rm-public.css:77
 * (".pb-body button { border: 0; background: none; padding: 0; color: inherit }", specificity 0,1,1) out-ranked a bare ".rm-cookie__btn" (0,1,0) and turned the buttons
 * and the close button into plain text on the public layout only. So EVERY rule below is scoped under .rm-cookie (0,2,0 or more) and the buttons reset what a
 * page's global "button" rules set (appearance, border, background, padding, font, colour, text-transform, shadow).
 * Colours: --ck-* tokens DEFINED ON .rm-cookie ITSELF, each ending in a literal colour (light; dark under html[data-rm-theme="dark"], html.rm-legal-dark and
 * .theme-dark, the three ways the four layouts mark dark). Contrast is pinned in Tests\Unit\Appkit\CookieSheetContrastTest. The accent is the saved accent
 * (--rm-accent, with a literal fallback).
 * Position: phones (under 768px) a full-width, compact bottom sheet with safe-area padding; from 768px a floating card at the bottom RIGHT (max 400px, 24px from
 * the edges), so it never covers a hero's primary button on the left. position: fixed: it never shifts the page. While open, the script lifts the connection bar
 * and the What's new bell above it (html.rm-cookie-on, --rm-cookie-h). z-index 125, below the connection bar (130). No dim backdrop: non-modal.
 * MOTION: a slide-up only inside prefers-reduced-motion: no-preference; otherwise the card simply appears and disappears.
 */
.rm-cookie {
    --rm-ck-on: #FFFFFF;      /* text on the filled "Accept all" button (4.5:1 or better on every saved accent; tested) */
    --ck-bg: #FFFFFF;
    --ck-text: #0E1120;
    --ck-muted: #4A5169;
    --ck-line: #D3D7E2;       /* the card border */
    --ck-btn-line: #596078;   /* the outlined button (3:1 or better on the card) */
    --ck-link: var(--rm-accent, #314EDB);
    --ck-accent: var(--rm-accent, #314EDB);
    --ck-shadow: rgba(14, 17, 32, 0.22);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 125; box-sizing: border-box; margin: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain;
    border: 1px solid var(--ck-line); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--ck-bg); color: var(--ck-text);
    font-family: inherit; font-size: 14px; line-height: 1.45; text-align: left;
    box-shadow: 0 -8px 28px var(--ck-shadow);
    outline: none;
}
html[data-rm-theme="dark"] .rm-cookie, html.rm-legal-dark .rm-cookie, .theme-dark .rm-cookie {
    --ck-bg: #161924;
    --ck-text: #F2F3F7;
    --ck-muted: #B4B9CA;
    --ck-line: #2E3345;
    --ck-btn-line: #8A91A8;
    --ck-link: var(--rm-accent-dark, #8D9FF6);
    --ck-shadow: rgba(0, 0, 0, 0.6);
}
.rm-cookie[hidden] { display: none; }
.rm-cookie *, .rm-cookie *::before, .rm-cookie *::after { box-sizing: border-box; }

@media (min-width: 768px) {
    .rm-cookie {
        left: auto; right: 24px; bottom: 24px; width: 400px; max-width: calc(100% - 32px); padding: 18px 20px 20px;
        border-bottom: 1px solid var(--ck-line); border-radius: 20px;
        box-shadow: 0 18px 48px var(--ck-shadow);
    }
}

.rm-cookie .rm-cookie__head { position: relative; display: flex; align-items: center; gap: 12px; margin: 0 0 8px; padding: 0 48px 0 0; }
.rm-cookie .rm-cookie__ico { display: none; flex: none; place-items: center; width: 40px; height: 40px; color: var(--ck-accent); font-size: 36px; line-height: 1; }
.rm-cookie .rm-cookie__ico i { color: inherit; }
.rm-cookie .rm-cookie__titles { min-width: 0; }
.rm-cookie .rm-cookie__eyebrow { display: none; margin: 0 0 -2px; color: var(--ck-link); font-size: 12px; font-weight: 700; line-height: 1.3; }
.rm-cookie .rm-cookie__title { margin: 0; padding: 0; color: var(--ck-text); font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: normal; text-transform: none; overflow-wrap: anywhere; }
.rm-cookie .rm-cookie__text { margin: 0 0 12px; padding: 0; color: var(--ck-muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.rm-cookie .rm-cookie__text a { margin-left: 4px; color: var(--ck-link); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.rm-cookie .rm-cookie__text a:hover { text-decoration-thickness: 2px; }

/* The close (x): a round button, the strong text colour as the fill and the card colour as the icon (15:1 or better, light and dark; tested). */
.rm-cookie .rm-cookie__close {
    position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0;
    -webkit-appearance: none; appearance: none; border: 0; border-radius: 50%; box-shadow: none;
    background: var(--ck-text); color: var(--ck-bg); font: inherit; font-size: 18px; line-height: 1; text-transform: none; cursor: pointer;
}
.rm-cookie .rm-cookie__close i { color: inherit; }
.rm-cookie .rm-cookie__close:hover { filter: brightness(1.15); }
.rm-cookie .rm-cookie__close:active { filter: brightness(0.9); }

.rm-cookie .rm-cookie__actions { display: flex; gap: 10px; margin: 0; padding: 0; }
.rm-cookie .rm-cookie__btn {
    flex: 1 1 0; min-width: 0; min-height: 48px; box-sizing: border-box; margin: 0; padding: 0 12px; border: 2px solid transparent; border-radius: 14px;
    -webkit-appearance: none; appearance: none; box-shadow: none; text-transform: none; letter-spacing: normal; text-align: center;
    color: var(--rm-ck-on); font: inherit; font-size: 15px; font-weight: 800; line-height: 1.2; cursor: pointer;
}
/* "Accept all": the filled accent button. "Essential only": the same size, outlined. */
.rm-cookie .rm-cookie__btn--all { background: var(--ck-accent); border-color: var(--ck-accent); }
.rm-cookie .rm-cookie__btn--essential { background: transparent; border-color: var(--ck-btn-line); color: var(--ck-text); }
.rm-cookie .rm-cookie__btn:hover { filter: brightness(1.1); }
.rm-cookie .rm-cookie__btn--essential:hover { background: var(--ck-line); filter: none; }
.rm-cookie .rm-cookie__btn:active { filter: brightness(0.92); }
.rm-cookie .rm-cookie__btn--essential:active { background: var(--ck-line); filter: brightness(0.95); }
.rm-cookie .rm-cookie__text a:focus-visible, .rm-cookie .rm-cookie__btn:focus-visible, .rm-cookie .rm-cookie__close:focus-visible { outline: 2px solid var(--ck-text); outline-offset: 2px; border-radius: 6px; }
.rm-cookie .rm-cookie__close:focus-visible { border-radius: 50%; }

@media (max-width: 767px) {
    .rm-cookie .rm-cookie__btn { min-height: 44px; }
    /* room under the content so the last lines of the page can scroll clear of the sheet (the bottom of the page only, nothing above the fold moves) */
    html.rm-cookie-on body { padding-bottom: var(--rm-cookie-h, 0px); }
}
@media (min-width: 768px) {
    .rm-cookie .rm-cookie__ico { display: grid; }
    .rm-cookie .rm-cookie__eyebrow { display: block; }
    .rm-cookie .rm-cookie__title { font-size: 22px; }
    .rm-cookie .rm-cookie__text { font-size: 14px; }
}
@media (max-width: 359px) { .rm-cookie .rm-cookie__actions { flex-direction: column; } }

@media (prefers-reduced-motion: no-preference) {
    .rm-cookie:not([hidden]) { animation: rm-cookie-in 320ms cubic-bezier(0.32, 0.72, 0, 1) both; }
    @keyframes rm-cookie-in { from { transform: translate3d(0, 110%, 0); } to { transform: none; } }
}

/* While the card is open it can cover the bottom nav, so the connection bar and the What's new bell sit just above it
   (--rm-cookie-h = the card's top edge above the viewport bottom plus a gap, set by the script). */
html.rm-cookie-on .rm-conn { bottom: calc(var(--rm-cookie-h, 0px) + 8px); }
html.rm-cookie-on body:has(#footer-bar) .rm-conn { bottom: calc(var(--rm-cookie-h, 0px) + 8px + 48px + 12px); }
html.rm-cookie-on .rm-whatsnew { bottom: calc(var(--rm-cookie-h, 0px) + 8px); }
