/*
  Controls above the page, carried over from 02-flapboard and restyled into this world:
  the scroll cue, the WhatsApp waves, the floating buttons, the accessibility panel, the cookie banner and its dialog.
*/

/* ---------- Scroll cue: after the entrance it moves three times (under 5s), rests, and leaves on the first scroll ---------- */
.scroll-hint {
  position: absolute; z-index: 3; inset-inline: 0; inset-block-end: calc(28px + var(--consent-h, 0px)); margin-inline: auto; inline-size: max-content;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink); font-size: 0.875rem; font-weight: 500; line-height: 1.3; text-align: center;
  pointer-events: none;
  transition: opacity 400ms var(--ease-out), visibility 0s linear 0s;
}
.hint-mouse { display: contents; }
.hint-touch { display: none; }
@media (hover: none), (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: contents; }
}
.hint-icon {
  position: relative; display: block; inline-size: 40px; block-size: 40px; border-radius: 50%;
  background: linear-gradient(180deg, #17171B, #0A0A0C); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 0 0 1px rgb(255 255 255 / 0.08), 0 6px 20px -8px rgb(245 34 45 / 0.7);
}
.hint-icon svg { position: absolute; inset: 8px; inline-size: 24px; block-size: 24px; }
.hint-wheel { color: var(--red-hot); }
.scroll-hint.is-live .hint-wheel { animation: hint-wheel 1500ms var(--ease-in-out) 3; }
.scroll-hint.is-live .hint-finger { animation: hint-finger 1600ms var(--ease-in-out) 3; }
@keyframes hint-wheel {
  0% { transform: translateY(0); opacity: 1; }
  65% { transform: translateY(5px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}
@keyframes hint-finger {
  0% { transform: translateY(8px); opacity: 0; }
  25% { opacity: 1; }
  70% { transform: translateY(-8px); opacity: 1; }
  100% { transform: translateY(-12px); opacity: 0; }
}
.motion .scroll-hint { opacity: 0; }
.motion .scroll-hint.is-live:not(.is-gone) { opacity: 1; }
.scroll-hint.is-gone { opacity: 0; visibility: hidden; transition: opacity 240ms var(--ease-out), visibility 0s linear 240ms; }
@media (prefers-reduced-motion: reduce) { .scroll-hint .hint-wheel, .scroll-hint .hint-finger { animation: none !important; } }
html.a11y-still .hint-wheel, html.a11y-still .hint-finger { animation: none !important; }
@media (max-height: 640px) { .scroll-hint { display: none; } }
html.consent-open .scroll-hint { display: none; } /* it would sit under the banner; it comes back once the banner is answered */

/* ---------- WhatsApp waves: two thin rings leave the button's edge one after the other, then a pause (3.2s cycle) ----------
   js/ui.js sizes them per button so every side travels the same distance. The header button runs on the beat,
   the hero, floating and closing buttons half a cycle later, so the header and the floating button never pulse together. */
.has-waves { position: relative; }
.has-waves::after,
.has-waves .wave {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  border: 1px solid rgb(255 120 108 / 0.85);
  opacity: 0;
  animation: wa-wave 3200ms infinite;
}
.has-waves .wave { animation-delay: 420ms; }
.hero-ctas .has-waves::after, .close-cta.has-waves::after, .float-wa.has-waves::after { animation-delay: 1600ms; }
.hero-ctas .has-waves .wave, .close-cta.has-waves .wave, .float-wa.has-waves .wave { animation-delay: 2020ms; }
@keyframes wa-wave {
  0% { opacity: 0.9; transform: scale(1); animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1); }
  55% { opacity: 0; transform: scale(var(--wave-sx, 1.15), var(--wave-sy, 1.6)); }
  100% { opacity: 0; transform: scale(var(--wave-sx, 1.15), var(--wave-sy, 1.6)); }
}
@media (prefers-reduced-motion: reduce) {
  .has-waves::after, .has-waves .wave { content: none; display: none; animation: none !important; }
}
html.a11y-still .has-waves::after, html.a11y-still .has-waves .wave { content: none; display: none; animation: none !important; }
.has-waves.is-off::after, .has-waves.is-off .wave { animation-play-state: paused; } /* off screen: the loop rests */

/* ---------- Floating controls ---------- */
.floats { position: fixed; inset-inline: 0; inset-block-end: calc(16px + var(--consent-h, 0px)); z-index: 55; /* above the cookie banner, so the accessibility menu always opens */ pointer-events: none; transition: inset-block-end 300ms var(--ease-out); }
.float {
  position: absolute; inset-block-end: 0; pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-inline-size: 54px; block-size: 54px; padding-inline: 20px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 0.9375rem; text-decoration: none; border: 0; cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 240ms var(--ease-out);
}
.float:active { transform: scale(0.96); }
.float .icon { inline-size: 1.5rem; block-size: 1.5rem; }
/* The WhatsApp and accessibility buttons share one look (Daniel, 18.11.2026): glossy red pill, red glow, label.
   Their waves run half a cycle apart (the accessibility button on the beat, WhatsApp 1600ms later), so they never pulse together. */
.float-wa,
.float-a11y {
  color: var(--white);
  background: linear-gradient(180deg, #E61E29 0%, #C8101A 50%, #9C0A12 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.36), 0 0 0 1px rgb(255 92 80 / 0.45), 0 12px 30px -8px rgb(245 34 45 / 0.85), 0 0 50px -10px rgb(245 34 45 / 0.6);
}
.float-wa {
  inset-inline-end: 16px;
  transition: transform 300ms var(--ease-out), opacity 250ms ease, box-shadow 240ms var(--ease-out);
}
.float-wa.is-waiting { opacity: 0; transform: translateY(12px) scale(0.96); pointer-events: none; }
/* Smaller than WhatsApp (Daniel, 18.11.2026): a 46px circle, icon only. Still above the 44px touch minimum. */
.float-a11y { inset-inline-start: 16px; inline-size: 46px; min-inline-size: 46px; block-size: 46px; padding: 0; }
.float-a11y .icon { inline-size: 1.3rem; block-size: 1.3rem; }
.float:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .float-wa:hover,
  .float-a11y:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.42), 0 0 0 1px rgb(255 120 108 / 0.7), 0 14px 34px -8px rgb(245 34 45 / 0.95), 0 0 70px -6px rgb(245 34 45 / 0.7); }
}
@media (max-width: 600px) { .float-label { display: none; } .float-wa { inline-size: 54px; padding: 0; } }

