/* CSS */
img,
svg,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 1px solid #9f2241;
}

/* ===== UTILIDADES ===== */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Utilidades de texto */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}

/* Utilidades de márgenes */
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 1rem;
}
.mt-4 {
  margin-top: 1.5rem;
}
.mt-5 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-3 {
  margin-bottom: 1rem;
}
.mb-4 {
  margin-bottom: 1.5rem;
}
.mb-5 {
  margin-bottom: 2rem;
}

/* ===== BOTÓN FLOTANTE DE ACCESIBILIDAD ===== */
.accessibility-float-btn {
  border: 0px;
  position: fixed;
  bottom: 6rem;
  right: 0px;
  width: 60px;
  height: 60px;
  border-radius: 3px;
  background-color: #bc955c !important;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-float-btn:hover,
.accessibility-float-btn:focus-visible {
  box-shadow:
    0 0 0 4px rgba(159, 34, 65, 0.1),
    0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.accessibility-float-btn:active {
  transform: scale(0.95);
}

.accessibility-float-btn[aria-expanded='true'] {
  background: linear-gradient(135deg, #bc955c);
}

.accessibility-float-btn__icon {
  width: 60px;
  height: 55px;
}

/* ===== ANIMACIONES ===== */
@keyframes float-btn-enter {
  from {
    opacity: 0;
    transform: translateY(100px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(159, 34, 65, 0.4),
      0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 12px rgba(159, 34, 65, 0),
      0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
}

/* ===== PANEL MODAL DE ACCESIBILIDAD ===== */
.accessibility-panel {
  position: fixed;
  bottom: calc(64px + 1rem);
  right: 0rem;
  width: min(350px, 50vw);
  max-height: min(75vh, 900px);
  overflow: hidden;
  background: rgb(255, 255, 255);
  backdrop-filter: blur(20px) saturate(180%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-panel--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header del panel */
.accessibility-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

.accessibility-panel__title {
  color: #55585a;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.accessibility-panel__title-icon {
  font-size: 1.4rem;
  color: #ffffff;
}

/* Botón cerrar del panel */
.accessibility-panel__close-btn {
  border: none;
  color: #9f2241;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  margin-left: 1rem;
  padding: 0;
}

.accessibility-panel__close-btn:hover,
.accessibility-panel__close-btn:focus-visible {
  background-color: #9f224173;
  transform: scale(1.1);
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.accessibility-panel__close-btn:active {
  transform: scale(0.95);
}

.accessibility-panel__close-btn .material-icons-outlined {
  font-size: 24px;
}

/* Contenido del panel */
.accessibility-panel__content {
  background-color: #fafafa;
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

.accessibility-panel__section {
  margin-bottom: 2rem;
}

.accessibility-panel__section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e5e7eb;
}

/* Grid de opciones */
.accessibility-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.accessibility-option {
  position: relative;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  overflow: hidden;
}

.accessibility-option:hover,
.accessibility-option:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.accessibility-option[aria-pressed='true'] {
  background: linear-gradient(135deg, #bc955c);
  border-color: #bc955c;
  color: white;
}

.accessibility-option__icon {
  font-size: 24px;
  color: #6b7280;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-option:hover .accessibility-option__icon {
  color: #9f2241;
}

.accessibility-option[aria-pressed='true'] .accessibility-option__icon {
  color: white;
}

.accessibility-option__label {
  color: #55585a;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* Botones de acción */
.accessibility-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.accessibility-action-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  min-width: 200px;
}

.accessibility-action-btn--reset {
  color: #9d2148;
  background: #ededed;
}

.accessibility-action-btn--reset:hover,
.accessibility-action-btn--reset:focus-visible {
  background: #e5e7eb;
  transform: translateY(-1px);
}

/* ===== NOTIFICACIONES (TOAST) ===== */
.accessibility-toast {
  position: fixed;
  top: 2rem;
  right: 2rem;
  min-width: 300px;
  max-width: 400px;
  background: white;
  border-radius: 2px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  z-index: 70;
  opacity: 0;
  transform: translateX(100%);
  transition:
    opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.accessibility-toast--show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.accessibility-toast__icon {
  flex-shrink: 0;
  font-size: 24px;
  color: #9f2241;
}

.accessibility-toast__content {
  flex: 1;
}

.accessibility-toast__title {
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
}

.accessibility-toast__message {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.4;
}

.accessibility-toast__close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-toast__close:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.accessibility-toast--success .accessibility-toast__icon {
  color: #10b981;
}

.accessibility-toast--error .accessibility-toast__icon {
  color: #ef4444;
}

/* ===== LÍNEA DE LECTURA ===== */
.reading-guide-line {
  position: fixed;
  left: 0;
  width: 100%;
  margin-top: -50px;
  height: 5px;
  background: #9f2241;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reading-guide-line-active {
  opacity: 0.7;
}

.reading-guide-line::before {
  content: '';
  position: absolute;
  inset: 0;
}

.reading-guide-line::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.55);
}

.reading-guide-line--active {
  opacity: 1;
}

/* ===== MODOS DE ACCESIBILIDAD ===== */

/* Alto contraste MEJORADO */
.accessibility-high-contrast {
  background-color: #000000 !important;
  color: #ffffff !important;
  background-image: none !important;
}

.accessibility-high-contrast * {
  background-color: #00000000 !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
}

/* Enlaces en alto contraste */
.accessibility-high-contrast a {
  background-color: #000000cf !important;
  color: #fedc2acb !important;
  text-decoration: underline !important;
  font-weight: bold !important;
}

.accessibility-high-contrast a:hover,
.accessibility-high-contrast a:focus {
  background-color: #fedc2acb !important;
  color: #000000 !important;
  outline: 3px solid #ffffff !important;
}

/* Botones y controles en alto contraste */
.accessibility-high-contrast button,
.accessibility-high-contrast input,
.accessibility-high-contrast select,
.accessibility-high-contrast textarea {
  background-color: #000000 !important;
  color: #ffffff !important;
  border-radius: 4px !important;
}

.accessibility-high-contrast button:hover,
.accessibility-high-contrast input:hover,
.accessibility-high-contrast select:hover,
.accessibility-high-contrast textarea:hover {
  background-color: #333333 !important;
}

/* Encabezados en alto contraste */
.accessibility-high-contrast h1,
.accessibility-high-contrast h2,
.accessibility-high-contrast h3,
.accessibility-high-contrast h4,
.accessibility-high-contrast h5,
.accessibility-high-contrast h6 {
  color: #fedc2acb !important;
  border-bottom: 2px solid #fedc2acb !important;
}

/* Imágenes en alto contraste */
.accessibility-high-contrast img {
  filter: contrast(200%) brightness(120%) !important;
  border: 2px solid #ffffff !important;
}

/* Tablas en alto contraste */
.accessibility-high-contrast table {
  border: 2px solid #ffffff !important;
}

.accessibility-high-contrast th {
  background-color: #333333 !important;
  color: #ffffff !important;
  border: 1px solid #ffffff !important;
}

.accessibility-high-contrast td {
  border: 1px solid #ffffff !important;
  color: #ffffff !important;
}

/* Footer específico para alto contraste */
.accessibility-high-contrast footer,
.accessibility-high-contrast .wrapper,
.accessibility-high-contrast .bg-guinda {
  background-color: #000000 !important;
  background-image: none !important;
  color: #ffffff !important;
}

/* Elementos de lista */
.accessibility-high-contrast li {
  color: #ffffff !important;
}

/* Asegurar que todos los textos sean visibles */
.accessibility-high-contrast
  *:not(a):not(button):not(input):not(select):not(textarea):not(h1):not(h2):not(
    h3
  ):not(h4):not(h5):not(h6) {
  color: #fedc2acb !important;
}

/* Focus visible mejorado para alto contraste */
.accessibility-high-contrast :focus-visible {
  outline: 3px solid #fedc2acb !important;
  outline-offset: 3px !important;
  background-color: #333333 !important;
}

/* Paneles y modales en alto contraste */
.accessibility-high-contrast .accessibility-panel {
  background-color: #000000 !important;
  color: #ffffff !important;
}

.accessibility-high-contrast .accessibility-panel__header {
  background-color: #333333 !important;
  border-bottom: 2px solid #fedc2acb !important;
  color: #ffffff !important;
}

.accessibility-high-contrast .accessibility-panel__title {
  color: #fedc2acb !important;
}

.accessibility-high-contrast .accessibility-panel__close-btn {
  background-color: #333333 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

.accessibility-high-contrast .accessibility-panel__close-btn:hover {
  background-color: #fedc2acb !important;
  color: #000000 !important;
}

/* Botones del panel en alto contraste */
.accessibility-high-contrast .accessibility-option {
  background-color: #000000 !important;
  color: #ffffff !important;
}

.accessibility-high-contrast .accessibility-option[aria-pressed='true'] {
  background-color: #fedc2acb !important;
  color: #000000 !important;
  border-color: #fedc2acb !important;
}

/* Filtros visuales */
.accessibility-monochrome::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: grayscale(100%);
  pointer-events: none;
  z-index: 2147483647;
}

.accessibility-inverted::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: invert(100%);
  pointer-events: none;
  z-index: 2147483647;
}

.accessibility-reduced-blue::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: hue-rotate(160deg) saturate(0.7) brightness(1.1);
  pointer-events: none;
  z-index: 2147483647;
}

/* Ajustes de texto */
.accessibility-large-text {
  font-size: 1.5em !important;
}

.accessibility-large-text h1 {
  font-size: 2.5em !important;
}
.accessibility-large-text h2 {
  font-size: 2em !important;
}

.accessibility-readable-font {
  font-family: var(--font-family-serif) !important;
  line-height: 3 !important;
}

.accessibility-spaced-text {
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
  line-height: 1.8 !important;
}

.accessibility-dyslexia-friendly {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
  letter-spacing: 0.05em !important;
  line-height: 2 !important;
}

/* Resaltado de elementos */
.accessibility-highlight-links a {
  background: #ffe136a4 !important;
  color: #000 !important;
  text-decoration: underline !important;
  border-radius: 3px !important;
  font-weight: 600 !important;
}

.accessibility-highlight-images img {
  color: #ffe136a4 !important;
  outline: 4px solid !important;
  outline-offset: 4px !important;
  border-radius: 4px !important;
}

/* Texto hablado */
.accessibility-speaking-text {
  background-color: rgba(159, 34, 65, 0.15) !important;
  outline: 3px solid #9f2241 !important;
  outline-offset: 3px !important;
  border-radius: 6px !important;
  position: relative;
  transition: all 0.3s ease !important;
}

.accessibility-speaking-text::after {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: #9f2241;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Hover speech */
[data-hover-speech='true'] {
  cursor: cell !important;
}
[data-hover-speech='true'] p:hover,
[data-hover-speech='true'] h1:hover,
[data-hover-speech='true'] h2:hover,
[data-hover-speech='true'] h3:hover,
[data-hover-speech='true'] h4:hover,
[data-hover-speech='true'] h5:hover,
[data-hover-speech='true'] h6:hover,
[data-hover-speech='true'] span:hover,
[data-hover-speech='true'] div:hover,
[data-hover-speech='true'] li:hover,
[data-hover-speech='true'] a:hover,
[data-hover-speech='true'] button:hover,
[data-hover-speech='true'] label:hover {
  transition: background-color 0.2s ease !important;
}

/* ===== ESTILOS DE DEMOSTRACIÓN ===== */
.demo-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem;
}

.demo-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 3rem;
  background: linear-gradient(135deg, #9f2241);
  border-radius: 16px;
}

.demo-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #9f2241;
  margin-bottom: 1rem;
}

.demo-subtitle {
  font-size: 16px;
  color: #6b7280;
  max-width: 600px;
  margin: 0 auto;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.demo-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.demo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.demo-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-card__icon {
  color: #9f2241;
  font-size: 16px;
}

.demo-article {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.demo-article h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 2rem 0 1.5rem;
}

.demo-article p {
  margin-bottom: 1.5rem;
  color: var(--color-gray-700);
}

.demo-article a {
  color: #9f2241;
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.demo-article a:hover {
  color: #9f2241;
  text-decoration: underline;
}

.demo-image-container {
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.demo-footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 768px) {
  .accessibility-panel {
    bottom: calc(80px + -5rem);
    right: 0rem;
    left: 5rem;
    width: auto;
    max-height: 100vh;
  }

  .accessibility-float-btn {
    bottom: 6rem;
    right: 0rem;
    width: 56px;
    height: 56px;
  }

  .demo-container {
    padding: 1.5rem;
  }

  .demo-title {
    font-size: 1.875rem;
  }
}

@media (max-width: 480px) {
  .accessibility-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .accessibility-actions {
    flex-direction: column;
  }

  .accessibility-toast {
    right: 1rem;
    left: 1rem;
    min-width: auto;
  }
}
