/*
 * The cookie banner (views/layouts/_cookie-banner.php, map З.Б1.В3): a strip at the bottom of the page, not a window.
 *
 * It is drawn closed once a choice exists. «Cookie choices» in the footer links to #cookie-banner, and :target
 * shows it again with no script (the page's CSP has none to spare). The two buttons are the same .app-btn: a refusal
 * is not a grey link (core.md §8).
 */

/*
 * The banner's height, one value read by the page's bottom padding below. It lives on :root: a custom property set on
 * .app-cookie itself is invisible to <body>, which is where the room is kept (that was the defect of KINV-247 F4).
 */
:root {
    --cookie-banner-h: calc(var(--control) + 5 * var(--space-5));
}

.app-cookie {
    position: fixed;
    inset: auto 0 0;
    z-index: 150;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-5);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
}

/* Not the `hidden` attribute: base.css makes it `!important`, which :target could never undo. */
.app-cookie--closed {
    display: none;
}

.app-cookie--closed:target {
    display: flex;
}

.app-cookie__text {
    flex: 1 1 var(--w-field-short);
    max-width: var(--w-prose);
    font-size: var(--fs-caption);
    color: var(--text-2);
}

.app-cookie__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* The page's own bottom is never under the banner: room is kept for as long as the banner is shown. */
body:has(.app-cookie:not(.app-cookie--closed)),
body:has(.app-cookie--closed:target) {
    padding-bottom: var(--cookie-banner-h);
}

@media (max-width: 720px) {
    :root {
        --cookie-banner-h: calc(var(--control) * 2 + 7 * var(--space-5));
    }

    .app-cookie {
        padding: var(--space-3);
    }

    .app-cookie__actions,
    .app-cookie__actions form {
        flex: 1 1 100%;
    }

    .app-cookie__actions .app-btn {
        width: 100%;
    }
}

/* «Cookie choices» (Б78) under the Legal list: the same gap as between the list's own links. */
.app-footer__more {
    margin: var(--space-1) 0 0;
}
