/* INGEBIR – hoja de estilos del sitio
   Identidad según el Manual de identidad y registro de marca, versión 1.0 (octubre de 2026). */

:root {
  /* Paleta oficial y la emoción que representa cada color */
  --azul: #3E4095;       /* Azul INGEBIR (confianza) */
  --tinta: #373435;      /* Carbono (seguridad) */
  --rojo: #D83236;       /* Rojo Ígneo (pasión) */
  --verde: #1C7A43;      /* Verde Biomasa (esperanza) */
  --papel: #F4F0E8;      /* Papel (cercanía) */

  /* Derivados para pantalla */
  --papel-2: #ECE6DA;
  --blanco: #FFFFFF;
  --tinta-2: #4A4647;
  --gris: #655F60;
  --regla: #DCD4C6;
  --azul-d: #2F3176;
  --azul-l: #919ECF;     /* azul claro, para fondos oscuros */
  --azul-p: #DCDDF2;     /* textos secundarios sobre azul */
  --rojo-d: #B8262C;     /* rojo para textos pequeños */
  --rojo-l: #F69282;     /* rojo claro, para fondos oscuros */
  --crema: #F4F0E8;
  --crema-2: #CDC7C0;
  --termico: linear-gradient(90deg, var(--rojo), var(--azul));
  --termico-claro: linear-gradient(90deg, var(--rojo-l), var(--azul-l));

  --serif: 'Marcellus', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;

  --ancho: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --header: 76px;
  --r: 6px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + 16px); }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--azul); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--rojo-d); }
:focus-visible { outline: 2px solid var(--azul); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--azul-p); color: var(--tinta); }

