/* ==================================================================
   CABECERAS — Carlos D. Perales
   El título de la página queda a caballo entre la imagen y el papel.
   Con «difference» se ve blanco sobre lo oscuro y negro sobre lo claro.
   ================================================================== */
/* Savoy con rutas relativas: así carga igual en el servidor que abriendo
   los archivos desde el ordenador (site.css usa rutas que solo valen online) */
@font-face{
  font-family: "Savoy-Regular";
  src: url("../fonts/Savoy-Regular.woff2") format("woff2"),
       url("../fonts/Savoy-Regular.woff") format("woff"),
       url("../fonts/Savoy-Regular.ttf") format("truetype");
  font-display: swap;
}

/* Títulos grandes: Sofia Sans Extra Condensed (fina). Fuente libre (OFL), en fonts/ */
@font-face{
  font-family: "Sofia Titulos";
  src: url("../fonts/SofiaSansExtraCondensed-200.woff2") format("woff2");
  font-weight: 200; font-display: swap;
}
@font-face{
  font-family: "Sofia Titulos";
  src: url("../fonts/SofiaSansExtraCondensed-200-ext.woff2") format("woff2");
  font-weight: 200; font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root{
  --alto-cabecera: 520px;
  --titulo-grande: clamp(40px, 4.6vw, 70px);
  --subida: 150px;
}

/* La imagen nace nítida por arriba y se disuelve en el papel por abajo */
.img-category,
.portada{
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 52%, rgba(0,0,0,.35) 82%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 52%, rgba(0,0,0,.35) 82%, transparent 100%);
}

/* En la portada (fotos con fondo negro) el fundido de abajo es más largo */
@media (min-width: 769px){
  .portada{
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 55%, rgba(0,0,0,.35) 84%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 0, #000 55%, rgba(0,0,0,.35) 84%, transparent 100%);
  }
}

