/*
 * Medību Tornis - cookie banner and cookie settings dialog.
 */

/* ---- Banner ------------------------------------------------------------- */

.cookie-banner {
    position: fixed;
    right: clamp(0.5rem, 2vw, 1.5rem);
    bottom: clamp(0.5rem, 2vw, 1.5rem);
    left: clamp(0.5rem, 2vw, 1.5rem);
    z-index: 150;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    max-width: 1400px;
    max-height: calc(100vh - 1rem);
    margin-inline: auto;
    padding: 1.1rem 1.5rem 1.1rem 0;
    background: linear-gradient(90deg, #0a1c13 0%, #07160f 100%);
    border: 1px solid var(--gold-500);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    color: var(--on-dark);
    overflow: hidden auto;
}

.cookie-banner__art {
    align-self: stretch;
    min-height: 96px;
    margin-block: -1.1rem;
    -webkit-mask-image: linear-gradient(90deg, #000 60%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 60%, transparent 100%);
}

.cookie-banner__art svg {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1d2a1c 0%, #4b3f1e 58%, #2a2f1a 100%);
}

.cookie-art__moon {
    fill: #e9c98f;
    opacity: 0.9;
}

.cookie-art__hill {
    fill: #0c1e15;
}

.cookie-art__hill--far {
    fill: #14271b;
}

.cookie-art__shape {
    fill: #07140e;
}

.cookie-art__line {
    fill: none;
    stroke: #07140e;
    stroke-width: 3;
    stroke-linecap: round;
}

.cookie-banner__body {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.cookie-banner__icon {
    flex: none;
    color: var(--gold-300);
}

.cookie-banner__icon .icon {
    width: 2.5rem;
    height: 2.5rem;
}

.cookie-banner__title {
    margin-bottom: 0.3rem;
    font-size: 1.3rem;
}

.cookie-banner__text {
    margin: 0;
    max-width: 62em;
    color: var(--on-dark-soft);
    font-size: 0.95rem;
    line-height: 1.5;
}

.cookie-banner__text a {
    color: var(--gold-300);
    white-space: nowrap;
}

.cookie-banner__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    min-width: 400px;
}

.cookie-banner__actions .btn {
    min-height: 48px;
    padding: 0.6rem 1rem;
    font-size: 1rem;
}

.cookie-banner__actions .btn--text {
    grid-column: 1 / -1;
    min-height: 40px;
    justify-self: center;
}

/* ---- Settings dialog ---------------------------------------------------- */

.cookie-dialog {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.cookie-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 10, 7, 0.78);
}

.cookie-dialog__panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 2rem);
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--green-900);
    border: 1px solid var(--gold-500);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    color: var(--on-dark);
    overflow-y: auto;
}

.cookie-dialog__panel:focus {
    outline: none;
}

.cookie-dialog__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--gold-300);
}

.cookie-dialog__close:hover {
    background: rgba(223, 179, 112, 0.14);
}

.cookie-dialog__title {
    padding-right: 3rem;
    font-size: 1.6rem;
}

.cookie-dialog__intro {
    margin: 0.6rem 0 0;
    color: var(--on-dark-soft);
    font-size: 0.975rem;
    line-height: 1.5;
}

.cookie-dialog__intro a {
    color: var(--gold-300);
}

.cookie-options {
    margin-block: 1.25rem;
    border-block: 1px solid var(--line-dark);
}

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding-block: 1rem;
}

.cookie-option + .cookie-option {
    border-top: 1px solid var(--line-dark);
}

.cookie-option__title {
    font-size: 1.1rem;
}

.cookie-option__text p {
    margin: 0.25rem 0 0;
    color: var(--on-dark-soft);
    font-size: 0.925rem;
    line-height: 1.45;
}

.switch {
    position: relative;
    flex: none;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    cursor: pointer;
}

.switch input {
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 32px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.switch input:disabled {
    cursor: not-allowed;
}

.switch__track {
    position: relative;
    display: block;
    width: 56px;
    height: 32px;
    border: 1.5px solid var(--gold-500);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    transition: background-color var(--transition);
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: var(--on-dark-soft);
    transition: transform var(--transition), background-color var(--transition);
}

.switch input:checked + .switch__track {
    background: var(--gold-500);
}

.switch input:checked + .switch__track::after {
    background: var(--green-950);
    transform: translateX(24px);
}

.switch input:disabled + .switch__track {
    opacity: 0.65;
}

.switch input:focus-visible + .switch__track {
    outline: 3px solid var(--gold-300);
    outline-offset: 3px;
}

.switch__state {
    color: var(--on-dark-soft);
    font-size: 0.8rem;
    white-space: nowrap;
}

.cookie-dialog__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.cookie-dialog__actions .btn {
    padding-inline: 0.75rem;
    font-size: 0.975rem;
}

/* ---- Narrow screens ----------------------------------------------------- */

@media (max-width: 1180px) {
    .cookie-banner {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
        padding: 1.1rem 1.25rem;
    }

    .cookie-banner__art {
        display: none;
    }

    .cookie-banner__actions {
        grid-template-columns: repeat(3, auto);
        justify-content: start;
        min-width: 0;
    }

    .cookie-banner__actions .btn--text {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .cookie-banner {
        border-radius: 14px;
    }

    .cookie-banner__icon {
        display: none;
    }

    .cookie-banner__title {
        font-size: 1.15rem;
    }

    .cookie-banner__text {
        font-size: 0.9rem;
    }

    .cookie-banner__actions,
    .cookie-dialog__actions {
        grid-template-columns: 1fr;
    }

    .cookie-banner__actions .btn--text {
        justify-self: stretch;
    }

    .cookie-option {
        align-items: flex-start;
    }
}
