/* =====================================================================
   RK Cookie Consent — banner + "Manage Cookies" popup
   Styled with Intone's global design-system tokens (--ds-*, --t-*).

   NOTE: this markup is injected on `wp_footer`, OUTSIDE the per-template
   `.intone-page` wrapper — so the *semantic* DS tokens (--primary,
   --gold-primary, --body-font, etc., defined only on `.intone-page`) are
   not in scope here. Only the *global* tokens on `:root` /
   `[data-theme="dark"]` (--ds-*, --t-*) resolve correctly, so those are
   used throughout instead.
   ===================================================================== */

#rk-cookie-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: clamp(280px, 90vw, 400px);
    padding: 24px;
    background: var(--t-bg, #ffffff);
    border: 1px solid var(--t-border, rgba(9, 16, 29, 0.08));
    box-shadow: var(--t-shadow, 0 4px 24px rgba(9, 16, 29, 0.08));
    justify-content: flex-start;
    align-items: flex-end;
    gap: 4px;
    display: inline-flex;
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease;
}

/* Slid into view once the visitor has scrolled past the reveal threshold */
#rk-cookie-banner.rk-cc-show {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    #rk-cookie-banner {
        transition: opacity 0.3s ease;
        transform: none;
    }
}

/* for desktop */
@media (min-width: 1025px) {
    #rk-cookie-banner svg {
        width: 43px;
        height: 40px;
    }
}

 /* Responsive Adjustments */
 @media (max-width: 1024px) {
    #rk-cookie-banner svg {
        width: 40px;
        height: 37px;
    }
}
.rk-cookie-banner-outer-wrapper {
    width: 100%;
    height: 100%;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    display: inline-flex;
}

.rk-cookie-banner-inner-wrapper {
    justify-content: flex-start;
    gap: 13px;
    display: flex; /* Changed from inline-flex to flex for better control */
    width: 100%; /* Ensure it takes full width within its parent */
}

.rk-cookie-icon {
    flex-shrink: 0; /* Prevent icon from shrinking */
    display: flex;
}

.rk-cookie-text-and-buttons-wrapper {
    display: flex;
    flex-direction: column; /* Stack text and buttons vertically */
    gap: 23px; /* Gap between text and buttons */
    flex-grow: 1; /* Allow this wrapper to take available space */
}

