/* Ajustes de terminación: conservar composición, imágenes y paleta editorial. */
html{scrollbar-gutter:stable}
body{overflow-wrap:break-word}
.topic h3,.geology-heading h2,.ancient-title h2,.process-heading h2{text-wrap:balance}
.topic-body p,.intro-story-text p{text-wrap:pretty}

/* Los controles pequeños también deben ser cómodos en una pantalla táctil. */
.expand-all,.topic-actions button,[data-close-index],[data-close-about],
[data-gallery-prev],[data-gallery-next],#close-media,#media-prev,#media-next,
.pm-view-btn,.pm-globe-reset,#reset-map{min-height:44px}
#media-prev,#media-next,[data-gallery-prev],[data-gallery-next]{min-width:44px}
.reading-index :focus-visible,.contents-gate :focus-visible{
  outline:2px solid #96472e;outline-offset:4px;
}
.pm-globe-canvas:focus-visible{outline:2px solid #ffbf97;outline-offset:4px;border-radius:50%}
.topic-body a,.about-story a{text-decoration-thickness:1px;text-underline-offset:4px}
.map-source,.intro-photo-credit,.photo-credit{font-size:10px;line-height:1.65}
.footer-bottom{font-size:9px;line-height:1.7}

/* Una misma familia de azul, marfil y cobre en los estados de interacción. */
.masthead nav>a{position:relative;padding-block:12px}
.masthead nav>a::after{
  content:"";position:absolute;left:0;right:0;bottom:5px;height:1px;
  background:var(--orange);transform:scaleX(0);transform-origin:left;
  transition:transform .24s ease;
}
.masthead nav>a:hover::after,.masthead nav>a:focus-visible::after{transform:scaleX(1)}
.chapter-links a{transition:color .2s,box-shadow .2s}
.chapter-links a[aria-current="location"]{color:#ffd0ae;box-shadow:inset 0 -2px #ffb17f}
.topic>summary{transition:color .2s}
.topic[open]>summary::before{opacity:1;background:rgba(255,192,150,.055)}
.topic[open]>summary h3{color:#ffd0ae}
.topic:target>summary{box-shadow:inset 3px 0 #ffb17f}
.references li:target{background:rgba(255,177,127,.075);outline:1px solid rgba(255,177,127,.35);outline-offset:5px}
.map-modes button,.pm-view-btn,.expand-all,.topic-actions button,
.about-close,.footer-about-trigger,.viewer-controls button{
  transition:color .2s,background-color .2s,border-color .2s;
}
.expand-all:hover,.topic-actions button:hover{color:#fff6e8}
.pm-window,.media-dialog{box-shadow:0 16px 48px rgba(8,27,40,.16)}
.pm-map-field[aria-busy="true"]{cursor:progress}

/* Apertura y cierre nativos; los navegadores anteriores conservan details. */
@supports (interpolate-size:allow-keywords) and selector(details::details-content){
  details.topic{interpolate-size:allow-keywords}
  details.topic::details-content{
    block-size:0;opacity:0;overflow:clip;
    transition:block-size .28s cubic-bezier(.2,.7,.2,1),opacity .2s,
      content-visibility .28s allow-discrete;
  }
  details.topic[open]::details-content{block-size:auto;opacity:1}
  details.topic[open]>.topic-body{animation:none}
}
@media(prefers-reduced-motion:no-preference){
  .about-dialog[open],.media-dialog[open],.reading-index[open]{animation:panel-arrive .22s ease-out both}
  dialog[open]::backdrop{animation:backdrop-arrive .18s ease-out both}
  @keyframes panel-arrive{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
  @keyframes backdrop-arrive{from{opacity:0}to{opacity:1}}
}
@media(hover:hover) and (pointer:fine){
  .topic>summary:hover h3{color:#ffd0ae}
  .pm-stop:not(.active):hover{background:rgba(255,209,174,.075)}
}
@media(max-width:760px){
  html{scrollbar-gutter:auto}
  /* La cabeza completa queda dentro del encuadre del celular. */
  .cover-animal{right:-10px;max-width:92vw}
  .map-modes button{min-height:44px}
  .map-modes{gap:2px}
  .topic-body{overflow-wrap:anywhere}
  .topic-body table{overflow-wrap:normal}
  .topic-actions{gap:8px 20px}
  .footer-bottom{row-gap:12px}
}
@media(prefers-reduced-motion:reduce){
  details.topic::details-content{transition:none!important}
  .about-dialog[open],.media-dialog[open],.reading-index[open],dialog[open]::backdrop{animation:none!important}
}
@media print{
  .masthead,.chapter-nav,.topic-actions,.topics-toolbar,.gallery-buttons,#hb-badge{display:none!important}
  details.topic::details-content{block-size:auto!important;content-visibility:visible!important;opacity:1!important;overflow:visible!important}
  .topic-body{color:#172b36!important;background:#fff!important}
  .topic-body a{color:inherit!important}
}