/* =============================================================
   HZL Microsite — Floating Widgets
   FAB cluster · Quick Links panel · Accessibility · Ask Zincky · TTS
   All fixed-position, z-index 500 (below site header at 1000)
   ============================================================= */

/* ============================================================
   TTS (Read-Aloud) BUTTON — lives in .nav-actions
   ============================================================ */
.tts-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0 0.85rem;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-dark-dim);
  white-space: nowrap;
  flex: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
/* green-play-icon.svg — circle baked in, show as-is */
.tts-toggle__icon {
  width: 22px;
  height: 22px;
  flex: none;
  display: block;
  transition: transform 0.2s var(--ease-out);
}
.tts-toggle:hover {
  border-color: rgba(79, 224, 207, 0.40);
  color: var(--teal-300);
  background: rgba(31, 194, 176, 0.07);
}
.tts-toggle:hover .tts-toggle__icon { transform: scale(1.12); }
.tts-toggle.is-playing {
  border-color: var(--teal-400);
  color: var(--teal-300);
  background: rgba(31, 194, 176, 0.12);
}
.tts-toggle.is-playing .tts-toggle__icon {
  animation: ttsWave 1.1s ease-in-out infinite;
}
@keyframes ttsWave {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(0.84); }
}

/* Hide on ≤900px — same as saver toggle */
@media (max-width: 900px) { .tts-toggle { display: none; } }

/* ============================================================
   RIGHT-EDGE FAB CLUSTER
   ============================================================ */
.fab-cluster {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  pointer-events: none; /* pass clicks through gaps */
}
.fab-cluster > * { pointer-events: auto; }

/* Base circle FAB */
.fab {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #74bf43;
  color: var(--navy-900);
  flex: none;
  box-shadow: -2px 4px 18px rgba(116, 191, 67, 0.45);
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: -2px 6px 26px rgba(116, 191, 67, 0.65);
}
.fab svg { width: 22px; height: 22px; }

/* ============================================================
   QUICK LINKS TRIGGER (left side — fixed above accessibility)
   ============================================================ */
.ql-trigger {
  position: fixed;
  left: 1.25rem;
  bottom: calc(1.25rem + 58px + 0.75rem);
  z-index: 500;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0060a3 0%, #7fb942 100%);
  border: 3px solid #ffffff;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 96, 163, 0.45);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
}
.ql-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 96, 163, 0.65);
}
.ql-trigger[aria-expanded="true"] {
  background: linear-gradient(135deg, #7fb942 0%, #0060a3 100%);
  box-shadow: 0 4px 20px rgba(127, 185, 66, 0.5);
}

/* ============================================================
   QUICK LINKS PANEL (slides in from LEFT)
   ============================================================ */
.ql-scrim {
  position: fixed;
  inset: 0;
  z-index: 510;
  background: rgba(2, 8, 16, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0s linear 0.3s;
}
.ql-scrim.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--ease-out);
}

.ql-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(340px, 86vw);
  z-index: 520;
  background: var(--navy-glass);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.38s var(--ease-out);
  overflow-y: auto;
}
.ql-panel.is-open { transform: translateX(0); }

.ql-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem var(--gutter);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: none;
}
.ql-panel__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
}
.ql-panel__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--on-dark-dim);
  transition: background 0.15s, color 0.15s;
}
.ql-panel__close:hover { background: rgba(255,255,255,0.08); color: var(--paper); }
.ql-panel__close svg { width: 18px; height: 18px; }

.ql-panel__list {
  padding: 1rem var(--gutter) 2.5rem;
  display: flex;
  flex-direction: column;
}
.ql-panel__list li { list-style: none; }
.ql-panel__list a {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.82rem 0.4rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--on-dark-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.15s var(--ease-out), padding-left 0.15s var(--ease-out);
}
.ql-panel__list a::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal-400);
  flex: none;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}
.ql-panel__list a:hover {
  color: var(--teal-300);
  padding-left: 0.75rem;
}
.ql-panel__list a:hover::before { opacity: 1; transform: scale(1.4); }

/* ============================================================
   ACCESSIBILITY WIDGET (bottom-left) — UserWay style
   ============================================================ */
.a11y-widget {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 600;
}

/* Trigger — brand gradient circle with body_bl person icon */
.a11y-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0060a3 0%, #7fb942 100%);
  border: 3px solid #ffffff;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 96, 163, 0.45);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
  overflow: hidden;
}
.a11y-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 96, 163, 0.65);
}
/* body_bl.svg has black paths — invert to white for the gradient bg */
.a11y-trigger__icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  display: block;
}

/* Green ✓ badge — hidden until a feature is active */
.a11y-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #74bf43;
  font-size: 0.65rem;
  font-weight: 900;
  color: white;
  display: grid;
  place-items: center;
  border: 2.5px solid white;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
}
/* tooltips feature: no extra body-class CSS needed — handled in JS */

