/* ============================================================
   Diskreet Logic — Accessibility System (WCAG 2.2 AA)
   Native accessibility toolbar, panel, feedback launcher,
   skip links, focus system and user-preference state classes.
   No third-party overlays. All UI is self-contained.
   ============================================================ */

:root {
  --a11y-navy: #0a2342;
  --a11y-accent: #00bceb;
  --a11y-ink: #f4f6fb;
  --a11y-line: rgba(255, 255, 255, 0.12);
  --a11y-fs: 1;            /* text-size multiplier (JS-controlled) */
  --a11y-ls: 0em;          /* letter spacing */
  --a11y-ws: normal;       /* word spacing */
  --a11y-lh: normal;       /* line height */
}

/* ---------- Global always-on focus indicator (WCAG 2.4.7 / 2.4.11) ---------- */
:where(a, button, input, select, textarea, summary,
  [tabindex]:not([tabindex="-1"]), [role="button"], [role="tab"], [role="menuitem"]):focus-visible {
  outline: 3px solid #00bceb !important;
  outline-offset: 2px !important;
  border-radius: 5px;
}
/* Distinguish in-content links without relying on colour alone (WCAG 1.4.1) */
/* Links inside running text / fine print are underlined at rest */
main p a:not(.btn):not(.link-arrow),
main li a:not(.btn):not(.link-arrow):not(.ai-slink):not(.mega-link),
.px-fine a, .fine a, .disclaimer a { text-decoration: underline; text-underline-offset: 2px; }
/* All other in-content links gain an underline on hover/focus */
main a:not(.btn):not(.nav-trigger):not(.link-arrow):hover,
main a:not(.btn):not(.nav-trigger):not(.link-arrow):focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Skip links ---------- */
.a11y-skips { position: fixed; top: 0; left: 0; z-index: 100050; }
.a11y-skip {
  position: absolute; top: -200px; left: 8px;
  display: inline-block; padding: 12px 18px; border-radius: 10px;
  background: var(--a11y-navy); color: #fff; font: 600 14px/1 var(--font-body, "Inter", system-ui, sans-serif);
  text-decoration: none; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); white-space: nowrap;
}
.a11y-skip:focus { top: 10px; outline: 3px solid var(--a11y-accent); outline-offset: 2px; }
.a11y-skip + .a11y-skip:focus { top: 58px; }
.a11y-skip + .a11y-skip + .a11y-skip:focus { top: 106px; }
.a11y-skip + .a11y-skip + .a11y-skip + .a11y-skip:focus { top: 154px; }

/* ---------- Floating launchers ---------- */
.a11y-fab, .a11y-fb-fab {
  position: fixed; z-index: 99992; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, rgba(10, 35, 66, 0.86), rgba(10, 35, 66, 0.72));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #fff; transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s, background .3s;
}
.a11y-fab:hover, .a11y-fb-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 20px 52px rgba(0,0,0,.55); }
.a11y-fab:focus-visible, .a11y-fb-fab:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 3px; }

/* Accessibility button — rounded square, desktop bottom-left */
.a11y-fab { left: 24px; bottom: 24px; width: 60px; height: 60px; border-radius: 18px; }
.a11y-fab svg { width: 30px; height: 30px; }
.a11y-fab::after { /* pulse ring */
  content: ""; position: absolute; inset: 0; border-radius: 18px;
  border: 2px solid rgba(0, 188, 235, 0.55); opacity: 0;
}
.a11y-fab.a11y-pulse::after { animation: a11yPulse 1.8s ease-out; }
@keyframes a11yPulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }

/* Feedback button — slim vertical pill, desktop right-center */
.a11y-fb-fab {
  right: 0; top: 50%; transform: translateY(-50%);
  flex-direction: column; gap: 8px; padding: 16px 9px; border-radius: 14px 0 0 14px;
  border-right: none; writing-mode: vertical-rl;
}
.a11y-fb-fab:hover { transform: translateY(-50%) translateX(-3px); }
.a11y-fb-fab svg { width: 20px; height: 20px; }
.a11y-fb-fab .a11y-fb-label { font: 700 12px/1 var(--font-body, "Inter", sans-serif); letter-spacing: .08em; text-transform: uppercase; transform: rotate(180deg); }

