/**
 * Cookie Consent Banner
 * Bar at the bottom of the screen (template-parts/cookie-consent.php).
 * "Zavrni vse" and "Sprejmi vse" deliberately look the same - refusing has
 * to be as easy and as visible as accepting.
 *
 * Compact on purpose: on a phone it covers the bottom of the screen, so it is
 * a short sentence and one row of buttons (~25% of a 390x844 screen);
 * on desktop text and buttons share one row.
 */

/* The banner is visible straight from the HTML, so it paints together with
   the page instead of waiting for JS. The <head> script adds
   .di-consent-given to <html> once a choice is stored. */
.di-consent-given .cookie-consent {
    display: none;
}

/* Author styles beat the UA [hidden]{display:none} rule on a plain
   specificity tie, so these are needed for the settings and the buttons to
   actually hide. */
.cookie-consent__settings[hidden],
.cookie-consent [data-consent-action][hidden] {
    display: none;
}

.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999; /* above the newsletter teaser (9998) */
    max-height: 100vh;
    overflow-y: auto;
    background: var(--color-surface);
    color: var(--color-text);
    border-top: 3px solid var(--color-primary-alt);
    box-shadow: 0 -4px 12px var(--color-shadow);
}

.cookie-consent__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--spacing-3) var(--spacing-4);
}

.cookie-consent__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-1);
}

.cookie-consent__title {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--color-heading);
}

/* "Prilagodi" - a text link next to the title, not a third button row. */
.cookie-consent__link {
    padding: 0;
    background: none;
    border: none;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-heading);
    text-decoration: underline;
    cursor: pointer;
}

.cookie-consent__text {
    margin: 0 0 var(--spacing-3);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

/* Purple text (white in dark mode) with an orange underline: orange 14px
   text is only 3.25:1 on white. Underlined, since it sits inside a sentence. */
.cookie-consent__text a {
    color: var(--color-heading);
    font-weight: var(--font-weight-bold);
    text-decoration: underline;
    text-decoration-color: var(--color-primary-alt);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.cookie-consent__settings {
    display: grid;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-3);
}

.cookie-consent__option {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
    border: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    cursor: pointer;
}

.cookie-consent__option strong {
    display: block;
    color: var(--color-heading);
}

.cookie-consent__option input {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin: var(--spacing-05) 0 0;
    accent-color: var(--color-primary-alt);
}

.cookie-consent__option input:disabled {
    cursor: not-allowed;
}

/* Mobile: "Zavrni vse" and "Sprejmi vse" side by side; "Shrani izbor"
   (only while the settings are open) on its own row above them. */
.cookie-consent__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2);
}

/* Two classes, so these beat components.css's .btn whichever loads first. */
.cookie-consent .cookie-consent__btn {
    padding: var(--spacing-3) var(--spacing-3);
}

.cookie-consent .cookie-consent__btn--secondary {
    grid-column: 1 / -1;
    background-color: transparent;
    color: var(--color-heading);
    border: 1px solid var(--color-border);
    box-shadow: none;
}

/* Keeps the newsletter owl from covering the banner - jQuery sets its
   display inline, so only !important wins here. */
html:not(.di-consent-given) .newsletter-corner-teaser {
    display: none !important;
}

@media (min-width: 768px) {
    /* Text left, buttons right, in one row; the settings take the full
       width between them when opened. */
    .cookie-consent__inner {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        column-gap: var(--spacing-6);
        padding: var(--spacing-4) var(--spacing-6);
    }

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

    .cookie-consent__text {
        margin-bottom: 0;
    }

    .cookie-consent__settings {
        grid-column: 1 / -1;
        grid-row: 2;
        grid-template-columns: repeat(3, 1fr);
        margin: var(--spacing-4) 0 0;
    }

    .cookie-consent__actions {
        display: flex;
        grid-column: 2;
        grid-row: 1;
    }

    .cookie-consent .cookie-consent__btn {
        width: auto;
        min-width: 9rem;
        padding: var(--spacing-3) var(--spacing-6);
    }

    .cookie-consent .cookie-consent__btn--secondary {
        grid-column: auto;
    }
}
