/* FAC - Portal Fotográfico · shell estable preview159
   Este fichero contiene únicamente las reglas finales de cabecera, selector,
   compatibilidad Enfold y responsive transversal. Se carga después del tema y
   tiene prioridad sobre reglas históricas del prototipo. */

:root{
  --fac-shell-max:1360px;
  --fac-shell-side:20px;
  --fac-shell-border:#dfe7ea;
  --fac-shell-ink:#173b4f;
  --fac-shell-muted:#667f8c;
  --fac-shell-accent:#1f607d;
  --fac-shell-soft:#f3f7f8;
  --fac-shell-bg:#ffffff;
}

html,body{max-width:100%;}
body.fac-portal-shell-active{overflow-x:hidden;}
@supports (overflow:clip){body.fac-portal-shell-active{overflow-x:clip;}}
body.fac-public-nav-open,
body.fac-location-panel-open{overflow:hidden!important;}

/* ---------- Enfold: retirar de verdad la cabecera y SU compensación ---------- */
body#top.fac-portal-shell-active #header,
body#top.fac-portal-shell-active #header_main,
body#top.fac-portal-shell-active #header_meta,
body#top.fac-portal-shell-active .header_bg,
body.fac-portal-shell-active #header,
body.fac-portal-shell-active #header_main,
body.fac-portal-shell-active #header_meta,
body.fac-portal-shell-active .header_bg{
  display:none!important;
  width:0!important;
  height:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  overflow:hidden!important;
}

/* Enfold aplica padding-top a #main con selectores de varios ID. Igualamos esa
   especificidad; por eso esta regla sí elimina el hueco que sobrevivía. */
html.html_header_top body#top.fac-portal-shell-active #wrap_all #main,
html.html_header_top.html_header_sticky body#top.fac-portal-shell-active #wrap_all #main,
html.html_header_top.html_header_shrinking body#top.fac-portal-shell-active #wrap_all #main,
html.html_header_top.html_header_transparency body#top.fac-portal-shell-active #wrap_all #main,
html.responsive body#top.fac-portal-shell-active #wrap_all #main,
body#top.fac-portal-shell-active #wrap_all #main{
  margin-top:0!important;
  padding-top:0!important;
  top:auto!important;
}
body#top.fac-portal-shell-active #wrap_all,
body#top.fac-portal-shell-active #main{
  width:100%!important;
  max-width:100%!important;
}
/* preview157: Enfold no puede desplazar #wrap_all hacia la antigua cabecera.
   Es una protección global para portada, páginas normales y archivos. */
body#top.fac-portal-shell-active #wrap_all{
  margin-top:0!important;
  padding-top:0!important;
  top:auto!important;
}
/* No alteramos el padding interno de los bloques de Enfold, pero sí cualquier
   separación EXTERNA que haya quedado asociada a la cabecera antigua. */
body#top.fac-portal-shell-active #main > .container_wrap:first-child,
body#top.fac-portal-shell-active #main > .container_wrap_first,
body#top.fac-portal-shell-active #main > .avia-section:first-child,
body#top.fac-portal-shell-active #main > main:first-child,
body#top.fac-portal-shell-active #main > article:first-child{
  margin-top:0!important;
  top:auto!important;
}

/* ---------- Cabecera FAC ---------- */
body.fac-portal-shell-active .fac-public-header{
  position:sticky!important;
  top:0!important;
  z-index:99980!important;
  width:100%!important;
  max-width:100%!important;
  margin:0!important;
  padding:0!important;
  background:#fff!important;
  border:0!important;
  border-bottom:1px solid var(--fac-shell-border)!important;
  box-shadow:0 1px 0 rgba(18,55,73,.03)!important;
  transform:none!important;
  contain:none!important;
  isolation:isolate;
}
body.admin-bar.fac-portal-shell-active .fac-public-header{top:32px!important;}
body.fac-portal-shell-active .fac-public-header,
body.fac-portal-shell-active .fac-public-header *{box-sizing:border-box;min-width:0;}

body.fac-portal-shell-active .fac-public-header-inner{
  width:min(var(--fac-shell-max),calc(100% - 40px))!important;
  max-width:var(--fac-shell-max)!important;
  min-height:78px!important;
  margin:0 auto!important;
  padding:0!important;
  display:flex!important;
  align-items:center!important;
  gap:22px!important;
}
body.fac-portal-shell-active .fac-public-brand{
  display:flex!important;
  align-items:center!important;
  flex:0 0 auto!important;
  max-width:220px!important;
}
body.fac-portal-shell-active .fac-public-brand img{
  display:block!important;
  width:auto!important;
  height:62px!important;
  max-width:215px!important;
  object-fit:contain!important;
}
body.fac-portal-shell-active .fac-public-nav{
  margin-left:auto!important;
  display:flex!important;
  align-items:center!important;
  gap:2px!important;
  overflow:visible!important;
}
body.fac-portal-shell-active .fac-public-nav>a,
body.fac-portal-shell-active .fac-public-nav-trigger,
body.fac-portal-shell-active .fac-public-location{
  -webkit-appearance:none!important;
  appearance:none!important;
  display:flex!important;
  align-items:center!important;
  min-height:44px!important;
  border:0!important;
  border-radius:9px!important;
  background:transparent!important;
  color:#334f5d!important;
  font:700 15px/1.2 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif!important;
  padding:11px 10px!important;
  white-space:nowrap!important;
  text-decoration:none!important;
  cursor:pointer!important;
}
body.fac-portal-shell-active .fac-public-nav>a:hover,
body.fac-portal-shell-active .fac-public-nav-trigger:hover,
body.fac-portal-shell-active .fac-public-nav>a:focus-visible,
body.fac-portal-shell-active .fac-public-nav-trigger:focus-visible,
body.fac-portal-shell-active .fac-public-location:hover,
body.fac-portal-shell-active .fac-public-location:focus-visible{
  background:#f0f5f6!important;
  color:#123e4d!important;
}
body.fac-portal-shell-active .fac-public-nav-group{position:relative!important;}
body.fac-portal-shell-active .fac-public-nav-trigger{gap:5px!important;}
body.fac-portal-shell-active .fac-public-nav-trigger>span[aria-hidden="true"]{transition:transform .14s ease!important;}
body.fac-portal-shell-active .fac-public-nav-group.is-open>.fac-public-nav-trigger>span[aria-hidden="true"]{transform:rotate(180deg)!important;}
body.fac-portal-shell-active .fac-public-submenu{
  position:absolute!important;
  left:0!important;
  top:100%!important;
  z-index:99995!important;
  display:none!important;
  min-width:235px!important;
  margin:6px 0 0!important;
  padding:8px!important;
  pointer-events:auto!important;
  background:#fff!important;
  border:1px solid #dce5e8!important;
  border-radius:12px!important;
  box-shadow:0 16px 36px rgba(22,47,58,.16)!important;
}
/* El submenú se mantiene abierto por estado, no por hover. Así se puede mover
   el puntero desde el botón al desplegable sin que desaparezca. */
