/* Cookie consent banner for the marketing website (#3861), docs/features/cookie-consent.md */

.cookie-consent {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1040;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--whitecolor);
    color: var(--buttontextcolor);
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 30, 102, 0.14);
}

.cookie-consent[hidden],
.cookie-consent [hidden] {
    display: none !important;
}

.cookie-consent-body {
    padding: 16px 18px;
}

.cookie-consent-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--buttontextcolor);
}

.cookie-consent-title:focus {
    outline: none;
}

.cookie-consent-text {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--buttontextcolor);
}

.cookie-consent-text a {
    color: var(--buttontextcolor);
    text-decoration: underline !important;
}

.cookie-consent-text a:hover {
    color: var(--primarycolor);
}

.cookie-consent-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Both choices look the same, so neither is pushed over the other */
.cookie-consent-btn {
    flex: 1 1 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    background: var(--primarycolor);
    color: var(--whitecolor);
    font-family: var(--publicsansfont);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease-in-out;
}

.cookie-consent-btn:hover {
    background: var(--accent05);
}

.cookie-consent-customise {
    border-top: 1px solid #E5E7EB;
}

.cookie-consent-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 18px;
    border: 0;
    background: transparent;
    color: var(--buttontextcolor);
    font-family: var(--publicsansfont);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.cookie-consent-chevron {
    flex: none;
    transition: transform 0.2s ease-in-out;
}

.cookie-consent-toggle[aria-expanded="true"] .cookie-consent-chevron {
    transform: rotate(180deg);
}

.cookie-consent-manage {
    padding: 0 18px 14px;
}

.cookie-consent-manage fieldset {
    margin: 0 0 10px;
    padding: 0;
    border: 0;
}

.cookie-consent-manage .cookie-consent-btn {
    width: 100%;
}

.cookie-consent-category {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #E5E7EB;
}

.cookie-consent-category input {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--primarycolor);
}

.cookie-consent-category label {
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--buttontextcolor);
}

.cookie-consent-category label strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

/*
 * The cookie tables in section 9 of the Privacy Policy, on its page and in the footer's modal. They would otherwise take the
 * 18px body size, larger than the 16px subheadings between them.
 */
.legal-content .table {
    --bs-table-color: var(--primarycolor);
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.4;
}

.legal-content .table th {
    font-weight: 600;
    white-space: nowrap;
}

/* Cookie names stay whole, and long lists of them wrap rather than stretch the table */
.legal-content .table td:first-child {
    min-width: 9.5em;
    overflow-wrap: anywhere;
}

/* The banner's Cookies Policy link lands on section 9 clear of the fixed navbar */
#cookies {
    scroll-margin-top: 120px;
}

/* Cookie settings in the footer: a button, styled like the legal links beside it */
.legal-menu-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent04);
    font: inherit;
    font-weight: 200;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.legal-menu-btn:hover {
    color: var(--accent08);
}

.cookie-consent-btn:focus-visible,
.cookie-consent-toggle:focus-visible,
.cookie-consent-category input:focus-visible,
.cookie-consent-text a:focus-visible,
.legal-menu [data-cookie-settings]:focus-visible {
    outline: 3px solid var(--secondarycolor);
    outline-offset: 2px;
}

/* The toggle spans the card, whose scrolling would clip an outline drawn outside it */
.cookie-consent-toggle:focus-visible {
    outline-offset: -3px;
}

@media (max-width: 575px) {
    .cookie-consent {
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        /* Leaves the navbar at the top of the screen clear */
        max-height: calc(100vh - 96px);
    }

    .cookie-consent-body {
        padding: 12px 14px;
    }

    .cookie-consent-toggle {
        padding: 10px 14px;
    }

    .cookie-consent-manage {
        padding: 0 14px 12px;
    }
}