.rk-cookie-banner-text {
    color: var(--t-text, #09101d);
    font-size: 14px;
    font-family: var(--ds-font-body, "Public Sans", sans-serif);
    font-weight: 400;
    line-height: 20px;
    word-wrap: break-word;
}

.rk-cookie-policy-link {
    color: var(--ds-primary-300, #ff5c02);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.rk-cookie-policy-link:hover {
    color: var(--ds-primary-400, #c74700);
}

.rk-cookie-banner-buttons-bottom {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 13px;
    display: inline-flex;
}

.rk-cookie-banner-buttons-bottom .button {
    padding: 7px 25px;
    overflow: hidden;
    border-radius: 0;
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 10px;
    font-family: var(--ds-font-body, "Public Sans", sans-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 20px;
    word-wrap: break-word;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* "Options" — secondary / outline treatment */
.rk-cookie-btn-reject {
    background: transparent;
    color: var(--t-text, #09101d);
    border: 2px solid var(--t-border-strong, rgba(9, 16, 29, 0.14));
}

.rk-cookie-btn-reject:hover {
    border-color: var(--ds-primary-300, #ff5c02);
    color: var(--ds-primary-300, #ff5c02);
}

/* "Accept All" — primary brand CTA */
.rk-cookie-btn-allow {
    background: var(--ds-gold, #f6b43f);
    color: #ffffff;
    border: 2px solid var(--ds-gold, #f6b43f);
}

.rk-cookie-btn-allow:hover {
    background: var(--ds-yellow-300, #dfb400);
    border-color: var(--ds-yellow-300, #dfb400);
}

/* Close button */
.rk-cookie-close-btn {
    position: absolute;
    top: 0px;
    right: 0px;
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: var(--t-text-muted, rgba(9, 16, 29, 0.5));
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    line-height: 1;
    z-index: 10000;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rk-cookie-close-btn:hover {
    color: var(--t-text, #09101d);
    background: var(--t-surface, #f4f6f9);
}

.rk-cookie-close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--ds-primary-300, #ff5c02);
}

.rk-cookie-close-btn:active {
    transform: scale(0.95);
}

/* Responsive Adjustments */
@media (max-width: 968px) {
    #rk-cookie-banner {
        padding: 15px;
        bottom: 10px;
        right: 10px;
        /* Keep the same flex layout as desktop */
        justify-content: flex-start;
        align-items: flex-end;
        gap: 4px;
        display: inline-flex;
    }

    .rk-cookie-banner-outer-wrapper {
        /* Keep the same flex layout as desktop */
        width: 100%;
        height: 100%;
        justify-content: flex-start;
        align-items: center;
        gap: 4px;
        display: inline-flex;
    }

    .rk-cookie-banner-inner-wrapper {
        /* Keep horizontal layout: image on left, text/buttons on right */
        justify-content: flex-start;
        align-items: flex-start; /* Changed to flex-start for better mobile alignment */
        gap: 10px; /* Reduced gap for mobile */
        display: flex;
        width: 100%;
    }

    .rk-cookie-icon {
        flex-shrink: 0;
        /* Make icon smaller on mobile */
        max-width: 40px;
    }

    .rk-cookie-icon svg {
        width: 100%;
        height: auto;
    }

    .rk-cookie-text-and-buttons-wrapper {
        display: flex;
        flex-direction: column; /* Keep text and buttons stacked vertically */
        gap: 15px; /* Reduced gap for mobile */
        flex-grow: 1;
        margin-right: 16px;
    }

    .rk-cookie-banner-text {
        color: var(--t-text, #09101d);
        font-size: 13px; /* Slightly smaller font for mobile */
        font-family: var(--ds-font-body, "Public Sans", sans-serif);
        font-weight: 400;
        line-height: 18px; /* Adjusted line height */
        word-wrap: break-word;
        width: 100%;
    }

    .rk-cookie-banner-buttons-bottom {
        /* Keep buttons in a row */
        justify-content: flex-start;
        align-items: flex-start;
        gap: 8px; /* Reduced gap for mobile */
        display: inline-flex;
        width: 100%;
    }

    .rk-cookie-banner-buttons-bottom .button {
        padding: 6px 15px; /* Reduced padding for mobile */
        overflow: hidden;
        border-radius: 0;
        justify-content: center;
        align-items: center;
        display: flex;
        gap: 8px; /* Reduced gap */
        font-size: 12px; /* Smaller font for mobile */
        font-weight: 600;
        line-height: 18px; /* Adjusted line height */
        word-wrap: break-word;
        cursor: pointer;
        flex: 1; /* Make buttons equal width */
        min-width: 0; /* Allow buttons to shrink */
    }

    /* Mobile close button adjustments */
    .rk-cookie-close-btn {
        top: 6px;
        right: 6px;
        font-size: 16px;
        width: 24px;
        height: 24px;
    }
}
/* =====================================================================
   Custom "Manage Cookies" popup
   ===================================================================== */
.rk-cc-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: none; /* toggled to flex by JS */
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: var(--ds-font-body, "Public Sans", sans-serif);
}

.rk-cc-modal.is-open {
    display: flex;
}

.rk-cc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 20, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.rk-cc-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--t-bg, #ffffff);
    border: 1px solid var(--t-border, rgba(9, 16, 29, 0.08));
    border-radius: 0;
    box-shadow: 0 30px 70px -20px rgba(20, 20, 20, 0.35);
    padding: 34px 38px 28px;
    overflow: hidden;
    animation: rkccIn 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes rkccIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rk-cc-x {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--t-text-muted, rgba(9, 16, 29, 0.5));
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}
.rk-cc-x:hover { background: var(--t-surface, #f4f6f9); color: var(--t-text, #09101d); }

.rk-cc-title {
    margin: 0 40px 10px 0;
    color: var(--t-text, #09101d);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.rk-cc-subtitle {
    margin: 0 0 22px;
    color: var(--t-text-muted, rgba(9, 16, 29, 0.5));
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
}

/* Bordered, scrollable card of categories */
.rk-cc-card {
    border: 1px solid var(--t-border-strong, rgba(9, 16, 29, 0.14));
    border-radius: 0;
    padding: 6px 26px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.rk-cc-cat {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    border-bottom: 1px solid var(--t-border, rgba(9, 16, 29, 0.08));
}
.rk-cc-cat:last-child { border-bottom: none; }

.rk-cc-cat-info { flex: 1 1 auto; min-width: 0; }

.rk-cc-cat-name {
    margin: 0 0 6px;
    color: var(--t-text, #09101d);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.rk-cc-cat-desc {
    margin: 0;
    color: var(--t-text-muted, rgba(9, 16, 29, 0.5));
    font-size: 14.5px;
    line-height: 1.5;
    font-weight: 400;
    max-width: 46ch;
}

/* Toggle switch */
.rk-cc-switch {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 26px;
    margin-top: 4px;
    cursor: pointer;
}
.rk-cc-switch .toggle-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}
.rk-cc-slider {
    position: absolute;
    inset: 0;
    background: var(--ds-neutral-300, #d2d2d2);
    border-radius: 999px;
    transition: background 0.25s ease;
}
[data-theme="dark"] .rk-cc-slider {
    background: rgba(255, 255, 255, 0.18);
}
.rk-cc-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease;
}
.rk-cc-switch .toggle-input:checked + .rk-cc-slider {
    background: var(--ds-green-200, #1fc16b);
}
.rk-cc-switch .toggle-input:checked + .rk-cc-slider::before {
    transform: translateX(22px);
}
.rk-cc-switch .toggle-input:focus-visible + .rk-cc-slider {
    box-shadow: 0 0 0 3px var(--ds-green-10, rgba(31, 193, 107, 0.25));
}
.rk-cc-switch.is-locked,
.rk-cc-switch.is-locked .toggle-input { cursor: not-allowed; }
.rk-cc-switch.is-locked .toggle-input:disabled + .rk-cc-slider { opacity: 0.65; }

/* Footer actions */
.rk-cc-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.rk-cc-btn {
    padding: 11px 22px;
    border-radius: 0;
    font-family: var(--ds-font-body, "Public Sans", sans-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Back — plain text, pushed to the far left */
.rk-cc-btn-ghost {
    margin-right: auto;
    background: transparent;
    border-color: transparent;
    color: var(--ds-primary-300, #ff5c02);
    padding-left: 6px;
    padding-right: 6px;
}
.rk-cc-btn-ghost:hover { color: var(--ds-primary-400, #c74700); }

/* Default Selection — outline */
.rk-cc-btn-outline {
    background: transparent;
    border-color: var(--t-border-strong, rgba(9, 16, 29, 0.14));
    color: var(--t-text, #09101d);
}
.rk-cc-btn-outline:hover {
    border-color: var(--ds-primary-300, #ff5c02);
    color: var(--ds-primary-300, #ff5c02);
}

/* Allow Selection — primary brand CTA */
.rk-cc-btn-primary {
    background: var(--ds-gold, #f6b43f);
    color: #ffffff;
    border-color: var(--ds-gold, #f6b43f);
}
.rk-cc-btn-primary:hover {
    background: var(--ds-yellow-300, #dfb400);
    border-color: var(--ds-yellow-300, #dfb400);
}

body.rk-cc-open { overflow: hidden; }

/* Responsive */
@media (max-width: 640px) {
    .rk-cc-dialog { padding: 26px 22px 22px; }
    .rk-cc-title { font-size: 23px; }
    .rk-cc-card { padding: 4px 16px; }
    .rk-cc-cat { gap: 14px; padding: 18px 0; }
    .rk-cc-cat-name { font-size: 16px; }
    .rk-cc-cat-desc { font-size: 13.5px; }
    .rk-cc-actions { gap: 8px; }
    .rk-cc-btn { padding: 10px 14px; font-size: 12px; }
    .rk-cc-btn-ghost { margin-right: auto; padding-left: 2px; padding-right: 2px; }
}
