/* ==========================================================================
   Dr María Eugenia Pereyra — style.css
   Sobrio a propósito: las microfotografías son las que aportan el color.
   ========================================================================== */

/* ---------- Tipografías (alojadas en el sitio, no en Google Fonts) ----------
   Archivos variables woff2 de Source Sans 3 y Source Serif 4 (licencia SIL OFL),
   descargados de Google Fonts. Los "latin-ext" solo se descargan si una página
   usa esos caracteres. */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tipografías de reserva con las mismas medidas ----------
   Mientras llegan las fuentes del sitio (font-display: swap), el texto se
   dibuja con Arial o Georgia ajustadas al ancho y alto de Source Sans 3 y
   Source Serif 4: al cambiar de fuente, las líneas no se reacomodan y la página
   no "salta" (hallazgo REN-01; CLS de Publications y Outreach). Valores
   calculados con fontTools a partir de los .woff2 y las fuentes del sistema. */

@font-face {
  font-family: "Source Sans 3 Fallback";
  font-style: normal;
  font-weight: 400 500;
  src: local("Arial"), local("ArialMT");
  size-adjust: 93.73%;
  ascent-override: 109.25%;
  descent-override: 42.67%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Sans 3 Fallback";
  font-style: normal;
  font-weight: 600 700;
  src: local("Arial Bold"), local("Arial-BoldMT");
  size-adjust: 89.31%;
  ascent-override: 114.66%;
  descent-override: 44.79%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Sans 3 Fallback";
  font-style: italic;
  font-weight: 400 700;
  src: local("Arial Italic"), local("Arial-ItalicMT");
  size-adjust: 91.53%;
  ascent-override: 111.87%;
  descent-override: 43.70%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Serif 4 Fallback";
  font-style: normal;
  font-weight: 400 500;
  src: local("Georgia");
  size-adjust: 108.48%;
  ascent-override: 95.50%;
  descent-override: 30.88%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Serif 4 Fallback";
  font-style: normal;
  font-weight: 600 700;
  src: local("Georgia Bold"), local("Georgia-Bold");
  size-adjust: 94.53%;
  ascent-override: 109.59%;
  descent-override: 35.44%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Source Serif 4 Fallback";
  font-style: italic;
  font-weight: 400 700;
  src: local("Georgia Italic"), local("Georgia-Italic");
  size-adjust: 96.53%;
  ascent-override: 107.33%;
  descent-override: 34.70%;
  line-gap-override: 0%;
}

/* ---------- Variables ---------- */

:root {
  /* Colores */
  --bg: #FAF8F4;
  --surface: #F3F0EA;
  --text: #1F1D1B;
  --text-muted: #5F5A54;      /* contraste 6,4:1 sobre --bg */
  --border: #E2DDD5;
  --accent: #1F5C63;          /* provisorio: ajustar a partir de hero.jpg */
  --accent-strong: #164449;
  --accent-tint: rgba(31, 92, 99, 0.15);

  /* Tipografía */
  --font-serif: "Source Serif 4", "Source Serif 4 Fallback", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Source Sans 3 Fallback", "Segoe UI", system-ui, -apple-system, sans-serif;

  --step--1: 0.9375rem;                               /* 15px: epígrafes, footer */
  --step-0: 1.0625rem;                                /* 17px: texto */
  --step-1: clamp(1.25rem, 1.15rem + 0.4vw, 1.4rem);  /* subtítulos */
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 1.9rem);    /* h2 */
  --step-3: clamp(2rem, 1.6rem + 1.8vw, 3rem);        /* h1 */

  /* Espaciado */
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  --space-xl: clamp(4rem, 3rem + 4vw, 6.5rem);

  /* Layout */
  /* ~70 caracteres por línea. Equivale a 68ch de Source Sans 3, pero en em: el
     ch depende de la fuente dibujada y cambiaba al llegar la tipografía,
     reacomodando las líneas (hallazgo REN-01). */
  --measure: 32.1em;
  --page-width: 70rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  --radius: 3px;
  --transition: 150ms ease;
}