@media (max-width: 768px) {
  /* Accessibility → bottom-right (raised above chat widget); Feedback → bottom-left */
  .a11y-fab { left: auto; right: 18px; bottom: 158px; width: 52px; height: 52px; border-radius: 15px; }
  .a11y-fb-fab { top: auto; right: auto; left: 18px; bottom: 22px; transform: none;
    flex-direction: row; writing-mode: horizontal-tb; border-radius: 999px; padding: 11px 16px; border: 1px solid rgba(255,255,255,.16); }
  .a11y-fb-fab:hover { transform: translateY(-3px); }
  .a11y-fb-fab .a11y-fb-label { transform: none; }
}

/* ---------- Panel ---------- */
.a11y-overlay { position: fixed; inset: 0; z-index: 99998; background: rgba(2, 8, 18, 0.5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.a11y-overlay.open { opacity: 1; visibility: visible; }

.a11y-panel {
  position: fixed; z-index: 99999; top: 0; left: 0; height: 100%; width: min(420px, 92vw);
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #0c1120, #0a0e1a);
  border-right: 1px solid var(--a11y-line);
  box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6);
  transform: translateX(-104%); transition: transform .34s cubic-bezier(.22,1,.36,1);
  font-family: var(--font-body, "Inter", system-ui, sans-serif);
}
.a11y-panel.open { transform: none; }
.a11y-panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--a11y-line);
  background: linear-gradient(135deg, rgba(0,188,235,.14), rgba(0,188,235,.04)); }
.a11y-panel-head .a11y-h-ico { width: 40px; height: 40px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--a11y-accent), #1d6fe0); color: #021018; }
.a11y-panel-head .a11y-h-ico svg { width: 22px; height: 22px; }
.a11y-panel-head h2 { margin: 0; font: 700 1.05rem/1.15 var(--font-display, "Space Grotesk", sans-serif); color: var(--a11y-ink); }
.a11y-panel-head p { margin: 2px 0 0; font-size: .76rem; color: #b9c0d4; }
.a11y-close { margin-left: auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--a11y-line);
  background: rgba(255,255,255,.04); color: var(--a11y-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.a11y-close:hover { background: rgba(255,255,255,.1); }
.a11y-close svg { width: 18px; height: 18px; }

.a11y-body { flex: 1; overflow-y: auto; padding: 16px; }
.a11y-group { margin-bottom: 20px; }
.a11y-group > h3 { margin: 0 0 10px; font: 700 .74rem/1 var(--font-body, sans-serif); text-transform: uppercase; letter-spacing: .12em; color: #8b93a7; }
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Toggle tile */
.a11y-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 13px 13px; border-radius: 13px; cursor: pointer;
  background: rgba(255,255,255,.035); border: 1px solid var(--a11y-line); color: var(--a11y-ink);
  font: 600 .84rem/1.2 inherit; transition: background .2s, border-color .2s, transform .15s;
}
.a11y-tile:hover { background: rgba(255,255,255,.07); }
.a11y-tile:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 2px; }
.a11y-tile .a11y-tile-ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,188,235,.12); color: var(--a11y-accent); }
.a11y-tile .a11y-tile-ico svg { width: 18px; height: 18px; }
.a11y-tile[aria-pressed="true"] { background: rgba(0,188,235,.16); border-color: rgba(0,188,235,.55); }
.a11y-tile[aria-pressed="true"] .a11y-tile-ico { background: var(--a11y-accent); color: #021018; }
.a11y-tile-full { grid-column: 1 / -1; flex-direction: row; align-items: center; }

/* Stepper (font size, spacing…) */
.a11y-step { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 13px;
  background: rgba(255,255,255,.035); border: 1px solid var(--a11y-line); }
.a11y-step .a11y-step-label { flex: 1; font: 600 .84rem/1.15 inherit; color: var(--a11y-ink); }
.a11y-step .a11y-step-label small { display: block; color: #8b93a7; font-weight: 500; font-size: .72rem; }
.a11y-step button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--a11y-line); background: rgba(255,255,255,.05);
  color: var(--a11y-ink); font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.a11y-step button:hover { background: rgba(0,188,235,.18); }
.a11y-step button:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 2px; }
.a11y-step .a11y-step-val { min-width: 34px; text-align: center; font-weight: 700; color: var(--a11y-accent); font-variant-numeric: tabular-nums; }