body.fac-portal-shell-active .fac-public-nav-group.is-open>.fac-public-submenu{display:grid!important;}
body.fac-portal-shell-active .fac-public-submenu a{
  display:block!important;
  padding:10px 12px!important;
  border-radius:8px!important;
  color:#334f5d!important;
  font-weight:650!important;
  white-space:normal!important;
  text-decoration:none!important;
}
body.fac-portal-shell-active .fac-public-submenu a:hover,
body.fac-portal-shell-active .fac-public-submenu a:focus-visible{background:#f0f5f6!important;color:#123e4d!important;}
body.fac-portal-shell-active .fac-public-location{
  gap:6px!important;
  margin-left:5px!important;
  padding-inline:13px!important;
  background:#f3f7f8!important;
  border:1px solid #d8e3e6!important;
}
body.fac-portal-shell-active .fac-public-menu-toggle{
  display:none!important;
  -webkit-appearance:none!important;
  appearance:none!important;
  margin-left:auto!important;
  width:46px!important;
  height:46px!important;
  padding:0!important;
  border:1px solid #d8e3e6!important;
  border-radius:10px!important;
  background:#fff!important;
  color:#173b4f!important;
  font-size:24px!important;
  line-height:1!important;
  cursor:pointer!important;
}

/* ---------- Selector territorial: un único drawer fijo y opaco ---------- */
body.fac-portal-shell-active #facLocationPanel.fac-location-drawer--global{
  position:fixed!important;
  top:var(--fac-location-top,var(--fac-shell-top,78px))!important;
  left:0!important;
  right:0!important;
  bottom:auto!important;
  z-index:99970!important;
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  grid-template-rows:none!important;
  max-height:calc(100vh - var(--fac-location-top,var(--fac-shell-top,78px)))!important;
  max-height:calc(100dvh - var(--fac-location-top,var(--fac-shell-top,78px)))!important;
  margin:0!important;
  padding:0!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y!important;
  background:#f4f7f8!important;
  border:0!important;
  border-bottom:1px solid #d7e3e7!important;
  box-shadow:0 18px 38px rgba(22,57,77,.18)!important;
  opacity:0!important;
  visibility:hidden!important;
  pointer-events:none!important;
  transform:translateY(-8px)!important;
  transition:opacity .16s ease,transform .16s ease,visibility .16s!important;
}
body.fac-portal-shell-active #facLocationPanel.fac-location-drawer--global.open{
  opacity:1!important;
  visibility:visible!important;
  pointer-events:auto!important;
  transform:translateY(0)!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-clip,
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner,
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-panel{
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
  background:#f4f7f8!important;
  border:0!important;
  box-shadow:none!important;
  transform:none!important;
  opacity:1!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container{
  width:min(var(--fac-shell-max),calc(100% - 40px))!important;
  max-width:var(--fac-shell-max)!important;
  margin:0 auto!important;
  padding:18px 0 22px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:18px!important;
  margin:0 0 13px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head h2{
  margin:0 0 3px!important;
  font-size:clamp(23px,2vw,30px)!important;
  line-height:1.12!important;
  overflow-wrap:anywhere!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head p:not(.fac-location-kicker){
  margin:0!important;
  color:#617985!important;
  font-size:15px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-kicker{display:none!important;}
body.fac-portal-shell-active #facLocationPanel .fac-close{
  flex:0 0 42px!important;
  width:42px!important;
  height:42px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:10px!important;
  background:#dcebf0!important;
  color:#214f66!important;
  font-size:25px!important;
  line-height:1!important;
  cursor:pointer!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-search{
  width:100%!important;
  max-width:none!important;
  height:52px!important;
  min-height:52px!important;
  margin:0 0 14px!important;
  padding:0 14px!important;
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  background:#fff!important;
  border:1px solid #b9ced7!important;
  border-radius:11px!important;
  box-shadow:none!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-search input[type="search"],
body.fac-portal-shell-active #facLocationPanel .fac-location-search input[type="text"]{
  -webkit-appearance:none!important;
  appearance:none!important;
  flex:1 1 auto!important;
  width:100%!important;
  min-width:0!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  background:transparent!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  outline:0!important;
  color:#173b4f!important;
  font-size:17px!important;
  line-height:1.35!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-search input::-webkit-search-decoration,
body.fac-portal-shell-active #facLocationPanel .fac-location-search input::-webkit-search-cancel-button,
body.fac-portal-shell-active #facLocationPanel .fac-location-search input::-webkit-search-results-button,
body.fac-portal-shell-active #facLocationPanel .fac-location-search input::-webkit-search-results-decoration{-webkit-appearance:none!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-list{
  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
}
body.fac-portal-shell-active #facLocationPanel [data-location-item][hidden]{display:none!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice{
  position:relative!important;
  min-width:0!important;
  min-height:86px!important;
  margin:0!important;
  padding:13px 14px!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  justify-content:center!important;
  background:#fff!important;
  border:1px solid #c5d5dc!important;
  border-radius:12px!important;
  box-shadow:none!important;
  color:#173b4f!important;
  text-align:left!important;
  overflow:hidden!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice strong{
  display:block!important;
  width:100%!important;
  font-size:16px!important;
  line-height:1.2!important;
  overflow-wrap:anywhere!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice span{
  display:block!important;
  margin-top:4px!important;
  color:#617985!important;
  font-size:13px!important;
  line-height:1.25!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.all{
  grid-column:auto!important;
  background:#1f607d!important;
  border-color:#1f607d!important;
  color:#fff!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.all strong,
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.all span{color:#fff!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.is-current{
  box-shadow:inset 0 0 0 2px #3d7d98!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.is-current::after{
  content:"Actual"!important;
  position:absolute!important;
  top:7px!important;
  right:8px!important;
  padding:2px 6px!important;
  border-radius:999px!important;
  background:#edf6f8!important;
  color:#1d586f!important;
  font-size:10px!important;
  font-weight:850!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.all.is-current::after{background:rgba(255,255,255,.94)!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-choice.is-empty{
  background:#fbfcfc!important;
  border-style:dashed!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-upload{
  display:inline-flex!important;
  margin-top:5px!important;
  color:#1f607d!important;
  font-size:12px!important;
  font-weight:850!important;
  text-decoration:underline!important;
  text-underline-offset:3px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-more{
  order:9999!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  background:#f6fbfc!important;
  border:1px dashed #77a4b7!important;
  color:#17495f!important;
  cursor:pointer!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-more[hidden]{display:none!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-more strong{font-size:15px!important;text-align:center!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-more span{width:100%!important;text-align:center!important;}
body.fac-portal-shell-active #facLocationPanel .fac-location-empty{
  margin-top:12px!important;
  padding:15px!important;
  background:#fff!important;
  border:1px dashed #9cbac6!important;
  border-radius:11px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-empty[hidden]{display:none!important;}

/* ---------- Responsive transversal del Portal ---------- */
body.fac-portal-shell-active .fac-ap-embedded,
body.fac-portal-shell-active .fac-portal-widget,
body.fac-portal-shell-active .fac-ap-embedded *,
body.fac-portal-shell-active .fac-portal-widget *{box-sizing:border-box;min-width:0;}
body.fac-portal-shell-active .fac-ap-embedded,
body.fac-portal-shell-active .fac-portal-widget{width:100%!important;max-width:100%!important;overflow-x:hidden!important;}
@supports (overflow:clip){
  body.fac-portal-shell-active .fac-ap-embedded,
  body.fac-portal-shell-active .fac-portal-widget{overflow-x:clip!important;}
}
body.fac-portal-shell-active .fac-ap-embedded .fac-container,
body.fac-portal-shell-active .fac-portal-widget .fac-container{
  width:min(var(--fac-shell-max),calc(100% - 40px))!important;
  max-width:var(--fac-shell-max)!important;
  margin-left:auto!important;
  margin-right:auto!important;
}
body.fac-portal-shell-active img,
body.fac-portal-shell-active video,
body.fac-portal-shell-active iframe,
body.fac-portal-shell-active svg,
body.fac-portal-shell-active canvas{max-width:100%;}
body.fac-portal-shell-active .fac-ap-embedded img,
body.fac-portal-shell-active .fac-portal-widget img{height:auto;}

body.fac-portal-shell-active .fac-page-hero h1,
body.fac-portal-shell-active .fac-ap-embedded h1{
  max-width:100%!important;
  font-size:clamp(30px,4vw,46px)!important;
  line-height:1.08!important;
  overflow-wrap:anywhere!important;
}
body.fac-portal-shell-active .fac-ap-embedded h2,
body.fac-portal-shell-active .fac-portal-widget h2{
  max-width:100%!important;
  font-size:clamp(24px,2.8vw,31px)!important;
  line-height:1.14!important;
  overflow-wrap:anywhere!important;
}
body.fac-portal-shell-active .fac-photo-title,
body.fac-portal-shell-active .fac-entity-title,
body.fac-portal-shell-active .fac-linked-profile-copy,
body.fac-portal-shell-active .fac-meta-row dd,
body.fac-portal-shell-active .fac-public-profile-facts dd{overflow-wrap:anywhere!important;word-break:normal!important;}

body.fac-portal-shell-active .fac-photo-card{
  display:flex!important;
  flex-direction:column!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
}
body.fac-portal-shell-active .fac-photo-card .fac-photo-media{width:100%!important;max-width:100%!important;}
body.fac-portal-shell-active .fac-photo-card-body{
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  gap:7px!important;
  min-height:0!important;
  width:100%!important;
  padding:11px 12px 13px!important;
  background:#eef4f6!important;
  border-top:1px solid #d9e5e9!important;
}
body.fac-portal-shell-active .fac-photo-card-meta{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
  flex-wrap:wrap!important;
  width:100%!important;
  margin:0!important;
}
body.fac-portal-shell-active .fac-photo-chip{
  display:inline-flex!important;
  align-items:center!important;
  gap:4px!important;
  width:auto!important;
  max-width:100%!important;
  min-height:27px!important;
  margin:0!important;
  padding:4px 8px!important;
  border:1px solid #cfdee5!important;
  border-radius:999px!important;
  background:#fff!important;
  color:#31596c!important;
  font-size:12px!important;
  font-weight:850!important;
  line-height:1.15!important;
  white-space:normal!important;
}
body.fac-portal-shell-active .fac-photo-chip--location{
  background:#f7f2ea!important;
  border-color:#e2d5c2!important;
  color:#6b5232!important;
}
body.fac-portal-shell-active .fac-photo-title{
  width:100%!important;
  margin:0!important;
  font-size:16px!important;
  line-height:1.28!important;
  font-weight:800!important;
}
/* Cualquier resto de las tarjetas históricas queda neutralizado. */
body.fac-portal-shell-active .fac-photo-card>.fac-photo-year,
body.fac-portal-shell-active .fac-photo-card>.fac-photo-location,
body.fac-portal-shell-active .fac-photo-year-badge{display:none!important;}

/* Datos en la ficha individual: año y localidad se leen como chips, no como texto suelto. */
body.fac-portal-shell-active .fac-meta-kind-year dd,
body.fac-portal-shell-active .fac-meta-kind-location dd{display:flex!important;flex-wrap:wrap!important;gap:6px!important;}
body.fac-portal-shell-active .fac-meta-kind-year dd>a,
body.fac-portal-shell-active .fac-meta-kind-location dd>a,
body.fac-portal-shell-active .fac-meta-kind-year dd>.fac-data-chip,
body.fac-portal-shell-active .fac-meta-kind-location dd>.fac-data-chip{
  width:max-content!important;
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-meta-kind-year dd>a,
body.fac-portal-shell-active .fac-meta-kind-location dd>a{
  display:inline-flex!important;
  align-items:center!important;
  min-height:29px!important;
  padding:4px 9px!important;
  border:1px solid #cfdee5!important;
  border-radius:999px!important;
  background:#edf3f7!important;
  color:#31596c!important;
  text-decoration:none!important;
  font-size:13px!important;
  font-weight:800!important;
}
body.fac-portal-shell-active .fac-meta-kind-location dd>a{background:#f7f2ea!important;border-color:#e2d5c2!important;color:#6b5232!important;}

/* Navegaciones temporales y filtros: envolver, nunca ensanchar la página. */
body.fac-portal-shell-active .fac-period-nav,
body.fac-portal-shell-active .fac-archive-tabs,
body.fac-portal-shell-active .fac-chip-row,
body.fac-portal-shell-active .fac-context,
body.fac-portal-shell-active .fac-filter-actions,
body.fac-portal-shell-active .fac-toolbar,
body.fac-portal-shell-active .fac-toolbar-actions,
body.fac-portal-shell-active .fac-listing-actions{
  max-width:100%!important;
  flex-wrap:wrap!important;
  white-space:normal!important;
  overflow:visible!important;
}
body.fac-portal-shell-active .fac-period-nav{overflow-x:visible!important;}
body.fac-portal-shell-active .fac-period-nav>a,
body.fac-portal-shell-active .fac-period-group,
body.fac-portal-shell-active .fac-period-group a{flex:0 1 auto!important;}
body.fac-portal-shell-active .fac-filter-grid,
body.fac-portal-shell-active .fac-search-filters,
body.fac-portal-shell-active .fac-documentary-grid,
body.fac-portal-shell-active .fac-photo-grid,
body.fac-portal-shell-active .fac-people-grid,
body.fac-portal-shell-active .fac-fund-grid,
body.fac-portal-shell-active .fac-theme-grid,
body.fac-portal-shell-active .fac-widget-directory-grid{width:100%!important;max-width:100%!important;}

/* Tablas: si alguna necesita ancho extra, el scroll queda dentro de la tabla. */
body.fac-portal-shell-active .fac-table-wrap,
body.fac-portal-shell-active .fac-table-scroll{width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;}
body.fac-portal-shell-active .fac-ap-embedded table,
body.fac-portal-shell-active .fac-portal-widget table{max-width:100%!important;}

@media(max-width:1100px){
  body.fac-portal-shell-active .fac-public-header-inner{
    width:calc(100% - 28px)!important;
    min-height:72px!important;
    gap:12px!important;
  }
  body.fac-portal-shell-active .fac-public-brand img{height:54px!important;max-width:185px!important;}
  body.fac-portal-shell-active .fac-public-menu-toggle{display:flex!important;align-items:center!important;justify-content:center!important;}

  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal{
    position:fixed!important;
    top:var(--fac-mobile-nav-top,var(--fac-shell-top,72px))!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    z-index:99960!important;
    display:flex!important;
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    margin:0!important;
    padding:12px 14px calc(24px + env(safe-area-inset-bottom,0px))!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:2px!important;
    background:#fff!important;
    border:0!important;
    border-top:1px solid #e1e8ea!important;
    box-shadow:0 18px 35px rgba(17,45,58,.18)!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transform:translateY(-8px)!important;
    transition:opacity .16s ease,transform .16s ease,visibility .16s!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal.is-open{
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
    transform:translateY(0)!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>a,
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>.fac-public-nav-trigger{
    width:100%!important;
    min-height:46px!important;
    padding:11px 12px!important;
    white-space:normal!important;
    text-align:left!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>.fac-public-location{
    order:-100!important;
    width:100%!important;
    min-height:49px!important;
    margin:0 0 10px!important;
    padding:12px 13px!important;
    justify-content:flex-start!important;
    background:#f1f6f7!important;
    border:1px solid #d5e2e6!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>.fac-public-location::after{
    content:"Cambiar";
    margin-left:auto;
    color:#56717f;
    font-size:12px;
    font-weight:850;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal .fac-public-submenu{
    position:static!important;
    display:none!important;
    width:100%!important;
    min-width:0!important;
    margin:0 0 6px 12px!important;
    padding:3px 0 3px 10px!important;
    border:0!important;
    border-left:2px solid #e2e9eb!important;
    border-radius:0!important;
    box-shadow:none!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal .fac-public-nav-group.is-open>.fac-public-submenu{display:grid!important;}

  body.fac-portal-shell-active #facLocationPanel .fac-location-list{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.fac-portal-shell-active .fac-ap-embedded .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container{width:calc(100% - 28px)!important;}
  body.fac-portal-shell-active .fac-photo-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.fac-portal-shell-active .fac-people-grid,
  body.fac-portal-shell-active .fac-fund-grid,
  body.fac-portal-shell-active .fac-theme-grid,
  body.fac-portal-shell-active .fac-widget-directory-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  body.fac-portal-shell-active .fac-filter-grid,
  body.fac-portal-shell-active .fac-search-filters,
  body.fac-portal-shell-active .fac-documentary-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  body.fac-portal-shell-active .fac-photo-detail,
  body.fac-portal-shell-active .fac-info-layout,
  body.fac-portal-shell-active .fac-profile-layout,
  body.fac-portal-shell-active .fac-detail-layout,
  body.fac-portal-shell-active .fac-author-layout,
  body.fac-portal-shell-active .fac-fund-layout{grid-template-columns:minmax(0,1fr)!important;}
  body.fac-portal-shell-active .fac-detail-card{position:static!important;top:auto!important;}
}

@media(max-width:782px){
  body.admin-bar.fac-portal-shell-active .fac-public-header{top:46px!important;}
}

@media(max-width:700px){
  body.fac-portal-shell-active .fac-public-header-inner{width:calc(100% - 24px)!important;min-height:66px!important;}
  body.fac-portal-shell-active .fac-public-brand img{height:47px!important;max-width:154px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container{width:calc(100% - 24px)!important;padding:14px 0 18px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head{gap:10px!important;margin-bottom:11px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head h2{font-size:23px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-head p:not(.fac-location-kicker){font-size:14px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-list{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-choice{min-height:72px!important;padding:10px 11px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-choice strong{font-size:14px!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-choice span{font-size:12px!important;}

  body.fac-portal-shell-active .fac-ap-embedded .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container{width:calc(100% - 24px)!important;}
  body.fac-portal-shell-active .fac-page-hero h1,
  body.fac-portal-shell-active .fac-ap-embedded h1{font-size:clamp(28px,8vw,37px)!important;}
  body.fac-portal-shell-active .fac-ap-embedded h2,
  body.fac-portal-shell-active .fac-portal-widget h2{font-size:clamp(22px,6.5vw,29px)!important;}

  body.fac-portal-shell-active .fac-search,
  body.fac-portal-shell-active .fac-search-row,
  body.fac-portal-shell-active .fac-filter-grid,
  body.fac-portal-shell-active .fac-search-filters,
  body.fac-portal-shell-active .fac-documentary-grid,
  body.fac-portal-shell-active .fac-form-grid{grid-template-columns:minmax(0,1fr)!important;width:100%!important;}
  body.fac-portal-shell-active .fac-field input,
  body.fac-portal-shell-active .fac-field select,
  body.fac-portal-shell-active .fac-field textarea,
  body.fac-portal-shell-active .fac-searchbox{width:100%!important;min-width:0!important;max-width:100%!important;}
  body.fac-portal-shell-active .fac-photo-grid,
  body.fac-portal-shell-active .fac-home-photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px 10px!important;}
  body.fac-portal-shell-active .fac-people-grid,
  body.fac-portal-shell-active .fac-fund-grid,
  body.fac-portal-shell-active .fac-theme-grid,
  body.fac-portal-shell-active .fac-widget-directory-grid,
  body.fac-portal-shell-active .fac-topic-grid{grid-template-columns:minmax(0,1fr)!important;}
  body.fac-portal-shell-active .fac-photo-card-body{padding:9px 10px 11px!important;gap:6px!important;}
  body.fac-portal-shell-active .fac-photo-title{font-size:14.5px!important;line-height:1.25!important;}
  body.fac-portal-shell-active .fac-photo-chip{min-height:24px!important;padding:3px 7px!important;font-size:11px!important;}
  body.fac-portal-shell-active .fac-meta-row{grid-template-columns:minmax(92px,.78fr) minmax(0,1.22fr)!important;gap:9px!important;}
  body.fac-portal-shell-active .fac-linked-profile{max-width:100%!important;}
  body.fac-portal-shell-active .fac-breadcrumbs{white-space:normal!important;overflow:visible!important;flex-wrap:wrap!important;}
}

@media(max-width:420px){
  body.fac-portal-shell-active .fac-public-header-inner{width:calc(100% - 20px)!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container,
  body.fac-portal-shell-active .fac-ap-embedded .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container{width:calc(100% - 20px)!important;}
  body.fac-portal-shell-active #facLocationPanel .fac-location-list{grid-template-columns:1fr!important;}
  body.fac-portal-shell-active .fac-meta-row{grid-template-columns:1fr!important;gap:3px!important;}
  body.fac-portal-shell-active .fac-meta-row dt{margin-bottom:0!important;}
  body.fac-portal-shell-active .fac-photo-grid,
  body.fac-portal-shell-active .fac-home-photo-grid{gap:9px!important;}
}

@media(prefers-reduced-motion:reduce){
  body.fac-portal-shell-active #facLocationPanel,
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal{transition:none!important;scroll-behavior:auto!important;}
}


/* ---------- preview156 · navegación por estado + búsqueda y fichas responsive ---------- */
body.fac-portal-shell-active .fac-public-nav-trigger{
  -webkit-appearance:none!important;
  appearance:none!important;
  border:0!important;
  box-shadow:none!important;
}
body.fac-portal-shell-active .fac-public-submenu[aria-hidden="true"]{display:none!important;}
body.fac-portal-shell-active .fac-public-nav-group.is-open>.fac-public-submenu[aria-hidden="false"]{display:grid!important;}
body.fac-portal-shell-active .fac-public-submenu::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:-7px;
  height:7px;
}
body.fac-portal-shell-active .fac-public-submenu a{
  position:relative!important;
  z-index:1!important;
  min-height:42px!important;
  display:flex!important;
  align-items:center!important;
}

/* El contenido nunca debe quedar por encima de menús/desplegables FAC. */
body.fac-portal-shell-active .fac-public-header{z-index:99980!important;overflow:visible!important;}
body.fac-portal-shell-active .fac-public-header-inner,
body.fac-portal-shell-active .fac-public-nav,
body.fac-portal-shell-active .fac-public-nav-group{overflow:visible!important;}

/* Selector territorial: siempre por encima de la página y con scroll propio. */
body.fac-portal-shell-active #facLocationPanel.fac-location-drawer--global{
  z-index:99970!important;
  isolation:isolate!important;
  contain:layout paint!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-more{
  position:relative!important;
  z-index:2!important;
}

/* Buscar / Fotos: estructura compacta y sin anchos heredados de Enfold. */
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="buscar"] .fac-page-hero,
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="fotos"] .fac-page-hero{
  padding-top:26px!important;
  padding-bottom:22px!important;
}
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="buscar"] .fac-photos-section,
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="fotos"] .fac-photos-section{
  padding-top:24px!important;
}
body.fac-portal-shell-active .fac-photo-search-block,
body.fac-portal-shell-active .fac-photo-search,
body.fac-portal-shell-active .fac-results-bar,
body.fac-portal-shell-active .fac-results-context,
body.fac-portal-shell-active .fac-results-actions,
body.fac-portal-shell-active .fac-photo-filter-panel,
body.fac-portal-shell-active .fac-photo-filter-form,
body.fac-portal-shell-active .fac-filter-grid,
body.fac-portal-shell-active .fac-predictive-field{
  min-width:0!important;
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-photo-search{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:stretch!important;
  gap:10px!important;
  width:100%!important;
}
body.fac-portal-shell-active .fac-photo-search .fac-searchbox{
  width:100%!important;
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-photo-filter-panel--compact{
  width:100%!important;
  margin:14px 0 0!important;
  padding:17px!important;
  overflow:visible!important;
}
body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-main{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-advanced{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
body.fac-portal-shell-active .fac-predictive-field:focus-within{z-index:120!important;}
body.fac-portal-shell-active .fac-predictive-menu{
  z-index:140!important;
  left:0!important;
  right:0!important;
  width:auto!important;
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-predictive-menu[hidden],
body.fac-portal-shell-active .fac-predictive-menu [hidden]{display:none!important;}
body.fac-portal-shell-active .fac-advanced-filters{max-width:100%!important;}
body.fac-portal-shell-active .fac-advanced-filters>summary{
  min-height:44px!important;
  display:flex!important;
  align-items:center!important;
  width:100%!important;
  cursor:pointer!important;
  overflow-wrap:anywhere!important;
}

/* Ficha de fotografía: menos vacío entre la cabecera documental y la imagen. */
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="foto"] .fac-photo-hero + .fac-section{
  padding-top:28px!important;
}
body.fac-portal-shell-active .fac-photo-card-meta{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:6px!important;
  min-width:0!important;
}
body.fac-portal-shell-active .fac-photo-chip{
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

@media(max-width:1100px){
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>.fac-public-nav-group>.fac-public-nav-trigger{
    width:100%!important;
    min-height:46px!important;
    padding:11px 12px!important;
    justify-content:flex-start!important;
    text-align:left!important;
    white-space:normal!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal>.fac-public-nav-group>.fac-public-nav-trigger>span[aria-hidden="true"]{
    margin-left:auto!important;
  }
  body.fac-portal-shell-active>.fac-public-nav.fac-public-nav--portal .fac-public-submenu{
    top:auto!important;
    margin:0 0 6px 12px!important;
  }
  body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-main,
  body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-advanced{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:700px){
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="buscar"] .fac-page-hero,
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="fotos"] .fac-page-hero{
    padding-top:18px!important;
    padding-bottom:17px!important;
  }
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="buscar"] .fac-page-hero h1,
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="fotos"] .fac-page-hero h1{
    font-size:clamp(28px,8.5vw,36px)!important;
    line-height:1.08!important;
  }
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="buscar"] .fac-photos-section,
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="fotos"] .fac-photos-section{
    padding-top:18px!important;
  }
  body.fac-portal-shell-active .fac-photo-search{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.fac-portal-shell-active .fac-photo-search .fac-btn{width:100%!important;}
  body.fac-portal-shell-active .fac-results-bar{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:12px!important;
  }
  body.fac-portal-shell-active .fac-results-actions{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;
  }
  body.fac-portal-shell-active .fac-results-actions>*{width:100%!important;max-width:100%!important;}
  body.fac-portal-shell-active .fac-results-actions .fac-sort-control{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    align-items:center!important;
    gap:8px!important;
  }
  body.fac-portal-shell-active .fac-results-actions .fac-select{width:100%!important;min-width:0!important;}
  body.fac-portal-shell-active .fac-photo-filter-panel--compact{
    padding:13px 12px!important;
    border-radius:12px!important;
  }
  body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-main,
  body.fac-portal-shell-active .fac-photo-filter-panel--compact .fac-filter-grid-advanced{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.fac-portal-shell-active .fac-archive-tabs{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:7px!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:1px 0 7px!important;
    -webkit-overflow-scrolling:touch!important;
    scrollbar-width:thin!important;
  }
  body.fac-portal-shell-active .fac-archive-tabs a{
    flex:0 0 auto!important;
    min-width:max-content!important;
    white-space:nowrap!important;
  }
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page="foto"] .fac-photo-hero + .fac-section{
    padding-top:18px!important;
  }
  body.fac-portal-shell-active .fac-photo-chip{
    font-size:11.5px!important;
    min-height:24px!important;
    padding:3px 7px!important;
  }
}

@media(max-width:420px){
  body.fac-portal-shell-active .fac-photo-card-meta{gap:5px!important;}
  body.fac-portal-shell-active .fac-photo-chip--location{max-width:100%!important;}
}


/* ---------- preview159 · integridad móvil transversal + solapes de cabecera ----------
   Esta capa no modifica el contenido ni la administración de pop-ups/banners.
   Solo garantiza que cualquier componente público del Portal respete el viewport
   y que los overlays nazcan por debajo de la altura real de la cabecera FAC. */
body.fac-portal-shell-active{
  --fac-safe-inline:20px;
}

/* El selector territorial puede ser administrado desde otro entorno, pero su
   superficie visual comparte este shell. No debe conservar scroll ni quedar
   oculto bajo la cabecera. */
body.fac-portal-shell-active #facLocationPanel.fac-location-drawer--global{
  top:var(--fac-location-top,var(--fac-shell-top,79px))!important;
  scroll-padding-top:18px!important;
}
body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container{
  padding-top:20px!important;
}

/* No esconder un desbordamiento real: primero hacemos fluidos todos los nodos
   estructurales que históricamente podían imponer ancho en páginas distintas. */
body.fac-portal-shell-active :is(
  #wrap_all,#main,.container_wrap,.avia-section,.content,
  .fac-ap-embedded,.fac-portal-widget,
  .fac-page-hero,.fac-section,.fac-public-archive-hero,
  .fac-public-archive-intro,.fac-public-archive-copy,
  .fac-info-layout,.fac-action-grid,.fac-footer-grid,.fac-contribute,
  .fac-directory-toolbar,.fac-listing-toolbar,.fac-results-bar,.fac-results-actions,
  .fac-photo-search,.fac-photo-filter-form,.fac-filter-grid,
  .fac-profile-layout,.fac-detail-layout,.fac-author-layout,.fac-fund-layout,
  .fac-linked-profiles,.fac-linked-profile,.fac-suggestion-panel,.fac-suggestion-form,
  .fac-history-current,.fac-history-proposal,.fac-rich-editor,
  .fac-pagination,.fac-pagination-readable,.fac-period-nav,.fac-archive-tabs,
  .fac-gallery-stage,.fac-gallery-original-layout,.fac-gallery-mainrow,.fac-gallery-data
){
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

/* Evitar 100vw dentro de contenedores/columnas Enfold. El ancho se calcula
   respecto al padre real, no respecto al viewport más scrollbar. */
body.fac-portal-shell-active .fac-ap-embedded[data-fac-page] .fac-container,
body.fac-portal-shell-active .fac-portal-widget .fac-container{
  width:min(var(--fac-shell-max),calc(100% - 40px))!important;
  max-width:var(--fac-shell-max)!important;
  margin-left:auto!important;
  margin-right:auto!important;
  transform:none!important;
}

/* Elementos de contenido que suelen provocar recortes por palabras largas,
   URLs, cifras o controles heredados. */
body.fac-portal-shell-active .fac-ap-embedded :is(h1,h2,h3,h4,p,li,dt,dd,a,strong,span,label,summary),
body.fac-portal-shell-active .fac-portal-widget :is(h1,h2,h3,h4,p,li,dt,dd,a,strong,span,label,summary){
  max-width:100%;
  overflow-wrap:anywhere;
}
body.fac-portal-shell-active .fac-ap-embedded :is(input,select,textarea,button),
body.fac-portal-shell-active .fac-portal-widget :is(input,select,textarea,button){
  min-width:0!important;
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-ap-embedded :is(img,picture,video,iframe,svg,canvas,.wp-caption),
body.fac-portal-shell-active .fac-portal-widget :is(img,picture,video,iframe,svg,canvas,.wp-caption){
  max-width:100%!important;
}
body.fac-portal-shell-active .fac-ap-embedded :is(.fac-data-chip,.fac-tag-chip,.fac-chip,.fac-photo-chip),
body.fac-portal-shell-active .fac-portal-widget :is(.fac-data-chip,.fac-tag-chip,.fac-chip,.fac-photo-chip){
  min-width:0!important;
  max-width:100%!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}

/* Cualquier rejilla del Portal debe permitir que sus columnas encojan. */
body.fac-portal-shell-active .fac-ap-embedded :is(
  .fac-quick-grid,.fac-photo-grid,.fac-home-photo-grid,.fac-archive-photo-grid,
  .fac-people-grid,.fac-fund-grid,.fac-theme-grid,.fac-topic-grid,
  .fac-directory-grid,.fac-widget-directory-grid,.fac-action-grid,
  .fac-filter-grid,.fac-filter-grid-main,.fac-filter-grid-advanced,.fac-mini-grid
)>*,
body.fac-portal-shell-active .fac-portal-widget :is(
  .fac-quick-grid,.fac-photo-grid,.fac-home-photo-grid,.fac-archive-photo-grid,
  .fac-people-grid,.fac-fund-grid,.fac-theme-grid,.fac-topic-grid,
  .fac-directory-grid,.fac-widget-directory-grid,.fac-action-grid
)>*{
  min-width:0!important;
  max-width:100%!important;
}

/* La primera pieza de contenido no puede usar compensaciones negativas de la
   antigua cabecera de Enfold. No tocamos transformaciones internas de sliders. */
body#top.fac-portal-shell-active #main > :first-child{
  margin-top:0!important;
  top:auto!important;
}

@media(max-width:989px){
  body.fac-portal-shell-active{--fac-safe-inline:14px;}
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page] .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container{
    width:calc(100% - 28px)!important;
    max-width:calc(100% - 28px)!important;
  }
  body.fac-portal-shell-active :is(.fac-info-layout,.fac-action-grid,.fac-photo-detail,.fac-profile-layout,.fac-detail-layout,.fac-author-layout,.fac-fund-layout){
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.fac-portal-shell-active :is(.fac-contribute,.fac-directory-toolbar,.fac-listing-toolbar,.fac-results-bar,.fac-results-actions,.fac-photo-hero-meta){
    flex-wrap:wrap!important;
    min-width:0!important;
  }
}

@media(max-width:767px){
  body.fac-portal-shell-active{--fac-safe-inline:12px;}

  body.fac-portal-shell-active #main,
  body.fac-portal-shell-active #main > .container_wrap,
  body.fac-portal-shell-active #main > .avia-section{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page],
  body.fac-portal-shell-active .fac-portal-widget{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin-left:0!important;
    margin-right:0!important;
    transform:none!important;
  }
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page] .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container{
    width:calc(100% - 24px)!important;
    max-width:calc(100% - 24px)!important;
    margin-left:auto!important;
    margin-right:auto!important;
    padding-left:0!important;
    padding-right:0!important;
  }

  /* Cabeceras, herramientas y acciones: nunca una fila rígida en móvil. */
  body.fac-portal-shell-active :is(
    .fac-section-head,.fac-results-head,.fac-directory-toolbar,.fac-listing-toolbar,
    .fac-results-bar,.fac-results-actions,.fac-filter-actions,.fac-context,
    .fac-photo-hero-meta,.fac-entity-meta,.fac-suggestion-head,.fac-gallery-topline
  ){
    min-width:0!important;
    max-width:100%!important;
    flex-wrap:wrap!important;
  }
  body.fac-portal-shell-active :is(.fac-directory-toolbar,.fac-listing-toolbar,.fac-results-bar){
    align-items:stretch!important;
  }
  body.fac-portal-shell-active :is(.fac-results-actions,.fac-filter-actions){
    width:100%!important;
  }

  /* Formularios y buscadores: una columna real y controles fluidos. */
  body.fac-portal-shell-active :is(
    .fac-search,.fac-search-row,.fac-photo-search,.fac-filter-grid,.fac-filter-grid-main,
    .fac-filter-grid-advanced,.fac-search-filters,.fac-documentary-grid,.fac-form-grid,
    .fac-mini-grid,.fac-upload-proposal-grid
  ){
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;
    max-width:100%!important;
  }
  body.fac-portal-shell-active :is(.fac-field,.fac-predictive-field,.fac-searchbox,.fac-select){
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
  body.fac-portal-shell-active :is(.fac-field input,.fac-field select,.fac-field textarea,.fac-searchbox input,.fac-predictive-control,.fac-select){
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }

  /* Páginas informativas / Asociación / Participa: el lateral baja debajo. */
  body.fac-portal-shell-active :is(.fac-info-layout,.fac-action-grid,.fac-footer-grid){
    grid-template-columns:minmax(0,1fr)!important;
    gap:16px!important;
  }
  body.fac-portal-shell-active .fac-contribute{
    flex-direction:column!important;
    align-items:stretch!important;
    gap:14px!important;
  }
  body.fac-portal-shell-active .fac-contribute .fac-btn{width:100%!important;}

  /* Perfiles y fichas: nada puede mantener una columna lateral fija. */
  body.fac-portal-shell-active .fac-public-archive-intro.is-profile:not(.is-autor){
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.fac-portal-shell-active .fac-public-archive-intro.is-profile:not(.is-autor) .fac-public-profile-image{
    width:min(190px,52vw)!important;
    max-width:190px!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }
  body.fac-portal-shell-active .fac-public-profile-facts{
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;
  }
  body.fac-portal-shell-active .fac-meta-row{
    min-width:0!important;
  }

  /* Navegaciones largas: el desplazamiento se queda dentro del control. */
  body.fac-portal-shell-active :is(.fac-archive-tabs,.fac-period-nav,.fac-taxonomy-nav,.fac-filter-chips){
    max-width:100%!important;
  }
  body.fac-portal-shell-active .fac-archive-tabs{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    overscroll-behavior-inline:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.fac-portal-shell-active .fac-archive-tabs>a{flex:0 0 auto!important;white-space:nowrap!important;}
  body.fac-portal-shell-active .fac-period-nav{flex-wrap:wrap!important;}

  /* Tablas: si hay más columnas, solo ellas desplazan; nunca el documento. */
  body.fac-portal-shell-active .fac-ap-embedded table,
  body.fac-portal-shell-active .fac-portal-widget table{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* Botones/enlaces largos no fuerzan el viewport. */
  body.fac-portal-shell-active .fac-ap-embedded :is(.fac-btn,.fac-button,button),
  body.fac-portal-shell-active .fac-portal-widget :is(.fac-btn,.fac-button,button){
    min-width:0!important;
    max-width:100%!important;
    white-space:normal!important;
  }

  /* El drawer territorial usa margen seguro respecto a la pantalla y siempre
     empieza mostrando su cabecera, aunque antes se haya hecho scroll interno. */
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container{
    width:calc(100% - 24px)!important;
    max-width:calc(100% - 24px)!important;
    padding-top:16px!important;
  }
}

@media(max-width:420px){
  body.fac-portal-shell-active .fac-ap-embedded[data-fac-page] .fac-container,
  body.fac-portal-shell-active .fac-portal-widget .fac-container,
  body.fac-portal-shell-active #facLocationPanel .fac-location-drawer-inner.fac-container{
    width:calc(100% - 20px)!important;
    max-width:calc(100% - 20px)!important;
  }
  body.fac-portal-shell-active .fac-page-hero h1,
  body.fac-portal-shell-active .fac-ap-embedded h1{
    font-size:clamp(27px,8.6vw,35px)!important;
    line-height:1.08!important;
    letter-spacing:-.02em!important;
  }
  body.fac-portal-shell-active .fac-public-profile-facts>div{
    min-width:0!important;
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.fac-portal-shell-active .fac-pagination-readable{
    gap:8px!important;
  }
  body.fac-portal-shell-active .fac-page-nav{
    min-width:0!important;
    max-width:100%!important;
  }
}