@media (min-width: 48rem) {
  :root {
    --step-0: 1.125rem;       /* 18px */
  }
}

/* Pantallas grandes (a pedido de la investigadora, para que el contenido no
   quede "chico en el medio"): como casi todo está en rem, subir el tamaño
   base agranda letra, márgenes, fotos y logo en proporción. Además se
   ensancha el contenedor; los párrafos mantienen su ancho cómodo (--measure).
   En porcentaje, así se respeta el tamaño de letra que elija cada usuario. */
@media (min-width: 90rem) {          /* desde 1440 px */
  html {
    font-size: 106.25%;              /* 17px */
  }

  :root {
    --page-width: 76rem;             /* ~1290 px */
  }
}

@media (min-width: 112rem) {         /* desde 1792 px */
  html {
    font-size: 112.5%;               /* 18px */
  }

  :root {
    --page-width: 78rem;             /* ~1400 px */
  }
}

/* ---------- Reset mínimo ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
h1, h2, h3, h4,
p, figure, blockquote,
ul, ol, dl, dd {
  margin: 0;
}

img,
picture,
svg,
iframe {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* ---------- Base ---------- */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 6rem;   /* que los anclas no queden tapados por el header fijo */
  /* Firefox compensa el cambio de alto del header al volver arriba y deja la
     página unos 30 px por debajo del tope (hallazgo JS-01) */
  overflow-anchor: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p {
  text-wrap: pretty;
}

/* Nombres de especies y títulos de revistas */
i,
em {
  font-style: italic;
}

strong,
b {
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(31, 92, 99, 0.4);
  text-underline-offset: 0.18em;
  transition: color var(--transition), text-decoration-color var(--transition);
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection {
  background: var(--accent-tint);
}

/* ---------- Utilidades ---------- */

.container {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: var(--space-s);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: var(--space-xs) var(--space-s);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-xs);
  color: #fff;
}