/* Cursor color swatches */
.a11y-swatches { grid-column: 1/-1; display: flex; gap: 8px; align-items: center; padding: 4px 2px; }
.a11y-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); cursor: pointer; }
.a11y-swatch[aria-pressed="true"] { outline: 2px solid var(--a11y-accent); outline-offset: 2px; }

.a11y-reset { width: 100%; margin-top: 4px; padding: 13px; border-radius: 12px; cursor: pointer;
  background: rgba(220, 60, 70, 0.14); border: 1px solid rgba(220,60,70,.4); color: #ff9aa2; font: 700 .9rem/1 inherit; }
.a11y-reset:hover { background: rgba(220,60,70,.24); }
.a11y-reset:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 2px; }

.a11y-panel-foot { padding: 12px 16px; border-top: 1px solid var(--a11y-line); display: flex; gap: 14px; justify-content: center; }
.a11y-panel-foot a { color: var(--a11y-accent); font-size: .8rem; font-weight: 600; text-decoration: none; }
.a11y-panel-foot a:hover { text-decoration: underline; }

/* Visually-hidden live region */
.a11y-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============================================================
   USER-PREFERENCE STATE CLASSES  (applied to <html>/<body>)
   ============================================================ */

/* Text size + spacing (live CSS vars) */
html.a11y-typo body,
html.a11y-typo body :where(p, li, a, span, h1, h2, h3, h4, h5, h6, button, label, input, td, th, blockquote, figcaption, small, strong, em, b) {
  letter-spacing: var(--a11y-ls) !important;
  word-spacing: var(--a11y-ws) !important;
}
html.a11y-lh body :where(p, li, blockquote, .lead, .section-lead, .section-lead) { line-height: var(--a11y-lh) !important; }
html.a11y-fontscale { font-size: calc(100% * var(--a11y-fs)); }

/* Readable / dyslexia fonts */
body.a11y-readable, body.a11y-readable * { font-family: Verdana, Tahoma, "Segoe UI", Arial, sans-serif !important; }
body.a11y-dyslexia, body.a11y-dyslexia * { font-family: "Comic Sans MS", "Trebuchet MS", Verdana, sans-serif !important; letter-spacing: .03em; }

