/* The bar ships hidden and is revealed by JS. This needs (0,2,0): the UA's
   `[hidden] { display: none }` is (0,1,0) and so is `.gia-cookie-banner`, and an
   author rule wins that tie against the UA stylesheet — display:flex below would
   otherwise keep the bar on screen for visitors who already accepted. */
.gia-cookie-banner[hidden] {
    display: none;
}

.gia-cookie-banner {
    position: fixed;
    inset-inline: 0;
    /* Physical `bottom`, matching how .gia-header pins itself. The bar floating
       mid-page is the one failure here that ruins the page, so it does not rely
       on a logical inset. */
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 0.8125rem 1.25rem;
    background: var(--color-white);
    border-block-start: 1px solid rgb(68, 68, 68);
    color: var(--color-ink);
}

/* Elementor's Global Kit styles bare `p` at (0,1,1), so a single class would
   lose the colour and size set here. */
.gia-cookie-banner .gia-cookie-banner__message {
    flex: 1 1 20rem;
    margin: 0;
    color: var(--color-ink);
    font-size: var(--text-small);
    line-height: 1.5;
}

/* The policy link and the settings trigger read the same, but the trigger is a
   <button> because it opens a dialog rather than navigating. That means it also
   has to answer the kit's bare `button` rule, which would otherwise give it a
   border, its own font and 25px/120px of padding. */
.gia-cookie-banner .gia-cookie-banner__link {
    display: inline;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    /* Longhands, not the `font` shorthand: it is the one declaration here that
       has to survive every engine, and where the shorthand is not expanded the
       button falls back to the UA's 16px and reads a size larger than the
       sentence it sits in. */
    font-family: inherit;
    font-size: inherit;
    font-style: inherit;
    line-height: inherit;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-brand-red);
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
    cursor: pointer;
}

/* The kit's `button:hover/:focus` is (0,2,1) and beats the resting rule above. */
.gia-cookie-banner .gia-cookie-banner__link:hover,
.gia-cookie-banner .gia-cookie-banner__link:focus {
    background: none;
    border: none;
    color: var(--color-brand-red);
    text-decoration: underline;
}

/* (0,3,0) to trim the 1rem/2rem padding `.btn.btn--primary` sets — a bar button
   is smaller than a form's submit. */
.gia-cookie-banner .btn.gia-cookie-banner__accept {
    flex-shrink: 0;
    justify-content: center;
    min-width: 140px;
    padding: 0.625rem 1.5rem;
    font-size: var(--text-small);
}

/* Native <dialog>: the browser handles focus trapping, Escape and the backdrop. */
.gia-cookie-settings {
    /* Stated rather than inherited from the UA stylesheet's
       `dialog { position: absolute; margin: auto }`. Same result in a conformant
       engine, but it no longer depends on that rule being there. */
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(40rem, 92vw);
    max-height: 90vh;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-white);
    color: var(--color-ink);
    overflow: auto;
}

.gia-cookie-settings::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.gia-cookie-settings__inner {
    position: relative;
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.gia-cookie-settings .gia-cookie-settings__title {
    margin-block-end: 1rem;
    padding-inline-end: 2.5rem;
    color: var(--color-ink);
    font-size: var(--text-h3);
    font-weight: var(--font-weight-bold);
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.2;
}

.gia-cookie-settings .gia-cookie-settings__intro {
    margin-block-end: 1.5rem;
    color: var(--color-ink);
    font-size: var(--text-small);
    line-height: 1.6;
}

/* (0,2,0) to clear Elementor's bare `button` rule while the plugin is still on. */
.gia-cookie-settings .gia-cookie-settings__close {
    position: absolute;
    inset-block-start: 0.75rem;
    inset-inline-end: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    color: var(--color-ink);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.gia-cookie-settings .gia-cookie-settings__close:hover,
.gia-cookie-settings .gia-cookie-settings__close:focus-visible {
    background: var(--color-section-bg);
    border: none;
}

.gia-cookie-settings__category {
    border-block-start: 1px solid var(--color-checkbox-border);
    padding-block: 1rem;
}

.gia-cookie-settings__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-weight-semibold);
}

.gia-cookie-settings__toggle input {
    flex-shrink: 0;
}

.gia-cookie-settings__always {
    color: var(--color-checkbox-checked);
    font-size: var(--text-tiny);
    font-weight: var(--font-weight-regular);
}

.gia-cookie-settings .gia-cookie-settings__description {
    margin-block-start: 0.5rem;
    color: var(--color-newsletter-label);
    font-size: var(--text-small);
    line-height: 1.5;
}

.gia-cookie-settings__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-block-start: 1.5rem;
}

.gia-cookie-settings .btn.gia-cookie-settings__save,
.gia-cookie-settings .btn.gia-cookie-settings__accept {
    padding: 0.625rem 1.5rem;
    font-size: var(--text-small);
}

/* Secondary action: the same box as the primary button, outlined instead of
   filled. (0,3,0) to outrank `.btn.btn--primary`, and its hover has to be
   answered separately or the kit's `button:hover` at (0,2,1) repaints it. */
.gia-cookie-settings .btn.gia-cookie-settings__save {
    background: none;
    border: 1px solid var(--color-brand-red);
    color: var(--color-brand-red);
}

.gia-cookie-settings .btn.gia-cookie-settings__save:hover,
.gia-cookie-settings .btn.gia-cookie-settings__save:focus {
    background: var(--color-section-bg);
    border: 1px solid var(--color-brand-red);
    color: var(--color-brand-red);
    filter: none;
}

@media (max-width: 640px) {
    .gia-cookie-banner {
        padding: 1rem;
    }

    .gia-cookie-banner .btn.gia-cookie-banner__accept {
        width: 100%;
    }

    .gia-cookie-settings__actions .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}
