/* =========================================================
   PACDIN · VirtualCat — hoja de estilos principal
   HTML5 + CSS puro (sin frameworks, sin JavaScript)
   Responsive: escritorio, tablet y móvil
   ========================================================= */

/* ---------- Variables ---------- */
:root {
  --color-primary: #1a3a5c;      /* azul oscuro institucional */
  --color-primary-dark: #12283f;
  --color-accent: #e8a020;       /* ámbar acento */
  --color-accent-dark: #c7881a;
  --color-bg: #ffffff;
  --color-bg-alt: #f4f6f8;
  --color-text: #2b2f33;
  --color-text-muted: #5c6670;
  --color-border: #dde3e8;

  --font-stack: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-height: 74px;
  --container-max: 1160px;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 32, 48, 0.08);
  --shadow-md: 0 6px 18px rgba(16, 32, 48, 0.10);
  --transition: 0.22s ease;
}

/* ---------- Reset básico ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: #f7f7f7 url("../assets/img/bg01.png");
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--color-primary-dark);
  font-weight: 700;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }

.container {
  width: min(100% - 2.5rem, var(--container-max));
  margin-inline: auto;
}

/* =========================================================
   Header y navegación
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
  flex-wrap: wrap;
  padding-block: 0.5rem;
}

/* --- Marca / logo --- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  min-width: 0;
}

.brand:hover { color: #fff; }

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 3px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 0.72rem;
  color: #b9c7d4;
  max-width: 34ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Lista de navegación (escritorio) --- */
.main-nav { margin-left: auto; }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}

.nav-item { position: relative; }

.nav-link {
  display: block;
  padding: 0.65rem 0.9rem;
  color: #e8eef4;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-item:focus-within > .nav-link {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Flechita en elementos con submenú */
.has-submenu > .nav-link::after {
  content: "▾";
  margin-left: 0.4em;
  font-size: 0.7em;
  vertical-align: middle;
  opacity: 0.8;
}

/* --- Submenú (escritorio: aparece al pasar el ratón o con foco) --- */
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: 0.4rem 0;
  list-style: none;
  margin: 0;

  /* Oculto por defecto */
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.submenu a {
  display: block;
  padding: 0.55rem 1.1rem;
  color: var(--color-text);
  font-size: 0.92rem;
  white-space: nowrap;
}

.submenu a:hover,
.submenu a:focus {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  font-weight: 600;
}

/* Mostrar submenú al pasar el ratón o al recibir foco (accesible con teclado) */
.has-submenu:hover > .submenu,
.has-submenu:focus-within > .submenu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Acordeón de submenús en móvil (oculto en escritorio) */
.sub-toggle { display: none; }
.sub-toggle-label { display: none; }

/* Puente invisible para no perder el hover al bajar hacia el submenú */
.submenu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* --- Botón hamburguesa (solo móvil) --- */
.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
}

.nav-toggle-label:hover { background: rgba(255, 255, 255, 0.12); }

.nav-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* =========================================================
   Hero / banner
   ========================================================= */
.hero {
  background:
    linear-gradient(120deg, rgba(18, 40, 63, 0.78) 0%, rgba(26, 58, 92, 0.52) 50%, rgba(26, 58, 92, 0.25) 100%),
    url("../assets/img/catenaria.jpg") center/cover no-repeat;
  color: #fff;
  padding: 5rem 0 4.5rem;
}

.hero-inner {
  display: flex;
  align-items: center;
}

.hero-text {
  max-width: 52rem;
}

.hero-title {
  color: #fff;
  max-width: 22ch;
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.hero-emphasis {
  display: block;
  font-size: 0.55em;
  font-weight: 500;
  color: var(--color-accent);
  margin-top: 0.35em;
}

.hero-lead {
  max-width: 62ch;
  font-size: 1.08rem;
  color: #d7e1ea;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-primary-dark);
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  color: #fff;
}

/* Botones fantasma: misma forma, borde blanco (sobre fondo oscuro) */
.btn-ghost {
  border: 2px solid rgba(255, 255, 255, 0.7);
  color: #fff;
}
.btn-ghost:hover {
  background: #fff;
  color: var(--color-primary-dark);
  border-color: #fff;
}

/* =========================================================
   Secciones y tarjetas
   ========================================================= */
.section { padding: 4rem 0; }
.section-alt { background: var(--color-bg-alt); }

.container-narrow { max-width: 760px; }

.section-header {
  text-align: center;
  max-width: 64ch;
  margin: 0 auto 2.5rem;
}

.section-header h2 {
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}

.section-header h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 56px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

.section-header p {
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* --- "De un vistazo": galería (desplazable) + noticias (scroll vertical) --- */
.glance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

/* Galería: carrusel (js/gallery.js) — una imagen a la vez, bien espaciada */
.gallery {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.gallery-viewport {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  aspect-ratio: 16 / 9;
  background: var(--color-primary-dark);
  touch-action: pan-y;
  flex: 0 0 auto;
}

.gallery-track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.65s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transform;
}

.gallery-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
}

.gallery-slide > a {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.4rem 2.6rem 0.85rem;
  background: linear-gradient(to top, rgba(18, 40, 63, 0.85) 0%, rgba(18, 40, 63, 0.45) 55%, transparent 100%);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Flechas */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(18, 40, 63, 0.55);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  z-index: 2;
}

.gallery-nav--prev { left: 0.8rem; }
.gallery-nav--next { right: 0.8rem; }

.gallery-nav:hover,
.gallery-nav:focus-visible {
  background: var(--color-accent);
  transform: translateY(-50%) scale(1.06);
}

/* Barra de control bajo la imagen: contador + puntos (absorbe el alto sobrante de la tarjeta) */
.gallery-bar {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.15rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  min-height: 48px;
}

.gallery-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  min-width: 3.5ch;
  text-align: center;
  white-space: nowrap;
}

