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

/* ==========================================
   CONSENT THEATRE
   a cookie banner that tells the truth.
   ========================================== */

[data-consent] {
    --ct-light-bg: #f8f9fa;
    --ct-light-fg: #1a1a2e;
    --ct-light-muted: #6c757d;
    --ct-light-border: #dee2e6;
    --ct-brand-blue: #0066cc;
    --ct-brand-blue-hover: #0052a3;
    --ct-accept-green: #28a745;
    --ct-reject-grey: #6c757d;
    --ct-banner-bg: #ffffff;
    --ct-banner-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    --ct-annotation-red: #e63b2e;
    --ct-dark-bg: #0d0d0d;
    --ct-dark-fg: #e0e0e0;
    --ct-toggle-on: #0066cc;
    --ct-toggle-off: #ccc;

    position: relative;
    min-height: 100vh;
    overflow: hidden;
}


/* ---- PHASE 0: THE FAKE SITE ---- */

[data-ct-site] {
    background: var(--ct-light-bg);
    min-height: 100vh;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ct-light-fg);
    transition: opacity 0.8s, filter 0.8s;
}

[data-ct-site] nav {
    background: white;
    border-bottom: 1px solid var(--ct-light-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

[data-ct-site] nav > span {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ct-brand-blue);
}

[data-ct-site] nav > div {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
}

[data-ct-site] nav > div > span {
    color: var(--ct-light-muted);
    font-size: 0.9rem;
}

[data-ct-site-content] {
    max-width: 48rem;
    margin: 0 auto;
    padding: 4rem 2rem 12rem;
}

[data-ct-site-content] h2 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ct-light-fg);
    text-transform: none;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

[data-ct-site-content] p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--ct-light-muted);
    margin-bottom: 1rem;
}

[data-ct-site-content] > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

[data-ct-site-content] > div > div {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--ct-light-border);
}

[data-ct-site-content] > div > div > strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--ct-light-fg);
}

[data-ct-site-content] > div > div > span {
    font-size: 0.9rem;
    color: var(--ct-light-muted);
    line-height: 1.6;
}

/* dimmed when banner is being annotated */
[data-consent="annotate"] [data-ct-site],
[data-consent="maze"] [data-ct-site],
[data-consent="audit"] [data-ct-site] {
    opacity: 0.15;
    filter: blur(3px);
    pointer-events: none;
}

[data-consent="reveal"] [data-ct-site] {
    display: none;
}

@media ( max-width: 48em ) {
    [data-ct-site-content] > div {
        grid-template-columns: 1fr;
    }
}


/* ---- THE COOKIE BANNER ---- */

[data-ct-banner] {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ct-banner-bg);
    box-shadow: var(--ct-banner-shadow);
    padding: 1.5rem 2rem;
    z-index: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ct-light-fg);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
    /* hidden below the viewport until JS triggers it */
    transform: translateY(100%);
}

[data-ct-banner="visible"] {
    transform: translateY(0);
}