.section {
  padding-block: var(--space-l);
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-title {
  margin-bottom: var(--space-m);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.subtitle {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
}

.more-link {
  display: inline-block;
  margin-top: var(--space-m);
  font-weight: 600;
}

.more-link::after {
  content: " \2192";
}

/* ---------- Botones ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5em 1.1em;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

.button:hover {
  background-color: var(--accent);
  color: #fff;
}

.button--primary {
  background-color: var(--accent);
  color: #fff;
}

.button--primary:hover {
  background-color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0;
  list-style: none;
}

/* ---------- Header ---------- */

.site-header {
  --header-ease: 250ms cubic-bezier(0.2, 0, 0, 1);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  transition: background-color var(--header-ease), box-shadow var(--header-ease);
}

/* Al bajar: el header se compacta, gana una sombra suave y,
   donde el navegador lo soporta, un fondo translúcido esmerilado. */
.site-header.is-scrolled {
  box-shadow: 0 2px 14px rgba(31, 29, 27, 0.08);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-scrolled {
    background-color: rgba(250, 248, 244, 0.75);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    backdrop-filter: blur(10px) saturate(1.2);
  }
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  padding-block: var(--space-s);
  transition: padding var(--header-ease);
}

.is-scrolled .header-inner {
  padding-block: 0.4rem;
}

.site-logo {
  position: relative;
  display: block;
  width: 10.5rem;
  flex-shrink: 0;
  transition: width var(--header-ease);
}

.is-scrolled .site-logo {
  width: 8.5rem;
}

.site-logo img {
  width: 100%;
}

/* Al pasar el mouse (o con el foco del teclado), el cocodrilo "bajo el
   microscopio" se funde en su versión verde realista. La verde está encima,
   con el mismo tamaño exacto, y solo cambia su opacidad. */
.site-logo-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}

.site-logo-hover img {
  height: 100%;
}

.site-logo:hover .site-logo-hover,
.site-logo:focus-visible .site-logo-hover {
  opacity: 1;
}

@media (min-width: 48rem) {
  .site-logo {
    width: 13rem;
  }

  .is-scrolled .site-logo {
    width: 10rem;
  }
}

.nav-toggle {
  display: none;
  padding: 0.35em 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.25rem;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Móvil con JS: el menú se colapsa detrás del botón.
   Sin JS, la navegación queda siempre visible. */
@media (max-width: 47.99rem) {
  .js .nav-toggle {
    display: inline-block;
  }

  .js .site-nav {
    display: none;
    flex-basis: 100%;
  }

  .js .site-nav.is-open {
    display: block;
  }

  .js .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding-bottom: var(--space-xs);
  }

  .js .site-nav li + li {
    border-top: 1px solid var(--border);
  }

  .js .site-nav a {
    display: block;
    padding-block: 0.7rem;
    border-bottom: 0;
  }

  .js .site-nav a[aria-current="page"] {
    color: var(--accent);
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.footer-inner {
  display: grid;
  gap: var(--space-m);
  padding-block: var(--space-l);
}

.footer-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
  list-style: none;
}

/* Franja inferior del footer: línea fina y, debajo, "Last updated" y el
   crédito del logo. Siempre última, también en móvil (en el HTML va antes
   que el sello de ByteCraft). */
.footer-bottom {
  grid-column: 1 / -1;
  order: 1;
  display: flex;
  flex-direction: column;   /* móvil: una línea debajo de la otra */
  gap: 0.25rem;
  padding-top: var(--space-s);
  border-top: 1px solid var(--border);
}

@media (min-width: 48rem) {
  .footer-bottom {
    flex-direction: row;
    gap: 0.6rem;
  }

  /* Punto separador entre la fecha y el crédito (solo si la fecha está visible) */
  .footer-updated:not([hidden]) + .footer-art-credit::before,
  .footer-art-credit + .footer-privacy::before {
    content: "·";
    margin-right: 0.6rem;
  }
}

/* Sello "Developed by ByteCraft" (enlace al formulario de contacto del
   desarrollador): apagado en gris para no competir con el contenido;
   recupera el color al pasar el mouse o con el foco del teclado. */
.footer-credit a {
  display: inline-block;
  border-radius: var(--radius);
}

/* Logo horizontal "Website by ByteCraft" (SVG, proporción ~3,7:1) */
.footer-credit img {
  width: 9.5rem;
  height: auto;
  opacity: 0.55;
  filter: grayscale(1);
  transition: opacity 250ms ease, filter 250ms ease;
}

.footer-credit a:hover img,
.footer-credit a:focus-visible img {
  opacity: 1;
  filter: none;
}

@media (min-width: 48rem) {
  /* Fila de arriba: nombre y afiliación | contacto | sello, a la misma altura.
     Debajo, la línea fina con "Last updated". */
  .footer-inner {
    grid-template-columns: 1fr auto auto;
    align-items: center;
    column-gap: var(--space-l);
    /* Espacio extra abajo para que "Last updated" no quede bajo el botón
       "volver arriba", fijo en la esquina inferior derecha */
    padding-bottom: 4.5rem;
  }

  .footer-links {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }
}

/* ---------- Volver arriba ---------- */

.back-to-top {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 40;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background-color: var(--bg);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(31, 29, 27, 0.1);
  transition: opacity var(--transition), visibility var(--transition),
              background-color var(--transition), color var(--transition);
}

.back-to-top:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.back-to-top svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* Con JS, aparece solo después de bajar un poco */
.js .back-to-top:not(.is-visible) {
  opacity: 0;
  visibility: hidden;
}

/* ---------- Figuras / microfotografías ---------- */

.figure img {
  width: 100%;
  background-color: var(--accent-tint);   /* tono mientras carga */
}

.figure figcaption {
  margin-top: var(--space-xs);
  font-size: var(--step--1);
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---------- Home ---------- */

.hero {
  position: relative;
  margin: 0;
}

/* Banner como galería (js/gallery.js): fotos apiladas en la misma celda y
   fundido más lento que en Research */
.hero .gallery-slides {
  display: grid;
}

.hero[data-gallery].is-animated .gallery-slide {
  transition: opacity 1.6s ease;
}

/* Botón de pausa sobre la foto, abajo a la derecha */
.hero-controls {
  position: absolute;
  right: var(--gutter);
  bottom: var(--space-s);
  margin: 0;
}

.hero .gallery-toggle {
  width: 2rem;
  height: 2rem;
  margin: 0;
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(31, 29, 27, 0.45);
  color: #fff;
}

.hero .gallery-toggle:hover {
  border-color: #fff;
  background-color: rgba(31, 29, 27, 0.7);
  color: #fff;
}

.hero .gallery-toggle:focus-visible {
  outline-color: #fff;
}

.hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background-color: var(--accent-tint);
}

/* Fotos del banner que, si hay que recortarlas, conservan la parte de abajo
   (pedido de la investigadora para la 36) */
.hero .hero-img-bottom {
  object-position: center bottom;
}

@media (min-width: 64rem) {
  .hero img {
    aspect-ratio: auto;
    height: min(72vh, 56.25vw);
  }
}

/* Franja beige de borde a borde detrás de la presentación (mismo tono que el
   footer): arranca pegada al banner y marca la transición hacia Research */
.intro-band {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.intro {
  display: grid;
  gap: var(--space-m);
  padding-block: var(--space-l);
}

.intro-portrait {
  width: min(13rem, 55vw);
}

.intro-portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background-color: var(--accent-tint);
  border-radius: var(--radius);
}

/* Crédito de la foto: discreto, en gris; el enlace toma el acento solo al pasar el mouse */
.photo-credit {
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.photo-credit a {
  color: inherit;
  text-decoration-color: rgba(95, 90, 84, 0.4);
}

.photo-credit a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.intro-bio {
  margin-top: var(--space-m);
}

.intro .button-list {
  margin-top: var(--space-m);
}

@media (min-width: 48rem) {
  .intro {
    grid-template-columns: 14rem minmax(0, var(--measure));
    gap: var(--space-l);
    align-items: start;
  }

  .intro-portrait {
    width: 100%;
  }
}

.research-teaser .subtitle {
  margin-top: var(--space-xs);
}

.research-teaser p:not(.subtitle):not(.eyebrow) {
  margin-top: var(--space-s);
}

/* ---------- Publicaciones ---------- */

.publication-list {
  padding: 0;
  list-style: none;
}

.pub {
  line-height: 1.55;
}

.pub + .pub {
  margin-top: var(--space-s);
}

.pub-me {
  font-weight: 700;
}

.pub-link {
  overflow-wrap: anywhere;   /* los DOI largos no rompen el ancho en móvil */
}

.pub-summary {
  margin-top: var(--space-xs);
  font-size: var(--step-1);
  color: var(--text-muted);
}

.pub-section {
  padding-block: var(--space-l);
  border-top: 1px solid var(--border);
}

.pub-section h2 {
  margin-bottom: var(--space-m);
}

.pub-year-group + .pub-year-group {
  margin-top: var(--space-m);
}

.pub-year {
  margin-bottom: var(--space-xs);
  font-size: var(--step-1);
  color: var(--accent);
}

@media (min-width: 48rem) {
  .pub-year-group {
    display: grid;
    grid-template-columns: 5rem minmax(0, var(--measure));
    gap: var(--space-m);
    align-items: baseline;
  }

  .pub-year {
    margin-bottom: 0;
  }

  .pub-section > .publication-list {
    margin-left: calc(5rem + var(--space-m));
    max-width: var(--measure);
  }
}

.pub-error {
  max-width: var(--measure);
  padding: var(--space-s) var(--space-m);
  border-left: 3px solid var(--accent);
  background-color: var(--surface);
}

.pub-scholar {
  max-width: var(--measure);
  padding-top: var(--space-m);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- Encabezado de página interna ---------- */

.page-header {
  padding-block: var(--space-l) var(--space-m);
}

.page-header h1 {
  max-width: 13.13em;   /* = 24ch de Source Serif 4 semibold, en em (REN-01) */
}

.page-header .subtitle {
  margin-top: var(--space-xs);
}

.page-intro {
  margin-top: var(--space-m);
}

/* ---------- Research: ejes ---------- */

.axis {
  padding-block: var(--space-l);
  border-top: 1px solid var(--border);
}

.axis-inner {
  display: grid;
  gap: var(--space-m);
}

.axis-figure img {
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* ---------- Galerías de Research (js/gallery.js) ---------- */

/* Foto arriba; debajo, el epígrafe a la izquierda y los controles a la derecha */
.gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-s);
}

.gallery-slides,
.gallery-captions {
  display: grid;
}

.gallery-slides {
  grid-column: 1 / -1;
}

.gallery-captions {
  grid-column: 1;
  grid-row: 2;
}

/* Fotos y epígrafes apilados en la misma celda: se ve solo el activo */
.gallery-slide,
.gallery-caption {
  grid-area: 1 / 1;
}

[data-gallery].is-ready .gallery-slide,
[data-gallery].is-ready .gallery-caption {
  opacity: 0;
}

/* El fundido se activa después de la carga (.is-animated), así al abrir la
   página las fotos y epígrafes ocultos ya arrancan ocultos */
[data-gallery].is-animated .gallery-slide {
  transition: opacity 1s ease;
}

[data-gallery].is-animated .gallery-caption {
  transition: opacity 600ms ease;
}

[data-gallery].is-ready .gallery-slide.is-active,
[data-gallery].is-ready .gallery-caption.is-active {
  opacity: 1;
}

/* Sin JS (o antes de que cargue): solo la primera foto y su epígrafe */
[data-gallery]:not(.is-ready) .gallery-slide:not(:first-child),
[data-gallery]:not(.is-ready) .gallery-caption:not(:first-child) {
  display: none;
}

.gallery-controls {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  margin-top: 0.15rem;
}

.gallery-controls[hidden] {
  display: none;
}

/* Puntos: área de clic de 24 px, punto visible de 8 px */
.gallery-dot {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;   /* el contorno de foco sigue la forma redonda */
  background: transparent;
  cursor: pointer;
}

.gallery-dot:focus-visible,
.gallery-toggle:focus-visible {
  outline-width: 2px;
  outline-offset: 1px;
}

.gallery-dot::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  transition: background-color var(--transition), border-color var(--transition);
}

.gallery-dot:hover::before {
  border-color: var(--accent);
}

.gallery-dot[aria-current="true"]::before {
  border-color: var(--accent);
  background-color: var(--accent);
}

.gallery-toggle {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.gallery-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.gallery-toggle svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.gallery-toggle .icon-play,
[data-gallery].is-paused .gallery-toggle .icon-pause {
  display: none;
}

[data-gallery].is-paused .gallery-toggle .icon-play {
  display: block;
}

.axis-number {
  font-family: var(--font-serif);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.axis-text {
  max-width: var(--measure);
}

.axis-text > .subtitle {
  margin-top: 0.25rem;
}

.axis-text > p:not(.axis-number):not(.subtitle) {
  margin-top: var(--space-s);
}

.axis-label {
  margin-top: var(--space-m);
  margin-bottom: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (min-width: 56rem) {
  .axis-inner {
    grid-template-columns: 30rem minmax(0, 1fr);
    gap: var(--space-l);
    align-items: start;
  }

  /* Alterna la imagen a la derecha en los ejes pares */
  .axis:nth-of-type(even) .axis-inner {
    grid-template-columns: minmax(0, 1fr) 30rem;
  }

  .axis:nth-of-type(even) .axis-figure {
    order: 2;
  }

  /* Los textos son más largos que la foto: la foto acompaña el scroll
     dentro de su bloque, debajo del header fijo (compactado ~4rem). */
  .axis-figure {
    position: sticky;
    top: 5.5rem;
  }
}

/* ---------- Secciones y listas con fecha (outreach.html) ----------
   Los nombres "cv-" vienen de la antigua página del CV, que se eliminó. */

.cv-section {
  padding-block: var(--space-l);
  border-top: 1px solid var(--border);
}

.cv-section h2 {
  margin-bottom: var(--space-m);
}

.cv-section > p {
  margin-bottom: var(--space-m);
}

.cv-list {
  max-width: calc(var(--measure) + 9rem);
  padding: 0;
  list-style: none;
}

.cv-list li + li {
  margin-top: var(--space-xs);
}

.cv-when {
  display: block;
  color: var(--text-muted);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 40rem) {
  .cv-list li {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: var(--space-m);
    align-items: baseline;
  }

  .cv-list li + li {
    margin-top: 0.6rem;
  }
}

/* "In the media" (outreach.html): medio en negrita, tipo de nota en gris */
.media-source {
  font-weight: 600;
}

.media-type {
  color: var(--text-muted);
}

.prose-width {
  max-width: var(--measure);
}

/* ---------- Videos (outreach.html) ---------- */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--space-l) var(--space-m);
}

.video-embed {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--text);
}

.video-embed img,
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed img {
  object-fit: cover;
  transition: opacity var(--transition);
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.5rem;
  height: 3.5rem;
  margin: -1.75rem 0 0 -1.75rem;
  border-radius: 50%;
  background-color: rgba(31, 29, 27, 0.75);
  transition: background-color var(--transition);
}

/* Triángulo de "play" */
.video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.6rem 0 0.6rem 1rem;
  border-color: transparent transparent transparent #fff;
}

.video-embed:hover .video-play,
.video-embed:focus-visible .video-play {
  background-color: var(--accent);
}

.video-embed:hover img {
  opacity: 0.9;
}

.video figcaption {
  margin-top: var(--space-xs);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.4;
}

/* ---------- Contacto ---------- */

.contact-email {
  margin-top: var(--space-s);
  font-family: var(--font-serif);
  /* En móvil se achica con el ancho de pantalla para que el email entre en una línea */
  font-size: min(var(--step-2), 5.2vw);
  overflow-wrap: anywhere;
}

/* Foto de la página de contacto: debajo de la dirección postal */
.contact-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background-color: var(--accent-tint);
}

