/* ============================================================
 * user_ui — Cookie notice chrome.
 * ============================================================
 *
 * The bar of `cookie_notice/_cookie_notice.html`: fixed to the
 * bottom of the viewport, full-bleed, content centred inside
 * `.wrap`. No overlay — the page stays usable while it shows.
 * Theme-aware through the design tokens (--surface-2 / --text /
 * --text-dim / --line), so it follows both themes.
 *
 * Section-local classes:
 *   - .cookie-notice          the fixed bar
 *   - .cookie-notice-row      inner flex row inside .wrap
 *   - .cookie-notice-text     the notice sentence + link
 *   - .cookie-notice-link     the Privacy Policy link
 *   - .cookie-notice-accept   the "Got it" button (with the
 *                             shared `.btn.primary.sm`)
 *   - .cookie-notice-spacer   in-flow spacer at the end of <body>
 *
 * `--cookie-notice-height` — written on <html> by the
 * `CookieNotice` Component (`ge/cookie_notice`) while the bar
 * shows: the bar's rendered height, its safe-area padding
 * included; absent otherwise. The fixed bottom chrome reads it
 * with a `0px` fallback and adds it to its `bottom` so the bar
 * never covers it: the help FAB and anchored panel (help.css),
 * the trade page's phone trade bar and the FAB clearance above it
 * (trade.css), and the Settings and Giveaway toasts. The spacer
 * below takes the same height, so the end of every page can
 * still be scrolled clear of the bar.
 *
 * Z-index 90 — BELOW every other fixed chrome layer (help FAB
 * 100, help panel 110, trade phone bar 120, drawers 150 / 200,
 * dialogs 300+). Before the Component has published the height,
 * anything that overlaps the bar therefore sits on top of it, so
 * the bar never covers a control.
 *
 * Loaded by base.html with the chrome sheets, after
 * user_menu/user_menu.css.
 * ============================================================ */

/* ------------------------------------------------------------
 * 1. The bar.
 *    Bottom padding grows by the iOS home-indicator safe area,
 *    so the text and the button stay clear of it.
 * ---------------------------------------------------------- */
.cookie-notice {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    padding: 14px 0;
    padding-bottom: calc(14px + constant(safe-area-inset-bottom)); /* iOS 11.0–11.2 */
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-2);
    color: var(--text);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
/* Flat in light mode (DESIGN_SYSTEM.md §9) — the top border
   separates the bar from the page. */
html[data-theme="light"] .cookie-notice {
    box-shadow: none;
}

/* ------------------------------------------------------------
 * 2. Row — sentence left, button right; wraps when the
 *    sentence (Spanish runs ~30% longer) needs the room.
 * ---------------------------------------------------------- */
.cookie-notice-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
}

.cookie-notice-text {
    flex: 1 1 320px;
    min-width: 0;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dim);
}

/* Underlined, so the link never relies on colour alone; the text
   colour keeps AA contrast on --surface-2 in both themes, the
   orange underline carries the brand accent. */
.cookie-notice-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--orange);
    text-underline-offset: 3px;
    white-space: nowrap;
}
.cookie-notice-link:hover {
    color: var(--orange);
}
.cookie-notice-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 2px;
}

.cookie-notice-accept {
    flex: 0 0 auto;
}
.cookie-notice-accept:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}
/* Busy while the dismiss POST is in flight (`aria-disabled`, so the
   button keeps keyboard focus). */
.cookie-notice-accept[aria-disabled="true"] {
    cursor: progress;
    opacity: .7;
}

/* ------------------------------------------------------------
 * 3. Spacer — takes the bar's height in the page flow (0 until
 *    the Component publishes it).
 * ---------------------------------------------------------- */
.cookie-notice-spacer {
    flex: 0 0 auto;
    height: var(--cookie-notice-height, 0px);
}

/* ------------------------------------------------------------
 * 4. Phone — the sentence and a full-width button stack.
 * ---------------------------------------------------------- */
@media (max-width: 640px) {
    .cookie-notice {
        padding-top: 12px;
        padding-bottom: calc(12px + constant(safe-area-inset-bottom)); /* iOS 11.0–11.2 */
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .cookie-notice-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .cookie-notice-text {
        flex: 0 0 auto;
        font-size: 13px;
    }
    .cookie-notice-accept {
        width: 100%;
    }
}

/* ------------------------------------------------------------
 * 5. Print — the notice is screen chrome only.
 * ---------------------------------------------------------- */
@media print {
    .cookie-notice,
    .cookie-notice-spacer {
        display: none;
    }
}
