/* Баннер согласия на cookie: templates/partial/cookie_consent.html */
.cookie-consent {
    --cc-ink: #3a2f45;
    --cc-ink-soft: #6b5f78;
    --cc-ink-muted: #9a8eaa;
    --cc-line: rgba(178, 162, 198, 0.32);
    --cc-surface: #fffef8;
    --cc-accent: #af8fcc;
    --cc-accent-deep: #8b7a9e;
    --cc-chip: rgba(178, 162, 198, 0.16);
    --cc-pink: rgba(233, 174, 210, 0.35);

    position: fixed;
    left: 16px;
    right: 16px;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
    z-index: 1085;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px 16px;
    max-width: 1040px;
    max-height: calc(100vh - 32px);
    margin: 0 auto;
    padding: 20px 56px 20px 20px;
    overflow-y: auto;
    background: var(--cc-surface);
    color: var(--cc-ink);
    border: 1px solid var(--cc-line);
    border-radius: 1.15rem;
    box-shadow: 0 16px 48px rgba(58, 47, 69, 0.18), 0 2px 8px rgba(58, 47, 69, 0.06);
    font-family: Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    text-align: left;
    animation: cookie-consent-in 0.28s ease-out both;
}

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

.cookie-consent:focus-visible {
    outline: 2px solid var(--cc-accent-deep);
    outline-offset: 2px;
}

.cookie-consent[hidden] {
    display: none;
}

.cookie-consent *,
.cookie-consent *::before,
.cookie-consent *::after {
    box-sizing: border-box;
}

@keyframes cookie-consent-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.cookie-consent__icon {
    align-self: start;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cc-pink);
    color: var(--cc-accent-deep);
}

.cookie-consent__body {
    min-width: 0;
}

.cookie-consent__title {
    margin: 0 0 4px;
    font-family: Cormorant, Georgia, serif;
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--cc-ink);
}

.cookie-consent__text {
    margin: 0;
    color: var(--cc-ink-soft);
}

.cookie-consent__status {
    display: inline-block;
    margin: 10px 0 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--cc-chip);
    color: var(--cc-accent-deep);
    font-size: 13px;
    font-weight: 500;
}

.cookie-consent__status[hidden] {
    display: none;
}

/* —— «Подробнее» —— */
.cookie-consent__details {
    margin-top: 8px;
}

.cookie-consent__details summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    color: var(--cc-accent-deep);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
}

.cookie-consent__details summary::-webkit-details-marker {
    display: none;
}

.cookie-consent__details summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.cookie-consent__details[open] summary::after {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.cookie-consent__categories {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.cookie-consent__categories li {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 2px 10px;
    padding: 10px 12px;
    border: 1px solid var(--cc-line);
    border-radius: 0.85rem;
    background: #ffffff;
}

.cookie-consent__category {
    font-weight: 500;
}

.cookie-consent__badge {
    justify-self: start;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--cc-chip);
    color: var(--cc-accent-deep);
    font-size: 12px;
    font-weight: 500;
}

.cookie-consent__badge--optional {
    background: var(--cc-pink);
    color: var(--cc-ink);
}

.cookie-consent__category-text {
    grid-column: 1 / -1;
    color: var(--cc-ink-soft);
    font-size: 13px;
}

.cookie-consent__note {
    margin: 10px 0 0;
    color: var(--cc-ink-soft);
    font-size: 13px;
}

.cookie-consent__note a {
    color: var(--cc-accent-deep);
    text-decoration: underline;
}

/* —— Кнопки —— */
.cookie-consent__actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Обе кнопки одинаковые: выбор не должен подталкивать к «Принять». */
.cookie-consent__button {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--cc-accent);
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cookie-consent__button:hover {
    background: var(--cc-accent-deep);
}

.cookie-consent__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cc-ink-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cookie-consent__close:hover {
    background: var(--cc-chip);
    color: var(--cc-ink);
}

.cookie-consent button:focus-visible,
.cookie-consent summary:focus-visible,
.cookie-consent a:focus-visible {
    outline: 2px solid var(--cc-accent-deep);
    outline-offset: 2px;
}

/* Десктоп: текст и кнопки в одну строку, баннер ниже и не перекрывает контент. */
@media (min-width: 768px) {
    .cookie-consent {
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 20px;
        bottom: 24px;
        padding: 20px 60px 20px 24px;
    }

    .cookie-consent__actions {
        grid-column: auto;
        /* 1fr 1fr в колонке auto: обе кнопки по ширине более длинной. */
        grid-template-columns: 1fr 1fr;
        align-self: center;
    }

    .cookie-consent__button {
        padding: 10px 22px;
        white-space: nowrap;
    }

    /* Раскрыли «Подробнее» — кнопки внизу, там, где заканчивается чтение. */
    .cookie-consent:has(.cookie-consent__details[open]) .cookie-consent__actions {
        align-self: end;
    }
}

/* Телефон: без иконки и с меньшими отступами — баннер занимает меньше экрана. */
@media (max-width: 767.98px) {
    .cookie-consent {
        grid-template-columns: 1fr;
        gap: 12px;
        left: 12px;
        right: 12px;
        padding: 16px 48px 16px 16px;
    }

    .cookie-consent__icon {
        display: none;
    }

    .cookie-consent__title {
        font-size: 1.3rem;
    }

    .cookie-consent__text {
        font-size: 14px;
    }

    .cookie-consent__actions {
        margin-right: -32px;
    }

    .cookie-consent__close {
        top: 6px;
        right: 6px;
    }
}

/* «Только необходимые» не помещается в половину ширины — кнопки друг под другом. */
@media (max-width: 419.98px) {
    .cookie-consent__actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent {
        animation: none;
    }

    .cookie-consent__details summary::after,
    .cookie-consent__button,
    .cookie-consent__close {
        transition: none;
    }
}

@media print {
    .cookie-consent {
        display: none !important;
    }
}

/* —— Ссылка «Настройки cookie» —— */
/* Кнопка выглядит как соседние ссылки и выравнивается так же. */
.footer-cookie-settings {
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    text-align: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.footer-cookie-settings.d-block {
    width: 100%;
}

/* В подвале — как соседние ссылки, без подчёркивания. */
.footer-text.footer-cookie-settings {
    text-decoration: none;
}
