/**
 * css/consent.css — consent banner + gated-embed placeholder.
 *
 * ⚠️ THE ONLY BLOCK YOU EDIT PER SITE IS THE FIRST ONE. Map the site's existing
 * brand variables into these eight tokens and the rest of the file inherits the
 * brand automatically. Do not scatter site colours through the rules below —
 * when the site re-tokenizes, this file should be a one-block change.
 *
 * The fallbacks after each var() are neutral greys on purpose. If a token is
 * wrong the banner looks unbranded, which is obvious; a fallback in someone
 * else's brand colours would look deliberate and ship.
 *
 * Prefix: `anamorphics`. If the site already had a consent layer under its own
 * prefix, keep that one — find/replace here and in the JS/PHP together.
 */

:root {
  /* --- mapped to Vaughn's brand, css/styles-custom.css :root -------------- */
  --consent-bg:        var(--brand-white, #fff);
  --consent-fg:        var(--brand-gray-dark, #191919);
  --consent-muted:     var(--brand-gray, #737373);
  --consent-accent:    var(--brand-red, #981426);     /* buttons, title, focus base */
  --consent-accent-fg: var(--brand-white, #fff);      /* text ON the accent */

  /* Darkened --brand-red. The palette has no darker red, and hovering from
     red to a grey or black would read as a different button rather than the
     same one. Defined here rather than scattered through the rules below. */
  --consent-hover:     #7a101f;

  /* Focus ring — TWO TONE, and it has to be.
     WCAG 2.2 SC 1.4.11 requires 3:1 for a focus indicator against adjacent
     colour. Controls here sit on two very different backgrounds: the white
     panel (checkboxes, the policy link) and the red buttons. Measured:
        amber #f5a623 vs white panel  = 2.03:1  ✗
        amber #f5a623 vs red button   = 4.21:1  ✓
        near-black #191919 vs white   = 17.58:1 ✓
        near-black #191919 vs red     = 2.06:1  ✗
     Neither colour passes alone, so the indicator uses both: an amber inner
     ring for the red buttons and a near-black outer ring for the white panel.
     Whichever background the control sits on, one band clears 3:1.
     Do not collapse this back to a single colour. */
  --consent-focus:      #f5a623;
  --consent-focus-edge: var(--brand-gray-dark, #191919);

  --consent-radius:    var(--border-radius-small, 0.2rem);

  /* --- structural, rarely changed ---------------------------------------- */
  --consent-max:       46rem;
  --consent-z:         1080;      /* site CSS tops out at 1060 — checked */

  /* Brand typeface. The site loads acumin-pro-condensed via Typekit, which is
     a third-party request — but it is already loaded by the page itself, so
     using it here adds no request the visitor was not already getting. */
  --consent-font:      var(--brand-font, "acumin-pro-condensed", sans-serif);
}

/* --------------------------------------------------------------- container */

/**
 * Fixed to the TOP edge, centred, with a max-width so it reads as part of the
 * site rather than as browser chrome.
 *
 * ⚠️ TOP, NOT BOTTOM — this is the one structural deviation from the house
 * pattern. Vaughn's counsel specified "top-middle, first thing the user sees".
 * It is still not a modal: no overlay, no scroll lock, no dimming, and
 * pointer-events below mean the page stays fully usable behind it.
 *
 * COLLISION CHECK, done 2026-08-11: styles-custom.css contains no
 * `position: fixed` or `position: sticky` rules at all, and its highest
 * z-index is 1060. The site header/navbar is a normal in-flow Bootstrap
 * navbar, so it is NOT permanently covered — but it IS overlaid while the
 * banner is up and the page is scrolled to the top, which is where a
 * first-time visitor starts. That is the intended consequence of counsel's
 * "first thing the user sees", not an accident. Re-check this if a sticky
 * header is ever added.
 */
.anamorphics-consent {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: var(--consent-z);
  padding: 1rem;
  display: flex;
  justify-content: center;
  pointer-events: none;        /* only the panel is interactive — the page stays usable */
}

.anamorphics-consent__panel {
  pointer-events: auto;
  width: 100%;
  max-width: var(--consent-max);
  background: var(--consent-bg);
  color: var(--consent-fg);
  border-radius: 0;
  /* Shadow falls downward now that the panel is pinned to the top edge. */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
  padding: 1rem 1.25rem;
  font-family: var(--consent-font);

  /* Slides DOWN from above, not up from below. */
  transform: translateY(-120%);
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.anamorphics-consent.is-visible .anamorphics-consent__panel {
  transform: translateY(0);
  opacity: 1;
}

/* -------------------------------------------------------------------- copy */

.anamorphics-consent__title {
  font-size: 1.21rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--consent-accent);
}

.anamorphics-consent__text {
  font-size: 1.06rem;
  line-height: 1.5;
  margin: 0;
  color: var(--consent-fg);
}

.anamorphics-consent__link {
  color: var(--consent-accent);
  text-decoration: underline;
  white-space: nowrap;
}

.anamorphics-consent__link:hover,
.anamorphics-consent__link:focus-visible { color: var(--consent-hover); }

/* ----------------------------------------------------------------- actions */

.anamorphics-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  justify-content: flex-end;
}

.anamorphics-consent__actions--options { margin-top: 0.75rem; }

/**
 * Accept All, Reject All and Cookie Settings are IDENTICAL — one size, one
 * weight, one min-width, one fill, one hover. Equal prominence is a legal
 * requirement, not a design preference. Do not restyle Accept to be louder,
 * and do not demote Reject to a text link.
 *
 * Vaughn note: the house pattern used a filled Accept against outlined
 * siblings. That distinction is dropped here — counsel put Accept first in
 * the reading order, and making it *also* the only filled button would stack
 * two nudges in the same direction. All three are filled and identical.
 * The --ghost and --primary modifiers below are retained only so the file
 * stays diffable against the portfolio version; nothing uses them.
 */
.anamorphics-consent__btn {
  font: inherit;
  font-family: var(--consent-font);
  font-size: 1.03rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  border-radius: var(--consent-radius);
  border: 2px solid var(--consent-accent);
  background: var(--consent-accent);
  color: var(--consent-accent-fg);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  min-width: 7.5rem;
  text-align: center;
}

.anamorphics-consent__btn:hover {
  background: var(--consent-hover);
  border-color: var(--consent-hover);
  color: var(--consent-accent-fg);
}

/* Unused on this site — kept for diffability against the portfolio version. */
.anamorphics-consent__btn--ghost {
  background: transparent;
  color: var(--consent-accent);
}

.anamorphics-consent__btn--ghost:hover {
  background: var(--consent-accent);
  color: var(--consent-accent-fg);
}

.anamorphics-consent__btn--primary {
  background: var(--consent-accent);
  color: var(--consent-accent-fg);
}

.anamorphics-consent__btn--primary:hover {
  background: var(--consent-hover);
  border-color: var(--consent-hover);
}

/* Branded focus ring. Never leave these at the UA default — the banner is
   frequently the first thing a keyboard user lands on. */
.anamorphics-consent__btn:focus-visible,
.anamorphics-consent__option input:focus-visible,
.anamorphics-consent__link:focus-visible,
.anamorphics-embed__btn:focus-visible {
  outline: 2px solid var(--consent-focus);
  outline-offset: 2px;
  /* The outer band. box-shadow paints outside the outline's offset, so the
     result reads as amber-then-dark and satisfies 3:1 on either background.
     Kept thin on purpose — the colors are load-bearing for contrast, the
     thickness isn't, so this is the dial to turn down without losing
     compliance. */
  box-shadow: 0 0 0 4px var(--consent-focus-edge);
}

/* ----------------------------------------------------------------- options */

.anamorphics-consent__options {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.anamorphics-consent__group { border: 0; margin: 0; padding: 0; }

.anamorphics-consent__legend {
  font-size: 0.91rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--consent-muted);
  padding: 0;
  margin-bottom: 0.5rem;
}

.anamorphics-consent__option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  cursor: pointer;
}

.anamorphics-consent__option--locked { cursor: default; opacity: 0.72; }

.anamorphics-consent__option input {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--consent-accent);
  flex: none;
}

.anamorphics-consent__option strong { display: block; font-size: 1.06rem; }

.anamorphics-consent__option em {
  display: block;
  font-style: normal;
  font-size: 0.97rem;
  color: var(--consent-muted);
}

/* ------------------------------------------------- gated embed placeholder */

/**
 * Stands in for a third-party iframe that has not been allowed yet. It occupies
 * the embed's exact aspect ratio (set inline by consentEmbed()) so releasing it
 * does not reflow the page — a placeholder that collapses and then shoves the
 * article down when it loads is worse than the embed.
 */
.anamorphics-embed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1.25rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.04);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: var(--consent-radius);
  color: var(--consent-fg);
}

.anamorphics-embed__text {
  margin: 0;
  font-size: 1.03rem;
  color: var(--consent-muted);
  max-width: 32rem;
}

.anamorphics-embed__btn {
  font: inherit;
  font-size: 1.03rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--consent-radius);
  border: 2px solid var(--consent-accent);
  background: var(--consent-accent);
  color: var(--consent-accent-fg);
  cursor: pointer;
}

