/* V36 · Accesibilidad integrada, búsqueda local y ajustes de lectura */

:root{
  --terracotta:#a8472f;
  --terracotta-on-dark:#ef9b78;
  --focus-ring:#0b63ce;
}

/* Foco visible, grande y consistente para teclado. */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--focus-ring)!important;
  outline-offset:4px!important;
  box-shadow:0 0 0 2px #fff!important;
}
.site-header :where(a,button):focus-visible,
.site-footer :where(a,button):focus-visible,
.menu-overlay :where(a,button):focus-visible{
  outline-color:#ffd58a!important;
  box-shadow:0 0 0 2px var(--forest-950)!important;
}

/* Contraste AA en la apariencia predeterminada. */
.feature-story .text-link span,
.section-quote>span,
.site-footer .text-link span{color:var(--terracotta-on-dark)}
.menu-column li small{color:rgba(255,255,255,.76)}
.menu-foot{color:rgba(255,255,255,.78)}
.footer-brand p{color:rgba(255,255,255,.76)}
.footer-nav a{color:rgba(255,255,255,.82)}
.footer-bottom{color:rgba(255,255,255,.74)}
.feature-story-copy>p:not(.section-number),
.rail-card--accent p,
.callout-dark p,
.archive-panel p,
.memory-poster p{color:rgba(255,255,255,.82)!important}

/* Los textos auxiliares dejan de depender de tamaños extremadamente pequeños. */
.brand-text small,
.menu-toggle-label,
.menu-kicker,
.home-kicker,
.hero-index,
.section-number,
.coordinate-card small,
.bento-card p,
.bento-number,
.feature-story-image span,
.home-triptych span,
.section-stamp small,
.breadcrumbs ol,
.editorial-card-image>span,
.page-toc summary,
.page-toc summary span,
.rail-index p,
.rail-card h2,
.rail-card a small,
.rail-label,
.footer-index,
.footer-nav h3,
.footer-bottom,
.timeline-date,
.chart-caption,
.caption,
.resource-eyebrow,
.discovery-note-kicker,
.reading-note-kicker,
.discovery-note-action,
.reading-note-action,
.insight-tag,
.source-chip,
.quote-badge,
.chapter-links span,
.toponym-grid span,
.occupation-grid span,
.external-resource-label,
.external-resource-item small,
.source-perspective>span,
.service-entry .service-kicker,
.service-entry small,
.infrastructure-item span,
.memory-poster span,
.author-homage .homage-label,
.archive-panel span,
.photo-credit,
.image-license-card dt,
.card-photo-credit,
.editorial-card-credit,
.ai-credit,
.external-photo-credit,
.inline-photo-credit{
  font-size:.78rem!important;
  line-height:1.45;
}
.page-toc li,
.reading-note-body p,
.reading-note-body li,
.species-details-card p{font-size:.875rem!important}

/* Tablas con reflujo seguro; el desplazamiento queda dentro del componente. */
.table-container,.table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain}
table caption{
  caption-side:top;
  padding:.85rem 1rem;
  color:var(--forest-950);
  background:var(--cream-2);
  font-weight:800;
  text-align:left;
}

.audio-transcript{
  margin-top:.8rem;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--cream);
}
.audio-transcript summary{
  min-height:48px;
  padding:.75rem .9rem;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  cursor:pointer;
  font-weight:800;
}
.audio-transcript summary::after{content:"+";color:var(--terracotta);font-size:1.2rem}
.audio-transcript[open] summary::after{content:"−"}
.audio-transcript-body{padding:0 .9rem .9rem;border-top:1px solid var(--line)}
.audio-transcript-body p{margin:.8rem 0 0!important;font-size:.9rem!important}

