/**
 * =============================================================================
 *  Project:        Enterramon
 *  Filename:       assets/css/em-consent.css
 *  Description:    Our own consent card. Replaces the Zaraz modal.
 *  Copyright :     (c) 2026 InlineBlack. All rights reserved.
 * =============================================================================
 *
 *  THE ENTERRAMON PALETTE, NOT ENTERRAHOST'S.
 *
 *  The card was ported from enterrahost.com, where it is a dark card on a dark
 *  site. Enterramon is light and orange, so the card is rebuilt from this site's
 *  own tokens (--color-primary, --color-on-surface, --color-border) instead of
 *  carrying the other site's palette across. The structural rules are the same;
 *  the colours, radius, type and button pair are this site's.
 *
 *  It sits bottom LEFT on purpose: the tool rating block is fixed bottom right,
 *  and a cookie card that covers the thing the visitor just used is the same
 *  mistake as a paywall.
 */

/* The host element Zaraz mounts. While our card owns consent, Zaraz's own card
   is suppressed from JS as well (zaraz.consent.modal = false); this rule is the
   second lock, and it only applies once our script has actually run, so a JS
   failure leaves Zaraz's card usable rather than leaving the visitor with no
   consent UI at all. */
html.em-consent-owned .cf_modal_container { display: none !important; }

/* The card is a <dialog>. Non-modal: the page stays usable, and the gate that
   matters (tags do not run) is enforced by Zaraz, not by trapping the visitor. */
.em-consent {
    position: fixed;
    inset: auto auto 1rem 1rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    width: min(26rem, calc(100vw - 2rem));
    max-width: none;
    max-height: none;
    overflow: visible;

    /* The site header is z-index 10000 (main.css). The old Zaraz host used
       2147483000 and the chat widget sits higher than both, so the card takes
       the same ceiling rather than guessing another number. */
    z-index: 2147483000;
}

/* No dimming. A cookie prompt is not a paywall, and the card is already the
   only thing on screen asking for anything. */
.em-consent::backdrop { background: transparent; }

.em-consent:not([open]) { display: none; }

.em-consent__card {
    width: 100%;
    max-width: 26rem;
    background: var(--color-white, #fff);
    color: var(--color-on-surface, #16181d);
    border: 1px solid var(--color-border, #e3e6eb);
    border-radius: var(--radius-lg, 1.5rem);
    padding: 1.25rem;
    font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
    box-shadow: var(--shadow-pop, 0 18px 50px rgba(11, 13, 18, .14));
}

.em-consent__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.em-consent__title {
    margin: 0 0 .5rem;
    font-family: var(--font-headline, inherit);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.em-consent__body,
.em-consent__note {
    margin: 0 0 .75rem;
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--color-on-surface-variant, #5b6270);
}

.em-consent__note { font-size: .8125rem; }

.em-consent__links {
    margin: 0 0 1rem;
    font-size: .8125rem;
    color: var(--color-on-surface-variant, #5b6270);
}

.em-consent__links a {
    color: var(--color-primary, #f26522);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.em-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.em-consent__actions .btn { flex: 1 1 auto; }

/* The preferences list, only shown when the visitor asks for it. */
.em-consent__purposes {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--color-border, #e3e6eb);
}

.em-consent__purposes[hidden] { display: none; }

/* The site defines .btn as an inline-flex, which beats the UA [hidden] rule, so
   "Save choices" was visible before Preferences was opened. !important because
   the button systems are loaded after this sheet. */
.em-consent [hidden] { display: none !important; }

.em-consent__purpose {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .75rem 0;
    border-bottom: 1px solid var(--color-border, #e3e6eb);
}

.em-consent__purpose input {
    margin-top: .2rem;
    flex: 0 0 auto;
    accent-color: var(--color-primary, #f26522);
}

.em-consent__purpose-name {
    display: block;
    font-weight: 700;
    font-size: .9375rem;
}

.em-consent__purpose-desc {
    display: block;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--color-on-surface-variant, #5b6270);
}

/* A cookie-settings link in the footer uses this; it is a button so it keeps
   keyboard behaviour without looking like one. */
/* The footer button. Every state is pinned because style.css ships a global
   `button:hover { background-color: var(--color-secondary) !important }` -
   that painted a white box behind the white footer text, so the label vanished
   on hover. */
.em-consent-open,
.em-consent-open:hover,
.em-consent-open:focus,
.em-consent-open:focus-visible,
.em-consent-open:active {
    background: none !important;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    /* no color here: the footer marks this .text-white, and a color rule in
       this sheet would win over that class and leave the label grey. */
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    box-shadow: none;
}

.em-consent__close {
    background: none !important;
    border: 0;
    padding: 0 .25rem;
    margin: -.25rem -.25rem 0 0;
    font-size: 1.5rem;
    line-height: 1;
    color: inherit;
    opacity: .55;
    cursor: pointer;
}

.em-consent__close:hover,
.em-consent__close:focus-visible {
    background: none !important;
    opacity: 1;
}

/* --------------------------------------------------------------------------
   THE BUTTON PAIR IS DEFINED HERE, NOT INHERITED.
   --------------------------------------------------------------------------
   This site ships two button systems (main.css and style.css) with different
   radii, gradients and hover colours. The card lives over the footer, so it
   defines its own pair from this site's tokens and does not depend on which
   stylesheet won:

     secondary  white, visible border - outlined, neutral
     primary    site orange, white ink - the one obvious choice

   !important on the ground because both systems set background and border
   without a card-scoped selector.
   -------------------------------------------------------------------------- */
.em-consent .btn {
    border-radius: var(--radius-pill, 999px);
    padding: .7rem 1.1rem;
    font-size: .9375rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.em-consent .btn-secondary {
    background: var(--color-white, #fff) !important;
    border: 1px solid var(--color-border, #e3e6eb) !important;
    color: var(--color-on-surface, #16181d) !important;
}

.em-consent .btn-secondary:hover,
.em-consent .btn-secondary:focus-visible {
    background: var(--color-secondary, #f4f5f7) !important;
    border-color: color-mix(in srgb, var(--color-on-surface, #16181d) 24%, transparent) !important;
    color: var(--color-on-surface, #16181d) !important;
}

.em-consent .btn-primary {
    background: var(--color-primary, #f26522) !important;
    border: 1px solid transparent !important;
    color: #fff !important;
}

.em-consent .btn-primary:hover,
.em-consent .btn-primary:focus-visible {
    background: var(--color-primary-dark, #d4531a) !important;
    color: #fff !important;
}

@media (max-width: 480px) {
    .em-consent { left: .5rem; right: .5rem; bottom: .5rem; width: auto; }
    .em-consent__card { padding: 1rem; border-radius: 1rem; }
}
