/*
 * Cookie consent banner (templates/components/cookie_consent.html): a small floating card at the bottom
 * centre, in the landing pages' palette so it sits on app pages and landing pages alike. Accept and Reject
 * are the same size; GDPR wants refusing to be as easy as agreeing.
 */
.cookie-consent {
    --cc-ink: #17211a;
    --cc-soft: #4d574f;
    --cc-line: #e1e6dc;
    --cc-stage: #e9f5db;
    --cc-accent: #54a300;
    --cc-accent-press: #3d7a00; /* green text: 5.3:1 on white */
    --cc-on-accent: #0d1608;    /* text on the green fill: white is only 3.2:1 */
    --cc-accent-hover: #62b80a;

    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 1060; /* above Bootstrap's modals and offcanvas, below the message toasts */
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(680px, calc(100% - 32px));
    padding: 12px 12px 12px 16px;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--cc-line);
    border-radius: 18px;
    box-shadow: 0 18px 40px -20px rgba(18, 27, 20, 0.45), 0 2px 6px rgba(18, 27, 20, 0.06);
    font-family: 'Outfit', sans-serif;
    color: var(--cc-ink);
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 220ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cookie-consent[hidden] { display: none; }
.cookie-consent.is-visible { opacity: 1; transform: translate(-50%, 0); }

.cookie-consent__icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cc-stage);
    color: var(--cc-accent);
    font-size: 16px;
}

.cookie-consent__text { flex: 1; min-width: 0; }
.cookie-consent__title {
    margin: 0 0 1px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--cc-ink);
}
.cookie-consent__body {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cc-soft);
    text-wrap: pretty;
}
.cookie-consent__body a {
    color: var(--cc-ink);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--cc-accent);
    text-underline-offset: 2px;
    white-space: nowrap;
}
.cookie-consent__body a:hover { color: var(--cc-accent-press); }

.cookie-consent__actions { flex-shrink: 0; display: flex; gap: 8px; }
.cookie-consent__btn {
    min-width: 96px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid var(--cc-accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.cookie-consent__btn:active { transform: scale(0.97); }
.cookie-consent__btn:focus-visible { outline: 3px solid var(--cc-accent); outline-offset: 2px; }
.cookie-consent__btn--reject { background: #fff; color: var(--cc-accent-press); }
.cookie-consent__btn--reject:hover { background: var(--cc-stage); }
.cookie-consent__btn--accept { background: var(--cc-accent); color: var(--cc-on-accent); }
.cookie-consent__btn--accept:hover { background: var(--cc-accent-hover); border-color: var(--cc-accent-hover); }

/* Footer "Cookie settings" entries are buttons styled like the links around them */
.cookie-settings-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
/* font: inherit above would undo Bootstrap's .small next to the footer links */
.cookie-settings-link.small { font-size: 0.875em; }

/* Phones: as short as it can be while still saying what it is, so it covers as little of the page as possible.
   The icon goes and the title is kept for screen readers only (it still names the region); the text alone
   says what the card is about. */
@media (max-width: 640px) {
    .cookie-consent { flex-wrap: wrap; gap: 6px; padding: 8px 10px 10px; border-radius: 16px; }
    .cookie-consent__icon { display: none; }
    .cookie-consent__title {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .cookie-consent__text { flex-basis: 100%; }
    .cookie-consent__body { font-size: 12.5px; line-height: 1.35; }
    .cookie-consent__actions { flex-basis: 100%; }
    .cookie-consent__btn { flex: 1; min-height: 36px; }
}

/* While the banner is up, the page keeps room for it (cookie_consent.js measures it into
   --cookie-consent-space: from the card's top edge to the bottom of the screen, bottom nav included).
   The end of the page can be scrolled clear of it, and a field that gets focus (Tab, the phone keyboard's
   "next") is scrolled above it instead of staying hidden underneath. Beats navbar.css's room for the
   bottom nav, which the measured space already includes. */
html.cookie-consent-open { scroll-padding-bottom: var(--cookie-consent-space, 0px); }
html.cookie-consent-open body { padding-bottom: var(--cookie-consent-space, 0px) !important; }

/* Above the app's phone bottom navigation (navbar.css: 70px tall, under 992px) */
@media (max-width: 991.98px) {
    body:has(.mobile-bottom-nav) .cookie-consent { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent { transition: none; }
}
