/* ============================================================
   River Dachs — Cookie / analytics consent banner
   ------------------------------------------------------------
   Injected by cookie-consent.js, so pages only need this
   stylesheet plus the script tag (same drop-in contract as
   theme-toggle.css / theme-toggle.js).

   Colors come from the ROLE TOKENS only (--c-*), never raw
   palette refs or hardcoded hex, so the banner themes with the
   rest of the site. See the theming section of CLAUDE.md.

   Touch targets are >=44px per the 2026-08-10 mobile sweep.
   ============================================================ */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;                    /* above the floating theme pill (9999) */
  background: var(--c-surface);
  color: var(--c-text);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
  font-family: var(--font-sans);
  /* animate in without hiding it from assistive tech */
  transform: translateY(100%);
  transition: transform 0.28s ease;
}

.cookie-banner.is-visible { transform: translateY(0); }

.cookie-banner__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.cookie-banner__copy { flex: 1 1 auto; }

.cookie-banner__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--c-heading);
  margin: 0 0 0.3rem;
  line-height: 1.2;
}

.cookie-banner__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--c-muted);
}

.cookie-banner__text a {
  color: var(--c-accent);
  text-decoration: underline;
}

.cookie-banner__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.75rem;
}

/* Both choices are the same size and weight on purpose — making
   "Decline" harder to find than "Accept" is a dark pattern and
   invalidates the consent. Do not restyle one to dominate. */
.cookie-btn {
  min-height: 44px;
  min-width: 132px;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.cookie-btn--accept {
  background: var(--c-accent);
  color: var(--c-on-accent);
  border: 1px solid var(--c-accent);
}

.cookie-btn--accept:hover {
  background: var(--c-cta);
  border-color: var(--c-cta);
  color: var(--c-on-cta);
}

.cookie-btn--decline {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-field-border);
}

.cookie-btn--decline:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.cookie-btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* The floating theme pill (theme-toggle.css) is fixed bottom-right
   at 22px and would sit underneath the banner. cookie-consent.js
   publishes the banner's measured height as --rd-consent-h, so the
   pill lifts by exactly that much and drops back when the banner
   goes. The 0px fallback makes this a no-op with no banner, and
   the :root prefix wins on specificity regardless of link order. */
:root .theme-toggle--floating {
  bottom: calc(22px + var(--rd-consent-h, 0px));
  transition: bottom 0.28s ease;
}

@media (prefers-reduced-motion: reduce) {
  :root .theme-toggle--floating { transition: none; }
}

/* Footer "Cookie Settings" link injected next to Privacy/Terms.
   Consent must be as easy to withdraw as it was to give. */
.cookie-settings-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Mobile: stack, full-width buttons ─────────────────────── */
@media (max-width: 760px) {
  .cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    /* keep clear of iOS home indicator */
    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }
  .cookie-banner__actions { width: 100%; }
  .cookie-btn { flex: 1 1 0; min-width: 0; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner { transition: none; }
}

@media print {
  .cookie-banner { display: none; }
}
