/* File: src/css/accesscore/toolbar.css
   AccessCore FAB + drawer chrome. Scoped by class names beginning with
   `accesscore-` or `ac-`. Does not affect any other page content. */

/* Offsets are in px, not rem: AccessCore's own text scale (up to 200%) must
   not push the button out of the 16px corner that sheets and sticky action
   bars reserve for it (--af-ac-size + 16px; Q2-05). */
.accesscore-fab {
  position: fixed;
  bottom: 16px;
  inset-inline-start: 16px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  background: #1a202c;
  color: #f7fafc;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.accesscore-fab:hover { background: #2d3748; transform: translateY(-1px); }
.accesscore-fab:focus-visible {
  /* DS focus token: 7.5:1 on the light page, harbor-400 in dark, yellow in
     AccessCore high (was #f6ad55, 1.74:1 on the page; Q2-22). */
  outline: 3px solid var(--af-focus, #0b5f5c);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .accesscore-fab { bottom: 64px; }
}

/* Reserved zone under the footer on phones. Signed-in app pages already clear
   the button (body padding in ds/shell.css); signed-out pages and the focus
   shell (login, legal, /processing-recurring …) end on the footer, whose last
   row can land in the button's corner and could not be scrolled clear of it
   (footer "נגישות" at 430px, Q1-03). The footer's own phone padding
   (--af-sp-5) plus the button and its 16px offset. */
@media (max-width: 767.98px) {
  html[data-shell] body:not([data-authenticated="true"]) .footer,
  html[data-shell="focus"] body .footer {
    padding-block-end: calc(var(--af-sp-5, 20px) + var(--af-ac-size, 48px) + 16px + env(safe-area-inset-bottom, 0px));
  }
}

.accesscore-drawer {
  position: fixed;
  bottom: 88px;
  inset-inline-start: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 128px));
  overflow-y: auto;
  background: #ffffff;
  color: #1a202c;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  z-index: 9998;
  padding: 1rem 1.15rem 1.15rem;
  /* direction comes from the drawer's own dir attribute (toolbar.js follows <html lang>) */
  font-family: 'Assistant', system-ui, sans-serif;
}
.accesscore-drawer:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: -3px;
}

.ac-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.75rem;
}
.ac-drawer-header h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
  /* The drawer is always a light panel: don't inherit the page heading colour,
     which is light under dark theme / AccessCore dark / high (Q2-06). */
  color: #1a202c;
}
.ac-btn-close {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.4rem;
}
.ac-btn-close:focus-visible { outline: 3px solid #667eea; }

.ac-section { margin-block: 0.85rem; }
.ac-section h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #4a5568; /* 7.5:1 on #fff (was #718096, 4.01:1; Q2-06) */
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.ac-slider-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 0.5rem;
  padding-block: 0.4rem;
}
.ac-slider-label { font-size: 0.85rem; color: #2d3748; }
.ac-slider-row input[type="range"] { width: 100%; }
.ac-slider-value {
  font-family: 'Recursive', ui-monospace, monospace;
  font-size: 0.75rem;
  color: #4a5568;
  justify-self: end;
}

.ac-radio-group {
  background: #ffffff; /* not the page's dark fieldset surface (Q2-06) */
  border: 1px solid #e2e8f0;
  padding: 0.6rem 0.75rem 0.75rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ac-radio-group legend {
  font-size: 0.8rem;
  padding-inline: 0.35rem;
  color: #2d3748;
}
.ac-radio-row,
.ac-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #2d3748;
  padding-block: 0.25rem;
  cursor: pointer;
}
.ac-radio-row input,
.ac-toggle-row input { accent-color: #667eea; }

.ac-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.9rem;
  margin-top: 0.6rem;
  border-top: 1px solid #e2e8f0;
}
.ac-btn-reset {
  background: #fed7d7;
  border: 1px solid #f56565;
  color: #742a2a;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.ac-btn-reset:focus-visible { outline: 3px solid #667eea; outline-offset: 2px; }
.ac-drawer-link {
  font-size: 0.8rem;
  color: #4c51bf; /* 6.49:1 on #fff (was #667eea, 3.66:1; Q2-06) */
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ac-drawer-link:hover { text-decoration-thickness: 2px; }
.ac-drawer-link:focus-visible {
  text-decoration: underline;
  outline: 2px solid #667eea;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Respect OS-level reduced motion for the drawer's own transitions. */
@media (prefers-reduced-motion: reduce) {
  .accesscore-fab,
  .accesscore-drawer,
  .accesscore-drawer * {
    transition: none !important;
    animation: none !important;
  }
}

/* Reserved zone, ≥1024 legal pages: the sticky side TOC sits on the inline-
   start side and reached down into the button's corner, so its last link
   ("יצירת קשר") was under the button at 1024x768 (Q1-09). Keep the TOC's
   scroll box above the button (button + 16px offset + 8px gap) from its
   unstuck position at the top of the page (app bar + 2 x --af-sp-7 = 120px);
   it already scrolls (overflow-y: auto in pages/legal.css), so every link
   stays reachable. */
@media (min-width: 1024px) {
  .legal-toc {
    max-height: calc(100dvh - var(--af-appbar-h, 56px) - 2 * var(--af-sp-7, 32px) - var(--af-ac-size, 48px) - 24px);
  }
}
