/* Accessibility Features - User-Controlled Options */
/* These classes are applied when users activate accessibility features */

/* Font Size Adjustments - Only affect main content, not header/nav */
.font-size-small main {
  font-size: 0.875rem !important;
}

/* Fix about page excessive bottom space at small font size */
.font-size-small body {
  min-height: auto !important;
}

.font-size-small main {
  padding-bottom: 2rem !important;
}

/* Specifically for about page content area */
.font-size-small .post-content {
  padding-bottom: 1rem !important;
}

.font-size-small main p,
.font-size-small main li,
.font-size-small aside p,
.font-size-small aside li {
  font-size: 0.875rem !important;
}

.font-size-medium {
  /* Default size - no changes */
}

.font-size-large main {
  font-size: 1.125rem !important;
}

.font-size-large main p,
.font-size-large main li,
.font-size-large aside p,
.font-size-large aside li,
.font-size-large article {
  font-size: 1.25rem !important;
}

.font-size-large main h1,
.font-size-large main .text-4xl {
  font-size: 2.75rem !important;
  line-height: 1.2 !important;
}

.font-size-large main h2,
.font-size-large article h2 {
  font-size: 2.125rem !important;
  line-height: 1.3 !important;
}

.font-size-large main h3,
.font-size-large aside h3 {
  font-size: 1.75rem !important;
  line-height: 1.3 !important;
}

/* Resize category and tag buttons */
.font-size-large aside a,
.font-size-large article .text-xs,
.font-size-large article .text-sm {
  font-size: 1rem !important;
}

.font-size-xlarge main {
  font-size: 1.25rem !important;
}

.font-size-xlarge main p,
.font-size-xlarge main li,
.font-size-xlarge aside p,
.font-size-xlarge aside li,
.font-size-xlarge article {
  font-size: 1.5rem !important;
}

.font-size-xlarge main h1,
.font-size-xlarge main .text-4xl {
  font-size: 3rem !important;
  line-height: 1.2 !important;
}

.font-size-xlarge main h2,
.font-size-xlarge article h2 {
  font-size: 2.5rem !important;
  line-height: 1.3 !important;
}

.font-size-xlarge main h3,
.font-size-xlarge aside h3 {
  font-size: 2rem !important;
  line-height: 1.3 !important;
}

/* Resize category and tag buttons for xlarge */
.font-size-xlarge aside a,
.font-size-xlarge article .text-xs,
.font-size-xlarge article .text-sm {
  font-size: 1.125rem !important;
}

/* Extra Extra Large Font Size - A++ */
.font-size-xxlarge main {
  font-size: 1.5rem !important;
}

.font-size-xxlarge main p,
.font-size-xxlarge main li,
.font-size-xxlarge aside p,
.font-size-xxlarge aside li,
.font-size-xxlarge article {
  font-size: 1.75rem !important;
}

.font-size-xxlarge main h1,
.font-size-xxlarge main .text-4xl {
  font-size: 3.5rem !important;
  line-height: 1.2 !important;
}

.font-size-xxlarge main h2,
.font-size-xxlarge main .text-3xl {
  font-size: 2.75rem !important;
  line-height: 1.2 !important;
}

.font-size-xxlarge main h3,
.font-size-xxlarge main .text-2xl {
  font-size: 2.25rem !important;
  line-height: 1.2 !important;
}

.font-size-xxlarge aside a,
.font-size-xxlarge article .text-xs,
.font-size-xxlarge article .text-sm {
  font-size: 1.25rem !important;
}

.font-size-xxlarge article.article-with-shadow {
  max-width: 100%;
  padding: 2.5rem;
}

/* Make article cards wider at larger font sizes for better readability */
.font-size-large article.article-with-shadow {
  max-width: calc(100% + 2rem);
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 1.5rem;
}

.font-size-xlarge article.article-with-shadow {
  max-width: 100%;
  padding: 2rem;
}

/* Ensure proper spacing with sidebar on larger screens */
@media (min-width: 768px) {
  .font-size-large main section.w-full.md\:w-2\/3 {
    max-width: 75%;
  }
  
  .font-size-xlarge main section.w-full.md\:w-2\/3 {
    max-width: 80%;
  }
}

/* Line Spacing Options */
.line-spacing-relaxed {
  line-height: 1.75 !important;
}

.line-spacing-relaxed p,
.line-spacing-relaxed li {
  line-height: 1.75 !important;
}

.line-spacing-loose {
  line-height: 2 !important;
}

.line-spacing-loose p,
.line-spacing-loose li {
  line-height: 2 !important;
}

/* High Readability Mode */
.high-readability {
  letter-spacing: 0.05em;
}

.high-readability p,
.high-readability li {
  letter-spacing: 0.05em;
}

/* Enhanced Focus Indicators */
.enhanced-focus a:focus,
.enhanced-focus button:focus,
.enhanced-focus input:focus,
.enhanced-focus textarea:focus,
.enhanced-focus select:focus {
  outline: 3px solid #FFA500 !important;
  outline-offset: 2px !important;
}

/* High Contrast Mode - Make everything more visible */
.high-contrast {
  /* Stronger text colors */
  color: #000 !important;
}

.high-contrast main,
.high-contrast article,
.high-contrast aside {
  background-color: #fff !important;
  color: #000 !important;
}

.high-contrast p,
.high-contrast li,
.high-contrast span {
  color: #000 !important;
  font-weight: 500 !important;
}