/* Puntos de indicación */
.gallery-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.gallery-dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 2px solid #b9c4cd;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.gallery-dot:hover {
  border-color: var(--color-accent);
  transform: scale(1.2);
}

.gallery-dot:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.gallery-dot.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.1);
}

/* Noticias: panel con lista desplazable verticalmente */
.news-box {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.news-box-title {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--color-primary-dark);
  position: relative;
}

.news-box-title::after {
  content: "";
  position: absolute;
  left: 1rem;
  bottom: 0;
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

.news-scroll {
  flex: 1;
  overflow-y: scroll;
  max-height: 420px;
  -webkit-overflow-scrolling: touch;
}

.news-scroll::-webkit-scrollbar { width: 8px; }
.news-scroll::-webkit-scrollbar-track { background: var(--color-bg-alt); }
.news-scroll::-webkit-scrollbar-thumb { background: var(--color-accent); border-radius: 4px; }

.news-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.news-item:last-child { border-bottom: none; }

.news-date {
  display: inline-block;
  justify-self: start;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

.news-title {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  color: var(--color-primary-dark);
}

.news-text {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .glance-layout { grid-template-columns: 1fr; }
  .news-scroll { max-height: 320px; }
}

@media (max-width: 560px) {
  .news-item { padding: 0.9rem; }
  .gallery-caption { font-size: 0.88rem; padding: 1.8rem 1rem 2.4rem; }
  .gallery-nav { width: 36px; height: 36px; font-size: 1rem; }
  .gallery-nav--prev { left: 0.5rem; }
  .gallery-nav--next { right: 0.5rem; }
  .gallery-dots { gap: 0.4rem; }
  .gallery-dot { width: 9px; height: 9px; }
  .gallery-bar { padding: 0.6rem 0.9rem; }
  .gallery-counter { font-size: 0.8rem; }
}

/* --- Rejilla de tarjetas --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card h3 { margin-bottom: 0.4rem; }

.card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  line-height: 1;
}

.card-link {
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.8rem;
}

.card-link:hover { color: var(--color-accent-dark); }

/* =========================================================
   Cabecera de páginas interiores
   ========================================================= */
.page-hero {
  background:
    linear-gradient(120deg, var(--color-primary-dark), var(--color-primary)),
    url("../assets/img/bg01.png");
  color: #fff;
  padding: 2.25rem 0 2rem;
}

.page-hero-title {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.page-hero-sub {
  max-width: 64ch;
  color: #d7e1ea;
  margin: 0;
}

/* Elemento de navegación activo: texto resaltado + línea de separación
   inferior (estilo de la web anterior) */
.nav-item.current > .nav-link {
  color: #fff;
  font-weight: 700;
  background: transparent;
  position: relative;
}

.nav-item.current > .nav-link::before {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.2rem;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* =========================================================
   Barra horizontal de subsecciones (debajo del menú)
   ========================================================= */
.subnav {
  background: var(--color-primary-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  z-index: 50;
}

.subnav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  width: min(100% - 2.5rem, var(--container-max));
  margin-inline: auto;
  padding: 0.55rem 0;
}

.subnav-label {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.75rem;
  white-space: nowrap;
}

/* La etiqueta de la sección siempre va "seleccionada" (es la página actual) */
.subnav-label a {
  color: var(--color-accent);
  font-weight: 700;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  padding: 0.45rem 0;
  position: relative;
  text-decoration: none;
}

.subnav-label a:hover {
  color: #fff;
}

.subnav-label a::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.05rem;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

.subnav-label a:hover::before {
  background: #fff;
}

.subnav a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  position: relative;
  white-space: nowrap;
}

.subnav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Indicador de la sección activa:
   - sin ancla no se resalta ninguna opción (solo la etiqueta de la página)
   - al pulsar una opción, queda resaltada (sin JavaScript) */
body:has(#pacdin-estatico:target) .subnav a[href$="#pacdin-estatico"],
body:has(#pacdin-dinamico:target) .subnav a[href$="#pacdin-dinamico"],
body:has(#optimizacion:target) .subnav a[href$="#optimizacion"],
body:has(#errores-montaje:target) .subnav a[href$="#errores-montaje"],
body:has(#pantografo:target) .subnav a[href$="#pantografo"],
body:has(#diagnostico:target) .subnav a[href$="#diagnostico"],
body:has(#hil:target) .subnav a[href$="#hil"],
body:has(#control-activo:target) .subnav a[href$="#control-activo"],
body:has(#identificacion-pantografo:target) .subnav a[href$="#identificacion-pantografo"],
body:has(#virtualcat-banco:target) .subnav a[href$="#virtualcat-banco"],
body:has(#virtualcat-hil:target) .subnav a[href$="#virtualcat-hil"],
body:has(#virtualcr:target) .subnav a[href$="#virtualcr"],
body:has(#prometeo:target) .subnav a[href$="#prometeo"] {
  color: #fff;
  font-weight: 700;
}

body:has(#pacdin-estatico:target) .subnav a[href$="#pacdin-estatico"]::before,
body:has(#pacdin-dinamico:target) .subnav a[href$="#pacdin-dinamico"]::before,
body:has(#optimizacion:target) .subnav a[href$="#optimizacion"]::before,
body:has(#errores-montaje:target) .subnav a[href$="#errores-montaje"]::before,
body:has(#pantografo:target) .subnav a[href$="#pantografo"]::before,
body:has(#diagnostico:target) .subnav a[href$="#diagnostico"]::before,
body:has(#hil:target) .subnav a[href$="#hil"]::before,
body:has(#control-activo:target) .subnav a[href$="#control-activo"]::before,
body:has(#identificacion-pantografo:target) .subnav a[href$="#identificacion-pantografo"]::before,
body:has(#virtualcat-banco:target) .subnav a[href$="#virtualcat-banco"]::before,
body:has(#virtualcat-hil:target) .subnav a[href$="#virtualcat-hil"]::before,
body:has(#virtualcr:target) .subnav a[href$="#virtualcr"]::before,
body:has(#prometeo:target) .subnav a[href$="#prometeo"]::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.05rem;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

@media (max-width: 760px) {
  .subnav-inner {
    width: 100%;
    margin-inline: 1.25rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0.5rem 0;
  }
  .subnav-label { margin-right: 0.4rem; }
}

/* =========================================================
   Listado de artículos
   ========================================================= */
.content-page {
  max-width: 1080px;
}

.article-group {
  margin-bottom: 2.25rem;
}

.article-group h2 {
  font-size: 1.15rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: 1rem;
}

.paper-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 0.75rem;
}

/* Móvil: si no caben dos columnas, una sola */
@media (max-width: 900px) {
  .paper-list { grid-template-columns: 1fr; }
}

.paper {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.paper:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.paper-icon-link {
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.paper-icon-link:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

.paper-icon {
  width: 96px;
  height: auto;
  border: none;
  border-radius: 0;
}

.paper-body {
  min-width: 0;
  flex: 1;
}

.paper-year {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  margin-bottom: 0.35rem;
}

.paper-title {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  line-height: 1.4;
}

.paper-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}

.paper-meta {
  margin: 0;
  font-size: 0.84rem;
  color: var(--color-text-muted);
}

/* Tarjeta clicable (proyectos con página propia) */
.paper-card-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
  transition: box-shadow var(--transition), transform var(--transition);
}

.paper:hover .paper-card-link,
.paper-card-link:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.paper-more {
  margin: 0.65rem 0 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-accent);
}

/* Enlace "← Volver" en páginas de proyecto */
.back-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.paper-link {
  font-weight: 700;
}

/* Texto continuo para páginas de detalle (p. ej. resumen de proyecto) */
.prose p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--color-text);
}

.prose h3 {
  margin: 1.25rem 0 0.75rem;
  font-size: 1rem;
  color: var(--color-primary-dark);
}

/* Figura ilustrativa con pie (p. ej. esquema HIL) */
.project-figure {
  margin: 0 0 1.25rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.project-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.project-figure video {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.project-figure figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.84rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* Cuadrícula de figuras del informe */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 0.25rem;
}

.figure-grid .project-figure {
  margin: 0;
}

/* Figura a ancho completo dentro de la cuadrícula */
.figure-grid .figure-wide {
  grid-column: 1 / -1;
}

/* Indicador de estado del proyecto (p. ej. "Proyecto finalizado") */
.status-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  background: #e7f3ea;
  color: #20713a;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* Variante neutra (p. ej. "Equipo colaborador") */
.status-badge.badge-neutral {
  background: #e8eef6;
  color: var(--color-primary);
}

/* Hueco reservado para vídeo */
.video-slot {
  margin-top: 1.25rem;
}

.video-embed {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-frame {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    var(--color-bg-alt) 0 14px,
    #eceff2 14px 28px
  );
}

.video-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

@media (max-width: 760px) {
  .figure-grid {
    grid-template-columns: 1fr;
  }
}

/* Lista ordenada de objetivos específicos */
.obj-list {
  margin: 0;
  padding-left: 1.2rem;
}

.obj-list li {
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text);
}

/* En móvil la portada pasa a ocupar toda la fila */
@media (max-width: 560px) {
  .paper {
    flex-direction: column;
    gap: 0.6rem;
  }
  .paper-icon { width: 160px; }
}

/* =========================================================
   Tarjetas de módulo (página Simulación)
   ========================================================= */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.5rem;
}

.module-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.module-media {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-media img {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Variantes para fotografía a rellenar la zona (p. ej. banco de ensayos) */
.module-media--cover {
  min-height: 180px;
}

.module-media--cover img {
  width: 100%;
  height: 180px;
  max-height: none;
  object-fit: cover;
}

.module-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.25rem 1.3rem;
  flex: 1;
}

.module-chip {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
}

.module-title {
  font-size: 1.2rem;
  margin: 0;
}

.module-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  flex: 1;
}

/* =========================================================
   Tarjetas de equipo (página Equipo)
   ========================================================= */
.team-intro {
  margin-bottom: 1.75rem;
}

.team-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.5rem;
}

.team-links a {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.team-links a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Enlaces de los institutos dentro del texto introductorio (Equipo) */
.team-intro a {
  text-decoration: underline;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--color-primary-dark);
  color: #c5d1dc;
  font-size: 0.92rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  padding: 3rem 0 2rem;
}

.site-footer h3 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li { margin-bottom: 0.5rem; }

.site-footer a { color: var(--color-accent); }
.site-footer a:hover { color: #fff; }

/* --- Logos institucionales en el footer --- */
.footer-logos {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.footer-logo {
  background: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  box-shadow: var(--shadow-sm);
  height: auto;
}

.footer-logo-i2mb { height: 52px; width: auto; }
.footer-logo-upv  { height: 52px; width: auto; }

.footer-copyright {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1rem 0;
  font-size: 0.85rem;
  color: #8fa3b3;
  text-align: center;
}

/* =========================================================
   Responsive: tablet (≤ 900 px)
   ========================================================= */
@media (max-width: 900px) {
  .brand-tagline { display: none; }
  .hero { padding: 3.5rem 0 3rem; }
  .section { padding: 3rem 0; }
}

/* =========================================================
   Responsive: móvil (≤ 760 px)
   Menú hamburguesa con checkbox (sin JavaScript)
   ========================================================= */
@media (max-width: 760px) {

  .nav-toggle-label { display: flex; }

  .header-inner {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  /* Navegación colapsada por defecto */
  .main-nav {
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  /* Menú abierto */
  .nav-toggle:checked ~ .main-nav {
    max-height: 900px;
    overflow: visible;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
    padding-bottom: 0.75rem;
  }

  .nav-link {
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
  }

  /* Submenús: desplegados en línea, sin posición absoluta,
     y colapsados por defecto (acordeón al pulsar la flecha) */
  .has-submenu > .nav-link::after { content: ""; }

  .nav-item.has-submenu {
    display: flex;
    flex-wrap: wrap;
  }

  .nav-item.has-submenu > .nav-link {
    flex: 1 1 auto;
  }

  .sub-toggle-label {
    display: flex;
    align-items: center;
    padding: 0 1.1rem;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.22s ease, background 0.22s ease;
  }

  .sub-toggle-label:active {
    background: rgba(255, 255, 255, 0.08);
  }

  .submenu {
    position: static;
    min-width: 0;
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.35rem 0 0.35rem 1rem;

    display: none;
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  .sub-toggle:checked ~ .sub-toggle-label {
    transform: rotate(180deg);
  }

  .sub-toggle:checked ~ .submenu {
    display: block;
  }

  .submenu::before { content: none; }

  .submenu a {
    color: #b9c7d4;
    padding: 0.45rem 0.25rem;
    font-size: 0.9rem;
  }

  .submenu a:hover { color: #fff; background: transparent; }

  /* Animación de la hamburguesa a X */
  .nav-toggle:checked ~ .nav-toggle-label .nav-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle:checked ~ .nav-toggle-label .nav-bar:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle:checked ~ .nav-toggle-label .nav-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero-actions .btn { width: 100%; text-align: center; }
}