/* Marcellus tiene un solo peso; se impide que el navegador invente negritas o cursivas */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; font-synthesis: none; line-height: 1.14; margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.3rem, 4.8vw, 3.9rem); line-height: 1.08; }
h2 { font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
h3 { font-size: clamp(1.18rem, 1.7vw, 1.4rem); line-height: 1.2; }
p { margin: 0 0 1em; }
.lead { font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.6; color: var(--tinta-2); max-width: 62ch; }
.muted { color: var(--gris); }
.mono { font-family: var(--mono); font-weight: 500; font-size: 0.82em; letter-spacing: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: calc(var(--ancho) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section + .section { border-top: 1px solid var(--regla); }
.section--tint { background: var(--papel-2); border-top: 0 !important; }
.section--dark { background: var(--azul); color: #FFFFFF; border-top: 0 !important; }
.section--dark a:not(.btn) { color: #FFFFFF; }
.section--dark a:not(.btn):hover { color: var(--azul-p); }
.section--dark .muted, .section--dark .lead { color: var(--azul-p); }
.section--dark :focus-visible { outline-color: #FFFFFF; }
.section--dark ::selection { background: #FFFFFF; color: var(--azul); }
.section-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 5vw, 80px); align-items: end; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head p { margin: 0; color: var(--tinta-2); max-width: 58ch; }
.section--dark .section-head p { color: var(--azul-p); }
.section-head .more { justify-self: start; }

/* Saltar al contenido */
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--tinta); color: var(--crema); padding: 10px 16px; border-radius: var(--r); }
.skip:focus { top: 12px; color: var(--crema); }

/* ---------------- Encabezado ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  view-transition-name: site-header;
}
.site-header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(244, 240, 232, 0.92); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
.site-header.is-scrolled { border-bottom-color: var(--regla); }
.site-header .wrap { height: 100%; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; flex: none; margin-right: auto; padding: 4px 0; text-decoration: none; }
/* Nivel 1 del sistema responsive: versión horizontal con descriptor, nunca por debajo de 320 px de ancho.
   En celulares, nivel 2: logotipo, nunca por debajo de 96 px (ver el bloque de 600 px) */
.brand picture { display: block; }
.brand img { height: 54px; width: auto; min-width: 96px; view-transition-name: brand-mark; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a { color: var(--tinta-2); text-decoration: none; font-size: 0.92rem; padding: 8px 8px; border-radius: var(--r); position: relative; white-space: nowrap; }
.nav a:hover { color: var(--tinta); background: rgba(55, 52, 53, 0.06); }
.nav a[aria-current="page"] { color: var(--tinta); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; background: var(--termico); border-radius: 2px; }
.header-tools { display: flex; align-items: center; gap: 6px; }
.lang { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; color: var(--tinta); text-decoration: none; border: 1px solid var(--regla); border-radius: 999px; padding: 6px 12px; }
.lang:hover { border-color: var(--tinta); color: var(--tinta); }
.menu-btn { display: none; }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 0.95rem/1 var(--sans);
  padding: 15px 22px; min-height: 48px;
  border-radius: var(--r); border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--rojo); color: #FFFFFF; }
.btn--primary:hover { background: var(--rojo-d); color: #FFFFFF; }
.btn--dark { background: var(--azul); color: #FFFFFF; }
.btn--dark:hover { background: var(--azul-d); color: #FFFFFF; }
.btn--ghost { border-color: currentColor; color: inherit; background: transparent; }
.btn--ghost:hover { background: rgba(55, 52, 53, 0.06); color: inherit; }
.section--dark .btn--primary { background: #FFFFFF; color: var(--azul); }
.section--dark .btn--primary:hover { background: var(--papel); color: var(--azul-d); }
.btn--small { padding: 10px 16px; min-height: 40px; font-size: 0.88rem; }
.btn svg { width: 16px; height: 16px; flex: none; }
.link-arrow { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.link-arrow svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.link-arrow:hover svg { transform: translateX(3px); }

/* ---------------- Portada ---------------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--papel);
  color: var(--tinta);
  min-height: min(800px, calc(100svh - var(--header)));
  display: flex; flex-direction: column;
}
.hero > .wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: center; gap: clamp(32px, 5vw, 88px); padding-top: clamp(40px, 7vh, 88px); padding-bottom: clamp(40px, 7vh, 88px); }
.hero-copy { max-width: 640px; }
.hero-kicker { font-family: var(--mono); font-weight: 500; font-size: 0.8rem; line-height: 1.4; letter-spacing: 0.14em; text-transform: uppercase; color: var(--azul); margin-bottom: 26px; display: flex; align-items: center; gap: 14px; }
.hero-kicker::before { content: ""; width: 40px; height: 3px; border-radius: 2px; background: var(--termico); flex: none; }
.hero h1 { font-size: clamp(2.7rem, 6vw, 5rem); line-height: 1.04; color: var(--tinta); }
.hero-sub { margin: 26px 0 36px; font-size: clamp(1.06rem, 1.4vw, 1.2rem); color: var(--tinta-2); max-width: 54ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions .btn--ghost { color: var(--tinta); }

/* Versión térmica del logotipo: se revela del foco caliente (arriba) al foco frío (abajo) */
.hero-mark { margin: 0; width: 100%; max-width: 540px; justify-self: center; }
.hero-mark img {
  width: 100%; height: auto; view-transition-name: hero-mark;
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(180deg, #000 45%, transparent 55%);
  -webkit-mask-size: 100% 300%; mask-size: 100% 300%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 0 0; mask-position: 0 0;
  animation: calor 1.8s cubic-bezier(.45, .05, .25, 1) 0.2s both;
}
@keyframes calor {
  from { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
.hero-programs { position: relative; border-top: 1px solid var(--regla); }
.hero-programs .wrap { display: flex; flex-wrap: wrap; gap: 12px 32px; padding-top: 18px; padding-bottom: 18px; font-size: 0.92rem; }
.hero-programs a { color: var(--tinta-2); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.hero-programs a:hover { color: var(--azul); }

/* Colores de los programas */
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.swatch--P1 { background: var(--verde); }
.swatch--P2 { background: var(--rojo); }
.swatch--P3 { background: var(--azul); }

/* Cadena de trabajo (secuencia real de cuatro pasos), del rojo al azul como el ciclo */
.chain { position: relative; margin-top: 8px; }
.chain-track { position: absolute; left: 0; right: 0; top: 23px; height: 4px; }
.chain-track svg { width: 100%; height: 4px; overflow: visible; }
.chain-track line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s cubic-bezier(.6, .1, .2, 1); }
.chain.is-in .chain-track line { stroke-dashoffset: 0; }
.chain ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; position: relative; }
.chain li { opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.6s ease; }
.chain.is-in li { opacity: 1; transform: none; }
.chain.is-in li:nth-child(2) { transition-delay: 0.35s; }
.chain.is-in li:nth-child(3) { transition-delay: 0.7s; }
.chain.is-in li:nth-child(4) { transition-delay: 1.05s; }
.chain-node { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 500; font-size: 1rem; background: var(--papel); border: 2px solid var(--rojo); color: var(--tinta); margin-bottom: 22px; }
.chain li:nth-child(2) .chain-node { border-color: #A53756; }
.chain li:nth-child(3) .chain-node { border-color: #713B75; }
.chain li:nth-child(4) .chain-node { border-color: var(--azul); }
.chain h3 { font-size: 1.45rem; margin-bottom: 8px; }
.chain p { color: var(--tinta-2); font-size: 0.98rem; margin: 0; }

/* Programas */
.programs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--tinta); }
.program { padding: 28px clamp(16px, 2.4vw, 32px) 8px; border-left: 1px solid var(--regla); position: relative; }
.program:first-child { border-left: 0; padding-left: 0; }
.program::before { content: ""; position: absolute; top: -1px; left: 0; width: 64px; height: 4px; }
.program:not(:first-child)::before { left: clamp(16px, 2.4vw, 32px); }
.program--P1::before { background: var(--verde); }
.program--P2::before { background: var(--rojo); }
.program--P3::before { background: var(--azul); }
.program-id { font-size: 0.85rem; color: var(--gris); margin-bottom: 10px; }
.program h3 { font-size: clamp(1.35rem, 1.9vw, 1.65rem); margin-bottom: 14px; }
.program > p { color: var(--tinta-2); font-size: 0.98rem; }
.program ul { list-style: none; padding: 0; margin: 20px 0 0; border-top: 1px solid var(--regla); }
.program li { border-bottom: 1px solid var(--regla); }
.program li a { display: grid; grid-template-columns: 34px 1fr 18px; gap: 8px; align-items: baseline; padding: 14px 0; color: var(--tinta); text-decoration: none; font-size: 0.97rem; line-height: 1.4; }
.program li a:hover { color: var(--azul); }
.program li a svg { width: 16px; height: 16px; align-self: center; opacity: 0.4; transition: opacity 0.2s, transform 0.2s; }
.program li a:hover svg { opacity: 1; transform: translateX(3px); }
.line-id { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--gris); }

/* Listas de publicaciones */
.pubs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--regla); }
.pub { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--regla); }
.pub-year { font-family: var(--mono); font-size: 0.86rem; font-weight: 500; color: var(--gris); padding-top: 4px; }
.pub-type { font-size: 0.8rem; font-weight: 600; color: var(--rojo-d); margin-bottom: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.pub-type .oa { color: var(--verde); font-weight: 500; }
.pub h3 { font-size: 1.2rem; line-height: 1.28; margin-bottom: 8px; }
.pub h3 a { color: var(--tinta); text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.3s ease; }
.pub h3 a:hover { background-size: 100% 1px; color: var(--azul); }
.pub-authors { font-size: 0.93rem; color: var(--tinta-2); margin: 0 0 4px; }
.pub-authors strong { color: var(--tinta); font-weight: 600; }
.pub-source { font-size: 0.93rem; color: var(--gris); margin: 0; }
.pub-source em { color: var(--tinta-2); }
.pub-doi { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; }

/* Bloques de dos columnas */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split h2 { margin-bottom: 20px; }
.sticky { position: sticky; top: calc(var(--header) + 32px); }

/* Noticias */
.news { list-style: none; margin: 0; padding: 0; }
.news-item { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; padding: 28px 0; border-top: 1px solid var(--regla); }
.news-item:last-child { border-bottom: 1px solid var(--regla); }
.news-date { font-size: 0.92rem; color: var(--gris); }
.news-date span { display: block; font-weight: 600; color: var(--rojo-d); font-size: 0.82rem; margin-top: 4px; }
.news-item h3 { font-size: clamp(1.25rem, 1.8vw, 1.45rem); margin-bottom: 10px; }
.news-item p { color: var(--tinta-2); max-width: 70ch; margin-bottom: 8px; }
.news--compact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.news--compact .news-item { grid-template-columns: 1fr; gap: 10px; border-top: 2px solid var(--tinta); padding-top: 20px; border-bottom: 0; }
.news--compact .news-item:last-child { border-bottom: 0; }
.news--compact p { font-size: 0.96rem; }

/* Invitación */
.invite { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: center; }
.invite h2 { color: #FFFFFF; margin-bottom: 14px; }
.invite-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------- Encabezado de páginas internas ---------------- */
.page-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--regla); }
.page-head .wrap { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: center; min-height: 360px; padding-top: 56px; padding-bottom: 56px; }
.page-head h1 { margin-bottom: 20px; }
.page-head .lead { margin: 0; }
.crumb { font-family: var(--mono); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--azul); margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.crumb::before { content: ""; width: 32px; height: 3px; border-radius: 2px; background: var(--termico); flex: none; margin-right: 2px; }
.crumb a { color: var(--azul); text-decoration: underline; text-decoration-color: rgba(62, 64, 149, 0.35); text-underline-offset: 0.28em; }
.crumb a:hover { color: var(--rojo-d); text-decoration-color: currentColor; }
.crumb > span[aria-hidden] { color: var(--crema-2); }
.crumb [aria-current] { color: var(--gris); }

/* Figura de cada página: una animación distinta por sección (static/js/figuras.js) y el ciclo de Carnot en Nosotros */
.page-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; view-transition-name: figura; }
.page-fig canvas { width: min(100%, 320px); height: auto; aspect-ratio: 1 / 1; }
.page-cycle { position: relative; width: 100%; height: 300px; }
.cycle { width: 100%; height: 100%; overflow: visible; }
.cycle .ax { fill: none; stroke: var(--gris); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cycle .iso { fill: none; stroke: var(--regla); stroke-width: 1.4; }
.cycle .area { fill: var(--rojo); fill-opacity: 0; animation: area 0.8s ease 2.4s forwards; }
.cycle .seg { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 1; animation: trazo 0.7s cubic-bezier(.4, 0, .2, 1) forwards; }
.cycle .s12 { stroke: var(--rojo); stroke-width: 5; animation-delay: 0.15s; }
.cycle .s23 { stroke: var(--tinta); stroke-width: 3; animation-delay: 0.8s; }
.cycle .s34 { stroke: var(--azul); stroke-width: 5; animation-delay: 1.45s; }
.cycle .s41 { stroke: var(--tinta); stroke-width: 3; animation-delay: 2.1s; }
.cycle .flecha { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; animation: aparece 0.4s ease forwards; }
.cycle .f12 { stroke: var(--rojo); animation-delay: 0.6s; }
.cycle .f34 { stroke: var(--azul); animation-delay: 1.9s; }
.cycle .st { opacity: 0; animation: aparece 0.4s ease forwards; }
.cycle .st circle { fill: var(--blanco); stroke: var(--tinta); stroke-width: 2.5; }
.cycle .e1 { animation-delay: 0.1s; }
.cycle .e2 { animation-delay: 0.75s; }
.cycle .e3 { animation-delay: 1.4s; }
.cycle .e4 { animation-delay: 2.05s; }
.cycle text { font-family: var(--mono); font-weight: 500; font-size: 17px; fill: var(--gris); }
.cycle .eje { font-size: 18px; fill: var(--tinta-2); }
.cycle .punto { stroke: var(--blanco); stroke-width: 3; opacity: 0; animation: aparece 0.5s ease 2.8s forwards; }
@keyframes trazo { to { stroke-dashoffset: 0; } }
@keyframes aparece { to { opacity: 1; } }
@keyframes area { to { fill-opacity: 0.07; } }

/* ---------------- Nosotros ---------------- */
.statement + .lead { margin-top: 28px; }
.statement { font-family: var(--serif); font-size: clamp(1.2rem, 1.75vw, 1.5rem); line-height: 1.42; color: var(--tinta); max-width: 36ch; margin: 0; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--tinta); margin-top: 48px; }
.fact { padding: 20px 20px 0 0; }
.fact b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 3.6vw, 2.9rem); line-height: 1; margin-bottom: 10px; color: var(--azul); }
.fact span { font-size: 0.92rem; color: var(--gris); }
.values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
.value { padding: 24px 0; border-top: 1px solid var(--regla); }
.value h3 { font-size: 1.35rem; margin-bottom: 8px; }
.value p { color: var(--tinta-2); font-size: 0.97rem; margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 70px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--rojo), var(--azul)); }
.timeline li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 32px; padding: 0 0 32px; position: relative; }
.timeline li::after { content: ""; position: absolute; left: 65px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--papel); border: 2px solid var(--tinta); }
.timeline b { font-family: var(--mono); font-size: 1rem; font-weight: 500; line-height: 1.2; padding-top: 3px; color: var(--azul); }
.timeline p { margin: 0; color: var(--tinta-2); max-width: 64ch; }

