/* Licensed to account 52c7da1aea3f, 2026-10-20. Moving parts. */
/* Cookie banner, the mechanics.
   Moving parts. Where the banner sits, the edge that draws it out of its mark and back, its switches and its states, on attributes; the look of the preview follows.
   Readable source: components/cookie-banner/cookie-banner.css */

/* ---------- colours, places, time ---------- */

/* Two colours, three lengths, one time, zero specificity.
   The engine writes the accent and the time from its settings, and the ink
   from the background of the banner. Set the lengths in a rule of your own:
   --cookie-banner-gap, how far the banner and the mark keep from the edges
   of the window, --cookie-banner-size, the side of the mark, and
   --cookie-banner-z, their layer. */
:where([data-cookie-banner], [data-cookie-banner-tab]) {
  --cookie-banner-accent: #ff4a00;
  --cookie-banner-ink: #15100c;
  --cookie-banner-gap: clamp(10px, 1.6vw, 28px);
  --cookie-banner-size: clamp(44px, 3.2vw, 48px);
  --cookie-banner-z: 9990;
  --cookie-banner-travel: 1.3s;
  --cookie-banner-ease: cubic-bezier(0.7, 0, 0.2, 1);
  --cookie-banner-out: cubic-bezier(0.3, 0, 0.1, 1);
}

/* How much of the banner is still covered, from the top and from the far
   side: registered, so the two can travel one after the other. */
@property --cookie-banner-top {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 0px;
}

@property --cookie-banner-far {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 0px;
}

/* ---------- the banner ---------- */

/* Held to the foot of the window, on the side of its mark.
   It is not a dialog: the page behind stays in reach. A banner taller than
   the window scrolls inside itself. */
[data-cookie-banner] {
  position: fixed;
  left: var(--cookie-banner-gap);
  bottom: calc(var(--cookie-banner-gap) + env(safe-area-inset-bottom, 0px));
  z-index: var(--cookie-banner-z);
  box-sizing: border-box;
  width: calc(100% - 2 * var(--cookie-banner-gap));
  max-height: calc(100vh - 2 * var(--cookie-banner-gap));
  max-height: calc(100svh - 2 * var(--cookie-banner-gap) - env(safe-area-inset-bottom, 0px));
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Covered down to a square the size of the mark, in its corner. Putting
     itself away, the far side comes back first, then the top comes down. */
  --cookie-banner-top: calc(100% - var(--cookie-banner-size));
  --cookie-banner-far: calc(100% - var(--cookie-banner-size));
  clip-path: inset(var(--cookie-banner-top) var(--cookie-banner-far) 0 0 round 4px);
  transition:
    --cookie-banner-far calc(var(--cookie-banner-travel) * 0.62) var(--cookie-banner-ease),
    --cookie-banner-top calc(var(--cookie-banner-travel) * 0.42) var(--cookie-banner-ease) calc(var(--cookie-banner-travel) * 0.58);
}

[data-cookie-banner][data-cookie-banner-side="right"] {
  left: auto;
  right: var(--cookie-banner-gap);
  clip-path: inset(var(--cookie-banner-top) 0 0 var(--cookie-banner-far) round 4px);
}

/* Drawn out: up first, then across. */
[data-cookie-banner][data-cookie-banner-state~="wide"] {
  --cookie-banner-top: 0px;
  --cookie-banner-far: 0px;
  transition:
    --cookie-banner-top calc(var(--cookie-banner-travel) * 0.42) var(--cookie-banner-ease),
    --cookie-banner-far calc(var(--cookie-banner-travel) * 0.62) var(--cookie-banner-ease) calc(var(--cookie-banner-travel) * 0.38);
}

/* Hidden until the engine opens it.
   So a page without JavaScript shows no banner, and runs no gated script
   either: those are text until a choice allows them. */
[data-cookie-banner]:not([data-cookie-banner-state~="open"]) {
  visibility: hidden;
  pointer-events: none;
}