/* Panel — light background, fixed above trigger */
.a11y-panel {
  position: fixed;
  left: 1.25rem;
  bottom: calc(1.25rem + 60px + 0.75rem);
  width: 316px;
  max-height: calc(100vh - 8rem);
  background: #f3f5f7;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;   /* iOS momentum scroll */
  overscroll-behavior: contain;        /* prevents page scroll bleed */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.22s var(--ease-out),
              transform 0.22s var(--ease-out),
              visibility 0s linear 0.22s;
}
.a11y-panel::-webkit-scrollbar { width: 4px; }
.a11y-panel::-webkit-scrollbar-thumb { background: #c8ced4; border-radius: 2px; }
.a11y-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.22s var(--ease-out),
              transform 0.22s var(--ease-out);
}

/* Mobile: full-width panel anchored to bottom of screen */
@media (max-width: 480px) {
  .a11y-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 82vh;
    border-radius: 20px 20px 0 0;
  }
}

/* Panel header (gradient matching trigger) — sticky so always visible */
.a11y-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #2ea8cc 0%, #1abfae 100%);
  flex: none;
  position: sticky;
  top: 0;
  z-index: 2;
}
.a11y-panel__head-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: #fff;
}
.a11y-panel__head-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.20);
  color: #fff;
  flex: none;
  transition: background 0.15s;
}
.a11y-panel__head-close:hover { background: rgba(0, 0, 0, 0.35); }

/* 2-column tile grid */
.a11y-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

/* Individual feature tile */
.a11y-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 8px 12px;
  background: #ffffff;
  border: 1.5px solid #dde2e8;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.a11y-tile:hover {
  border-color: #3ab4db;
  box-shadow: 0 2px 10px rgba(58, 180, 219, 0.2);
}
/* Active state */
.a11y-tile.is-on {
  border-color: #222;
  background: #f0f0f0;
}
/* Checkmark badge when on */
.a11y-tile.is-on::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 7px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  line-height: 1;
}
.a11y-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}
.a11y-tile__label {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2c3445;
  line-height: 1.3;
}

/* Footer reset button — sticky at bottom */
.a11y-panel__foot {
  padding: 6px 10px 12px;
  position: sticky;
  bottom: 0;
  background: #f3f5f7;
  z-index: 2;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.a11y-panel__reset {
  padding: 0.38rem 1rem;
  border-radius: 999px;
  background: #dde2e8;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: #445;
  cursor: pointer;
  transition: background 0.15s;
}
.a11y-panel__reset:hover { background: #cdd2d8; }

/* ── Accessibility feature body-class effects ──────────────── */

/* Contrast + */
body.a11y-contrast {
  filter: contrast(1.45) brightness(1.05);
}

/* Highlight Links */
body.a11y-links a {
  background: #ffe566 !important;
  color: #000 !important;
  text-decoration: underline !important;
  padding: 0 3px !important;
  border-radius: 2px;
}

/* Bigger Text */
body.a11y-bigtext { font-size: 118%; }

/* Text Spacing */
body.a11y-spacing * {
  letter-spacing: 0.08em !important;
  word-spacing: 0.16em !important;
}

/* Pause Animations (delegates to saver mode — handled in JS) */

/* Hide Images */
body.a11y-hideimg img,
body.a11y-hideimg canvas,
body.a11y-hideimg video,
body.a11y-hideimg .hero__canvas { visibility: hidden !important; }

/* Dyslexia Friendly */
body.a11y-dyslexic,
body.a11y-dyslexic * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
  letter-spacing: 0.05em !important;
}

/* Large cursor */
body.a11y-cursor,
body.a11y-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M8 4l24 14-12 2-6 12z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 8 4, auto !important;
}

/* Line Height */
body.a11y-lineheight p,
body.a11y-lineheight li,
body.a11y-lineheight span,
body.a11y-lineheight div { line-height: 2 !important; }

/* Text Align — left-align for readability */
body.a11y-textalign p,
body.a11y-textalign li,
body.a11y-textalign h1, body.a11y-textalign h2, body.a11y-textalign h3,
body.a11y-textalign h4, body.a11y-textalign h5, body.a11y-textalign h6 {
  text-align: left !important;
}

/* Saturation — grayscale */
body.a11y-saturation { filter: grayscale(1) brightness(1.04); }
body.a11y-contrast.a11y-saturation {
  filter: contrast(1.45) brightness(1.05) grayscale(1);
}

/* Reading Guide bar — created by JS, positioned via mousemove */
.a11y-readguide-bar {
  position: fixed;
  left: 0;
  width: 100%;
  height: 44px;
  background: rgba(255, 225, 60, 0.18);
  border-top: 1.5px solid rgba(190, 160, 0, 0.40);
  border-bottom: 1.5px solid rgba(190, 160, 0, 0.40);
  pointer-events: none;
  z-index: 9000;
  display: none;
}
body.a11y-readguide .a11y-readguide-bar { display: block; }

/* Focus Mode — thick visible focus ring on all interactive elements */
body.a11y-focus :focus,
body.a11y-focus :focus-visible {
  outline: 3px solid #0060a3 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(0, 96, 163, 0.22) !important;
  border-radius: 3px !important;
}

