/* ==========================================================================
   COOKIE CONSENT BANNER

   Deliberately NOT styled like the rest of the site.

   The site is dark: deep green ground, warm sand ink, display serif, big
   radii, glass. This banner inverts that — light sand surface, dark green
   ink, sans only, tight radii, no blur — so it reads as a system-level
   object sitting on top of the page rather than as another card in it. A
   consent notice that looks like site furniture invites being ignored as
   decoration.

   The inversion is not a third style: it is the same two brand colours
   swapped, which is exactly what the logo mark does (see variables.css).
   No new hue is introduced.

   Two rules here are load-bearing beyond taste:

     1. Inside the panel, "Reject all" and "Accept all" share
        .bm-consent-btn--primary and must stay visually identical. The ICO
        treats a quieter reject control as invalid consent.

     2. .bm-consent-btn--primary has TWO definitions. The base one is the
        site style (sand on dark) and is used by the "Change cookie settings"
        button on the dark /cookies page. The panel-scoped one inverts it for
        the light surface. Collapsing them makes one of the two invisible.
   ========================================================================== */

.bm-consent-root {
  position: fixed;
  z-index: 9999;
  /* Corner-anchored, not a full-width bar: smaller footprint, and it stops
     competing with the page's own bottom-edge furniture. */
  inset: auto auto 1.25rem 1.25rem;
  display: none;
  pointer-events: none;
}

.bm-consent-root.is-visible {
  display: block;
}

/* An author `display` rule outranks the UA stylesheet's [hidden]{display:none},
   so .bm-consent-options (display:flex) rendered expanded on first load even
   with the attribute set. Anything hidden inside the banner is hidden. */
.bm-consent-root [hidden] {
  display: none !important;
}

.bm-consent-panel {
  pointer-events: auto;
  width: 340px;
  background: var(--brand-sand-light);
  color: var(--bg-main);
  border-radius: var(--radius-sm);
  /* Hard, close shadow — it sits ON the page, it is not part of it. */
  box-shadow: 0 8px 28px rgba(9, 15, 11, 0.55);
  padding: 1.05rem 1.1rem 1.1rem;
  font-family: var(--font-body);
  /* The banner appears on every page, including 404.html which centres its
     body text. Pin the alignment so it reads identically everywhere. */
  text-align: left;
  animation: bm-consent-rise 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bm-consent-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .bm-consent-panel { animation: none; }
}

/* Sans, small, uppercase — a label, not one of the site's serif headlines. */
.bm-consent-title {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg-main);
  margin: 0 0 0.45rem 0;
}

.bm-consent-title:focus,
.bm-consent-title:focus-visible {
  outline: none;
}

.bm-consent-text {
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(19, 30, 22, 0.78);
  margin: 0 0 0.85rem 0;
}

.bm-consent-text a {
  color: var(--bg-main);
  font-weight: 500;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Category toggles — hidden until "Customise"
   -------------------------------------------------------------------------- */
.bm-consent-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0 0 0.85rem 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(19, 30, 22, 0.16);
}

.bm-consent-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.bm-consent-option label {
  cursor: pointer;
  display: block;
}

.bm-consent-option-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bg-main);
  margin-bottom: 0.1rem;
}

.bm-consent-option-desc {
  display: block;
  font-size: 0.71rem;
  line-height: 1.45;
  color: rgba(19, 30, 22, 0.62);
}

.bm-consent-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border: 1px solid rgba(19, 30, 22, 0.42);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bm-consent-checkbox::after {
  content: '';
  width: 7px;
  height: 4px;
  border-left: 2px solid var(--brand-sand-light);
  border-bottom: 2px solid var(--brand-sand-light);
  transform: rotate(-45deg) scale(0);
  transition: transform 0.15s ease;
}

.bm-consent-checkbox:checked {
  background: var(--bg-main);
  border-color: var(--bg-main);
}

.bm-consent-checkbox:checked::after {
  transform: rotate(-45deg) scale(1);
}

.bm-consent-checkbox:focus-visible {
  outline: 2px solid var(--bg-main);
  outline-offset: 2px;
}

.bm-consent-option--fixed .bm-consent-lock {
  flex-shrink: 0;
  width: 15px;
  margin-top: 1px;
  text-align: center;
  color: rgba(19, 30, 22, 0.5);
  font-size: 0.62rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */
.bm-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bm-consent-btn {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.55rem 0.8rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Base = site surfaces (the CTA on the dark /cookies page). Sand on dark. */
.bm-consent-btn--primary {
  background: var(--text-primary);
  color: var(--bg-main);
}

.bm-consent-btn--primary:hover {
  background: var(--brand-sand-light);
}

/* Inside the light panel, invert. Reject and Accept share this — equal by
   requirement, not by preference. Both sit on one row, each half the width. */
.bm-consent-panel .bm-consent-btn--primary {
  flex: 1 1 0;
  background: var(--bg-main);
  color: var(--brand-sand-light);
}

.bm-consent-panel .bm-consent-btn--primary:hover {
  background: var(--brand-green);
}

/* Customise / Save drop to their own full-width row, quieter than both. */
.bm-consent-panel .bm-consent-btn--quiet {
  flex: 1 1 100%;
  background: transparent;
  border-color: rgba(19, 30, 22, 0.28);
  color: rgba(19, 30, 22, 0.75);
}

.bm-consent-panel .bm-consent-btn--quiet:hover {
  border-color: var(--bg-main);
  color: var(--bg-main);
}

.bm-consent-panel .bm-consent-btn:focus-visible {
  outline: 2px solid var(--bg-main);
  outline-offset: 2px;
}

.bm-consent-btn:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
}

/* Phones: span the bottom edge, but keep the compact proportions. */
@media (max-width: 640px) {
  .bm-consent-root {
    inset: auto 0.7rem 0.7rem 0.7rem;
  }

  .bm-consent-panel {
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   Footer / drawer entry points
   -------------------------------------------------------------------------- */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
}

.legal-links a,
.legal-links button {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: inherit;
  transition: color 0.2s ease;
}

.legal-links a:hover,
.legal-links button:hover {
  color: var(--text-primary);
}

.legal-links a:focus-visible,
.legal-links button:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* In the drawer the links sit under the main nav, quieter than it. */
.drawer-legal-links {
  margin-top: auto;
  padding-top: 1.5rem;
  justify-content: center;
  border-top: 1px solid var(--border-color);
}

.drawer-legal-links a,
.drawer-legal-links button {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .bm-consent-panel {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  /* Stacked full-width on phones — still equal weight, still no scroll to
     reach the reject control. */
  .bm-consent-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bm-consent-btn {
    width: 100%;
    text-align: center;
  }
}