.phases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: fase; }
.phase { padding: 24px 24px 0 0; border-top: 4px solid; position: relative; }
.phase:nth-child(1) { border-color: var(--rojo); }
.phase:nth-child(2) { border-color: #A53756; }
.phase:nth-child(3) { border-color: #713B75; }
.phase:nth-child(4) { border-color: var(--azul); }
.phase small { display: block; font-family: var(--mono); font-weight: 500; font-size: 0.8rem; color: var(--gris); margin-bottom: 10px; }
.phase h3 { font-size: 1.32rem; margin-bottom: 8px; }
.phase p { font-size: 0.95rem; color: var(--tinta-2); margin: 0; }
/* Sobre azul se usan las variantes claras del degradado térmico */
.section--dark .phase:nth-child(1) { border-color: var(--rojo-l); }
.section--dark .phase:nth-child(2) { border-color: #D4969C; }
.section--dark .phase:nth-child(3) { border-color: #B39AB5; }
.section--dark .phase:nth-child(4) { border-color: var(--azul-l); }
.section--dark .phase small { color: var(--azul-p); }
.section--dark .phase p { color: var(--azul-p); }

.org { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.org-item { background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); padding: 22px; }
.org-item h3 { font-size: 1.22rem; margin-bottom: 6px; }
.org-item p { margin: 0; font-size: 0.94rem; color: var(--tinta-2); }

.dl { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); margin: 0; border-top: 1px solid var(--regla); }
.dl dt, .dl dd { padding: 14px 0; border-bottom: 1px solid var(--regla); margin: 0; }
.dl dt { color: var(--gris); font-size: 0.92rem; padding-right: 16px; }

/* ---------------- Investigación ---------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.chip {
  font: 500 0.9rem/1 var(--sans); color: var(--tinta-2);
  background: transparent; border: 1px solid var(--regla); border-radius: 999px;
  padding: 10px 16px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--tinta); color: var(--tinta); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--tinta); border-color: var(--tinta); color: var(--crema); }
.chip[aria-pressed="true"] .swatch--P3, .chip[aria-selected="true"] .swatch--P3 { background: var(--azul-l); }

.line-block { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); padding: 48px 0; border-top: 1px solid var(--regla); }
.line-block[hidden] { display: none; }
.line-tag, .chain-node, .fact b, .timeline b, .steps li::before, .year-group h2, .phase small { font-variant-numeric: lining-nums; }
/* Las cifras y los códigos van en IBM Plex Mono, como indica el manual */
.line-tag { font-family: var(--mono); font-weight: 500; font-size: 2.1rem; line-height: 1; letter-spacing: -0.02em; color: var(--azul); }
.line-tag small { display: flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 0.8rem; color: var(--gris); margin-top: 12px; line-height: 1.3; }
.line-block h2 { font-size: clamp(1.55rem, 2.5vw, 2.05rem); margin-bottom: 16px; max-width: 32ch; }
.line-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; margin-top: 28px; }
.line-cols h3 { font-family: var(--sans); font-size: 0.86rem; font-weight: 600; color: var(--gris); margin-bottom: 10px; letter-spacing: 0.01em; }
.line-cols ul { margin: 0; padding-left: 1.1em; color: var(--tinta-2); }
.line-cols li { margin-bottom: 6px; }
.line-cols li::marker { color: var(--rojo); }
.line-cols p { color: var(--tinta-2); font-size: 0.97rem; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.person-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--blanco); border: 1px solid var(--regla); color: var(--tinta); text-decoration: none; font-size: 0.88rem; }
.person-chip:hover { border-color: var(--tinta); color: var(--tinta); }
.person-chip i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; font-weight: 600; color: #FFFFFF; background: var(--tinta); }
.person-chip i.P1 { background: var(--verde); }
.person-chip i.P2 { background: var(--rojo-d); }
.person-chip i.P3 { background: var(--azul); }

.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.project { background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); padding: clamp(24px, 3vw, 36px); display: flex; flex-direction: column; }
.project small { color: var(--rojo-d); font-weight: 600; font-size: 0.84rem; margin-bottom: 12px; }
.project h3 { font-size: 1.38rem; margin-bottom: 14px; }
.project p { color: var(--tinta-2); font-size: 0.97rem; }
.project .tags { margin-top: auto; padding-top: 8px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-weight: 500; font-size: 0.74rem; padding: 3px 8px; border-radius: 4px; background: var(--papel-2); color: var(--tinta-2); text-decoration: none; }
.section--tint .tag { background: var(--blanco); }
a.tag:hover { background: var(--azul); color: #FFFFFF; }

/* ---------------- Equipo ---------------- */
.team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.member { background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); padding: 28px; display: flex; flex-direction: column; scroll-margin-top: calc(var(--header) + 24px); transition: border-color 0.3s, box-shadow 0.3s; }
.member:target { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(62, 64, 149, 0.18); }
.avatar { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 1.65rem; letter-spacing: 0.02em; color: #FFFFFF; margin-bottom: 20px; position: relative; overflow: hidden; }
.avatar.P1 { background: var(--verde); }
.avatar.P2 { background: var(--rojo-d); }
.avatar.P3 { background: var(--azul); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar span { position: relative; }
.member h3 a { color: var(--tinta); text-decoration: none; }
.member h3 a:hover { color: var(--azul); }
.member h3 { font-size: 1.38rem; margin-bottom: 6px; }
.member .role { font-weight: 600; font-size: 0.92rem; margin: 0 0 4px; }
.member .degree { font-size: 0.88rem; color: var(--gris); margin: 0 0 14px; line-height: 1.45; }
.member .bio { font-size: 0.95rem; color: var(--tinta-2); }
.member .tags { margin-bottom: 18px; }
.member-links { margin-top: auto; display: flex; gap: 16px; padding-top: 16px; border-top: 1px solid var(--regla); font-size: 0.88rem; font-weight: 600; }
.member-links a { text-decoration: none; }
.team-group + .team-group { margin-top: 72px; }
@media (min-width: 1101px) { .team--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .team--4 .member { padding: 24px; } }
.team-group > h2 { margin-bottom: 28px; }
.allies { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.allies li { border-top: 2px solid var(--tinta); padding-top: 16px; }
.allies b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.25rem; line-height: 1.25; margin-bottom: 6px; }
.allies span { color: var(--gris); font-size: 0.94rem; }

/* ---------------- Publicaciones ---------------- */
.filters { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; margin-bottom: 20px; }
.filters .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--gris); }
.field input, .field select, .field textarea {
  font: 400 1rem/1.4 var(--sans); color: var(--tinta);
  background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r);
  padding: 12px 14px; min-height: 48px; width: 100%;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--azul); outline-offset: 0; border-color: var(--azul); }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 12px; margin-bottom: 12px; }
