/**
 * @file
 * accessibility-widget.css
 *
 * Styles for the Accessibility Widget module.
 * Matches the Vachana Investments style:
 *   - Dark navy (#1a3c6e) header & buttons
 *   - Slide-in panel from right edge
 *   - Outlined option buttons that fill on active/hover
 */

/* =============================================================================
   CSS Custom Properties
   ============================================================================= */
:root {
  --acc-primary:       #1a3c6e;
  --acc-primary-hover: #22509e;
  --acc-border:        #c8d6ea;
  --acc-bg:            #ffffff;
  --acc-text:          #1a3c6e;
  --acc-radius:        6px;
  --acc-shadow:        -6px 0 32px rgba(0, 0, 0, 0.18);
  --acc-panel-width:   285px;
  --acc-transition:    0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   Floating Trigger Tab
   ============================================================================= */
.acc-trigger-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 99998;
  background: #5b2067;
  color: #fff;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 18px 10px;
  border-radius: 8px 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: none;
  box-shadow: -3px 0 14px rgba(0, 0, 0, 0.18);
  font-family: 'Segoe UI', Arial, sans-serif;
  user-select: none;
  transition: background 0.2s ease;
  outline: none;
}

.acc-trigger-tab:hover,
.acc-trigger-tab:focus-visible {
  background: #e99b21;
}

.acc-trigger-tab:focus-visible {
  outline: 3px solid #e99b21;
  outline-offset: 2px;
}

.acc-trigger-tab svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  flex-shrink: 0;
}

.acc-tab-label {
  transform: rotate(180deg);
  display: block;
}

/* =============================================================================
   Slide-in Panel
   ============================================================================= */
.acc-panel {
  position: fixed;
  right: calc(-1 * var(--acc-panel-width) - 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 99999;
  width: var(--acc-panel-width);
  background: var(--acc-bg);
  border-radius: 10px 0 0 10px;
  box-shadow: var(--acc-shadow);
  transition: right var(--acc-transition);
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.acc-panel.acc-open {
  right: 0;
}

/* =============================================================================
   Panel Header
   ============================================================================= */
.acc-panel-header {
  background: #5b2067;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.acc-panel-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.acc-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 3px;
  border-radius: 4px;
  font-family: inherit;
  transition: background 0.15s;
  outline: none;
}

.acc-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.acc-close-btn:focus-visible {
  outline: 3px solid #e99b21;
  outline-offset: 2px;
}

/* =============================================================================
   Panel Body (scrollable button list)
   ============================================================================= */
.acc-panel-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

/* =============================================================================
   Option Buttons
   ============================================================================= */
.acc-opt-btn {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--acc-border);
  border-radius: var(--acc-radius);
  background: var(--acc-bg);
  color: #333333;;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.1s;
  font-family: 'Segoe UI', Arial, sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
  outline: none;
  line-height: 1.2;
}

.acc-opt-btn:hover {
  border-color: #5b2067;
  background: #eef3fc;
}

.acc-opt-btn:active {
  transform: scale(0.98);
}

.acc-opt-btn:focus-visible {
  outline: 3px solid #e99b21;
  outline-offset: 2px;
}

/* Active / toggled on */
.acc-opt-btn.acc-active {
  background: #5b2067;
  color: #fff;
  border-color: #5b2067;
}

.acc-opt-btn.acc-active:hover {
  background: #e99b21;
  border-color: #e99b21;
}

/* Disabled (at font size limits) */
.acc-opt-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none !important;
}

/* Reset button */
.acc-reset-btn {
  background: #5b2067;;
  color: #fff;
  border-color: var(--acc-primary);
  justify-content: center;
  font-size: 15px;
  margin-top: 4px;
}

.acc-reset-btn:hover {
  background: #5b2067;;
  border-color: #5b2067;
}

/* Icon column */
.acc-ico {
  font-size: 15px;
  font-weight: 800;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.acc-ico-sm {
  font-size: 12px;
}

/* Size percentage readout */
.acc-size-readout {
  font-size: 11px;
  color: #888;
  text-align: center;
  font-weight: 500;
  margin-top: -2px;
  transition: color 0.2s;
}

.acc-size-readout.acc-changed {
  color: var(--acc-primary);
  font-weight: 700;
}

/* =============================================================================
   Body-level Accessibility Classes
   ============================================================================= */

/* Grayscale — whole page goes grey EXCEPT the accessibility widget */
body.acc-grayscale {
  filter: grayscale(100%) !important;
}

/* Widget must stay fully visible so user can toggle grayscale OFF */
body.acc-grayscale #acc-trigger-tab,
body.acc-grayscale #acc-panel {
  filter: none !important;
  -webkit-filter: none !important;
}

/* High Contrast */
body.acc-high-contrast {
  background: #000 !important;
  color: #ff0 !important;
}

body.acc-high-contrast *:not(.acc-panel):not(.acc-panel *):not(.acc-trigger-tab):not(.acc-trigger-tab *) {
  background: #000 !important;
  color: #ff0 !important;
  border-color: #ff0 !important;
}

body.acc-high-contrast a:not(.acc-panel a) {
  color: #0ff !important;
}

body.acc-high-contrast img {
  filter: contrast(1.4) brightness(1.1) !important;
}

/* Negative Contrast — whole page inverts EXCEPT the accessibility widget */
body.acc-negative {
  filter: invert(100%) hue-rotate(180deg) !important;
}

body.acc-negative img,
body.acc-negative video {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Widget stays normal so user can toggle negative contrast OFF */
body.acc-negative #acc-trigger-tab,
body.acc-negative #acc-panel {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Underline Links */
body.acc-underline-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

/* Readable Font */
body.acc-readable-font,
body.acc-readable-font p,
body.acc-readable-font li,
body.acc-readable-font span,
body.acc-readable-font div,
body.acc-readable-font td,
body.acc-readable-font th,
body.acc-readable-font h1,
body.acc-readable-font h2,
body.acc-readable-font h3,
body.acc-readable-font h4,
body.acc-readable-font h5,
body.acc-readable-font h6 {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.12em !important;
  line-height: 1.75 !important;
}

/* Reduce Motion */
body.acc-reduce-motion *,
body.acc-reduce-motion *::before,
body.acc-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* =============================================================================
   Responsive — on very small screens shrink the tab
   ============================================================================= */
@media (max-width: 480px) {
  .acc-trigger-tab {
    padding: 14px 8px;
    font-size: 11px;
  }

  .acc-panel {
    width: 260px;
  }
}