.anamorphics-embed__link {
  font: inherit;
  font-size: 0.97rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--consent-accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ----------------------------------------------------------- small screens */

@media (max-width: 575.98px) {
  .anamorphics-consent { padding: 0.5rem; }

  .anamorphics-consent__panel {
    padding: 0.9rem;
    max-height: 85vh;
    overflow-y: auto;
  }

  .anamorphics-consent__actions { justify-content: stretch; }

  .anamorphics-consent__btn { flex: 1 1 100%; min-width: 0; }
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .anamorphics-consent__panel {
    transition: opacity 0.01ms linear;
    transform: none;
  }
  .anamorphics-consent.is-visible .anamorphics-consent__panel { transform: none; }
}


/* =========================================================================
   Vaughn additions — elements counsel's panel structure needs that the
   portfolio banner did not have.
   ========================================================================= */

/**
 * "Manage Your Cookie Preferences" — the visible heading of the expanded
 * panel. The fieldset's <legend> is visually hidden (below) so a screen
 * reader does not announce counsel's heading twice.
 */
.anamorphics-consent__subtitle {
  font-family: var(--consent-font);
  font-size: 1.21rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--consent-accent);
  margin: 0 0 0.35rem;
}

.anamorphics-consent__intro {
  font-size: 1.03rem;
  line-height: 1.45;
  color: var(--consent-muted);
  margin: 0 0 0.75rem;
}

/**
 * Visually hidden, still in the accessibility tree. Not display:none — that
 * would remove the fieldset's accessible name entirely.
 */
.anamorphics-consent__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/** "Always Active" beside Necessary Cookies. */
.anamorphics-consent__always {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--consent-muted);
  color: var(--consent-accent-fg);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: 0.08em;
}

/**
 * The panel can now be tall — four categories plus counsel's intro copy — and
 * it is pinned to the top of the viewport. Cap it and let it scroll rather
 * than letting it run off the bottom of a laptop screen.
 */
.anamorphics-consent__options {
  max-height: min(60vh, 32rem);
  overflow-y: auto;
}

/**
 * "Necessary Cookies" + its ALWAYS ACTIVE badge on one line.
 *
 * The base rule sets `strong { display: block }` so the category name and its
 * description stack. That also pushed the badge onto its own line, which read
 * as a third element rather than as a state attached to the name. Scope an
 * inline-block override to the locked option only — every other category keeps
 * the stacked layout.
 */
.anamorphics-consent__option--locked strong {
  display: inline-block;
  vertical-align: middle;
}

.anamorphics-consent__option--locked .anamorphics-consent__always {
  vertical-align: middle;
  margin-left: 0.45rem;
}
