/* =========================================================
   ALL KLEER — FIRST-VISIT PRIVACY CHOICE GATE
   Site interaction is blocked only until the visitor chooses
   Allow Optional or Reject Optional. Rejecting still grants full access.

   FIRST-VISIT STACKING FIX:
   - forces the header/gate above hero content in a clean session
   - prevents transformed header ancestors from trapping fixed positioning
   - gives backdrop and panel explicit internal z-index layers
   ========================================================= */

html.consent-pending,
html.consent-pending body {
    overflow: hidden;
}

/*
   The gate is rendered from the shared header. Some site header/hero effects
   create their own stacking contexts. During the first-visit decision only,
   neutralize those traps and put the header above all page content.
*/
html.consent-pending header {
    position: relative !important;
    z-index: 2147483000 !important;
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    isolation: isolate;
}

/* Nothing underneath the consent UI should be clickable while pending. */
html.consent-pending main,
html.consent-pending footer {
    pointer-events: none !important;
    user-select: none;
}

.cookie-gate {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483646 !important;
    pointer-events: none;
    isolation: isolate;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
}

html.consent-pending .cookie-gate {
    display: block;
    pointer-events: auto;
}

.cookie-gate__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(3, 5, 7, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.cookie-gate__panel {
    position: fixed;
    z-index: 2;
    top: 126px;
    left: 50%;
    width: min(calc(100% - 6rem), 1450px);
    transform: translateX(-50%);

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: center;

    padding: 1.4rem 1.6rem;
    border: 1px solid rgba(140, 255, 159, 0.42);
    border-top: 0;
    border-radius: 0 0 16px 16px;

    /*
       Intentionally opaque. The hero should never visually bleed through
       the first-visit privacy choice panel.
    */
    background: #070a09;

    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.58),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);

    color: #f5f7f5;
}

.cookie-gate__copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.cookie-gate__copy h2 {
    margin: 0.22rem 0 0.55rem;
    font-size: clamp(1.55rem, 2.2vw, 2.35rem);
    line-height: 1;
    letter-spacing: -0.035em;
    font-weight: 500;
}

.cookie-gate__copy p:last-child {
    max-width: 820px;
    margin: 0;
    color: rgba(245, 247, 245, 0.74);
    line-height: 1.55;
}

.cookie-gate a,
.cookie-text-button,
.footer-cookie-settings,
.inline-cookie-settings {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.cookie-gate__actions {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.cookie-gate .button {
    width: auto;
    min-height: 44px;
    white-space: nowrap;
}

.cookie-text-button,
.footer-cookie-settings,
.inline-cookie-settings {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0.65rem 0.35rem;
    font: inherit;
    cursor: pointer;
}

/* Preferences dialog */
.cookie-dialog {
    width: min(720px, calc(100vw - 2rem));
    max-height: min(780px, calc(100vh - 2rem));
    padding: 0;
    border: 1px solid rgba(140, 255, 159, 0.48);
    border-radius: 16px;
    background: #090b0e;
    color: #f6f7f8;
    box-shadow: 0 25px 90px rgba(0,0,0,.65);
    z-index: 2147483647;
}

.cookie-dialog::backdrop {
    background: rgba(0,0,0,.76);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.cookie-dialog__panel { padding: 1.6rem; }

.cookie-dialog__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.cookie-dialog__header h2 {
    margin: .2rem 0 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.cookie-dialog__close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

html.consent-pending .cookie-dialog__close {
    opacity: 0.35;
    cursor: not-allowed;
}

.cookie-preference-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.1rem 0;
    border-top: 1px solid rgba(255,255,255,.14);
}

.cookie-preference-row p {
    margin: .25rem 0 0;
    opacity: .76;
    line-height: 1.5;
}

.cookie-preference-row input {
    width: 1.3rem;
    height: 1.3rem;
}

.cookie-always-on {
    font-family: var(--font-tech, monospace);
    font-size: .8rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #98ffad;
}

.cookie-dialog__actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    padding-top: 1.35rem;
}

/* Light theme remains fully opaque as well. */
body:not(.dark-theme) .cookie-gate__panel,
body:not(.dark-theme) .cookie-dialog {
    background: #fafbfc;
    color: #101216;
    border-color: rgba(20, 130, 95, .42);
}

body:not(.dark-theme) .cookie-gate__copy p:last-child {
    color: rgba(16, 18, 22, 0.72);
}

@media (max-width: 1100px) {
    .cookie-gate__panel {
        top: 110px;
        width: min(calc(100% - 3rem), 1450px);
        grid-template-columns: 1fr;
        gap: 1.15rem;
    }

    .cookie-gate__actions {
        justify-content: flex-start;
    }
}

@media (max-width: 650px) {
    .cookie-gate__panel {
        top: 92px;
        width: calc(100% - 2rem);
        max-height: calc(100vh - 108px);
        overflow-y: auto;
        padding: 1rem;
        border-radius: 0 0 12px 12px;
    }

    .cookie-gate__actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cookie-gate .button,
    .cookie-gate .cookie-text-button {
        width: 100%;
        text-align: center;
    }

    .cookie-preference-row {
        grid-template-columns: 1fr;
        gap: .65rem;
    }
}
