/* ==========================================================================
   Jean d'Cancale - cookie consent overrides
   --------------------------------------------------------------------------
   Loaded right after css/cookie-consent-css/cookieconsent.css (the
   unmodified vanilla-cookieconsent v3.3.0 stylesheet). Styling is done by
   overriding the library's CSS custom properties on #cc-main; only a few
   layout safeguards and the footer 🍪 button need plain rules.
   Colours stay close to the previous banner: white box, slate text, black
   buttons (hover now in the brand red instead of the old blue).
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Library variables
   -------------------------------------------------------------------------- */

#cc-main {
    /* Shape */
    --cc-modal-border-radius: 0.5rem;
    --cc-btn-border-radius: 0.3rem;

    /* Base colours (previous banner: white background, #2d4156 text) */
    --cc-bg: #ffffff;
    --cc-primary-color: #2d4156;
    --cc-secondary-color: #4a5a6a;
    --cc-link-color: #050505;

    /* Primary buttons: "Tout accepter" and "Tout refuser" share this style
       (equalWeightButtons), as on the previous banner (black) */
    --cc-btn-primary-bg: #050505;
    --cc-btn-primary-color: #ffffff;
    --cc-btn-primary-border-color: #050505;
    --cc-btn-primary-hover-bg: #eb1f12;
    --cc-btn-primary-hover-color: #ffffff;
    --cc-btn-primary-hover-border-color: #eb1f12;

    /* Secondary buttons ("Préférences", "Sauvegarder") */
    --cc-btn-secondary-bg: #eaeff2;
    --cc-btn-secondary-color: #2d4156;
    --cc-btn-secondary-border-color: #eaeff2;
    --cc-btn-secondary-hover-bg: #d8e0e6;
    --cc-btn-secondary-hover-color: #050505;
    --cc-btn-secondary-hover-border-color: #d8e0e6;

    /* Toggles (preferences modal) */
    --cc-toggle-on-bg: #050505;
    --cc-toggle-readonly-bg: #d5dee2;

    /* Section blocks and separators */
    --cc-separator-border-color: #eef1f4;
    --cc-cookie-category-block-bg: #f4f6f8;
    --cc-cookie-category-block-border: #f4f6f8;
    --cc-cookie-category-block-hover-bg: #eceff3;
    --cc-cookie-category-block-hover-border: #eceff3;
    --cc-overlay-bg: rgba(5, 5, 5, 0.65);
}


/* --------------------------------------------------------------------------
   2. Safeguards
   -------------------------------------------------------------------------- */

/* The consent box never grows taller than the viewport (e.g. landscape
   phones, where the desktop "cloud" layout still applies above 640px):
   it scrolls inside instead of covering the page. */
#cc-main .cm {
    max-height: calc(100vh - 2 * var(--cc-modal-margin));
    max-height: calc(100dvh - 2 * var(--cc-modal-margin));
    overflow-y: auto;
}

/* Keyboard focus ring. theme.css removes every outline with
   `*, *:focus { outline: none !important; }`, so !important is required
   here to give the banner and its buttons a visible focus state again. */
#cc-main :focus-visible {
    outline: 2px solid #eb1f12 !important;
    outline-offset: 2px;
}


/* --------------------------------------------------------------------------
   3. Footer 🍪 button (data-cc="show-preferencesModal")
   Moved here unchanged from the old hand-edited library stylesheet;
   the old --main-color-hover variable is now written out (#0062cc).
   -------------------------------------------------------------------------- */

.cookie-button {
    background-color: transparent;
    color: black;
    border: 1px solid #ee2a24;
    line-height: 1.5;
    margin-left: 0.5rem;
    position: relative;
    border-radius: 5px;
    font-size: 1rem;
    padding: 0.1rem;
    cursor: pointer;
}

.cookie-button:hover {
    border: 1px solid #0062cc;
    transition: all 0.3s ease;
}

/* Same reason as above: restore a focus ring hidden by theme.css */
.cookie-button:focus-visible {
    outline: 2px solid #eb1f12 !important;
    outline-offset: 2px;
}
