@charset "UTF-8";

/* =====================================================================
   OLLATOEDU ECOSYS
   Cookie Consent Component
   =====================================================================

   File:
   assets/css/components/cookie-consent.css

   Phase:
   Phase 6 - Component CSS

   Purpose:
   - Style the cookie consent banner
   - Support essential information and consent actions
   - Support optional preference controls
   - Support accessible focus states
   - Support compact mobile presentation
   - Support reduced motion and forced colours
   - Hide consent UI in print

   Dependencies:
   - assets/css/style.css
   - assets/css/website.css
   - assets/css/forms.css
   - assets/css/responsive.css

   Component markup will later be rendered by:
   website/components/cookie-consent.php

   Behaviour will later be implemented by:
   assets/js/components/cookie-consent.js

   IMPORTANT:
   - This file defines presentation only.
   - Legal wording and consent logic are not defined here.
   - Consent categories must only be implemented if actually required
     by the application's privacy/cookie policy.
   ===================================================================== */


/* =====================================================================
   1. ROOT
   ===================================================================== */

.cookie-consent {
    position: fixed;

    right: 0;
    bottom: 0;
    left: 0;

    z-index: var(--z-modal);

    padding:
        var(--space-4)
        max(
            var(--space-4),
            env(safe-area-inset-right, 0px)
        )
        max(
            var(--space-4),
            env(safe-area-inset-bottom, 0px)
        )
        max(
            var(--space-4),
            env(safe-area-inset-left, 0px)
        );

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transform:
        translateY(1rem);

    transition:
        opacity var(--transition-base),
        visibility var(--transition-base),
        transform var(--transition-base);
}


/* =====================================================================
   2. VISIBLE STATE
   ===================================================================== */

.cookie-consent.is-visible {
    opacity: 1;
    visibility: visible;

    pointer-events: auto;

    transform:
        translateY(0);
}


/* =====================================================================
   3. CONTAINER
   ===================================================================== */

.cookie-consent__container {
    width:
        min(
            100%,
            76rem
        );

    margin-inline: auto;
}


/* =====================================================================
   4. PANEL
   ===================================================================== */

.cookie-consent__panel {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr);

    gap: var(--space-5);

    padding:
        var(--space-5);

    color: var(--color-text);
    background-color: var(--color-white);

    border:
        var(--border-width)
        solid
        var(--color-border);

    border-radius: var(--radius-xl);

    box-shadow:
        0 18px 48px
        rgb(15 23 42 / 0.16);
}


/* =====================================================================
   5. CONTENT
   ===================================================================== */

.cookie-consent__content {
    min-width: 0;
}


/* =====================================================================
   6. HEADER
   ===================================================================== */

.cookie-consent__header {
    display: flex;
    align-items: flex-start;

    gap: var(--space-3);

    margin-bottom: var(--space-3);
}


/* =====================================================================
   7. ICON
   ===================================================================== */

.cookie-consent__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 2rem;
    height: 2rem;

    color: var(--color-primary-700);
    background-color: var(--color-primary-50);

    border-radius: var(--radius-md);
}


.cookie-consent__icon svg {
    width: 1.1rem;
    height: 1.1rem;
}


/* =====================================================================
   8. TITLE
   ===================================================================== */

.cookie-consent__title {
    margin: 0;

    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-snug);

    color: var(--color-heading);
}


/* =====================================================================
   9. TEXT
   ===================================================================== */

.cookie-consent__text {
    margin: 0;

    max-width: 52rem;

    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);

    color: var(--color-text-soft);
}


/* =====================================================================
   10. TEXT LINKS
   ===================================================================== */

.cookie-consent__text a {
    color: var(--color-primary-700);

    font-weight: var(--font-weight-semibold);

    text-decoration: underline;
    text-underline-offset: 0.16em;
}


.cookie-consent__text a:hover {
    color: var(--color-primary-800);
}


/* =====================================================================
   11. ACTIONS
   ===================================================================== */

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    gap: var(--space-3);
}


/* =====================================================================
   12. ACTION BUTTONS
   ===================================================================== */

.cookie-consent__actions .btn {
    min-height: 2.75rem;
}


/* =====================================================================
   13. PRIMARY ACTION
   ===================================================================== */

.cookie-consent__accept {
    min-width: 8rem;
}


/* =====================================================================
   14. SECONDARY ACTION
   ===================================================================== */

.cookie-consent__decline {
    min-width: 8rem;
}


/* =====================================================================
   15. PREFERENCES ACTION
   ===================================================================== */

.cookie-consent__preferences {
    display: inline-flex;
    align-items: center;

    min-height: 2.75rem;

    padding:
        var(--space-2)
        var(--space-3);

    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);

    color: var(--color-primary-700);
    background: transparent;

    border: 0;
    border-radius: var(--radius-md);

    cursor: pointer;
}


