/* Crecer Diferente — accesibilidad (mismo patrón que Hipatia) */

@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/opendyslexic/OpenDyslexic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/opendyslexic/OpenDyslexic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

html {
  font-size: calc(100% * var(--page-zoom, 1));
}

body {
  font-size: var(--font-size-base, 1.05rem);
  line-height: var(--line-height-base, 1.65);
  letter-spacing: var(--letter-spacing-base, 0);
  color: var(--text);
  background: var(--bg);
}

body[data-theme="dark"] {
  --bg: #1a1f22;
  --bg-elevated: #232a2e;
  --bg-card: #2a3238;
  --text: #f0eeea;
  --text-muted: #b8c0c4;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --teal-dark: #6bb8b8;
  --accent: var(--teal);
  --accent-dim: rgba(107, 184, 184, 0.2);
  --focus-ring: 0 0 0 3px rgba(107, 184, 184, 0.55);
}

body[data-theme="light"] {
  --bg: var(--cream);
  --bg-elevated: #ffffff;
  --bg-card: var(--paper);
  --text: var(--ink);
  --text-muted: var(--muted);
  --border: #e4ddd4;
  --accent: var(--teal);
  --accent-dim: rgba(61, 143, 143, 0.15);
  --focus-ring: 0 0 0 3px rgba(61, 143, 143, 0.45);
}

body[data-high-contrast="true"] {
  --text: #ffffff;
  --text-muted: #e8e8e8;
  --border: rgba(255, 255, 255, 0.35);
  --focus-ring: 0 0 0 3px #ffd700;
}

body[data-theme="light"][data-high-contrast="true"] {
  --text: #000000;
  --text-muted: #1a1a1a;
  --border: rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 3px #5a4200;
}

body[data-read-bg="cream"] { --bg: #f5f0e1; --bg-elevated: #faf6ec; --bg-card: #fffdf8; --text: #2a2520; --text-muted: #4a4438; }
body[data-read-bg="blue"] { --bg: #e3f0fa; --bg-elevated: #eef6fc; --bg-card: #f8fbfe; --text: #1a2838; --text-muted: #324558; }
body[data-read-bg="green"] { --bg: #e5f2e8; --bg-elevated: #eef7f0; --bg-card: #f8fcf9; --text: #1a3020; --text-muted: #345042; }
body[data-read-bg="yellow"] { --bg: #faf6e0; --bg-elevated: #fdfae8; --bg-card: #fffef5; --text: #2a2818; --text-muted: #4a4528; }
body[data-read-bg="pink"] { --bg: #fae8ee; --bg-elevated: #fdf0f4; --bg-card: #fff8fa; --text: #301820; --text-muted: #4a3038; }
body[data-read-bg="gray"] { --bg: #ececec; --bg-elevated: #f4f4f4; --bg-card: #fafafa; --text: #1e1e1e; --text-muted: #383838; }
body[data-read-bg="sepia"] { --bg: #f0e6d2; --bg-elevated: #f6efe0; --bg-card: #faf5ea; --text: #2e2618; --text-muted: #4a3a28; }

body[data-read-bg="cream"][data-high-contrast="true"],
body[data-read-bg="blue"][data-high-contrast="true"],
body[data-read-bg="green"][data-high-contrast="true"],
body[data-read-bg="yellow"][data-high-contrast="true"],
body[data-read-bg="pink"][data-high-contrast="true"],
body[data-read-bg="gray"][data-high-contrast="true"],
body[data-read-bg="sepia"][data-high-contrast="true"] {
  --text: #000000;
  --text-muted: #1a1a1a;
  --border: rgba(0, 0, 0, 0.45);
}

body[data-font="serif"] {
  --font-body: Georgia, "Times New Roman", serif;
  --font-display: Georgia, "Times New Roman", serif;
}

body[data-font="dys"] {
  --font-body: "OpenDyslexic", Arial, Helvetica, sans-serif;
  --font-display: "OpenDyslexic", Arial, Helvetica, sans-serif;
}

body[data-cursor="custom"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%233d8f8f' d='M3 3l7 18 2.5-7.5L21 11z'/%3E%3C/svg%3E") 0 0, auto;
}
body[data-cursor-size="2"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%233d8f8f' d='M3 3l7 18 2.5-7.5L21 11z'/%3E%3C/svg%3E") 0 0, auto; }
body[data-cursor-size="3"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath fill='%233d8f8f' d='M3 3l7 18 2.5-7.5L21 11z'/%3E%3C/svg%3E") 0 0, auto; }

body.modal-open { overflow: hidden; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-select {
  appearance: none;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c656d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.a11y-fab {
  --fab-size: 3.25rem;
  --fab-right: 1.25rem;
  --a11y-fab-icon: #2d6f6f;
  position: fixed;
  bottom: var(--fab-right);
  right: var(--fab-right);
  z-index: 980;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: #ffffff;
  padding: 0;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(31, 36, 40, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-fab:hover,
.a11y-fab:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(31, 36, 40, 0.28);
}

.a11y-fab:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.a11y-fab__icon {
  display: block;
  flex-shrink: 0;
  width: 100%;
  height: 100%;
}

.a11y-fab__figure {
  background-color: var(--a11y-fab-icon);
  mask: url("../images/a11y-person-icon.png") center / 108% no-repeat;
  -webkit-mask: url("../images/a11y-person-icon.png") center / 108% no-repeat;
}

body[data-theme="dark"] .a11y-fab {
  --a11y-fab-icon: #e8f4f4;
  background: #2a3238;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body[data-high-contrast="true"] .a11y-fab {
  --a11y-fab-icon: #000000;
}

.a11y-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 990;
  width: min(360px, 100vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 1.5rem;
}

.a11y-panel.is-open { transform: translateX(0); }

.a11y-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.a11y-panel__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.a11y-panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  line-height: 1;
}

.a11y-panel__close:hover {
  color: var(--text);
  background: var(--accent-dim);
}

.a11y-group { margin-bottom: 1.5rem; }

.a11y-group__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.a11y-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.a11y-btn {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.a11y-btn:hover { border-color: var(--teal); }

.a11y-btn.is-active {
  background: var(--accent-dim);
  border-color: var(--teal);
  color: var(--teal-dark);
  font-weight: 600;
}

.a11y-range {
  width: 100%;
  accent-color: var(--teal);
}

.a11y-swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.a11y-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.a11y-swatch:hover { transform: scale(1.08); }

.a11y-swatch.is-active {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
}

.a11y-swatch--default { background: #faf8f5; }
.a11y-swatch--cream { background: #f5f0e1; }
.a11y-swatch--blue { background: #e3f0fa; }
.a11y-swatch--green { background: #e5f2e8; }
.a11y-swatch--yellow { background: #faf6e0; }
.a11y-swatch--pink { background: #fae8ee; }
.a11y-swatch--gray { background: #ececec; }
.a11y-swatch--sepia { background: #f0e6d2; }

.a11y-reset { width: 100%; margin-top: 0.5rem; }

.a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 985;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.a11y-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .site-header__inner {
    flex-wrap: nowrap;
  }
}

@media (max-width: 767px) {
  .header-actions {
    margin-left: auto;
  }
  .lang-select {
    max-width: 7.5rem;
    font-size: 0.8rem;
    padding-right: 1.75rem;
  }
}