[data-consent="reveal"] [data-ct-banner] {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

[data-ct-banner-inner] {
    max-width: 64rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

[data-ct-banner] p {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ct-light-muted);
    min-width: 20rem;
}

[data-ct-banner] p > strong {
    display: block;
    color: var(--ct-light-fg);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

[data-ct-buttons] {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
}

/* accept all: big, green, prominent. this is the dark pattern. */
[data-ct-accept] {
    background: var(--ct-brand-blue);
    color: white;
    border: none;
    padding: 0.85rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, transform 0.1s;
}

[data-ct-accept]:hover {
    background: var(--ct-brand-blue-hover);
}

[data-ct-accept]:active {
    transform: scale(0.97);
}

/* manage preferences: small, grey, designed to be overlooked */
[data-ct-manage] {
    background: none;
    border: none;
    color: var(--ct-light-muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    padding: 0.5rem;
    transition: color 0.2s;
}

[data-ct-manage]:hover {
    color: var(--ct-light-fg);
}

/* the close X - tiny, barely visible. intentional. */
[data-ct-close] {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--ct-light-border);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    font-family: inherit;
    transition: color 0.2s;
}

[data-ct-close]:hover {
    color: var(--ct-light-muted);
}


/* ---- ANNOTATIONS ---- */

[data-ct-annotations] {
    position: fixed;
    inset: 0;
    z-index: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

[data-consent="annotate"] [data-ct-annotations] {
    opacity: 1;
}

[data-ct-note] {
    position: fixed;
    background: var(--ct-annotation-red);
    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: 601;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s, transform 0.4s;
}

[data-consent="annotate"] [data-ct-note] {
    opacity: 1;
    transform: translateY(0) !important;
}

/* staggered entrance */
[data-ct-note]:nth-child(1) { transition-delay: 0.3s; }
[data-ct-note]:nth-child(2) { transition-delay: 0.7s; }
[data-ct-note]:nth-child(3) { transition-delay: 1.1s; }
[data-ct-note]:nth-child(4) { transition-delay: 1.5s; }
[data-ct-note]:nth-child(5) { transition-delay: 1.9s; }

[data-ct-note] strong {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    opacity: 0.7;
}

/* positioned across the viewport, same grid as the homepage banner notes */
[data-ct-note="accept"] {
    top: 6%;
    right: 4%;
}
[data-ct-note="manage"] {
    top: 6%;
    left: 4%;
}
[data-ct-note="no-reject"] {
    top: 38%;
    left: 4%;
}
[data-ct-note="language"] {
    top: 38%;
    right: 4%;
}
[data-ct-note="close"] {
    top: 68%;
    left: 50%;
    transform: translateX(-50%);
}

@media ( max-width: 48em ) {
    [data-ct-note] {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        margin-bottom: 0.75rem;
        transform: translateY(12px) !important;
    }
    [data-consent="annotate"] [data-ct-note] {
        transform: translateY(0) !important;
    }
    [data-ct-annotations] {
        position: fixed;
        inset: 0;
        z-index: 600;
        overflow-y: auto;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}


/* ---- THE MAZE (toggle hell) ---- */

[data-ct-maze] {
    position: fixed;
    inset: 0;
    z-index: 700;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-consent="maze"] [data-ct-maze],
[data-consent="audit"] [data-ct-maze] {
    opacity: 1;
    pointer-events: auto;
}

[data-ct-maze-panel] {
    background: white;
    border-radius: 12px;
    max-width: 32rem;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    color: var(--ct-light-fg);
    position: relative;
}

[data-ct-maze-panel] > h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--ct-light-fg);
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
}

[data-ct-maze-panel] > p {
    font-size: 0.85rem;
    color: var(--ct-light-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* toggle rows */
[data-ct-toggle-row] {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 0;
    border-top: 1px solid var(--ct-light-border);
    gap: 1rem;
}

[data-ct-toggle-row] > div {
    flex: 1;
}

[data-ct-toggle-row] > div > strong {
    display: block;
    font-size: 0.9rem;
    color: var(--ct-light-fg);
    margin-bottom: 0.25rem;
}

[data-ct-toggle-row] > div > span {
    font-size: 0.78rem;
    color: var(--ct-light-muted);
    line-height: 1.5;
}

/* the honest translation - hidden until audit phase */
[data-ct-honest] {
    display: none;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.72rem;
    color: var(--ct-annotation-red);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff5f5;
    border-left: 2px solid var(--ct-annotation-red);
    line-height: 1.5;
}

[data-consent="audit"] [data-ct-honest] {
    display: block;
    animation: ct-honest-in 0.3s ease forwards;
}

@keyframes ct-honest-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* stagger the honest reveals */
[data-ct-toggle-row]:nth-child(2) [data-ct-honest] { animation-delay: 0.1s; }
[data-ct-toggle-row]:nth-child(3) [data-ct-honest] { animation-delay: 0.2s; }
[data-ct-toggle-row]:nth-child(4) [data-ct-honest] { animation-delay: 0.3s; }
[data-ct-toggle-row]:nth-child(5) [data-ct-honest] { animation-delay: 0.4s; }
[data-ct-toggle-row]:nth-child(6) [data-ct-honest] { animation-delay: 0.5s; }

/* toggle switch (CSS only) */
[data-ct-switch] {
    position: relative;
    width: 3rem;
    height: 1.6rem;
    flex-shrink: 0;
}

[data-ct-switch] input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

[data-ct-switch] span {
    position: absolute;
    inset: 0;
    background: var(--ct-toggle-on);
    border-radius: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

[data-ct-switch] span::before {
    content: "";
    position: absolute;
    height: 1.2rem;
    width: 1.2rem;
    left: 0.2rem;
    bottom: 0.2rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    transform: translateX(1.4rem);
}

[data-ct-switch] input:not(:checked) + span {
    background: var(--ct-toggle-off);
}

[data-ct-switch] input:not(:checked) + span::before {
    transform: translateX(0);
}

/* "strictly necessary" toggle is disabled and always on */
[data-ct-switch="locked"] span {
    opacity: 0.5;
    cursor: not-allowed;
}

/* save button */
[data-ct-save] {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.85rem;
    background: var(--ct-brand-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

[data-ct-save]:hover {
    background: var(--ct-brand-blue-hover);
}

/* reject link at the bottom - tiny, grey, easy to miss */
[data-ct-reject-all] {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.72rem;
    color: var(--ct-light-border);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

[data-ct-reject-all]:hover {
    color: var(--ct-light-muted);
}


/* ---- THE REVEAL ---- */

[data-ct-reveal] {
    position: relative;
    z-index: 800;
    min-height: 100vh;
    background: var(--ct-dark-bg);
    color: var(--ct-dark-fg);
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s;
}

[data-consent="reveal"] [data-ct-reveal] {
    opacity: 1;
    pointer-events: auto;
}

[data-ct-reveal] h2 {
    font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(2rem, 1rem + 5vw, 4.5rem);
    color: white;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 0.95;
    margin-bottom: 3rem;
    max-width: 16ch;
}

[data-ct-reveal] h2 > em {
    color: var(--ct-annotation-red);
    font-style: normal;
}

[data-ct-stats] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 2rem;
    max-width: 50rem;
    width: 100%;
    margin-bottom: 4rem;
    text-align: left;
}

[data-ct-stat] {
    border-left: 2px solid var(--ct-annotation-red);
    padding-left: 1rem;
}

[data-ct-stat] > strong {
    display: block;
    font-size: clamp(2rem, 1rem + 3vw, 3.5rem);
    color: var(--ct-annotation-red);
    font-family: 'Arial Black', sans-serif;
    line-height: 1;
    margin-bottom: 0.5rem;
}

[data-ct-stat] > span {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

[data-ct-truth] {
    max-width: 38rem;
    margin-bottom: 3rem;
}

[data-ct-truth] p {
    font-size: clamp(0.85rem, 0.5rem + 1vw, 1.05rem);
    line-height: 1.8;
    color: #aaa;
    margin-bottom: 1.5rem;
}

[data-ct-truth] p > strong {
    color: white;
}

[data-ct-verdict] {
    font-family: 'Arial Black', sans-serif;
    font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem);
    color: var(--ct-annotation-red);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-top: 2rem;
    border-top: 1px solid #2a2a2a;
    max-width: 30rem;
}

/* continue link back to the site */
[data-ct-continue] {
    display: inline-block;
    margin-top: 3rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--grey, #919191);  /* was #666, 3.38:1 on the dark page - this link is real UI, not part of the replica's demonstration */
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--grey, #919191);
    padding-bottom: 0.25rem;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}

[data-ct-continue]:hover {
    color: white;
    border-color: white;
}


/* ---- REDUCED MOTION ---- */

[data-reduced-motion="true"] [data-ct-note],
[data-reduced-motion="true"] [data-ct-honest],
[data-reduced-motion="true"] [data-ct-banner],
[data-reduced-motion="true"] [data-ct-maze],
[data-reduced-motion="true"] [data-ct-reveal],
[data-reduced-motion="true"] [data-ct-site] {
    transition: none !important;
    animation: none !important;
}

[data-reduced-motion="true"] [data-ct-note] {
    transition-delay: 0s !important;
}


/* ============================================
   JS-CREATED ELEMENTS - the advance button, the
   close-button note, the armed save button, and
   the dimmed banner. JS creates and toggles
   attributes only; every rule lives here.
   ============================================ */

[data-ct-advance] {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 700;
    background: #e63b2e;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    letter-spacing: 0.05em;
}

[data-ct-banner][data-ct-dimmed] {
    opacity: 0.3;
}

[data-ct-close-note] {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 700;
    background: #0d0d0d;
    color: #e63b2e;
    font-family: monospace;
    font-size: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e63b2e;
    max-width: 24rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

[data-ct-close-note="in"] {
    opacity: 1;
}

[data-ct-save][data-ct-armed] {
    background: #e63b2e;
}