.cookie-consent__preferences:hover {
    color: var(--color-primary-800);
    background-color: var(--color-primary-50);
}


.cookie-consent__preferences:focus-visible {
    outline:
        3px
        solid
        rgb(33 111 219 / 0.22);

    outline-offset: 2px;
}


/* =====================================================================
   16. CLOSE BUTTON
   ===================================================================== */

.cookie-consent__close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 2.25rem;
    height: 2.25rem;

    padding: 0;

    color: var(--color-grey-600);
    background: transparent;

    border: 0;
    border-radius: var(--radius-sm);

    cursor: pointer;
}


.cookie-consent__close:hover {
    color: var(--color-grey-900);
    background-color: var(--color-grey-100);
}


.cookie-consent__close:focus-visible {
    outline:
        3px
        solid
        rgb(33 111 219 / 0.22);

    outline-offset: 2px;
}


/* =====================================================================
   17. PREFERENCE PANEL
   ===================================================================== */

.cookie-consent__preferences-panel {
    display: none;

    margin-top: var(--space-5);
    padding-top: var(--space-5);

    border-top:
        var(--border-width)
        solid
        var(--color-border);
}


/* =====================================================================
   18. PREFERENCE PANEL OPEN STATE
   ===================================================================== */

.cookie-consent.is-preferences-open
.cookie-consent__preferences-panel {
    display: block;
}


/* =====================================================================
   19. PREFERENCE HEADING
   ===================================================================== */

.cookie-consent__preferences-title {
    margin:
        0
        0
        var(--space-2);

    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);

    color: var(--color-heading);
}


/* =====================================================================
   20. PREFERENCE INTRODUCTION
   ===================================================================== */

.cookie-consent__preferences-text {
    margin:
        0
        0
        var(--space-4);

    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);

    color: var(--color-text-muted);
}


/* =====================================================================
   21. PREFERENCE LIST
   ===================================================================== */

.cookie-consent__categories {
    display: flex;
    flex-direction: column;

    gap: var(--space-3);

    margin: 0;
    padding: 0;

    list-style: none;
}


/* =====================================================================
   22. CATEGORY
   ===================================================================== */

.cookie-consent__category {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: var(--space-4);

    align-items: start;

    padding: var(--space-4);

    background-color: var(--color-background-soft);

    border:
        var(--border-width)
        solid
        var(--color-border);

    border-radius: var(--radius-lg);
}


/* =====================================================================
   23. CATEGORY CONTENT
   ===================================================================== */

.cookie-consent__category-content {
    min-width: 0;
}


/* =====================================================================
   24. CATEGORY TITLE
   ===================================================================== */

.cookie-consent__category-title {
    margin:
        0
        0
        var(--space-1);

    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);

    color: var(--color-heading);
}


/* =====================================================================
   25. CATEGORY DESCRIPTION
   ===================================================================== */

.cookie-consent__category-text {
    margin: 0;

    font-size: var(--font-size-xs);
    line-height: var(--line-height-relaxed);

    color: var(--color-text-muted);
}


/* =====================================================================
   26. REQUIRED LABEL
   ===================================================================== */

.cookie-consent__required {
    display: inline-flex;
    align-items: center;

    padding:
        0.2rem
        0.45rem;

    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);

    color: var(--color-grey-700);
    background-color: var(--color-grey-100);

    border-radius: var(--radius-pill);

    white-space: nowrap;
}


/* =====================================================================
   27. CATEGORY TOGGLE
   ===================================================================== */

.cookie-consent__category-toggle {
    align-self: center;
}


/* =====================================================================
   28. PREFERENCE ACTIONS
   ===================================================================== */

.cookie-consent__preferences-actions {
    display: flex;
    flex-wrap: wrap;

    gap: var(--space-3);

    margin-top: var(--space-5);
}


/* =====================================================================
   29. COMPACT VARIANT
   ===================================================================== */

.cookie-consent--compact
.cookie-consent__panel {
    padding: var(--space-4);

    gap: var(--space-4);
}


.cookie-consent--compact
.cookie-consent__title {
    font-size: var(--font-size-base);
}


.cookie-consent--compact
.cookie-consent__text {
    font-size: var(--font-size-xs);
}


/* =====================================================================
   30. DARK VARIANT
   ===================================================================== */

.cookie-consent--dark
.cookie-consent__panel {
    color: var(--color-white);
    background-color: var(--color-primary-900);

    border-color:
        rgb(255 255 255 / 0.12);
}


.cookie-consent--dark
.cookie-consent__title {
    color: var(--color-white);
}


.cookie-consent--dark
.cookie-consent__text {
    color:
        rgb(255 255 255 / 0.72);
}


.cookie-consent--dark
.cookie-consent__preferences {
    color: var(--color-white);
}


