/* --- Dynamic Font Sizing via Slider (0% - 100%) --- */
:root {
  --access-font-scale: 1;
}

body.access-scaling {
  font-size: calc(1rem * var(--access-font-scale)) !important;
}

body.access-scaling a,
body.access-scaling button:not(.access-widget-container button),
body.access-scaling label,
body.access-scaling li,
body.access-scaling p,
body.access-scaling span:not(.access-widget-container span):not(.access-toggle-text):not(.access-slider-badge):not(.access-slider-label-min):not(.access-slider-label-max),
body.access-scaling td,
body.access-scaling th {
  font-size: calc(1em * var(--access-font-scale)) !important;
}

body.access-scaling h1 { font-size: calc(2.25rem * var(--access-font-scale)) !important; }
body.access-scaling h2 { font-size: calc(1.75rem * var(--access-font-scale)) !important; }
body.access-scaling h3 { font-size: calc(1.4rem * var(--access-font-scale)) !important; }
body.access-scaling h4 { font-size: calc(1.2rem * var(--access-font-scale)) !important; }
body.access-scaling h5 { font-size: calc(1.05rem * var(--access-font-scale)) !important; }
body.access-scaling h6 { font-size: calc(0.95rem * var(--access-font-scale)) !important; }

/* Preset Classes */
body.access-text-lg {
  font-size: 1.15rem !important;
}
body.access-text-lg a,
body.access-text-lg button:not(.access-widget-container button),
body.access-text-lg label,
body.access-text-lg li,
body.access-text-lg p,
body.access-text-lg span,
body.access-text-lg td,
body.access-text-lg th {
  font-size: 1.15em !important;
}

body.access-text-xl {
  font-size: 1.3rem !important;
}
body.access-text-xl a,
body.access-text-xl button:not(.access-widget-container button),
body.access-text-xl label,
body.access-text-xl li,
body.access-text-xl p,
body.access-text-xl span,
body.access-text-xl td,
body.access-text-xl th {
  font-size: 1.3em !important;
}

/* --- High Contrast (Kuning di atas Hitam WCAG) --- */
body.access-contrast-high {
  background-color: #000 !important;
  background-image: none !important;
  color: #ff0 !important;
}

/* Explicitly protect Widget Container & Panel */
body.access-contrast-high .access-widget-container,
html.access-contrast-high .access-widget-container,
body.access-contrast-inverted .access-widget-container,
html.access-contrast-inverted .access-widget-container {
  z-index: 2147483647 !important;
}

body.access-contrast-high .access-trigger-btn,
html.access-contrast-high .access-trigger-btn {
  background: #ff0 !important;
  color: #000 !important;
  border: 3px solid #000 !important;
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.9) !important;
}

body.access-contrast-high .access-panel {
  background: #0f172a !important;
  color: #fff !important;
  border: 2px solid #ff0 !important;
}

body.access-contrast-high .access-widget-container * {
  border-color: revert;
}

/* CRITICAL: Prevent transparent full-screen overlays, loaders & shadow hosts from becoming opaque black */
#loader:not(.show),
body.access-contrast-high #loader,
body.access-contrast-high #loader:not(.show) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  background-color: transparent !important;
  z-index: -1 !important;
}

body.access-contrast-high [id*="host"],
body.access-contrast-high [id*="shadow"],
body.access-contrast-high [id*="loader"],
body.access-contrast-high [class*="overlay"],
body.access-contrast-high [class*="backdrop"],
body.access-contrast-high [class*="fullscreen"],
body.access-contrast-high .access-reading-ruler,
body.access-contrast-high .access-adhd-mask {
  background-color: transparent !important;
  border-color: transparent !important;
}

