/* =============================================================================
   COOKIE CONSENT BANNER
   CR: fysh-cookie-consent-2026-06-25
   Global — loaded via $_global_css in partials/head.php.
   Uses design tokens from /css/tokens.css.
============================================================================= */

/* ── Shell ──────────────────────────────────────────────────────────────── */

.cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: min(820px, calc(100vw - 32px));
    z-index: 9500;
    /* Invisible until JS reveals it — avoids flash before CSS is ready */
    opacity: 0;
    pointer-events: none;
}

/* ── Entrance ───────────────────────────────────────────────────────────── */

.cookie-banner--visible {
    /* Issue 2 fix: explicit opacity:1 independent of the animation fill.
       If the browser cancels or resets ck-rise (memory pressure, focus loss,
       compositor flush), this property keeps the banner visible without
       relying solely on animation-fill-mode: forwards.               */
    opacity: 1;
    pointer-events: auto;
    animation: ck-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Exit ───────────────────────────────────────────────────────────────── */

.cookie-banner--leaving {
    animation: ck-sink 0.3s ease forwards;
}

@keyframes ck-rise {
    from { opacity: 0; transform: translateX(-50%) translateY(36px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

@keyframes ck-sink {
    from { opacity: 1; transform: translateX(-50%) translateY(0);    }
    to   { opacity: 0; transform: translateX(-50%) translateY(36px); }
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.cookie-banner__card {
    background: #fff;
    border-radius: var(--radius-lg);
    border-top: 3px solid var(--gold);
    box-shadow: 0 8px 40px rgba(15, 35, 64, 0.16),
                0 2px 8px  rgba(15, 35, 64, 0.08);
    padding: 20px 24px 18px;
}

/* ── Top row (icon + copy) ──────────────────────────────────────────────── */

.cookie-banner__top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.cookie-banner__icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--cream) 0%, #EDE9DF 100%);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 21px;
    line-height: 1;
}

.cookie-banner__heading {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 5px;
    line-height: 1.3;
}

.cookie-banner__body {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.cookie-banner__link {
    color: var(--blue);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(30, 91, 168, 0.4);
    transition: color var(--ease), text-decoration-color var(--ease);
}
.cookie-banner__link:hover {
    color: var(--navy);
    text-decoration-color: currentColor;
}

/* ── Actions ────────────────────────────────────────────────────────────── */

.cookie-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.cookie-btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 20px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--ease), color var(--ease),
                border-color var(--ease), transform 0.1s;
}
.cookie-btn:active { transform: scale(0.97); }
.cookie-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Accept — navy fill, gold-accent hover */
.cookie-btn--accept {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.cookie-btn--accept:hover { background: var(--blue); border-color: var(--blue); }

/* Dismiss — outlined ghost */
.cookie-btn--dismiss {
    background: transparent;
    color: var(--navy);
    border-color: var(--border);
}
.cookie-btn--dismiss:hover {
    background: var(--cream);
    border-color: #C8D3DE;
}

/* Don't show again — text link, pushed to far right */
.cookie-btn--never {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
    padding: 9px 6px;
    font-size: 12px;
    margin-left: auto;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: transparent;
    transition: color var(--ease), text-decoration-color var(--ease);
}
.cookie-btn--never:hover {
    color: var(--navy);
    text-decoration-color: currentColor;
}

/* ── Mobile (≤ 540 px) ──────────────────────────────────────────────────── */

@media (max-width: 540px) {
    .cookie-banner           { bottom: 12px; }
    .cookie-banner__card     { padding: 16px 16px 14px; }
    .cookie-banner__top      { gap: 12px; }
    .cookie-banner__icon     { width: 36px; height: 36px; font-size: 18px; }
    .cookie-banner__heading  { font-size: 14px; }
    .cookie-banner__actions  { gap: 8px; }

    /* Accept + Dismiss share the first row as equal-width buttons */
    .cookie-btn--accept,
    .cookie-btn--dismiss {
        flex: 1;
        justify-content: center;
    }

    /* Don't show again drops below on its own row, full width, centred */
    .cookie-btn--never {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        padding-top: 14px;
        padding-bottom: 2px;
        border-top: 1px solid var(--border);
        margin-top: 2px;
        text-decoration: underline;
        text-underline-offset: 2px;
        text-decoration-color: rgba(107, 122, 141, 0.4);
    }
}

/* ── Browser compatibility alert ─────────────────────────────────────────── */
/* Shown by JS when a cookie-hostile browser or mode is detected.            */

.cookie-banner__alert {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    background: rgba(201, 168, 76, 0.10);
    border: 1px solid rgba(201, 168, 76, 0.38);
    border-radius: 7px;
    padding: 0.6rem 0.85rem;
    margin: 0 0 14px;
    line-height: 1.5;
}

.cookie-banner__alert .ti {
    color: #92702A;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

.cookie-banner__alert p {
    font-size: 12px;
    color: var(--navy);
    margin: 0;
    line-height: 1.5;
}