/* On phones the accessibility button steps aside with the header while you read on, and comes back with it.
   The floating WhatsApp button does the opposite (js/ui.js): it is there while the header is away. */
@media (max-width: 760px) {
  .float-a11y { transition: transform 260ms var(--ease-out), opacity 200ms ease, box-shadow 240ms var(--ease-out); }
  html.chrome-away .floats:not(:focus-within):not(:has(.a11y-panel:not([hidden]))) .float-a11y {
    transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none; transition-duration: 300ms, 180ms, 160ms;
  }
}

/* Keyboard focus never lands under the fixed parts. */
html { scroll-padding-block-start: 96px; scroll-padding-block-end: calc(84px + var(--consent-h, 0px)); }

.a11y-panel {
  position: absolute; inset-inline-start: 16px; inset-block-end: 58px; pointer-events: auto;
  inline-size: min(330px, calc(100vw - 32px)); padding: 18px;
  max-block-size: calc(100dvh - 96px - var(--consent-h, 0px)); overflow-y: auto;
  background: linear-gradient(180deg, #121215, #09090B); color: var(--ink);
  border-radius: 22px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 0 0 1px rgb(255 255 255 / 0.1), 0 24px 60px -16px rgb(0 0 0 / 0.9), 0 20px 60px -30px rgb(245 34 45 / 0.5);
}
.a11y-panel h2 { font-weight: 700; font-size: 1.0625rem; line-height: 1.3; margin-block-end: 14px; }
.a11y-panel h2:focus { outline: none; }
.a11y-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-opt {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  min-block-size: 78px; padding: 12px; cursor: pointer;
  background: #0D0D10; color: var(--ink); border: 0; border-radius: 14px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
  font-size: 0.875rem; font-weight: 600; text-align: start;
  transition: box-shadow 200ms ease, background-color 200ms ease, color 200ms ease;
}
.a11y-opt .icon { inline-size: 1.25rem; block-size: 1.25rem; }
.a11y-opt .a11y-on { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; inline-size: 1rem; block-size: 1rem; opacity: 0; }
.a11y-opt[aria-pressed='true'] { background: linear-gradient(180deg, #D3121C, #9A0A12); color: var(--white); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 0 0 1px rgb(255 92 80 / 0.5); }
.a11y-opt[aria-pressed='true'] .a11y-on { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .a11y-opt:not([aria-pressed='true']):hover { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.4); } }
.a11y-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block-start: 14px; font-size: 0.875rem; }
.a11y-reset {
  background: none; border: 0; padding: 0; min-block-size: 44px; cursor: pointer; color: var(--ink); font-size: 0.875rem;
  text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.4); text-underline-offset: 0.22em;
}
.a11y-foot a { display: inline-flex; align-items: center; min-block-size: 44px; color: var(--ink); text-decoration-color: rgb(255 255 255 / 0.4); }