/* Nombre y menú de arriba: superpuestos al papel, sin barra fija */
@media (min-width: 769px){
  header{ position: absolute; background: transparent; min-height: 0; }
  header .title,
  header .title a{ color: #4a4a48; }
  header .menu-principal li a{ color: #4a4a48; }
  header .menu-principal li a:hover{ color: #a3201b; background: none; }
  .img-category{ margin-top: 0; }
}

/* Sin el fundido de arriba, entre 769 y 1099 px el nombre y el menú
   necesitan una franja opaca del color del papel para poder leerse.
   La imagen queda nítida justo debajo de la franja, sin degradado. */
@media (min-width: 769px) and (max-width: 1099px){
  header{ background: #fff; }
}

/* Imagen de cabecera de cada página */
.img-category{
  float: none; clear: both;
  height: var(--alto-cabecera);
  background-position: center 40%;
}

/* El título va DENTRO de la imagen, discreto: blanco algo translúcido.
   --subida: cuánto se mete en la imagen; --titulo-grande: su tamaño. */
.titulo-cabecera{
  position: relative; top: calc(var(--subida) * -1);
  margin: calc(var(--titulo-grande) * -1) 0 0 !important;
  font-family: "Sofia Titulos", "Arial Narrow", sans-serif; font-weight: 200;
  font-size: var(--titulo-grande) !important; line-height: 1 !important;
  letter-spacing: .02em;
  color: rgba(255,255,255,.88) !important;
  text-shadow: 0 1px 18px rgba(0,0,0,.28);
}
/* Color del título según la imagen de cada página (si cambias una foto,
   ajusta aquí): blanco en las oscuras, gris translúcido en las claras. */
html[data-seccion="agenda"] .titulo-cabecera{ text-shadow: 0 0 16px rgba(0,0,0,.75), 0 0 4px rgba(0,0,0,.5); }
html[data-seccion="publicaciones"] .titulo-cabecera{ color: rgba(40,36,32,.62) !important; text-shadow: none; }

/* ---------- Portada (inicio) ---------- */
.portada{
  position: relative; clear: both;
  height: 82vh; min-height: 480px; max-height: 860px;
  margin-top: -50px;              /* empieza arriba del todo (el body tiene 50px) */
  background: #000; overflow: hidden;
}
.portada-img{
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  opacity: 0; transition: opacity 2.4s ease;
}
.portada-img.activa{ opacity: 1; }

@media (prefers-reduced-motion: reduce){ .portada-img{ transition: none; } }

@media (max-width: 768px){
  :root{ --alto-cabecera: 260px; --titulo-grande: 38px; --subida: 70px; }
  .portada{ margin-top: 0; height: 56vh; min-height: 300px; }
  .img-category,
  .portada{
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 50%, rgba(0,0,0,.35) 82%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 0, #000 50%, rgba(0,0,0,.35) 82%, transparent 100%);
  }
}

/* ---------- Banda anclada al bajar (la monta js/cabecera.js) ---------- */
.anclaje{
  position: fixed; top: 0; left: 0; right: 0; z-index: 1040;
  transform: translateY(-100%); visibility: hidden;
  transition: transform .35s ease, visibility 0s linear .35s;
}
.anclaje.visible{
  transform: none; visibility: visible;
  transition: transform .35s ease, visibility 0s;
}
.anclaje-fila{ background: #fff; }
.anclaje-fila .container{ padding-top: 0; padding-bottom: 0; }   /* site.css le pone 50px abajo */
.anclaje-fila .col-xs-12{
  display: flex; align-items: baseline; gap: 28px;
  min-height: 58px; padding-top: 18px;
}
.anclaje-nombre{
  font-family: "Savoy-Regular", Georgia, serif; font-size: 13px;
  letter-spacing: .15em; text-transform: uppercase;
  color: #8a8a86 !important; text-decoration: none !important; white-space: nowrap;
}
.anclaje-titulo{
  font-family: "Sofia Titulos", "Arial Narrow", sans-serif; font-weight: 200; font-size: 26px; line-height: 1;
  color: #1d1d1b;
}
.anclaje-menu{ margin-left: auto; display: flex; gap: 22px; }
.anclaje-menu a{
  font-family: "Savoy-Regular", Georgia, serif; font-size: 12px;
  letter-spacing: 3px; text-transform: uppercase;
  color: #8a8a86 !important; text-decoration: none !important;
}
.anclaje-menu a:hover{ color: #a3201b !important; }
@media (prefers-reduced-motion: reduce){ .anclaje, .anclaje.visible{ transition: none; } }

@media (max-width: 768px){
  .anclaje{ top: 50px; z-index: 1020; }     /* bajo la barra del móvil */
  .anclaje-nombre, .anclaje-menu{ display: none; }
  .anclaje-fila .col-xs-12{ min-height: 44px; padding-top: 12px; }
  .anclaje-titulo{ font-size: 19px; }
}
/* en el móvil, la portada no necesita banda (la barra ya lleva el nombre) */
@media (max-width: 768px){ .anclaje-portada{ display: none; } }

/* ==================================================================
   PANEL LATERAL — solo en pantallas anchas (lo monta js/cabecera.js)
   ================================================================== */
.panel{ display: none; }
@media (min-width: 1100px){
  :root{ --ancho-panel: 250px; --arriba: 48px; }
  html.con-panel body{ padding-left: var(--ancho-panel); }
  html.con-panel header,
  html.con-panel .anclaje{ display: none !important; }   /* el panel los sustituye */
  /* el contenido arranca pegado al panel: años y menú forman un solo eje a la izquierda */
  html.con-panel .container{ width: auto; max-width: 1170px; margin-left: 0; padding-left: 40px; }
  html.con-panel .col-lg-offset-1{ margin-left: 0; }
  /* en agenda y publicaciones las fichas usan todo el ancho disponible */
  html.con-panel .col-lg-9:has(.fichas){ width: 100%; }
  html.con-panel .portada{ margin-top: -50px; }

  .panel{
    display: flex; flex-direction: column; justify-content: center;
    position: fixed; z-index: 1040;
    top: 0; left: 0; bottom: 0; width: var(--ancho-panel); margin: 0;
    padding: 0 20px 0 40px; box-sizing: border-box;
    background: var(--fondo-panel, #f5f5f4);
    transition: background-color .4s ease;
  }
  /* un tono casi imperceptible para cada sección */
  html[data-seccion="inicio"]        { --fondo-panel: #f5f5f4; }
  html[data-seccion="agenda"]        { --fondo-panel: #f3f2f0; }
  html[data-seccion="catalogo"]      { --fondo-panel: #f0f2f1; }
  html[data-seccion="publicaciones"] { --fondo-panel: #f3f2f4; }
  .panel a{ text-decoration: none !important; }

  /* nombre: arriba, protagonista, en dos líneas muy espaciadas */
  .panel-nombre{
    position: absolute; top: 13vh; left: 40px; right: 12px;
    font-family: "Savoy-Regular", Georgia, serif; font-size: 18px; line-height: 1;
    letter-spacing: .3em; text-transform: uppercase; color: #1d1d1b !important;
  }
  .panel-nombre span{ display: block; width: max-content; white-space: nowrap; letter-spacing: 6px; }
  .panel-nombre span + span{ margin-top: 20px; }

  /* menú: bloque compacto a media altura */
  .panel-menu{
    position: absolute; top: 47vh; left: 40px; right: 16px;
    display: flex; flex-direction: column; gap: 13px;
  }
  .panel-item > a{
    display: block;
    font-family: "Savoy-Regular", Georgia, serif; font-size: 16.5px; line-height: 1.2;
    color: #5f5f5c !important;
  }
  .panel-item > a:hover{ color: #a3201b !important; }
  .panel-item > a.actual{ color: #1d1d1b !important; }
  .panel-item > a{ position: relative; }
  .panel-item > a.actual::before{ content: "—"; position: absolute; right: calc(100% + 8px); color: #a3201b; }

  .panel-sub{ margin: 8px 0 4px 0; }
  .panel-sub a{
    display: block; margin-bottom: 5px;
    font-family: "Savoy-Regular", Georgia, serif; font-size: 13.5px; color: #8a8a86 !important;
  }
  .panel-sub a:hover{ color: #a3201b !important; }
  .panel-sub a.actual{ color: #1d1d1b !important; }
  /* épocas dentro de cada categoría de Publicaciones: solo se abren las de la categoría activa */
  .panel-epocas{ display: none; margin: 2px 0 8px 14px; }
  .panel-epocas.abierta{ display: block; }
  .panel-epocas a{ font-size: 12.5px !important; margin-bottom: 3px !important; }

  .panel a:focus{ outline: none; }
  .panel a:focus-visible{ outline: 1px solid #a3201b; outline-offset: 3px; }
}
html{ scroll-behavior: smooth; }
.seccion-pub-titulo, .anyo{ scroll-margin-top: 40px; }
@media (max-width: 1099px){ .seccion-pub-titulo{ scroll-margin-top: 120px; } }
@media (prefers-reduced-motion: reduce){ html{ scroll-behavior: auto; } }

/* ==================================================================
   INICIO: biografía y contacto con el mismo esquema que años + contenido
   ================================================================== */
.bio{
  display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 32px;
  margin: 8px 0 72px;
  scroll-margin-top: 90px;   /* el ancla #bio (viejas bio.html) no queda bajo la cabecera fija */
}
.bio-lateral{ position: sticky; top: 48px; align-self: start; }
.agenda-article p.bio-lugar, .agenda-article p.bio-etiqueta, .bio-etiqueta{
  margin: 0; font-family: "Savoy-Regular", Georgia, serif;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #8a8a86;
}
.agenda-article p.bio-anyo{
  padding: 0; text-align: left; letter-spacing: 0;
  margin: 6px 0 28px; font-family: "Savoy-Regular", Georgia, serif;
  font-size: 46px; line-height: 1; color: #c9c8c3; font-variant-numeric: lining-nums;
}
/* idiomas: texto con subrayado fino, como las pestañas del catálogo */
.bio-idiomas{ display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border: 0; background: none; overflow: visible; }
.bio-idiomas button{
  float: none; padding: 0; border: 0; background: none !important; cursor: pointer;
  font-family: "Savoy-Regular", Georgia, serif; font-size: 14px; color: #8a8a86;
}
.bio-idiomas button:hover{ color: #1d1d1b; }
.bio-idiomas button.active{
  color: #1d1d1b; text-decoration: underline; text-decoration-color: #a3201b;
  text-decoration-thickness: 1px; text-underline-offset: 6px;
}
.bio-texto{ max-width: 600px; }
.bio-texto .tabcontent{ border: 0; padding: 0; }
.agenda-article .bio-texto p{
  margin: 0 0 1.1em; padding: 0; text-align: left; hyphens: manual;
  font-family: "Savoy-Regular", Georgia, serif; font-size: 15.5px; line-height: 1.6; color: #4a4a48;
}
.bio-texto a{ color: #1d1d1b; text-decoration: underline; text-decoration-color: #c9c8c3; text-underline-offset: 3px; }
.bio-texto a:hover{ color: #a3201b; }
.bio-texto a:not([href]){ color: inherit; text-decoration: none; }
.bio-contacto .bio-lateral{ padding-top: 4px; }
.agenda-article .bio-texto p.bio-correo{ margin-bottom: 14px; color: #1d1d1b; }
.bio-redes{ display: flex; flex-wrap: wrap; gap: 8px 26px; }
.bio-redes a{ font-family: "Savoy-Regular", Georgia, serif; font-size: 14px; color: #4a4a48; text-decoration: none; }
@media (max-width: 768px){
  .bio{ grid-template-columns: 1fr; row-gap: 20px; margin-bottom: 48px; }
  .bio-lateral{ position: static; }
  .agenda-article p.bio-anyo{ font-size: 38px; margin-bottom: 18px; }
  .bio-idiomas{ flex-direction: row; gap: 22px; }
  .agenda-article .bio-texto p{ font-size: 15px; }
}

/* ==================================================================
   PIE DE PÁGINA (todas las páginas)
   ================================================================== */
.pie{
  clear: both; margin-top: 96px;
  background: var(--fondo-panel, #f5f5f4);
  color: #8a8a86; font-family: "Savoy-Regular", Georgia, serif;
}
.pie-dentro{
  max-width: 1170px; box-sizing: border-box;
  padding: 44px 40px 48px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 18px;
}
.pie-redes{ display: flex; gap: 22px; align-items: center; }
.pie-redes a{ display: inline-flex; color: #8a8a86; transition: color .2s ease; }
.pie-redes a:hover, .pie-redes a:focus-visible{ color: #a3201b; }
.pie-redes svg{ width: 19px; height: 19px; fill: currentColor; }
.pie-redes .pie-correo svg{ width: 22px; height: 22px; fill: none; }
.pie-legal{ margin: 0; display: flex; gap: 22px; justify-self: end; font-size: 13px; }
.pie-legal a{ color: #8a8a86; text-decoration: none; }
.pie-legal a:hover{ color: #1d1d1b; }
.pie-copy{ grid-column: 1 / -1; margin: 0; font-size: 12px; color: #a5a5a0; }
@media (max-width: 768px){
  .pie{ margin-top: 64px; }
  .pie-dentro{ grid-template-columns: 1fr; padding: 36px 15px 40px; }
  .pie-legal{ justify-self: start; flex-wrap: wrap; }
}

/* ==================================================================
   PÁGINAS LEGALES (privacidad, aviso legal, cookies)
   ================================================================== */
.pagina-legal .container.agenda{ padding-top: 40px; }
@media (min-width: 1100px){ .pagina-legal .container.agenda{ padding-top: 0; } }
.pagina-legal h1.title-article{
  font-family: "Sofia Titulos", "Arial Narrow", sans-serif; font-weight: 200;
  font-size: 46px; line-height: 1.15; color: #1d1d1b; margin: 0 0 28px;
}
.pagina-legal .agenda-article p{ max-width: 680px; text-align: left; font-size: 14px; }

/* ==================================================================
   BUSCADOR (js/buscador.js)
   ================================================================== */
.buscar-panel, .buscar-movil{
  background: none; border: 0; padding: 0; cursor: pointer; color: #8a8a86;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "Savoy-Regular", Georgia, serif; font-size: 13px;
}
.buscar-panel:hover, .buscar-movil:hover{ color: #a3201b; }
.buscar-panel svg, .buscar-movil svg{ width: 17px; height: 17px; }
.buscar-panel{ position: absolute; left: 40px; bottom: 44px; }
.buscar-movil{ display: none; }
@media (max-width: 1099px){
  .buscar-movil{ display: inline-flex; position: fixed; z-index: 1032; top: 14px; right: 72px; padding: 6px; }
  .buscar-movil svg{ width: 20px; height: 20px; }
}
@media (min-width: 769px) and (max-width: 1099px){ .buscar-movil{ top: 22px; right: 24px; } }

.buscador{
  position: fixed; inset: 0; z-index: 3000; overflow-y: auto;
  background: rgba(255,255,255,.98);
}
.buscador[hidden]{ display: none; }
html.buscando{ overflow: hidden; }
.buscador-dentro{ max-width: 720px; margin: 14vh auto 80px; padding: 0 24px; font-family: "Savoy-Regular", Georgia, serif; }
.buscador-cerrar{
  position: absolute; top: 22px; right: 28px; background: none; border: 0; cursor: pointer;
  font-size: 34px; line-height: 1; color: #8a8a86; font-family: Georgia, serif;
}
.buscador-cerrar:hover{ color: #a3201b; }
.buscador-campo{ display: flex; align-items: center; gap: 14px; border-bottom: 1px solid #c9c8c3; padding-bottom: 10px; color: #8a8a86; font-weight: normal; width: 100%; }
.buscador-campo svg{ width: 24px; height: 24px; flex: none; }
.buscador-campo input{
  flex: 1; border: 0; outline: 0; background: none; padding: 0;
  font-family: "Savoy-Regular", Georgia, serif; font-size: 24px; color: #1d1d1b;
}
.buscador-campo input::placeholder{ color: #c9c8c3; }
.buscador-estado{ margin: 14px 0 34px; font-size: 14px; color: #8a8a86; }
.buscador-resultados section{ margin-bottom: 34px; }
.buscador-resultados h3{
  margin: 0 0 12px; font-family: "Savoy-Regular", Georgia, serif; font-weight: normal;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #8a8a86;
}
.buscador-resultados ul{ list-style: none; margin: 0; padding: 0; }
.buscador-resultados li{ margin: 0 0 14px; }
.buscador-resultados a{ display: block; text-decoration: none; }
.br-titulo{ display: block; font-size: 16px; line-height: 1.3; color: #1d1d1b; }
.br-meta{ display: block; font-size: 13px; line-height: 1.45; color: #8a8a86; margin-top: 2px; }
.buscador-resultados a:hover .br-titulo{ color: #a3201b; }
.br-mas{ font-size: 13px; color: #a5a5a0; }
@media (max-width: 768px){
  .buscador-dentro{ margin-top: 90px; }
  .buscador-campo input{ font-size: 20px; }
}

/* entrada a la que se llega desde un resultado: se resalta un momento */
.resaltado{ outline: 1px solid #a3201b; outline-offset: 10px; transition: outline-color 1s ease; }