/* The edge: a line of the accent on the side that moves, gone at rest. */
[data-cookie-banner-edge] {
  position: absolute;
  top: var(--cookie-banner-top);
  right: var(--cookie-banner-far);
  bottom: 0;
  width: 2px;
  background-color: var(--cookie-banner-accent);
  pointer-events: none;
  transition: opacity 0.3s;
}

[data-cookie-banner-side="right"] > [data-cookie-banner-edge] {
  right: auto;
  left: var(--cookie-banner-far);
}

[data-cookie-banner-state~="wide"]:not([data-cookie-banner-state~="blank"]) > [data-cookie-banner-edge] {
  opacity: 0;
  transition-duration: 0.6s;
}

/* The words come up once the banner is out, and leave before it goes. */
[data-cookie-banner] > :not([data-cookie-banner-edge], [data-cookie-banner-glyph]) {
  transition: opacity 0.6s var(--cookie-banner-out), transform 0.7s var(--cookie-banner-out);
}

[data-cookie-banner][data-cookie-banner-state~="blank"] > :not([data-cookie-banner-edge], [data-cookie-banner-glyph]) {
  opacity: 0;
  transform: translateY(10px);
  transition-duration: 0.28s;
}

/* The switch of the mark, drawn on the banner in the square the mark leaves.
   The mark hides the moment the banner takes its place, on the same pixels:
   the switch stays while the banner draws out, and fades as it widens; it is
   back before the banner has closed down, so the mark takes over unseen. */
[data-cookie-banner-glyph] {
  position: absolute;
  bottom: calc(var(--cookie-banner-size) / 2 - 5px);
  left: calc(var(--cookie-banner-size) / 2 - 9px);
  box-sizing: border-box;
  width: 18px;
  height: 10px;
  border: 1.5px solid #f4ece0;
  border-radius: 2px;
  background: linear-gradient(#f4ece0, #f4ece0) right 2px center / 5px 3px no-repeat;
  pointer-events: none;
  transition: opacity 0.35s calc(var(--cookie-banner-travel) * 0.5);
}

[data-cookie-banner-side="right"] > [data-cookie-banner-glyph] {
  left: auto;
  right: calc(var(--cookie-banner-size) / 2 - 9px);
}

[data-cookie-banner-state~="wide"] > [data-cookie-banner-glyph] {
  opacity: 0;
  transition: opacity 0.3s 0.12s;
}

/* The focus the engine gives the banner when it is asked for by hand. */
[data-cookie-banner]:focus {
  outline: none;
}

:where([data-cookie-banner]) :focus-visible,
[data-cookie-banner-tab]:focus-visible {
  outline: 2px solid var(--cookie-banner-accent);
  outline-offset: 3px;
}

/* While the banner is open, what the keyboard reaches scrolls clear of it. */
:where(html[data-cookie-banner-page]) {
  scroll-padding-bottom: calc(var(--cookie-banner-height, 0px) + 32px);
}

/* ---------- the buttons ---------- */

/* Accept, refuse and save answer the pointer the same way.
   One plate of the accent rises behind the word of each: neither answer is
   made easier than the other. */
[data-cookie-banner-accept],
[data-cookie-banner-refuse],
[data-cookie-banner-save] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.4s;
}

:is([data-cookie-banner-accept], [data-cookie-banner-refuse], [data-cookie-banner-save])::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--cookie-banner-accent);
  transform: translateY(101%);
  transition: transform 0.6s var(--cookie-banner-ease);
}

@media (hover: hover) {
  :is([data-cookie-banner-accept], [data-cookie-banner-refuse], [data-cookie-banner-save]):hover {
    color: var(--cookie-banner-ink);
  }

  :is([data-cookie-banner-accept], [data-cookie-banner-refuse], [data-cookie-banner-save]):hover::before {
    transform: translateY(0);
  }
}

:is([data-cookie-banner-accept], [data-cookie-banner-refuse], [data-cookie-banner-save]):active {
  color: var(--cookie-banner-ink);
}