/* Acceso a los ajustes en la cabecera. */
.header-actions{display:flex;align-items:center;gap:.65rem}
.reading-settings-toggle{
  min-height:48px;
  border:1px solid rgba(255,255,255,.38);
  border-radius:999px;
  padding:.5rem .85rem;
  background:rgba(255,255,255,.08);
  color:#fff;
  display:inline-flex;
  align-items:center;
  gap:.55rem;
  cursor:pointer;
  transition:background .25s,color .25s,transform .25s;
}
.reading-settings-toggle:hover{background:#fff;color:var(--forest-950);transform:translateY(-1px)}
.reading-settings-aa{
  min-width:2rem;
  min-height:2rem;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#fff;
  color:var(--forest-950);
  font:800 .82rem/1 var(--sans);
}
.reading-settings-toggle:hover .reading-settings-aa{background:var(--forest-950);color:#fff}
.reading-settings-label{font-size:.75rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.footer-reading-link{
  width:100%;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.1);
  padding:.55rem 0;
  background:transparent;
  color:rgba(255,255,255,.82);
  text-align:left;
  cursor:pointer;
}
.footer-reading-link:hover{color:#fff;padding-left:.45rem}

/* Búsqueda local: usa un índice estático y no envía consultas fuera del sitio. */
.site-search-toggle{
  min-height:48px;
  border:1px solid rgba(255,255,255,.38);
  border-radius:999px;
  padding:.5rem .85rem;
  background:rgba(255,255,255,.08);
  color:#fff;
  display:inline-flex;
  align-items:center;
  gap:.6rem;
  cursor:pointer;
  transition:background .25s,color .25s,transform .25s;
}
.site-search-toggle:hover{background:#fff;color:var(--forest-950);transform:translateY(-1px)}
.site-search-symbol{
  position:relative;
  width:1.2rem;
  height:1.2rem;
  border:2px solid currentColor;
  border-radius:50%;
}
.site-search-symbol::after{
  content:"";
  position:absolute;
  right:-.34rem;
  bottom:-.2rem;
  width:.5rem;
  height:2px;
  border-radius:2px;
  background:currentColor;
  transform:rotate(45deg);
  transform-origin:left center;
}
.site-search-label{font-size:.75rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.footer-search-link{
  width:100%;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.1);
  padding:.55rem 0;
  background:transparent;
  color:rgba(255,255,255,.82);
  text-align:left;
  cursor:pointer;
}
.footer-search-link:hover{color:#fff;padding-left:.45rem}
.site-search-dialog{
  width:min(1040px,calc(100% - 2rem));
  max-height:min(820px,calc(100dvh - 2rem));
  margin:auto;
  padding:0;
  border:0;
  border-radius:28px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 30px 100px rgba(0,0,0,.32);
  overflow:auto;
}
.site-search-dialog::backdrop{background:rgba(2,20,16,.78);backdrop-filter:blur(6px)}
.site-search-shell{padding:clamp(1.25rem,4vw,3rem)}
.site-search-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem}
.site-search-kicker{margin:0 0 .45rem;color:var(--terracotta);font-size:.78rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}
.site-search-header h2{max-width:780px;margin:0;font:700 clamp(2rem,5vw,4rem)/.98 var(--serif);letter-spacing:-.045em}
.site-search-close,.correction-dialog-close{
  flex:0 0 auto;
  width:48px;
  height:48px;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--cream);
  color:var(--ink);
  cursor:pointer;
  font-size:1.35rem;
}
.site-search-form{
  margin-top:clamp(1.4rem,4vw,2.5rem);
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(170px,240px);
  align-items:end;
  gap:.65rem 1rem;
}
.site-search-form>label{font-size:.82rem;font-weight:850}
.site-search-filter-label{grid-column:2}
.site-search-field{position:relative}
.site-search-field input,.site-search-form select{
  width:100%;
  min-height:56px;
  border:1px solid rgba(17,36,30,.24);
  border-radius:16px;
  background:#fff;
  color:var(--ink);
  font:700 1rem var(--sans);
}
.site-search-field input{padding:.8rem 5rem .8rem 1rem}
.site-search-form select{padding:.8rem 2.4rem .8rem 1rem}
.site-search-clear{
  position:absolute;
  top:50%;
  right:.55rem;
  min-height:42px;
  padding:.4rem .75rem;
  border:0;
  border-radius:999px;
  background:var(--cream-2);
  color:var(--forest-800);
  cursor:pointer;
  transform:translateY(-50%);
  font-weight:800;
}
.site-search-status{margin:1rem 0 .4rem;color:var(--muted);font-size:.88rem;font-weight:750}
.site-search-results{min-height:2rem}
.site-search-result-list{margin:.6rem 0 0;padding:0;list-style:none;display:grid;gap:.6rem}
.site-search-result{
  position:relative;
  min-height:112px;
  padding:1rem 3.5rem 1rem 1.1rem;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  color:var(--ink);
  text-decoration:none;
  display:grid;
  gap:.26rem;
  transition:transform .2s,border-color .2s,box-shadow .2s;
}
.site-search-result:hover{
  border-color:var(--forest-700);
  box-shadow:0 12px 28px rgba(8,39,31,.1);
  transform:translateY(-2px);
}
.site-search-result-meta{color:var(--terracotta);font-size:.75rem;font-weight:900;letter-spacing:.06em;text-transform:uppercase}
.site-search-result strong{font-size:1.08rem;line-height:1.25}
.site-search-result-copy{color:var(--muted);font-size:.88rem;line-height:1.55}
.site-search-result-arrow{position:absolute;top:50%;right:1.2rem;color:var(--terracotta);font-size:1.2rem;transform:translateY(-50%)}
.site-search-empty{
  margin-top:1rem;
  padding:1rem 1.1rem;
  border-radius:18px;
  background:var(--cream);
  color:var(--muted);
}
.site-search-empty[hidden]{display:none}
.site-search-empty p{margin:0 0 .8rem}
.site-search-suggestions{display:flex;flex-wrap:wrap;gap:.5rem}
.site-search-suggestions button{
  min-height:44px;
  padding:.5rem .8rem;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--forest-800);
  cursor:pointer;
  font-weight:800;
}

/* Vigencia de la información variable. */
.information-freshness{
  margin:0 0 1.4rem;
  padding:1rem 1.1rem;
  border:1px solid rgba(168,71,47,.28);
  border-left:5px solid var(--terracotta);
  border-radius:16px;
  background:#fff8f1;
}
.information-freshness span{color:var(--terracotta);font-size:.75rem;font-weight:900;letter-spacing:.08em;text-transform:uppercase}
.information-freshness p{margin:.35rem 0 0!important;color:var(--ink)!important;font-size:.9rem!important;line-height:1.55}

/* Preparador local de correcciones: no recopila ni transmite datos. */
.correction-workflow{
  margin:1rem 0 1.5rem;
  padding:1.1rem;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--cream);
}
.correction-workflow p{margin:0 0 .9rem!important}
.correction-helper-button{
  min-height:48px;
  padding:.7rem 1rem;
  border:1px solid var(--forest-800);
  border-radius:999px;
  background:var(--forest-800);
  color:#fff;
  cursor:pointer;
  font-weight:850;
}
.correction-helper-note{margin:.65rem 0 0!important;color:var(--muted)!important;font-size:.8rem!important}
.correction-dialog{
  width:min(680px,calc(100% - 1.5rem));
  max-height:calc(100dvh - 1.5rem);
  margin:auto;
  padding:0;
  border:0;
  border-radius:24px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 24px 80px rgba(0,0,0,.3);
  overflow:auto;
}
.correction-dialog::backdrop{background:rgba(2,20,16,.76);backdrop-filter:blur(5px)}
.correction-dialog-shell{padding:clamp(1.2rem,4vw,2.2rem);display:grid;gap:1rem}
.correction-dialog-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.correction-dialog-header p{margin:0 0 .25rem;color:var(--terracotta);font-size:.76rem;font-weight:900;letter-spacing:.1em;text-transform:uppercase}
.correction-dialog-header h2{margin:0;font:700 clamp(2rem,5vw,3.2rem)/1 var(--serif)}
.correction-dialog-shell label{display:grid;gap:.4rem;font-size:.86rem;font-weight:850}
.correction-dialog-shell input,.correction-dialog-shell textarea{
  width:100%;
  border:1px solid rgba(17,36,30,.28);
  border-radius:14px;
  padding:.75rem .85rem;
  background:#fff;
  color:var(--ink);
  font:500 1rem/1.5 var(--sans);
}
.correction-dialog-shell textarea{resize:vertical}
.correction-dialog-privacy{margin:0;color:var(--muted);font-size:.82rem}
.correction-dialog-actions{display:flex;flex-wrap:wrap;gap:.65rem}
.correction-dialog-actions button{
  min-height:48px;
  padding:.7rem 1rem;
  border:1px solid var(--forest-800);
  border-radius:999px;
  cursor:pointer;
  font-weight:850;
}
.correction-copy{background:var(--forest-800);color:#fff}
.correction-share{background:transparent;color:var(--forest-800)}
.correction-dialog-status{min-height:1.4em;margin:0;color:var(--forest-700);font-size:.84rem;font-weight:750}

/* Las anclas enlazadas no quedan ocultas bajo la cabecera fija. */
main [id]{scroll-margin-top:8rem}
.visually-hidden{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}

/* Panel nativo modal: el resto de la página queda inerte mientras está abierto. */
.reading-settings-dialog{
  width:min(560px,calc(100% - 1.5rem));
  max-height:min(820px,calc(100dvh - 1.5rem));
  margin:auto 0 auto auto;
  padding:0;
  border:0;
  border-radius:28px 0 0 28px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:-24px 0 80px rgba(0,0,0,.28);
  overflow:auto;
}
.reading-settings-dialog::backdrop{background:rgba(2,20,16,.72);backdrop-filter:blur(5px)}
.reading-settings-shell{padding:clamp(1.25rem,4vw,2.5rem)}
.reading-settings-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1.2rem}
.reading-settings-kicker{margin:0 0 .4rem;color:var(--terracotta);font-size:.78rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}
.reading-settings-header h2{margin:0;font:700 clamp(2.2rem,5vw,3.5rem)/.95 var(--serif);letter-spacing:-.04em}
.reading-settings-close{
  flex:0 0 auto;
  width:48px;
  height:48px;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--cream);
  color:var(--ink);
  cursor:pointer;
  font-size:1.35rem;
}
.reading-settings-intro{margin:1rem 0 1.5rem;color:var(--muted)}
.reading-settings-form{display:grid;gap:1.25rem}
.reading-setting-group{margin:0;padding:1rem;border:1px solid var(--line);border-radius:18px}
.reading-setting-group legend{padding:0 .35rem;font-weight:850}
.reading-size-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.55rem}
.reading-size-option,.reading-switch{
  min-height:52px;
  padding:.7rem .8rem;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--cream);
  display:flex;
  align-items:center;
  gap:.7rem;
  cursor:pointer;
}
.reading-size-option{justify-content:center}
.reading-size-option:has(input:checked),.reading-switch:has(input:checked){
  border-color:var(--forest-700);
  background:#e3eee7;
  box-shadow:inset 0 0 0 1px var(--forest-700);
}
.reading-size-option input,.reading-switch input{width:1.2rem;height:1.2rem;accent-color:var(--forest-700)}
.reading-switch-list{display:grid;gap:.55rem}
.reading-switch-copy{display:grid}
.reading-switch-copy strong{font-size:.95rem}
.reading-switch-copy small{color:var(--muted);font-size:.78rem;line-height:1.35}
.reading-settings-note{margin:0;color:var(--muted);font-size:.82rem}
.reading-settings-actions{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.7rem;padding-top:.25rem}
.reading-settings-actions button{
  min-height:48px;
  padding:.7rem 1rem;
  border-radius:999px;
  cursor:pointer;
  font-weight:800;
}
.reading-settings-reset{border:1px solid var(--line);background:transparent;color:var(--ink)}
.reading-settings-done{border:1px solid var(--forest-800);background:var(--forest-800);color:#fff}
.reading-settings-status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}

