/* consent-banner - extracted from the template so every rule
   lives in a .css file, enqueued conditionally in functions.php.
   Viola Cherchi, 2025-26 */

/* ── consent banner (site-wide) ── */
[data-wr-consent] {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #ffffff;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    padding: 1.25rem 1.5rem;
    z-index: 9000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-wr-consent][data-visible] {
    transform: translateY(0);
}
[data-wr-consent][hidden] { display: none; }
[data-wr-consent-close] {
    position: absolute; top: 0.35rem; right: 0.5rem;
    background: none; border: none;
    font-size: 1.2rem; color: #ccc; cursor: pointer;
    line-height: 1;
    /* SC 2.5.8: the refusal path gets a real target.
       the glyph stays small - the button does not. */
    min-width: 32px;
    min-height: 32px;
    display: grid;
    place-items: center;
}
[data-wr-consent-inner] {
    max-width: 64rem; margin: 0 auto;
    display: flex; align-items: center; gap: 1.5rem;
    flex-wrap: wrap;
}
[data-wr-consent-inner] p {
    flex: 1 1 20rem;
    font-size: 0.85rem; line-height: 1.55;
    margin: 0; color: #444;
}
[data-wr-consent-inner] p > strong {
    display: block; margin-bottom: 0.3rem;
    font-size: 0.95rem; color: #1a1a1a;
}
[data-wr-consent-buttons] {
    display: flex; gap: 0.75rem; align-items: center;
    flex-shrink: 0;
}
[data-wr-consent-accept] {
    display: inline-block;
    background: #0066cc; color: #fff;
    border: none; padding: 0.7rem 1.8rem;
    font-size: 0.9rem; font-weight: 600;
    border-radius: 4px; cursor: pointer;
    text-decoration: none; letter-spacing: 0.01em;
    font-family: inherit;
}
[data-wr-consent-accept]:hover { background: #0052a3; }
[data-wr-consent-manage] {
    background: none; border: none;
    font-size: 0.75rem; color: #666;  /* was #888 (3.54:1 on white) - still footnote-grey in spirit, 5.74:1 in measurement */
    text-decoration: underline; cursor: pointer;
    /* SC 2.5.8: padding lifts the hit target past 24x24
       while the styling keeps its deliberate reluctance */
    padding: 0.5em 0.5em; min-height: 24px;
    font-family: inherit;
}
@media (max-width: 48em) {
    /* presentation feedback + pilot, triangulated: on phones the
       full banner buried half the hero and cut off its own buttons.
       the satire survives at a fraction of the size - the trap only
       needs to exist, not to smother. */
    [data-wr-consent] { padding: 0.6rem 0.75rem; }
    [data-wr-consent-inner] { flex-direction: row; align-items: center; gap: 0.6rem; }
    [data-wr-consent-inner] p { margin: 0; font-size: 0.72rem; line-height: 1.3; }
    [data-wr-consent-verbose] { display: none; }
    [data-wr-consent-buttons] { justify-content: flex-end; flex-shrink: 0; gap: 0.4rem; }
    [data-wr-consent-accept] { padding: 0.45rem 0.7rem; font-size: 0.72rem; }
    [data-wr-consent-manage] { font-size: 0.65rem; }
}

/* ── overlay + scattered annotations ── */
[data-wr-consent-overlay] {
    position: fixed;
    inset: 0;
    z-index: 8999;
    pointer-events: none;
}
[data-wr-consent-overlay][hidden] { display: none; }

[data-wr-note] {
    position: fixed;
    /* placement arrives from JS as custom properties per note */
    top: var(--note-top, auto);
    left: var(--note-left, auto);
    right: var(--note-right, auto);
    background: #e63b2e;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(0.65rem, 0.5rem + 0.5vw, 0.8rem);
    line-height: 1.45;
    padding: 0.85rem 1.1rem;
    width: clamp(14rem, 30vw, 20rem);
    z-index: 9001;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: auto;
}

/* the centred note (dark pattern #5) */
[data-wr-note][data-center] {
    left: 50%;
    transform: translateX(-50%) translateY(12px);
}
[data-wr-note="visible"] {
    opacity: 1;
    transform: translateY(0);
}
[data-wr-note] strong {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    opacity: 0.7;
}

/* on mobile, stack notes vertically instead of scattering */
@media (max-width: 48em) {
    [data-wr-note] {
        position: relative !important;
        top: auto !important; left: auto !important; right: auto !important;
        width: 100% !important;
        margin-bottom: 0.75rem;
        transform: translateY(12px);
    }
    [data-wr-note="visible"] {
        transform: translateY(0);
    }
    [data-wr-consent-overlay] {
        position: fixed;
        inset: 0;
        z-index: 8999;
        overflow-y: auto;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        /* flex-start, not center - centering an overflowing column
           pushes the first and last notes outside the scrollable
           area and they can never be reached */
        justify-content: flex-start;
        /* clearance for the fixed 'what just happened?' button */
        padding-bottom: 6rem;
        pointer-events: auto;
    }
}

/* "what just happened?" button */
[data-wr-consent-reveal] {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9002;
    background: #e63b2e;
    color: #fff;
    border: none;
    padding: 0.85rem 2.2rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: auto;
}
[data-wr-consent-reveal][data-visible] {
    opacity: 1;
}
[data-wr-consent-reveal]:hover {
    background: #c5291e;
}

/* dim the page behind annotations */
body[data-wr-annotating]::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 8998;
    pointer-events: none;
}

[data-reduced-motion="true"] [data-wr-consent],
[data-reduced-motion="true"] [data-wr-note],
[data-reduced-motion="true"] [data-wr-consent-reveal] {
    transition: none !important;
}