/* ---------- Consent banner (non-modal) ---------- */
.consent {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 50;
  max-block-size: calc(100dvh - 16px); overflow-y: auto;
  background: rgb(8 8 10 / 0.98); color: var(--ink); border-block-start: 1px solid rgb(255 255 255 / 0.1);
  box-shadow: 0 -24px 60px -24px rgb(0 0 0 / 0.9), 0 -1px 0 rgb(255 74 61 / 0.25);
}
.consent-inner { display: grid; grid-template-columns: 1fr auto; gap: 14px 32px; align-items: center; padding-block: 18px; }
.consent-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.consent p { font-size: 0.875rem; color: var(--ink-2); margin-block-start: 4px; max-inline-size: 54ch; line-height: 1.55; }
.consent p a { color: var(--ink); }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.consent-actions .btn { min-inline-size: 8.5rem; padding-inline: 16px; font-size: 0.9375rem; min-block-size: 44px; }
@media (max-width: 860px) {
  .consent-inner { grid-template-columns: 1fr; padding-block: 14px 16px; }
  .consent-actions .btn { flex: 1 1 0; min-inline-size: 0; }
}
/* Small phones: a compact banner, so it never covers the hero's buttons. Three equal buttons on one row. */
@media (max-width: 420px) {
  .consent-inner { gap: 10px; padding-block: 12px 14px; }
  .consent-title { font-size: 0.9375rem; }
  .consent p { font-size: 0.8125rem; line-height: 1.5; }
  .consent-actions { gap: 6px; }
  .consent-actions .btn { padding-inline: 6px; font-size: 0.8125rem; }
}