.count { font-size: 0.9rem; color: var(--gris); margin: 16px 0 8px; display: flex; gap: 16px; align-items: center; }
.count button { font: inherit; color: var(--azul); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.empty { padding: 32px 0; color: var(--tinta-2); border-top: 1px solid var(--regla); }
.year-group { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; border-top: 1px solid var(--tinta); }
.year-group[hidden] { display: none; }
.year-group h2 { font-family: var(--mono); font-weight: 500; font-size: 1.6rem; letter-spacing: -0.01em; padding-top: 18px; align-self: start; position: sticky; top: calc(var(--header) + 16px); color: var(--azul); }
.year-group .pubs { border-top: 0; max-width: 880px; }
.year-group .pub { grid-template-columns: minmax(0, 1fr); }
.year-group .pub:last-child { border-bottom: 0; }
.theses { list-style: none; margin: 0; padding: 0; }
.thesis { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 1px solid var(--regla); }
.thesis-level { font-weight: 600; font-size: 0.9rem; }
.thesis-level span { display: block; font-weight: 400; color: var(--gris); font-size: 0.86rem; }
.thesis-level .ongoing { color: var(--rojo-d); }
.thesis h3 { font-size: 1.15rem; line-height: 1.3; margin-bottom: 6px; }
.thesis p { margin: 0; font-size: 0.92rem; color: var(--tinta-2); }

/* ---------------- Formación ---------------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 24px; counter-reset: paso; }
.steps li { counter-increment: paso; padding-top: 18px; border-top: 2px solid var(--tinta); }
.steps li::before { content: counter(paso, decimal-leading-zero); font-family: var(--mono); font-weight: 500; font-size: 1.05rem; line-height: 1; display: block; margin-bottom: 14px; color: var(--rojo-d); }
.steps h3 { font-size: 1.28rem; margin-bottom: 6px; }
.steps p { margin: 0; font-size: 0.95rem; color: var(--tinta-2); }
.section--dark .steps li { border-color: rgba(255, 255, 255, 0.85); }
.section--dark .steps li::before { color: var(--rojo-l); }
.section--dark .steps p { color: var(--azul-p); }
.route { --n: 5; }
.topics { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 48px; }
.topics li { break-inside: avoid; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--regla); }

/* ---------------- Contacto ---------------- */
.contact { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); }
.contact-info .dl { grid-template-columns: 110px minmax(0, 1fr); }
.big-mail { font-family: var(--serif); font-size: clamp(1.45rem, 2.7vw, 2.05rem); display: inline-block; margin: 8px 0 28px; word-break: break-word; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); padding: clamp(20px, 3vw, 36px); }
.form .full { grid-column: 1 / -1; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 0.9rem; color: var(--tinta-2); align-items: start; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--azul); }
.form .muted { font-size: 0.88rem; margin: 0; }
.form-note { font-size: 0.9rem; color: var(--verde); margin: 0; min-height: 1.4em; }
.form-note.is-error { color: var(--rojo-d); }