:is([data-cookie-banner-accept], [data-cookie-banner-refuse], [data-cookie-banner-save]):active::before {
  transform: translateY(0);
  transition-duration: 0.12s;
}

/* What opens the categories: a plus that turns into a cross. */
[data-cookie-banner-choose] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

[data-cookie-banner-choose]::after {
  content: "+";
  display: inline-block;
  margin-left: 0.6em;
  transition: transform 0.6s var(--cookie-banner-ease);
}

[data-cookie-banner-choose][aria-expanded="true"]::after {
  transform: rotate(135deg);
}

/* ---------- the categories ---------- */

/* Folded to no height until asked for, then as tall as what they hold.
   Nothing inside can take the focus while they are folded. */
[data-cookie-banner-panel] {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
}

[data-cookie-banner-panel] > * {
  min-height: 0;
  overflow: hidden;
}

[data-cookie-banner-state~="choosing"] [data-cookie-banner-panel] {
  grid-template-rows: 1fr;
  visibility: visible;
}

/* Only a banner that is out moves them: one about to open takes its size at once. */
[data-cookie-banner][data-cookie-banner-state~="wide"] > [data-cookie-banner-panel] {
  transition: grid-template-rows 0.8s var(--cookie-banner-ease), visibility 0s linear 0.8s,
    opacity 0.6s var(--cookie-banner-out), transform 0.7s var(--cookie-banner-out);
}

[data-cookie-banner][data-cookie-banner-state~="wide"][data-cookie-banner-state~="choosing"] > [data-cookie-banner-panel] {
  transition: grid-template-rows 0.8s var(--cookie-banner-ease), visibility 0s,
    opacity 0.6s var(--cookie-banner-out), transform 0.7s var(--cookie-banner-out);
}

/* The categories come up one after the other as their room opens. */
[data-cookie-banner-category],
[data-cookie-banner-save] {
  transition: opacity 0.3s, transform 0.3s, color 0.4s;
}

[data-cookie-banner]:not([data-cookie-banner-state~="choosing"]) :is([data-cookie-banner-category], [data-cookie-banner-save]) {
  opacity: 0;
  transform: translateY(14px);
}

[data-cookie-banner-state~="choosing"] :is([data-cookie-banner-category], [data-cookie-banner-save]) {
  transition: opacity 0.7s var(--cookie-banner-out) 0.5s, transform 0.8s var(--cookie-banner-out) 0.5s, color 0.4s;
}

[data-cookie-banner-state~="choosing"] [data-cookie-banner-category]:nth-child(1) { transition-delay: 0.2s, 0.2s, 0s; }
[data-cookie-banner-state~="choosing"] [data-cookie-banner-category]:nth-child(2) { transition-delay: 0.28s, 0.28s, 0s; }
[data-cookie-banner-state~="choosing"] [data-cookie-banner-category]:nth-child(3) { transition-delay: 0.36s, 0.36s, 0s; }
[data-cookie-banner-state~="choosing"] [data-cookie-banner-category]:nth-child(4) { transition-delay: 0.44s, 0.44s, 0s; }