/* Prevent dark hero/slider image overlays from dimming contrast */
body.access-contrast-high .site-wrap:before,
body.access-contrast-high .intro-section:before,
body.access-contrast-high .site-blocks-cover:before,
body.access-contrast-high [class*="cover"]:before,
body.access-contrast-high [class*="hero"]:before,
body.access-contrast-high [class*="overlay"]:before,
body.access-contrast-high [class*="overlay"]:after {
  background: transparent !important;
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* CRITICAL: Force AOS (Animate on Scroll) elements to be visible immediately */
body.access-contrast-high [data-aos],
html.access-contrast-high [data-aos] {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
  transition: none !important;
}

/* Structural & container elements */
body.access-contrast-high header,
body.access-contrast-high footer,
body.access-contrast-high nav,
body.access-contrast-high main,
body.access-contrast-high section,
body.access-contrast-high article,
body.access-contrast-high aside,
body.access-contrast-high table,
body.access-contrast-high tr,
body.access-contrast-high th,
body.access-contrast-high td,
body.access-contrast-high ul,
body.access-contrast-high ol,
body.access-contrast-high .card,
body.access-contrast-high div:not(.access-widget-container):not(.access-widget-container *):not([id*="host"]):not([id*="shadow"]):not([id*="loader"]):not(.access-reading-ruler):not(.access-adhd-mask):not([class*="overlay"]):not([class*="backdrop"]):not([class*="fullscreen"]) {
  background-color: #000 !important;
  background-image: none !important;
  border-color: #ff0 !important;
  box-shadow: none !important;
  color: #ff0 !important;
}

/* Text elements - ensure transparent bg so they never block content */
body.access-contrast-high p,
body.access-contrast-high span,
body.access-contrast-high h1,
body.access-contrast-high h2,
body.access-contrast-high h3,
body.access-contrast-high h4,
body.access-contrast-high h5,
body.access-contrast-high h6,
body.access-contrast-high li,
body.access-contrast-high label,
body.access-contrast-high b,
body.access-contrast-high strong,
body.access-contrast-high em,
body.access-contrast-high small,
body.access-contrast-high blockquote,
body.access-contrast-high .text-black,
body.access-contrast-high .text-dark,
body.access-contrast-high .text-muted,
body.access-contrast-high [class*="text-black"],
body.access-contrast-high [class*="text-dark"] {
  color: #ff0 !important;
  background-color: transparent !important;
}

/* Links & Navigation */
body.access-contrast-high a:not(.access-widget-container *),
body.access-contrast-high .site-navbar a,
body.access-contrast-high .site-navbar .nav-link,
body.access-contrast-high .sticky-wrapper .site-navbar a,
body.access-contrast-high .sticky-wrapper.is-sticky .site-navbar a {
  color: #0ff !important;
  text-decoration: underline !important;
  background-color: transparent !important;
}

/* Icons */
body.access-contrast-high i,
body.access-contrast-high [class*="icon-"],
body.access-contrast-high svg:not(.access-widget-container svg) {
  color: #ff0 !important;
  fill: #ff0 !important;
}

/* Buttons */
body.access-contrast-high button:not(.access-widget-container *) {
  background-color: #000 !important;
  color: #ff0 !important;
  border: 2px solid #ff0 !important;
}

/* Form inputs */
body.access-contrast-high input:not(.access-widget-container *),
body.access-contrast-high textarea:not(.access-widget-container *),
body.access-contrast-high select:not(.access-widget-container *) {
  background-color: #000 !important;
  color: #ff0 !important;
  border: 2px solid #ff0 !important;
}

/* SVG icons */
body.access-contrast-high svg:not(.access-widget-container svg) {
  color: #ff0 !important;
}
body.access-contrast-high svg:not(.access-widget-container svg) path,
body.access-contrast-high svg:not(.access-widget-container svg) circle,
body.access-contrast-high svg:not(.access-widget-container svg) rect {
  stroke: #ff0 !important;
}

/* --- Monochrome & Inverted --- */
/* Apply to html so position:fixed elements on body are NOT displaced */
html.access-monochrome {
  filter: grayscale(100%) !important;
}

html.access-contrast-inverted {
  background-color: #000 !important;
  filter: invert(1) hue-rotate(180deg) !important;
}
html.access-contrast-inverted iframe,
html.access-contrast-inverted img,
html.access-contrast-inverted video {
  filter: invert(1) hue-rotate(180deg) !important;
}
/* Counter-invert widget container so its colors remain natural and visible */
html.access-contrast-inverted .access-widget-container {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* --- Text & Line Spacing --- */
body.access-spacing-md :not(.access-widget-container *) {
  letter-spacing: 0.12em !important;
  line-height: 1.8 !important;
}
body.access-spacing-lg :not(.access-widget-container *) {
  letter-spacing: 0.24em !important;
  line-height: 2.2 !important;
}

/* --- Dyslexia Font --- */
body.access-dyslexic :not(.access-widget-container *):not(i):not(.fa) {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

/* --- Highlight Links --- */
body.access-links a:not(.access-widget-container *) {
  background-color: #f59e0b26 !important;
  color: #000 !important;
  font-weight: 700 !important;
  outline: 3px solid #f59e0b !important;
  text-decoration: underline !important;
}
body.access-contrast-high.access-links a:not(.access-widget-container *) {
  background-color: #000 !important;
  color: #0ff !important;
  outline: 3px solid #f0f !important;
}

/* --- Highlight Headings --- */
body.access-headings h1,
body.access-headings h2,
body.access-headings h3,
body.access-headings h4,
body.access-headings h5,
body.access-headings h6 {
  background-color: #10b98114 !important;
  border-radius: 4px !important;
  outline: 2px dashed #10b981 !important;
  padding: 2px 4px !important;
}

/* --- Large Cursor --- */
body.access-cursor-lg,
body.access-cursor-lg * {
  cursor: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath stroke='%23fff' stroke-width='1.5' d='M4.5 3v15.25l4.5-4.5h6.25z'/%3E%3C/svg%3E"), auto !important;
}

/* --- Stop Animations --- */
body.access-stop-animations *,
body.access-stop-animations :after,
body.access-stop-animations :before {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
}

/* ==========================================================================
   Widget UI Components
   ========================================================================== */

.access-widget-container {
  bottom: 25px;
  font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  left: 25px;
  position: fixed !important;
  z-index: 2147483647 !important;
}

.access-trigger-btn {
  align-items: center;
  background: linear-gradient(135deg, #b49a68, #967d4e);
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(180, 154, 104, 0.45);
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 1.6rem;
  height: 55px;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 55px;
}
.access-trigger-btn:hover {
  background: linear-gradient(135deg, #ce9835, #b49a68);
  box-shadow: 0 6px 20px rgba(180, 154, 104, 0.65);
  transform: scale(1.1);
}

.access-panel {
  animation: accessSlideUp 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(220, 224, 230, 0.7);
  border-radius: 16px;
  bottom: 65px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  gap: 12px;
  left: 0;
  max-height: calc(100vh - 110px);
  max-width: calc(100vw - 50px);
  overflow: hidden;
  padding: 16px 20px;
  position: absolute;
  transform-origin: bottom left;
  width: 320px;
}

@keyframes accessSlideUp {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.access-panel-header {
  align-items: center;
  border-bottom: 1px solid rgba(220, 224, 230, 0.6);
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  touch-action: none;
}

.access-panel-title {
  align-items: center;
  color: #1e293b;
  display: flex;
  font-size: 1.1rem;
  font-weight: 700;
  gap: 8px;
  margin: 0;
}
.access-panel-title svg,
.text-primary-svg {
  color: #846b3e;
}

.access-close-btn {
  align-items: center;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  font-size: 1.2rem;
  justify-content: center;
  padding: 0;
  transition: color 0.2s;
}
.access-close-btn:hover {
  color: #1e293b;
}

.access-panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  margin-right: -6px;
  padding-right: 6px;
}
.access-panel-body::-webkit-scrollbar {
  width: 6px;
}
.access-panel-body::-webkit-scrollbar-track {
  background: transparent;
}
.access-panel-body::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.2);
  border-radius: 3px;
}
.access-panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 154, 104, 0.5);
}

.access-option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.access-option-label {
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0;
}

.access-btn-row {
  display: flex;
  gap: 8px;
}

.access-btn {
  background: #fff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 10px;
  transition: all 0.2s ease;
}
.access-btn:hover {
  background: #fdfaf4;
  border-color: #d1c2a5;
}
.access-btn.active {
  background: #b49a68;
  border-color: #b49a68;
  box-shadow: 0 2px 8px rgba(180, 154, 104, 0.35);
  color: #fff;
}

.font-size-xs-btns .access-btn {
  font-size: 0.72rem !important;
  padding: 6px 4px !important;
}

/* --- Font Size Slider Component --- */
.access-slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 2px 2px;
}