/* Link + heading helpers */
body.a11y-underline a { text-decoration: underline !important; text-underline-offset: 3px; }
body.a11y-hl-links a { background: #ffe600 !important; color: #111 !important; box-shadow: 0 0 0 2px #ffe600; border-radius: 3px; }
body.a11y-hl-links a * { color: #111 !important; }
body.a11y-hl-headings :where(h1,h2,h3,h4,h5,h6) { background: rgba(0,188,235,.16) !important; outline: 1px dashed rgba(0,188,235,.6); border-radius: 4px; }

/* Color / contrast filters (on <html>) */
html.a11y-grayscale { filter: grayscale(1); }
html.a11y-invert { filter: invert(1) hue-rotate(180deg); }
html.a11y-invert.a11y-grayscale { filter: grayscale(1) invert(1) hue-rotate(180deg); }
/* keep the a11y UI legible under invert by re-inverting it */
html.a11y-invert .a11y-ui { filter: invert(1) hue-rotate(180deg); }

body.a11y-contrast { background: #000 !important; }
body.a11y-contrast :where(p,li,span,h1,h2,h3,h4,h5,h6,td,th,label,figcaption,blockquote,strong,em,small,div) { color: #fff !important; }
body.a11y-contrast a, body.a11y-contrast a * { color: #ffe600 !important; }
body.a11y-contrast :where(section,header,footer,article,aside,main,.glass,.card,.value-card,.abc-feat,.solution-card,.industry-card) { background-color: #000 !important; background-image: none !important; }
body.a11y-contrast .bg-video, body.a11y-contrast .bg-molecule, body.a11y-contrast .slide-bg, body.a11y-contrast .feature-media, body.a11y-contrast .air-media { display: none !important; }
body.a11y-contrast :where(.btn-primary) { background: #ffe600 !important; color: #000 !important; }
body.a11y-contrast :where(.btn, .btn-ghost) { border: 2px solid #fff !important; color: #fff !important; }

/* Soft contrast (gentle readability boost) */
body.a11y-soft { filter: contrast(1.06) brightness(1.04); }

/* Light mode — flip the dark theme to a light surface */
body.a11y-light { background: #f4f6fb !important; color: #16202e !important; }
body.a11y-light .bg-video, body.a11y-light .bg-molecule { display: none !important; }
body.a11y-light :where(p,li,span,figcaption,blockquote,small,td,th,label,h1,h2,h3,h4,h5,h6) { color: #16202e !important; }
body.a11y-light :where(section,footer,header,main) { background-color: transparent !important; }
body.a11y-light :where(.glass,.value-card,.abc-feat,.solution-card,.industry-card,.stat-box,.air-plan,.callout,.cta-band) {
  background: #ffffff !important; border-color: rgba(10,35,66,.12) !important; box-shadow: 0 10px 30px rgba(10,35,66,.08) !important; }
body.a11y-light .nav { background: rgba(255,255,255,.9) !important; }
body.a11y-light .gradient-text { -webkit-text-fill-color: #1d6fe0; color: #1d6fe0; }

/* Colour-blind friendly (accessible hue rotation to widen deutan/protan separation) */
body.a11y-cbf { filter: saturate(1.25) hue-rotate(-12deg); }

/* Large cursor + colours (JS sets the SVG data-URI) */
body.a11y-bigcursor, body.a11y-bigcursor * { cursor: var(--a11y-cursor, auto) !important; }

/* Focus system */
body.a11y-focus :where(a, button, input, select, textarea, summary, [tabindex], [role="button"], [role="tab"], .btn):focus-visible {
  outline: 3px solid var(--a11y-accent) !important; outline-offset: 3px !important; border-radius: 4px; box-shadow: 0 0 0 6px rgba(0,188,235,.28) !important;
}
/* Always-on baseline focus ring for keyboard users */
body.a11y-keyboard :where(a, button, input, select, textarea, summary, [tabindex]):focus {
  outline: 3px solid var(--a11y-accent) !important; outline-offset: 3px !important;
}

/* Reading guide + mask */
.a11y-guide { position: fixed; left: 0; right: 0; height: 3px; background: var(--a11y-accent); box-shadow: 0 0 12px 2px rgba(0,188,235,.7);
  z-index: 99990; pointer-events: none; display: none; }
.a11y-mask-top, .a11y-mask-bot { position: fixed; left: 0; right: 0; background: rgba(0,0,0,.72); z-index: 99989; pointer-events: none; display: none; }
.a11y-active-guide .a11y-guide { display: block; }
.a11y-active-mask .a11y-mask-top, .a11y-active-mask .a11y-mask-bot { display: block; }

/* Reduce / pause motion */
html.a11y-reduce *, html.a11y-reduce *::before, html.a11y-reduce *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Success / confirmation animation (feedback page) */
@keyframes a11yPop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes a11yCheck { to { stroke-dashoffset: 0; } }

/* ============================================================
   Feedback page form
   ============================================================ */
.fb-form { padding: 32px; border-radius: 22px; }
.fb-set { border: none; border-top: 1px solid var(--a11y-line); margin: 0; padding: 26px 0 6px; }
.fb-set:first-of-type { border-top: none; padding-top: 6px; }
.fb-set legend { font: 700 1.05rem/1 var(--font-display, "Space Grotesk", sans-serif); color: var(--a11y-ink); padding: 0; margin-bottom: 16px; }
.fb-opt { color: #8b93a7; font-weight: 500; font-size: .82rem; font-family: var(--font-body, sans-serif); }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fb-field { margin-bottom: 16px; }
.fb-field label, .fb-label { display: block; margin-bottom: 7px; color: var(--a11y-ink); font-weight: 600; font-size: .92rem; }
.fb-form input[type="text"], .fb-form input[type="email"], .fb-form select, .fb-form textarea {
  width: 100%; padding: 13px 15px; border-radius: 12px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14); color: var(--a11y-ink); font: inherit; font-size: .95rem;
}
.fb-form textarea { resize: vertical; min-height: 96px; }
.fb-form input:focus, .fb-form select:focus, .fb-form textarea:focus {
  outline: none; border-color: var(--a11y-accent); box-shadow: 0 0 0 3px rgba(0,188,235,.2);
}
.fb-form input::placeholder, .fb-form textarea::placeholder { color: #8b93a7; }

/* checkboxes / radios as chips */
.fb-checks, .fb-radios { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-check, .fb-radio { display: inline-flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--a11y-line); color: var(--a11y-ink); font-size: .9rem; cursor: pointer; }
.fb-check:hover, .fb-radio:hover { background: rgba(255,255,255,.08); }
.fb-check input, .fb-radio input { width: 17px; height: 17px; accent-color: var(--a11y-accent); cursor: pointer; }
.fb-check:focus-within, .fb-radio:focus-within { border-color: var(--a11y-accent); box-shadow: 0 0 0 3px rgba(0,188,235,.2); }
.fb-consent { width: 100%; margin-top: 18px; align-items: flex-start; }
.fb-consent span { flex: 1; }
.fb-req { color: #ff6a8a; }
.fb-error { color: #ff9aa2; font-size: .88rem; margin: 10px 0 0; }

/* star rating */
.fb-stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.fb-stars input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fb-stars label { font-size: 2rem; line-height: 1; color: rgba(255,255,255,.22); cursor: pointer; transition: color .15s, transform .15s; }
.fb-stars label:hover, .fb-stars label:hover ~ label,
.fb-stars input:checked ~ label { color: #ffc83d; }
.fb-stars label:hover { transform: scale(1.15); }
.fb-stars input:focus-visible + label { outline: 3px solid var(--a11y-accent); outline-offset: 3px; border-radius: 6px; }

.fb-actions { display: flex; align-items: center; gap: 16px; margin-top: 26px; flex-wrap: wrap; }
.fb-req-note { color: #8b93a7; font-size: .85rem; }

/* success */
.fb-success { margin: 20px 0; }
.fb-success-card { text-align: center; padding: 48px 32px; border-radius: 22px; animation: a11yPop .5s cubic-bezier(.22,1,.36,1) both; }
.fb-success-card h2 { font-family: var(--font-display, "Space Grotesk", sans-serif); font-size: 1.8rem; color: var(--a11y-ink); margin: 18px 0 10px; }
.fb-success-card p { color: #b9c0d4; max-width: 460px; margin: 0 auto 24px; line-height: 1.6; }
.fb-check-anim svg { width: 88px; height: 88px; }
.fb-check-anim path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: a11yCheck .5s .35s ease forwards; }

@media (max-width: 640px) {
  .fb-row { grid-template-columns: 1fr; }
  .fb-form { padding: 22px; }
}