/* The whole line of a category is its switch. */
[data-cookie-banner-category]:not([data-cookie-banner-locked]) {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* A switch: on, its track takes the accent and its knob crosses over. */
[data-cookie-banner-switch] {
  cursor: pointer;
  transition: background-color 0.4s;
}

[data-cookie-banner-knob] {
  transition: transform 0.55s var(--cookie-banner-ease), background-color 0.4s;
}

[data-cookie-banner-switch][aria-checked="true"] {
  background-color: var(--cookie-banner-accent);
}

[data-cookie-banner-switch][aria-checked="true"] [data-cookie-banner-knob] {
  background-color: var(--cookie-banner-ink);
  transform: translateX(16px);
}

/* A category that cannot be refused: its switch is on and stays there. */
[data-cookie-banner-switch][aria-disabled="true"] {
  cursor: default;
  opacity: 0.45;
}

/* ---------- the mark in the corner ---------- */

/* What is left of the banner once the choice is made, and what opens it
   again: a square of its ink with the edge on its side. Under the pointer
   and under the keyboard the edge moves out and uncovers its name. */
[data-cookie-banner-tab] {
  position: fixed;
  left: var(--cookie-banner-gap);
  bottom: calc(var(--cookie-banner-gap) + env(safe-area-inset-bottom, 0px));
  z-index: var(--cookie-banner-z);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  height: var(--cookie-banner-size);
  margin: 0;
  padding: 0 22px 0 var(--cookie-banner-size);
  border: 0;
  border-radius: 0;
  background-color: var(--cookie-banner-ink);
  color: #f4ece0;
  font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  --cookie-banner-far: calc(100% - var(--cookie-banner-size));
  clip-path: inset(0 var(--cookie-banner-far) 0 0 round 4px);
  transition: --cookie-banner-far 0.7s var(--cookie-banner-ease);
  -webkit-tap-highlight-color: transparent;
}

[data-cookie-banner-tab] > [data-cookie-banner-word] {
  transition: opacity 0.4s;
  opacity: 0;
}

[data-cookie-banner-tab]::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: var(--cookie-banner-far);
  width: 2px;
  background-color: var(--cookie-banner-accent);
}

/* A small switch, on, drawn in the square. */
[data-cookie-banner-tab]::after {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  left: calc(var(--cookie-banner-size) / 2 - 9px);
  box-sizing: border-box;
  width: 18px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(currentColor, currentColor) right 2px center / 5px 3px no-repeat;
}

[data-cookie-banner-tab][data-cookie-banner-side="right"]::after {
  left: auto;
  right: calc(var(--cookie-banner-size) / 2 - 9px);
}

[data-cookie-banner-tab][data-cookie-banner-side="right"] {
  left: auto;
  right: var(--cookie-banner-gap);
  padding: 0 var(--cookie-banner-size) 0 22px;
  clip-path: inset(0 0 0 var(--cookie-banner-far) round 4px);
}

[data-cookie-banner-tab][data-cookie-banner-side="right"]::before {
  right: auto;
  left: var(--cookie-banner-far);
}

[data-cookie-banner-tab]:not([data-cookie-banner-tab="shown"]) {
  visibility: hidden;
  pointer-events: none;
}

@media (hover: hover) {
  [data-cookie-banner-tab]:hover {
    --cookie-banner-far: 0px;
  }

  [data-cookie-banner-tab]:hover > [data-cookie-banner-word] {
    opacity: 1;
    transition: opacity 0.5s 0.25s;
  }
}

[data-cookie-banner-tab]:focus-visible {
  --cookie-banner-far: 0px;
}

[data-cookie-banner-tab]:focus-visible > [data-cookie-banner-word] {
  opacity: 1;
}

/* What a screen reader is told: there, and seen by no one. */
[data-cookie-banner-live] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- less motion, and paper ---------- */

@media (prefers-reduced-motion: reduce) {
  [data-cookie-banner],
  [data-cookie-banner] *,
  [data-cookie-banner] *::before,
  [data-cookie-banner] *::after,
  [data-cookie-banner-tab],
  [data-cookie-banner-tab] * {
    transition: none !important;
  }
}

@media print {
  [data-cookie-banner],
  [data-cookie-banner-tab] {
    display: none;
  }
}

/* ---------- look, left out of the Webflow Embed ---------- */

/* Clinix Studio: the look of the preview (the cookie-banner-* classes of
   the ink card on the cream page, set in Instrument Sans and Geist Mono) is
   left out of this copy on purpose. The banner's own look, on the site's
   tokens, stands in src/components/CookieBanner.astro: the same card, the
   same row of answers, the same switches, in Cocoa with Ivory type and the
   Sky accent. The mechanics above are the file as shipped. */