.cookie-consent--dark
.cookie-consent__preferences-panel {
    border-top-color:
        rgb(255 255 255 / 0.12);
}


/* =====================================================================
   31. DESKTOP
   ===================================================================== */

@media (min-width: 64rem) {

    .cookie-consent__panel {
        grid-template-columns:
            minmax(0, 1fr)
            auto;

        align-items: center;

        gap: var(--space-8);
    }


    .cookie-consent__actions {
        justify-content: flex-end;
    }


    .cookie-consent__preferences-panel {
        grid-column: 1 / -1;
    }
}


/* =====================================================================
   32. TABLET
   ===================================================================== */

@media
    (min-width: 48rem)
    and
    (max-width: 63.9375rem) {

    .cookie-consent__panel {
        padding: var(--space-5);
    }


    .cookie-consent__actions {
        justify-content: flex-start;
    }
}


/* =====================================================================
   33. MOBILE
   ===================================================================== */

@media (max-width: 47.9375rem) {

    .cookie-consent {
        padding:
            var(--space-3)
            max(
                var(--space-3),
                env(safe-area-inset-right, 0px)
            )
            max(
                var(--space-3),
                env(safe-area-inset-bottom, 0px)
            )
            max(
                var(--space-3),
                env(safe-area-inset-left, 0px)
            );
    }


    .cookie-consent__panel {
        max-height:
            min(
                80dvh,
                38rem
            );

        overflow-y: auto;

        padding: var(--space-4);

        border-radius: var(--radius-lg);

        -webkit-overflow-scrolling: touch;
    }


    .cookie-consent__header {
        padding-right: var(--space-8);
    }


    .cookie-consent__actions {
        display: grid;

        grid-template-columns:
            1fr;

        width: 100%;
    }


    .cookie-consent__actions .btn,
    .cookie-consent__preferences {
        width: 100%;
    }


    .cookie-consent__category {
        grid-template-columns: 1fr;

        gap: var(--space-3);
    }


    .cookie-consent__category-toggle {
        justify-self: start;
    }


    .cookie-consent__preferences-actions {
        display: grid;

        grid-template-columns: 1fr;
    }


    .cookie-consent__preferences-actions .btn {
        width: 100%;
    }
}


/* =====================================================================
   34. VERY SMALL MOBILE
   ===================================================================== */

@media (max-width: 23.9375rem) {

    .cookie-consent__panel {
        padding: var(--space-3);
    }


    .cookie-consent__title {
        font-size: var(--font-size-base);
    }


    .cookie-consent__text {
        font-size: var(--font-size-xs);
    }
}


/* =====================================================================
   35. SHORT VIEWPORT
   ===================================================================== */

@media (max-height: 32rem) {

    .cookie-consent__panel {
        max-height:
            calc(
                100dvh
                -
                var(--space-4)
            );

        overflow-y: auto;
    }
}


/* =====================================================================
   36. BODY STATE
   =====================================================================

   cookie-consent.js may add this class while the banner is visible.
   back-to-top.css already recognises the same state.
   ===================================================================== */

body.has-cookie-consent {
    --cookie-consent-visible: 1;
}


/* =====================================================================
   37. LONG CONTENT SAFETY
   ===================================================================== */

.cookie-consent__title,
.cookie-consent__text,
.cookie-consent__category-title,
.cookie-consent__category-text {
    overflow-wrap: anywhere;
}


/* =====================================================================
   38. REDUCED MOTION
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {

    .cookie-consent,
    .cookie-consent__preferences,
    .cookie-consent__close {
        transition: none;
    }


    .cookie-consent {
        transform: none;
    }
}


/* =====================================================================
   39. REDUCED DATA
   ===================================================================== */

@media (prefers-reduced-data: reduce) {

    .cookie-consent__panel {
        box-shadow: var(--shadow-sm);
    }
}


/* =====================================================================
   40. FORCED COLOURS / HIGH CONTRAST
   ===================================================================== */

@media (forced-colors: active) {

    .cookie-consent__panel,
    .cookie-consent__category {
        color: CanvasText;
        background: Canvas;

        border-color: CanvasText;

        box-shadow: none;
    }


    .cookie-consent__title,
    .cookie-consent__text,
    .cookie-consent__category-title,
    .cookie-consent__category-text {
        color: CanvasText;
    }


    .cookie-consent__preferences,
    .cookie-consent__close {
        color: ButtonText;
    }


    .cookie-consent__preferences:focus-visible,
    .cookie-consent__close:focus-visible {
        outline-color: Highlight;
    }
}


/* =====================================================================
   41. PRINT
   ===================================================================== */

@media print {

    .cookie-consent {
        display: none !important;
    }
}


/* =====================================================================
   END OF OLLATOEDU ECOSYS COOKIE CONSENT COMPONENT
   ===================================================================== */