/* ============================================================
   ASK ZINCKY CHATBOT (bottom-right)
   ============================================================ */
.zincky-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

/* FAB trigger */
.zincky-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.1rem 0.55rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--navy-700) 100%);
  color: var(--paper);
  box-shadow: 0 6px 24px rgba(31, 194, 176, 0.40);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
}
.zincky-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(31, 194, 176, 0.55);
}
.zincky-fab__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  flex: none;
  overflow: hidden;
}
.zincky-fab__avatar img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}
.zincky-fab__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Chat window */
.zincky-chat {
  width: min(340px, 92vw);
  background: var(--navy-800);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.25s var(--ease-out),
              transform 0.25s var(--ease-out),
              visibility 0s linear 0.25s;
}
.zincky-chat.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 0.25s var(--ease-out),
              transform 0.25s var(--ease-out);
}

/* Chat header */
.zincky-chat__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--navy-700) 0%, rgba(31,194,176,0.10) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.zincky-chat__avatar-sm {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-400);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--navy-900);
  flex: none;
}
.zincky-chat__meta { flex: 1; min-width: 0; }
.zincky-chat__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--paper);
}
.zincky-chat__status {
  display: block;
  font-size: 0.68rem;
  color: var(--teal-300);
}
.zincky-chat__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--on-dark-dim);
  flex: none;
  transition: background 0.15s, color 0.15s;
}
.zincky-chat__close:hover { background: rgba(255,255,255,0.08); color: var(--paper); }
.zincky-chat__close svg { width: 16px; height: 16px; }

/* Message scroll area */
.zincky-chat__messages {
  height: 260px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.zincky-chat__messages::-webkit-scrollbar { width: 4px; }
.zincky-chat__messages::-webkit-scrollbar-track { background: transparent; }
.zincky-chat__messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 2px; }

/* Message bubbles */
.chat-msg { display: flex; max-width: 90%; }
.chat-msg--bot  { align-self: flex-start; }
.chat-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg__bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--on-dark);
}
.chat-msg--bot  .chat-msg__bubble {
  background: rgba(31, 194, 176, 0.09);
  border: 1px solid rgba(31, 194, 176, 0.17);
  border-bottom-left-radius: 3px;
}
.chat-msg--user .chat-msg__bubble {
  background: var(--teal-500);
  color: white;
  border-bottom-right-radius: 3px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.85rem;
}
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal-400);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.35; }
  30%            { transform: translateY(-5px); opacity: 1;    }
}

/* Input area */
.zincky-chat__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.zincky-chat__input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  color: var(--paper);
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s;
}
.zincky-chat__input:focus { border-color: var(--teal-400); }
.zincky-chat__input::placeholder { color: rgba(238, 242, 246, 0.35); }
.zincky-chat__send {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--teal-500);
  color: white;
  flex: none;
  transition: background 0.15s, transform 0.15s;
}
.zincky-chat__send:hover { background: var(--teal-400); transform: scale(1.08); }
.zincky-chat__send svg { width: 15px; height: 15px; }

/* ============================================================
   HIGH CONTRAST MODE
   ============================================================ */
body.is-high-contrast {
  --navy-900: #000;
  --navy-800: #0d0d0d;
  --navy-700: #111;
  --navy-glass: rgba(0, 0, 0, 0.92);
  --on-dark:     #fff;
  --on-dark-dim: rgba(255, 255, 255, 0.85);
  --teal-400:    #00ffe4;
  --teal-300:    #00ffe4;
  --gold-400:    #ffe066;
  --paper:       #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .fab-cluster { right: 0.6rem; }
  .fab { width: 44px; height: 44px; }
  .fab svg { width: 19px; height: 19px; }

  /* QL trigger: smaller + adjusted bottom to stay above a11y */
  .ql-trigger {
    left: 0.75rem;
    bottom: calc(0.75rem + 46px + 0.6rem);
    width: 46px;
    height: 46px;
    border-width: 2.5px;
  }
  .a11y-widget { left: 0.75rem; bottom: 0.75rem; }
  .a11y-trigger__icon { width: 28px; height: 28px; }

  .zincky-widget { right: 0.75rem; bottom: 0.75rem; }
  .zincky-fab__label { display: none; }
  .zincky-fab { padding: 0.5rem; border-radius: 50%; }
  .zincky-fab__avatar { width: 34px; height: 34px; }
  .zincky-fab__avatar img { width: 34px; height: 34px; }
  .zincky-chat { width: min(310px, 94vw); }
  .zincky-chat__messages { height: 200px; }
}

@media (prefers-reduced-motion: reduce), body.is-saver {
  .zincky-chat, .ql-panel, .a11y-panel { transition: none; }
  .chat-typing span, .tts-toggle__icon { animation: none !important; opacity: 0.8; }
}

/* zincky-widget click pass-through fix: let the container be transparent to
   clicks (its hidden chat reserves layout space) so the in-page "Back to top"
   button beneath it stays clickable; FAB + chat remain interactive. */
.zincky-widget { pointer-events: none; }
.zincky-fab, .zincky-chat { pointer-events: auto; }
