/* ==========================================================================
   Cookie consent banner + preferences modal — STANDALONE
   Split out of site.css so it can be linked by pages that don't use the
   marketing stylesheet (login/dashboard/success/cancelled). consent.js
   toggles a .show class; do not remove those rules.
   Loaded by every page that loads /js/consent.js.
   ========================================================================== */

:root {
    --ink: #1A1D23;
    --ink-hover: #31353D;
    --body-text: #4A4E57;
    --body-strong: #3A3E46;
    --muted-2: #75716A;
    --cream: #FAF7F1;
    --card: #FDFCFA;
    --card-border: #E6E1D8;
    --line: #EFEBE3;
    --border-btn: #D9D2C5;
    --amber: #E69F00;
    --amber-deep: #B07900;
    --amber-label: #9A6B00;
    --font-display: 'Archivo', sans-serif;
    --font-body: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

.consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Hidden by sliding out of view; consent.js adds .show to reveal.
       transform (not a percentage `bottom`) so it resolves reliably
       regardless of how the viewport height is reported. */
    transform: translateY(110%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s;
    z-index: 2000;
    background: #FFFFFF;
    border-top: 3px solid var(--amber);
    box-shadow: 0 -6px 28px rgba(26, 29, 35, 0.14);
    padding: 22px 0;
}

.consent-banner.show { transform: translateY(0); visibility: visible; }

.consent-banner-content {
    max-width: 1232px;
    margin: 0 auto;
    padding: 0 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.consent-banner-text { max-width: 620px; }

.consent-banner-text strong {
    display: block;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
}

.consent-banner-text p {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--body-text);
    margin: 0;
}

.consent-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.consent-btn {
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 8px;
    padding: 11px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Accept and Decline share the same weight — neither is nudged */
.consent-btn-primary {
    background: var(--ink);
    color: #FFFFFF;
    border-color: var(--ink);
}

.consent-btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }

.consent-btn-secondary {
    background: #FFFFFF;
    color: var(--ink);
    border-color: var(--ink);
}

.consent-btn-secondary:hover { background: var(--cream); }

/* Settings is the quieter, tertiary option */
.consent-btn-settings {
    background: none;
    color: var(--body-strong);
    border-color: var(--border-btn);
}

.consent-btn-settings:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Preferences modal ---------- */

.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none;                 /* consent.js toggles .show */
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.consent-modal.show { display: flex; }

.consent-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 29, 35, 0.55);
}

.consent-modal-content {
    position: relative;
    background: #FFFFFF;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 18px 50px rgba(26, 29, 35, 0.28);
}

.consent-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--line);
}

.consent-modal-header h2 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.consent-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--muted-2);
    cursor: pointer;
    padding: 0 4px;
}

.consent-modal-close:hover { color: var(--ink); }

.consent-modal-body { padding: 20px 28px; }

.consent-modal-intro {
    font-size: 15px;
    line-height: 1.6;
    color: var(--body-text);
    margin: 0 0 20px;
}

.consent-option {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--card);
}

.consent-option-header { display: flex; align-items: flex-start; gap: 14px; }

.consent-option-info strong {
    display: block;
    font-family: var(--font-display);
    font-size: 15.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 3px;
}

.consent-option-info p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--body-text);
    margin: 0;
}

/* Toggle — state shown by knob POSITION as well as colour (colour-blind safe) */
.consent-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

.consent-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.consent-toggle-slider {
    position: absolute;
    inset: 0;
    background: #CFC9BD;
    border-radius: 999px;
    transition: background 0.15s ease;
}

.consent-toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease;
}

.consent-toggle input:checked + .consent-toggle-slider { background: var(--amber-deep); }

.consent-toggle input:checked + .consent-toggle-slider::before { transform: translateX(20px); }

.consent-toggle input:focus-visible + .consent-toggle-slider { outline: 2px solid var(--ink); outline-offset: 2px; }

.consent-toggle-disabled { opacity: 0.55; cursor: not-allowed; }

.consent-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

body.consent-modal-open { overflow: hidden; }

@media (max-width: 860px) {
    .consent-banner { padding: 18px 0; max-height: 82vh; overflow-y: auto; }
    .consent-banner-content { flex-direction: column; align-items: stretch; gap: 16px; padding: 0 24px; }
    .consent-banner-actions { flex-direction: column; }
    .consent-btn { width: 100%; text-align: center; }
    .consent-modal-footer { flex-direction: column-reverse; }
    .consent-modal-footer .consent-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .consent-banner { transition: none; }
}


/* Minimal cookie-settings link for pages with no site footer
   (login / dashboard / success / cancelled). Without this those pages
   offer no way to withdraw consent, which UK GDPR Art 7(3) requires. */
.consent-mini-link {
    position: fixed;
    left: 14px;
    bottom: 12px;
    z-index: 1900;               /* under the banner (2000), above page chrome */
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(26, 29, 35, 0.18);
    border-radius: 999px;
    padding: 7px 13px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.consent-mini-link:hover { background: #FFFFFF; border-color: var(--ink); }

.consent-mini-link:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Out of the way while the banner itself is up */
.consent-banner.show ~ .consent-mini-link { display: none; }