/* ---------------- Texto largo ---------------- */
.prose { max-width: 70ch; }
.prose h2 { font-size: clamp(1.45rem, 2.3vw, 1.8rem); margin: 48px 0 14px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 8px; }

/* ---------------- Pie ---------------- */
.site-footer { font-size: 0.94rem; }
/* Franja institucional: los logos de la Universidad siempre van sobre fondo claro */
.footer-inst { background: var(--blanco); border-top: 1px solid var(--regla); }
.footer-inst .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px 48px; padding-top: 28px; padding-bottom: 28px; }
.footer-inst p { margin: 0; max-width: 56ch; color: var(--tinta-2); font-size: 0.92rem; line-height: 1.55; }
.inst-logos { display: flex; align-items: center; gap: 28px; }
.inst-logos a { display: block; }
.inst-logos .unisucre { width: 210px; height: auto; }
.inst-logos .acreditacion { width: 64px; height: auto; }
.inst-rule { width: 1px; height: 56px; background: var(--regla); }

.footer-main { background: var(--tinta); color: var(--crema-2); padding: 64px 0 32px; border-top: 4px solid var(--rojo); border-image: var(--termico) 1; }
.footer-main a { color: var(--crema); text-decoration: none; }
.footer-main a:hover { color: var(--rojo-l); text-decoration: underline; }
.footer-main :focus-visible { outline-color: #FFFFFF; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 5fr) repeat(3, minmax(0, 2.4fr)); gap: 40px; }
/* Nivel 1 del sistema responsive: versión horizontal con descriptor, mínimo 320 px */
.footer-brand img { width: 340px; max-width: 100%; height: auto; margin-bottom: 26px; }
.footer-brand p { max-width: 42ch; }
.footer-main h2 { font-family: var(--sans); font-size: 0.86rem; font-weight: 600; color: var(--crema); margin-bottom: 14px; letter-spacing: 0.02em; }
.footer-main ul { list-style: none; margin: 0; padding: 0; }
.footer-main li { margin-bottom: 8px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(244, 240, 232, 0.14); margin-top: 56px; padding-top: 24px; font-size: 0.84rem; }

/* 404 */
.notfound { min-height: calc(100svh - var(--header) - 200px); display: grid; place-items: center; text-align: center; padding: 64px 0; }
.notfound-mark { width: min(200px, 46vw); height: auto; margin: 0 auto 32px; }
.notfound h1 { margin-bottom: 14px; }
.notfound .lead { margin-left: auto; margin-right: auto; }
.notfound .hero-actions { justify-content: center; }

/* ---------------- Imágenes protegidas ----------------
   Sin arrastre ni menú de “guardar imagen” en logos, figuras, retratos y lienzos (complementa site.js) */
img, svg, canvas, picture { -webkit-user-drag: none; -webkit-touch-callout: none; }
img, .avatar, .portrait, .page-fig, .feature-fig, .hero-mark, .brand, .inst-logos { -webkit-user-select: none; user-select: none; }

/* ---------------- Piezas comunes ---------------- */
.kicker { font-family: var(--mono); font-weight: 500; font-size: 0.78rem; line-height: 1.5; letter-spacing: 0.14em; text-transform: uppercase; color: var(--azul); margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 4px rgba(28, 122, 67, 0.16); flex: none; }
.label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; color: var(--gris); margin: 0 0 10px; }
.label--gap { margin-top: 40px; }
.statement--long { max-width: 46ch; font-size: clamp(1.12rem, 1.5vw, 1.32rem); margin-bottom: 28px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li + li { margin-top: 6px; }
.plain a { text-decoration: none; }
.dl--tight dd .plain a { display: grid; grid-template-columns: 34px 1fr; gap: 6px; color: var(--tinta); }
.dl--tight dd .plain a:hover { color: var(--azul); }
.numbered { margin: 0; padding-left: 1.3em; color: var(--tinta-2); }
.numbered li { margin-bottom: 12px; padding-left: 6px; }
.numbered li::marker { font-family: var(--mono); font-weight: 500; color: var(--rojo-d); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding: 12px 0 12px 32px; border-top: 1px solid var(--regla); color: var(--tinta-2); }
.checks li::before { content: ""; position: absolute; left: 2px; top: 19px; width: 13px; height: 7px; border-left: 2px solid var(--verde); border-bottom: 2px solid var(--verde); transform: rotate(-45deg); }
.checks--compact li { padding: 7px 0 7px 26px; font-size: 0.95rem; border-top: 0; }
.checks--compact li::before { top: 14px; width: 11px; height: 6px; }
.steps--3 { --n: 3; }
.steps--4 { --n: 4; }
.link-arrow--back:hover svg { transform: translateX(-3px); }
.back { margin: 32px 0 0; }
.section-more { margin: 40px 0 0; }
.section-head--sub { margin-top: clamp(56px, 7vw, 88px); }
.person-chip > span { display: inline-flex; flex-direction: column; line-height: 1.25; }
.person-chip small { font-size: 0.76rem; color: var(--gris); }
.person-chip--rol { padding: 6px 18px 6px 6px; }
.person-chip--rol i { width: 36px; height: 36px; font-size: 0.78rem; }
.person-chip--anon { background: transparent; border-style: dashed; }
.person-chip--anon i { background: var(--crema-2); color: var(--tinta); }
.people--roles { gap: 12px; margin-top: 0; }
.people--small { margin-top: 0; }
.people--small .person-chip { font-size: 0.82rem; }

/* ---------------- Servicios ---------------- */
.service-icon { display: inline-grid; place-items: center; width: 50px; height: 50px; flex: none; border-radius: 12px; background: var(--papel-2); color: var(--azul); transition: background-color 0.25s ease, color 0.25s ease; }
.service-icon .icon { width: 27px; height: 27px; }
.service-minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.service-mini { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 22px; background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); color: var(--tinta); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; line-height: 1.25; transition: border-color 0.25s ease, transform 0.25s ease; }
.service-mini:hover { border-color: var(--tinta); color: var(--tinta); transform: translateY(-2px); }
.service-mini:hover .service-icon, .service:target .service-icon { background: var(--azul); color: #FFFFFF; }
.services-index { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 48px; }
.services-index .chip { text-decoration: none; }
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.service { background: var(--blanco); border: 1px solid var(--regla); border-radius: var(--r); padding: clamp(24px, 3vw, 40px); display: flex; flex-direction: column; scroll-margin-top: calc(var(--header) + 24px); transition: border-color 0.3s, box-shadow 0.3s; }
.service:target { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(62, 64, 149, 0.18); }
.service-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.service h2 { font-size: clamp(1.45rem, 2.1vw, 1.8rem); }
.service-lead { color: var(--tinta-2); margin-bottom: 22px; }
.service .checks { margin-bottom: 20px; }
.service-proof { font-size: 0.93rem; color: var(--gris); }
.service-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--regla); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.clients { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.clients li { border-top: 2px solid var(--tinta); padding-top: 18px; }
.clients h3 { font-size: 1.3rem; margin-bottom: 8px; }
.clients p { color: var(--tinta-2); font-size: 0.95rem; margin: 0; }

/* Proyecto destacado en la portada */
.feature { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.feature-fig canvas { width: min(100%, 340px); height: auto; aspect-ratio: 1 / 1; margin: 0 auto; }
.feature h2 { margin-bottom: 18px; max-width: 26ch; }
.feature .lead { margin-bottom: 24px; }

/* Proyectos */
.projects--one { grid-template-columns: minmax(0, 1fr); }
.project small { display: block; line-height: 1.5; }
.project small .status-dot { margin-right: 10px; vertical-align: 1px; }
.project h3 a { color: var(--tinta); text-decoration: none; }
.project h3 a:hover { color: var(--azul); }
.project .link-arrow { margin-top: 20px; align-self: flex-start; }
.project--main { border-top: 4px solid var(--verde); }
.section--tint .project--main .tag { background: var(--papel-2); }
.project--part { background: transparent; border-style: dashed; }
.project--part small { color: var(--gris); }

/* ---------------- Perfiles de integrantes ---------------- */
.page-head--perfil .wrap { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
.page-head--perfil h1 { font-size: clamp(2.2rem, 4.4vw, 3.5rem); margin-bottom: 16px; }
.page-head--sub h1 { font-size: clamp(2rem, 3.8vw, 3.1rem); }
.portrait-wrap { position: relative; width: fit-content; justify-self: center; }
.portrait-wrap::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; padding: 3px; background: var(--termico); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.portrait { width: clamp(180px, 21vw, 250px); aspect-ratio: 1 / 1; border-radius: 50%; display: grid; place-items: center; color: #FFFFFF; font-family: var(--serif); font-size: clamp(3.4rem, 6vw, 4.8rem); letter-spacing: 0.02em; position: relative; overflow: hidden; }
.portrait.P1 { background: var(--verde); }
.portrait.P2 { background: var(--rojo-d); }
.portrait.P3 { background: var(--azul); }
.portrait span { position: relative; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(40px, 5vw, 64px); }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; padding: 9px 14px; border: 1px solid var(--regla); border-radius: 999px; background: var(--blanco); color: var(--tinta); text-decoration: none; }
.pill svg { width: 13px; height: 13px; opacity: 0.55; }
.pill:hover { border-color: var(--azul); color: var(--azul); }
.section--tight-top { padding-top: clamp(32px, 4vw, 48px); }
.program-name { display: flex; align-items: center; gap: 10px; margin: 0 0 24px; font-size: 0.97rem; }
.plain--lines li { margin-bottom: 10px; }
.plain--lines a { color: var(--tinta); line-height: 1.4; display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.plain--lines a:hover { color: var(--azul); }
.prose-bio p { color: var(--tinta-2); max-width: 66ch; }
.prose-bio p:first-child { font-size: clamp(1.08rem, 1.4vw, 1.2rem); color: var(--tinta); }
.prose-bio + .label { margin-top: 32px; }
.areas { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.areas li { font-size: 0.86rem; padding: 6px 12px; border-radius: 999px; background: var(--papel-2); color: var(--tinta-2); }
.cv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 6vw, 96px); align-items: start; }
.cv h2 { margin-bottom: 24px; }
.cv-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--regla); }
.cv-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--regla); }
.cv-list h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; line-height: 1.35; margin-bottom: 2px; }
.cv-list p { margin: 0; font-size: 0.92rem; color: var(--gris); }
.cv-when { font-family: var(--mono); font-weight: 500; font-size: 0.8rem; color: var(--azul); white-space: nowrap; padding-top: 2px; }
.section--end { padding: clamp(40px, 5vw, 64px) 0; }
.end-links { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.thesis-level .badge { display: inline-block; margin-top: 8px; font-size: 0.74rem; font-weight: 600; color: var(--verde); background: rgba(28, 122, 67, 0.1); border-radius: 999px; padding: 3px 10px; }

/* Crédito del sitio en el pie */
.credit { display: inline-flex; align-items: center; gap: 10px; }
.credit-mark { width: 22px; height: 3px; border-radius: 2px; background: var(--termico-claro); flex: none; }

/* ---------------- Transiciones entre páginas ---------------- */
@view-transition { navigation: auto; }
::view-transition-group(figura) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(.5, 0, .1, 1); }
::view-transition-old(root) { animation: 0.28s cubic-bezier(.4, 0, 1, 1) both vt-out; }
::view-transition-new(root) { animation: 0.5s cubic-bezier(0, 0, .2, 1) 0.08s both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }

/* Carga de cada página sin transición nativa */
.page-head .wrap > div:first-child { animation: rise 0.7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-copy > * { animation: rise 0.8s cubic-bezier(.2, .7, .2, 1) both; }
.hero-copy > *:nth-child(2) { animation-delay: 0.08s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.16s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .chain li { opacity: 1; transform: none; }
  .chain-track line { stroke-dashoffset: 0; }
  .cycle .punto { display: none; }
  @view-transition { navigation: none; }
}

/* ---------------- Responsivo ---------------- */
.nav .nav-extra { display: none; }
/* El menú se pliega antes de que el logo horizontal tenga que encogerse por debajo de 320 px */
@media (max-width: 1299px) {
  .nav, .header-tools .btn { display: none; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: 600 0.9rem/1 var(--sans); color: var(--tinta);
    background: transparent; border: 1px solid var(--regla); border-radius: 999px;
    min-height: 40px; padding: 0 14px; cursor: pointer; white-space: nowrap;
  }
  .menu-btn span { display: grid; gap: 4px; }
  .menu-btn span i { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
  .nav.is-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: fixed; inset: var(--header) 0 0 0; z-index: 49;
    background: var(--azul); padding: 24px var(--gutter) 40px; overflow-y: auto;
  }
  .nav.is-open a { color: #FFFFFF; font-family: var(--serif); font-size: 1.8rem; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.16); border-radius: 0; }
  .nav.is-open a:hover { background: transparent; color: var(--azul-p); }
  .nav.is-open a[aria-current="page"]::after { display: none; }
  .nav.is-open a[aria-current="page"] { color: var(--rojo-l); }
  .nav.is-open :focus-visible { outline-color: #FFFFFF; }
  .nav .nav-extra { display: block; }
}

@media (max-width: 1100px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  :root { --header: 68px; }
  .hero { min-height: auto; }
  .hero > .wrap { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 48px; gap: 48px; }
  .hero-mark { justify-self: start; max-width: 340px; }
  .section-head, .split, .split--even, .invite, .contact, .page-head .wrap { grid-template-columns: 1fr; }
  .page-head .wrap { min-height: 0; padding-top: 24px; gap: 8px; }
  .page-fig { order: -1; flex-direction: row; align-items: center; gap: 18px; }
  .page-fig canvas { width: 168px; flex: none; }
  .page-cycle { height: 124px; width: 190px; flex: none; }
  .chain ol { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .chain-track { display: none; }
  .programs { grid-template-columns: 1fr; border-top: 0; }
  .program, .program:first-child { border-left: 0; padding: 28px 0 8px; border-top: 1px solid var(--tinta); }
  .program:not(:first-child)::before { left: 0; }
  .news--compact { grid-template-columns: 1fr; }
  .news-item { grid-template-columns: 1fr; gap: 6px; }
  .values, .team, .projects, .allies { grid-template-columns: 1fr 1fr; }
  .phases, .facts, .org { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .steps, .route { grid-template-columns: 1fr 1fr; }
  .invite-actions { justify-content: flex-start; }
  .line-block { grid-template-columns: 1fr; }
  .line-tag { display: flex; align-items: baseline; gap: 16px; font-size: 1.8rem; }
  .line-tag small { margin: 0; }
  .feature, .cv, .page-head--perfil .wrap { grid-template-columns: 1fr; }
  .feature-fig { order: -1; }
  .feature-fig canvas { width: 220px; margin: 0; }
  .services { grid-template-columns: 1fr; }
  .service-minis, .clients { grid-template-columns: 1fr 1fr; }
  .portrait-wrap { order: -1; justify-self: start; margin: 12px 0 8px 12px; }
  .portrait { width: 132px; font-size: 2.6rem; }
  .sticky { position: static; }
  .filters { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { font-size: 1rem; }
  .lang { padding: 6px 10px; }
  .values, .team, .projects, .allies, .phases, .facts, .org, .steps, .route, .line-cols, .chain ol { grid-template-columns: 1fr; }
  .topics { columns: 1; }
  .pub { grid-template-columns: 1fr; gap: 4px; }
  .thesis { grid-template-columns: 1fr; gap: 8px; }
  .search-row, .form { grid-template-columns: 1fr; }
  .year-group { grid-template-columns: 1fr; gap: 0; }
  .year-group h2 { position: static; font-size: 1.4rem; }
  .dl, .contact-info .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .inst-logos { gap: 20px; }
  .inst-logos .unisucre { width: 180px; }
  .inst-logos .acreditacion { width: 56px; }
  .timeline::before { left: 54px; }
  .timeline li { grid-template-columns: 54px minmax(0, 1fr); gap: 28px; }
  .timeline li::after { left: 49px; }
  .timeline b { font-size: 0.95rem; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .clients { grid-template-columns: 1fr; }
  .services-index { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)) 32px; padding: 0 var(--gutter) 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .services-index::-webkit-scrollbar { display: none; }
  .services-index .chip { flex: none; }
  .service-minis { grid-template-columns: 1fr; gap: 10px; }
  .service-mini { flex-direction: row; align-items: center; padding: 14px 16px; font-size: 1.08rem; }
  .service-mini .service-icon { width: 42px; height: 42px; }
  .cv-list li { grid-template-columns: 1fr; gap: 4px; }
  .service-top { align-items: flex-start; }
  .end-links { flex-direction: column; align-items: flex-start; }
}

/* Celulares: el logotipo reemplaza a la versión horizontal (el <source> del encabezado usa el mismo corte) */
@media (max-width: 600px) {
  .brand img { height: 46px; }
}

@media print {
  .site-header, .footer-main, .page-fig, .filters, .tabs, .hero-programs { display: none !important; }
  body { background: #fff; }
  .hero-mark img { -webkit-mask-image: none; mask-image: none; }
}

/* ---------------- Frases de la termodinámica ---------------- */
/* Portada: las frases ocupan el lugar del titular y rotan; la altura se fija con la frase más larga */
.hero-quote { margin: 0; }
.hq-stage { display: flex; flex-direction: column; justify-content: flex-end; min-height: 15rem; }
.hq-text { margin: 0; font-family: var(--serif); font-weight: 400; font-synthesis: none; color: var(--tinta); letter-spacing: 0; }
.hq-text p { margin: 0; }
.hq-text.q-s { font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.1; }
.hq-text.q-m { font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.16; }
.hq-text.q-l { font-size: clamp(1.4rem, 2.1vw, 1.8rem); line-height: 1.22; }
.hq-text.q-xl { font-size: clamp(1.25rem, 1.8vw, 1.55rem); line-height: 1.26; }
.hq-cap { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; font-size: 0.95rem; line-height: 1.4; }
.hq-author { font-weight: 600; color: var(--azul); }
.hq-work { color: var(--gris); }
.hq-work cite { font-style: italic; }
.hq-stage.is-out .hq-text, .hq-stage.is-out .hq-cap { opacity: 0; transform: translateY(-8px); }
.hq-stage.is-in .hq-text, .hq-stage.is-in .hq-cap { opacity: 0; transform: translateY(10px); transition: none; }
.hq-text, .hq-cap { transition: opacity 0.45s ease, transform 0.45s cubic-bezier(.2, .7, .2, 1); }
.hq-bar { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.hq-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid var(--regla); border-radius: 50%; background: transparent; color: var(--tinta); cursor: pointer; }
.hq-btn:hover { border-color: var(--azul); color: var(--azul); }
.hq-btn svg { width: 14px; height: 14px; }
.hq-pause svg path.i-pausa { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hq-pause svg path.i-seguir { fill: currentColor; display: none; }
.hq-pause[aria-pressed="true"] svg path.i-pausa { display: none; }
.hq-pause[aria-pressed="true"] svg path.i-seguir { display: inline; }
.hq-progress { position: relative; flex: 1 1 auto; max-width: 160px; height: 3px; border-radius: 2px; background: var(--regla); overflow: hidden; }
.hq-progress i { position: absolute; inset: 0; background: var(--termico); transform-origin: 0 50%; transform: scaleX(0); }
.hq-src { font-size: 0.86rem; color: var(--gris); margin-left: auto; white-space: nowrap; }
.hq-src:hover { color: var(--azul); }

/* Página de frases y fuentes */
.qt-wrap { max-width: calc(880px + 2 * var(--gutter)); }
.qt-author { padding: 8px 0 28px; border-top: 1px solid var(--tinta); }
.qt-author + .qt-author { margin-top: 24px; }
.qt-author h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); padding-top: 22px; }
.qt-life { font-family: var(--mono); font-size: 0.8rem; color: var(--gris); margin-left: 8px; letter-spacing: 0; }
.qt-list { list-style: none; margin: 0; padding: 0; }
.qt { padding: 22px 0; border-bottom: 1px solid var(--regla); scroll-margin-top: calc(var(--header) + 16px); }
.qt:last-child { border-bottom: 0; }
.qt blockquote { margin: 0; font-family: var(--serif); font-size: clamp(1.15rem, 1.6vw, 1.32rem); line-height: 1.4; color: var(--tinta); }
.qt blockquote p { margin: 0; }
.qt-orig { margin: 12px 0 0; padding-left: 14px; border-left: 2px solid var(--regla); font-size: 0.95rem; color: var(--tinta-2); font-style: italic; }
.qt-label { display: block; font-family: var(--mono); font-style: normal; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gris); margin-bottom: 2px; }
.qt-src { margin: 10px 0 0; font-size: 0.86rem; line-height: 1.55; color: var(--gris); }
.qt-src a { white-space: nowrap; }
.qt-src a svg { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; }

@media (max-width: 900px) {
  .hq-stage { min-height: 12rem; }
  .hq-src { margin-left: 0; white-space: normal; }
  .hq-bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .hq-text, .hq-cap { transition: none; }
}
@media print {
  .hq-bar { display: none; }
}