.access-slider-badge {
  background: rgba(180, 154, 104, 0.14);
  color: #846b3e;
  border: 1px solid rgba(180, 154, 104, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}

.access-slider-label-min,
.access-slider-label-max {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 26px;
}
.access-slider-label-max {
  text-align: right;
}

.access-font-slider {
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 6px;
  flex: 1;
  height: 6px;
  outline: none;
  transition: background 0.2s;
  cursor: pointer;
  margin: 0;
}
.access-font-slider:hover {
  background: #cbd5e1;
}
.access-font-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #b49a68;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(180, 154, 104, 0.45);
  cursor: pointer;
  height: 18px;
  width: 18px;
  transition: transform 0.15s, background 0.15s;
}
.access-font-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  background: #967d4e;
}
.access-font-slider::-moz-range-thumb {
  background: #b49a68;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(180, 154, 104, 0.45);
  cursor: pointer;
  height: 18px;
  width: 18px;
}

.access-toggle-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.access-toggle-card {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  text-align: center;
  transition: all 0.2s ease;
}
.access-toggle-card:hover {
  background: #fdfaf4;
  border-color: #d1c2a5;
}
.access-toggle-card.active {
  background: rgba(180, 154, 104, 0.1);
  border-color: #b49a68;
  box-shadow: 0 2px 8px rgba(180, 154, 104, 0.2);
}

.access-toggle-icon {
  color: #64748b;
  height: 20px;
  transition: color 0.2s;
  width: 20px;
}
.access-toggle-card.active .access-toggle-icon {
  color: #846b3e;
}

.access-toggle-text {
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
}
.access-toggle-card.active .access-toggle-text {
  color: #846b3e;
  font-weight: 700;
}

.access-helper-text {
  color: #846b3e;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 4px 0 0;
}

.access-reset-btn {
  align-items: center;
  background: #ef4444;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
  padding: 10px;
  transition: all 0.2s ease;
  width: 100%;
}
.access-reset-btn:hover {
  background: #dc2626;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* --- Reading Ruler and ADHD Mask Overlays --- */
.access-reading-ruler {
  background-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  height: 4px;
  left: 0;
  pointer-events: none;
  position: fixed;
  transform: translateY(-50%);
  width: 100vw;
  z-index: 9999999;
}

.access-adhd-mask {
  background: transparent;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.35);
  border-top: 2px dashed rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.65);
  height: 120px;
  left: 0;
  pointer-events: none;
  position: fixed;
  transform: translateY(-50%);
  width: 100vw;
  z-index: 9999998;
}