/* Preferencias opcionales. */
html.a11y-text-large{font-size:112.5%}
html.a11y-text-xlarge{font-size:125%}
html.a11y-simple-type{--serif:var(--sans)}
html.a11y-simple-type :where(h1,h2,h3,h4,.brand-text strong){letter-spacing:-.025em}
html.a11y-underlined-links :where(.article-card,.footer-nav,.menu-overlay,.breadcrumbs,.home-statement,.feature-story-copy) a{
  text-decoration:underline!important;
  text-decoration-thickness:.12em!important;
  text-underline-offset:.22em!important;
}
html.a11y-underlined-links :where(.bento-card,.editorial-card,.home-triptych a,.resource-card,.external-resource-item){
  outline:2px solid currentColor;
  outline-offset:-4px;
}
html.a11y-reduced-motion,
html.a11y-reduced-motion *{
  scroll-behavior:auto!important;
  animation-duration:.001ms!important;
  animation-iteration-count:1!important;
  transition-duration:.001ms!important;
}
html.a11y-reduced-motion [data-reveal]{opacity:1!important;transform:none!important}

html.a11y-high-contrast{
  --forest-950:#001a14;
  --forest-900:#00271e;
  --forest-800:#073d30;
  --forest-700:#145b46;
  --forest-600:#216b52;
  --cream:#fff;
  --cream-2:#ededed;
  --paper:#fff;
  --ink:#07130f;
  --muted:#30463e;
  --line:rgba(7,19,15,.5);
  --terracotta:#7c2f1f;
  --terracotta-on-dark:#ffb394;
  --gold:#ffdc91;
}
html.a11y-high-contrast .site-header.is-scrolled,
html.a11y-high-contrast .menu-open .site-header{background:#001a14}
html.a11y-high-contrast :where(.hero-wash,.home-hero-gradient){opacity:.96}
html.a11y-high-contrast .footer-bottom,
html.a11y-high-contrast .footer-brand p,
html.a11y-high-contrast .footer-nav a,
html.a11y-high-contrast .menu-column li small,
html.a11y-high-contrast .menu-foot{color:#fff}

/* Reflujo equivalente a 400 % y controles táctiles. */
@media(max-width:820px){
  .site-search-label,
  .reading-settings-label{display:none}
  .site-search-toggle,
  .reading-settings-toggle{padding:.45rem}
  .site-search-dialog{width:100%;max-height:94dvh;margin:auto auto 0;border-radius:24px 24px 0 0}
  .site-search-form{grid-template-columns:1fr}
  .site-search-filter-label{grid-column:1}
  .reading-settings-dialog{border-radius:24px 24px 0 0;margin:auto auto 0;width:100%;max-height:92dvh}
}
@media(max-width:480px){
  .header-actions{gap:.35rem}
  .site-search-shell{padding:1.15rem}
  .site-search-header h2{font-size:2rem}
  .site-search-result{padding-right:2.5rem}
  .site-search-result-copy{font-size:.84rem}
  .reading-size-options{grid-template-columns:1fr}
  .reading-settings-actions{flex-direction:column}
  .reading-settings-actions button{width:100%}
  .correction-dialog-actions{flex-direction:column}
  .correction-dialog-actions button{width:100%}
}
@media(max-width:360px){
  .brand-symbol{display:none}
  .brand-text strong{font-size:1rem}
}
@media(prefers-reduced-motion:reduce){
  .reading-settings-dialog::backdrop{backdrop-filter:none}
}
@media print{
  .site-search-toggle,.site-search-dialog,.footer-search-link,
  .reading-settings-toggle,.reading-settings-dialog,.footer-reading-link,
  .correction-helper-button,.correction-dialog{display:none!important}
}