.consent-dialog {
  inline-size: min(560px, calc(100vw - 32px)); max-block-size: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 24px;
  background: linear-gradient(180deg, #121215, #09090B); color: var(--ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 0 0 1px rgb(255 255 255 / 0.12), 0 40px 100px -30px rgb(245 34 45 / 0.45);
}
.consent-dialog::backdrop { background: rgb(0 0 0 / 0.76); }
.consent-dialog[open] { animation: dialog-in 240ms var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.97); } }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; border-block-end: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.5rem; line-height: 1.2; }
.dialog-head h2:focus { outline: none; }
.dialog-close {
  inline-size: 44px; block-size: 44px; display: grid; place-items: center; cursor: pointer; flex: none;
  background: rgb(255 255 255 / 0.05); color: var(--ink); border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
}
@media (hover: hover) and (pointer: fine) { .dialog-close:hover { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.5); } }
.consent-cats { padding: 8px 24px; }
.consent-cat { padding-block: 16px; }
.consent-cat + .consent-cat { border-block-start: 1px solid var(--line); }
.consent-cat-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.consent-cat-name { font-weight: 700; }
.consent-cat-desc { color: var(--ink-2); font-size: 0.875rem; margin-block-start: 4px; line-height: 1.55; }
/* Switch: a pill. The 2px grey outline keeps the off state above 3:1 (1.4.11). */
.consent-cat input[type='checkbox'] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; cursor: pointer;
  inline-size: 52px; block-size: 30px; border-radius: var(--r-pill);
  background: #0D0D10; border: 2px solid #8A8F97;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.consent-cat input[type='checkbox']::after {
  content: ''; position: absolute; inset-block-start: 3px; inset-inline-start: 3px;
  inline-size: 20px; block-size: 20px; background: #8A8F97; border-radius: 50%;
  transition: transform 200ms var(--ease-out), background-color 200ms ease;
}
.consent-cat input[type='checkbox']:checked { background: var(--red-body); border-color: var(--red-hot); }
.consent-cat input[type='checkbox']:checked::after { background: var(--white); transform: translateX(-22px); } /* RTL: inline-end is -x */
.consent-cat input[type='checkbox']:disabled { opacity: 0.6; cursor: not-allowed; }
.consent-cat input[type='checkbox']:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.consent-dialog .consent-actions { padding: 16px 24px 24px; border-block-start: 1px solid var(--line); }
.consent-dialog .consent-actions .btn { flex: 1 1 0; min-inline-size: 0; }

/* ---------- Accessibility modes (set by the panel; applied before first paint by js/boot.js) ---------- */
html.a11y-large { font-size: 125%; }
html.a11y-links a:not(.btn):not(.float),
html.a11y-links .footer-links button,
html.a11y-links .a11y-reset {
  text-decoration: underline 2px; text-underline-offset: 0.25em;
  background: #2A2A00; color: #FFFF00 !important;
}
html.a11y-contrast {
  --ink-2: #FFFFFF;
  --ink-3: #E6E6E6;
  --line: rgb(255 255 255 / 0.5);
  --line-2: rgb(255 255 255 / 0.85);
}
html.a11y-contrast body { background: #000000; }
html.a11y-contrast .silver, html.a11y-contrast .h2 .l2, html.a11y-contrast .hero-title .ln-in, html.a11y-contrast .close-title .ln-in, html.a11y-contrast .dash-brand span { background: none; color: #FFFFFF; -webkit-text-fill-color: #FFFFFF; }
html.a11y-contrast .lit { background: none; color: #FFFF00; -webkit-text-fill-color: #FFFF00; filter: none; }
html.a11y-contrast a:not(.btn):not(.float) { color: #FFFF00; text-decoration: underline; }
html.a11y-contrast .btn, html.a11y-contrast .float { box-shadow: none; outline: 2px solid #FFFFFF; outline-offset: 0; }
html.a11y-contrast .btn-red, html.a11y-contrast .float-wa, html.a11y-contrast .float-a11y { background: #A00B13; }
html.a11y-contrast .btn::before { display: none; }
html.a11y-contrast dialog { border: 2px solid #FFFFFF; }
html.a11y-contrast .work-frame img { filter: none; }
/* Windows high contrast and other forced colours: the shapes are drawn with shadows, so give every control a real edge. */
@media (forced-colors: active) {
  .btn, .float, .a11y-opt, .dialog-close, .work-frame, .qa-ic, .pill, .mini, .state { border: 1px solid CanvasText; }
  .frame, .card { outline: 1px solid CanvasText; }
  .silver, .lit, .h2 .l2, .hero-title .ln-in, .close-title .ln-in, .dash-brand span { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; filter: none; }
  .aura, .aura-anchor, .tiles, .grain, .frame-dots { display: none; }
}
/* Stop animations: every loop and keyframe ends at once, things that travel stop travelling. Short colour, opacity
   and press feedback stays, so a state change still reads (the posts' colour, the FAQ, the demo's status). */
html.a11y-still *, html.a11y-still *::before, html.a11y-still *::after {
  animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important;
}
html.a11y-still .site-header, html.a11y-still .floats, html.a11y-still .float, html.a11y-still .skip { transition: none !important; }