.contact-photo {
  max-width: 18rem;   /* más chica a pedido de la investigadora */
  margin-top: var(--space-l);
}

.contact-details {
  display: grid;
  gap: var(--space-l);
  padding-top: var(--space-l);
  border-top: 1px solid var(--border);
}

.contact-details .axis-label {
  margin-top: 0;
}

address {
  font-style: normal;
  line-height: 1.6;
}

@media (min-width: 48rem) {
  .contact-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 52rem;
  }
}

/* ---------- Redes sociales (index.html, contact.html) ---------- */

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: var(--space-s);
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}

.contact-details .contact-social-title {
  margin-top: var(--space-l);
}

.contact-social {
  display: grid;
  gap: 0.6rem;
  padding: 0;
  list-style: none;
}

/* El subrayado va solo en el usuario, no debajo del logo */
.contact-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.contact-social img {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;   /* el de Bluesky no es cuadrado */
}

.contact-social a span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(31, 92, 99, 0.4);
  text-underline-offset: 0.18em;
}

.contact-social a:hover span {
  text-decoration-color: currentColor;
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ---------- Privacy (privacy.html) ---------- */

.privacy h2 {
  margin-top: var(--space-l);
  font-size: var(--step-1);
}

.privacy-updated {
  font-size: var(--step--1);
  color: var(--text-muted);
}
