/* =========================================================================
   Sanctuary Cookie Consent — vanilla, theme-aware, no external deps.
   =========================================================================

   Loaded on every public page. The banner element ships hidden; the
   companion script (cookie-consent.js) reveals it only when no prior
   consent is stored, and sets data-theme="light"|"dark" on the banner
   so all colour rules in this file resolve from CSS variables.

   Class prefix `scc-` = Sanctuary Cookie Consent — chosen to avoid
   collisions with existing `sanctuary-*`, `ap-*`, `tour-*` rules.
   ======================================================================= */

.scc-banner {
    /* ── Default (light) tokens — overridden by data-theme="dark" ── */
    --scc-primary:       #d99a00;
    --scc-primary-hover: #bd8500;
    --scc-on-primary:    #ffffff;
    --scc-bg:            #ffffff;
    --scc-card-bg:       #ffffff;
    --scc-text:          #1f1f1f;
    --scc-muted:         #5e5e5e;
    --scc-border:        #e2e2e2;
    --scc-shadow:        0 -10px 32px rgba(0, 0, 0, 0.10);
    --scc-row-bg:        #fafafa;

    position: fixed;
    inset: auto 0 0 0;            /* bottom: 0; left: 0; right: 0 */
    z-index: 99999;

    background: var(--scc-card-bg);
    color: var(--scc-text);
    border-top: 1px solid var(--scc-border);
    box-shadow: var(--scc-shadow);

    font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;

    transform: translateY(100%);
    transition: transform 320ms cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
}
.scc-banner[hidden] { display: none !important; }
.scc-banner[data-state="open"] { transform: translateY(0); }

/* ── Dark theme tokens. Applied by JS on the banner element so we
      don't have to chase every container's preferred dark-mode hook. */
.scc-banner[data-theme="dark"] {
    --scc-bg:        #121212;
    --scc-card-bg:   #1e1e1e;
    --scc-text:      #f5f5f5;
    --scc-muted:     #c7c7c7;
    --scc-border:    #333333;
    --scc-shadow:    0 -10px 32px rgba(0, 0, 0, 0.50);
    --scc-row-bg:    #181818;
}

/* ── Card layout ───────────────────────────────────────────────── */
.scc-card {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 28px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "intro   actions"
        "details details";
    gap: 18px 28px;
    align-items: center;
}

/* ── Intro copy ────────────────────────────────────────────────── */
.scc-intro { grid-area: intro; min-width: 0; }
.scc-title {
    margin: 0 0 6px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--scc-text);
}
.scc-desc {
    margin: 0;
    color: var(--scc-muted);
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 64ch;
}
.scc-desc a {
    color: var(--scc-primary);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

/* ── Top-row buttons ───────────────────────────────────────────── */
.scc-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.scc-btn {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    letter-spacing: 0.01em;
    padding: 11px 18px;
    border-radius: 6px;
    border: 1.5px solid transparent;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease;
    white-space: nowrap;
}
.scc-btn:focus-visible {
    outline: 2px solid var(--scc-primary);
    outline-offset: 2px;
}
.scc-btn:active { transform: translateY(1px); }

.scc-btn--primary {
    background: var(--scc-primary);
    color: var(--scc-on-primary);
    border-color: var(--scc-primary);
}
.scc-btn--primary:hover {
    background: var(--scc-primary-hover);
    border-color: var(--scc-primary-hover);
}

.scc-btn--outline {
    background: transparent;
    color: var(--scc-primary);
    border-color: var(--scc-primary);
}
.scc-btn--outline:hover {
    background: var(--scc-primary);
    color: var(--scc-on-primary);
}

/* ── Customize panel ───────────────────────────────────────────── */
.scc-details {
    grid-area: details;
    padding-top: 18px;
    border-top: 1px solid var(--scc-border);
}
.scc-details[hidden] { display: none; }

.scc-details__title {
    margin: 0 0 12px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--scc-muted);
}

.scc-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    margin: 0 0 8px;
    background: var(--scc-row-bg);
    border: 1px solid var(--scc-border);
    border-radius: 6px;
    cursor: pointer;
}
.scc-row:last-of-type { margin-bottom: 16px; }
.scc-row__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.scc-row__name {
    font-weight: 600;
    color: var(--scc-text);
    font-size: 13.5px;
}
.scc-row__hint {
    color: var(--scc-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* Native checkbox restyled to a small toggle-style square */
.scc-row input[type="checkbox"] {
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    background: var(--scc-card-bg);
    border: 1.5px solid var(--scc-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.scc-row input[type="checkbox"]:checked {
    background: var(--scc-primary);
    border-color: var(--scc-primary);
}
.scc-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.scc-row input[type="checkbox"]:disabled {
    background: var(--scc-primary);
    border-color: var(--scc-primary);
    opacity: 0.65;
    cursor: not-allowed;
}
.scc-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--scc-primary);
    outline-offset: 2px;
}

.scc-details__actions {
    display: flex;
    justify-content: flex-end;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .scc-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "intro"
            "actions"
            "details";
        padding: 18px 18px 20px;
        gap: 14px;
    }
    .scc-actions {
        justify-content: stretch;
    }
    .scc-actions .scc-btn {
        flex: 1 1 auto;
        min-width: 0;
    }
    .scc-title { font-size: 17px; }
    .scc-desc  { font-size: 13px; }
    .scc-row   { padding: 11px 12px; gap: 10px; }
}

@media (max-width: 420px) {
    .scc-actions {
        flex-direction: column;
    }
    .scc-actions .scc-btn { width: 100%; }
}

/* Reduced motion — instant show/hide */
@media (prefers-reduced-motion: reduce) {
    .scc-banner { transition: none; }
}