.high-contrast h1,
.high-contrast h2,
.high-contrast h3,
.high-contrast h4,
.high-contrast h5,
.high-contrast h6 {
  color: #000 !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
}

.high-contrast a {
  color: #0000EE !important;
  font-weight: 600 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
}

.high-contrast a:visited {
  color: #551A8B !important;
}

.high-contrast a:hover {
  background-color: #FFFF00 !important;
  color: #000 !important;
}

.high-contrast button,
.high-contrast input,
.high-contrast textarea,
.high-contrast select {
  border: 2px solid #000 !important;
  background-color: #fff !important;
  color: #000 !important;
}

.high-contrast article.article-with-shadow {
  border: 3px solid #000 !important;
  box-shadow: none !important;
}

.high-contrast code,
.high-contrast pre {
  background-color: #f0f0f0 !important;
  border: 2px solid #000 !important;
  color: #000 !important;
}

/* Dark mode high contrast */
.dark .high-contrast {
  color: #fff !important;
}

.dark .high-contrast main,
.dark .high-contrast article,
.dark .high-contrast aside {
  background-color: #000 !important;
  color: #fff !important;
}

.dark .high-contrast p,
.dark .high-contrast li,
.dark .high-contrast span {
  color: #fff !important;
}

.dark .high-contrast h1,
.dark .high-contrast h2,
.dark .high-contrast h3,
.dark .high-contrast h4,
.dark .high-contrast h5,
.dark .high-contrast h6 {
  color: #fff !important;
}

.dark .high-contrast a {
  color: #9999FF !important;
}

.dark .high-contrast a:visited {
  color: #CC99FF !important;
}

.dark .high-contrast a:hover {
  background-color: #FFFF00 !important;
  color: #000 !important;
}

.dark .high-contrast button,
.dark .high-contrast input,
.dark .high-contrast textarea,
.dark .high-contrast select {
  border: 2px solid #fff !important;
  background-color: #000 !important;
  color: #fff !important;
}

.dark .high-contrast article.article-with-shadow {
  border: 3px solid #fff !important;
}

.dark .high-contrast code,
.dark .high-contrast pre {
  background-color: #1a1a1a !important;
  border: 2px solid #fff !important;
  color: #fff !important;
}

/* Skip Navigation Link - Only for keyboard users */
.skip-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: -200px;  /* Hidden off-screen */
  background: #000;
  color: #fff;
  padding: 20px 40px;
  text-decoration: none;
  z-index: 999999;  /* Maximum z-index */
  font-weight: 700;
  font-size: 18px;
  border: 4px solid #ffeb3b;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  transition: top 0.3s ease;
  display: block;
  white-space: nowrap;
}

/* Only show on keyboard focus, not mouse click */
.skip-nav:focus {
  top: 20px;  /* Appears at top with some margin */
  outline: 4px solid #ff0000;
  outline-offset: 4px;
}

.skip-nav:focus-visible {
  top: 20px;  /* Modern browsers */
}

/* When toolbar is visible, adjust position to avoid overlap */
body.toolbar-visible .skip-nav:focus {
  top: 80px;  /* Below the toolbar */
}

/* New Top-Bar Accessibility Toolbar */
.accessibility-toolbar {
  position: relative;
  z-index: 40;
  transition: all 0.3s ease;
}

.accessibility-toolbar.hidden {
  display: none;
}

/* Quick Control Buttons */
.accessibility-quick-btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}

.dark .accessibility-quick-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.accessibility-quick-btn:hover {
  background: #225f78;
  color: white;
  border-color: #225f78;
}

/* Preset Buttons */
.accessibility-preset-btn {
  padding: 0.25rem 0.75rem;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}

.dark .accessibility-preset-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.accessibility-preset-btn:hover,
.accessibility-preset-btn.active {
  background: #225f78;
  color: white;
  border-color: #225f78;
}

/* More Settings Button - Fixed contrast */
.accessibility-more-btn {
  padding: 0.25rem 0.75rem;
  background: #8a6f2a; /* Darker gold for better contrast */
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.accessibility-more-btn:hover {
  background: #6d5621;
}

/* Close Button */
.accessibility-close-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.dark .accessibility-close-btn {
  border-color: #4b5563;
  color: #9ca3af;
}

.accessibility-close-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* First Visit Banner */
.accessibility-banner {
  animation: slideDown 0.3s ease;
}

.accessibility-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.accessibility-btn {
  padding: 8px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.dark .accessibility-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.accessibility-btn:hover {
  border-color: #225f78;
}

.accessibility-btn.active {
  background: #225f78;
  color: white;
  border-color: #225f78;
}

.accessibility-btn.toggle {
  min-width: 140px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Print styles */
@media print {
  .accessibility-toolbar-toggle,
  .accessibility-toolbar,
  .darkmode-toggle {
    display: none !important;
  }
}

/* Active state for toolbar buttons */
.accessibility-quick-btn.active,
.accessibility-preset-btn.active,
.accessibility-btn.active {
  background-color: #10b981 !important;
  color: white !important;
  border-color: #10b981 !important;
}

.dark .accessibility-quick-btn.active,
.dark .accessibility-preset-btn.active,
.dark .accessibility-btn.active {
  background-color: #34d399 !important;
  color: #1f2937 !important;
  border-color: #34d399 !important;
}