/* ============================================================
   Applied Animal Genomics & Cytogenomics Lab — Shared Styles
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
  color: #222;
  background: #fdfdfd;
}
p, li, .pub {
  text-align: left;
  line-height: 1.65;
}
footer p, header p, nav p, h1, h2, h3, h4 {
  text-align: center;
}

/* ── Header ── */
header {
  background: #072f5f;
  color: white;
  padding: 2rem 1rem;
  text-align: center;
}
header h1,
header .site-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.2;
}

/* ── Navigation ── */
nav {
  background: #004080;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
nav a {
  display: inline-block;
  padding: 1rem;
  color: white;
  text-decoration: none;
}
nav a:hover,
nav a[aria-current="page"] {
  background: #0055a5;
}

/* Desplegable del menú (se abre al pasar el ratón, con el teclado o al pulsar) */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-toggle {
  display: inline-block;
  padding: 1rem;
  background: none;
  border: 0;
  color: white;
  font: inherit;
  cursor: pointer;
}
.nav-dropdown-toggle::after { content: " \25BE"; font-size: 0.8em; }
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle,
.nav-dropdown-toggle[aria-current="true"] { background: #0055a5; }
/* Pantallas anchas: casillas algo más grandes para llenar la barra */
@media (min-width: 769px) {
  nav > a { font-size: 1.05rem; padding: 1.1rem 1.5rem; }
}

.nav-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  z-index: 20;
  background: #004080;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  text-align: left;
}
.nav-submenu a { display: block; white-space: nowrap; }
.nav-dropdown:hover .nav-submenu,
.nav-dropdown:focus-within .nav-submenu,
.nav-dropdown.abierto .nav-submenu { display: block; }

/* ── Main Content ── */
main {
  padding: 2rem;
  max-width: 960px;
  margin: auto;
}
section {
  margin-bottom: 3rem;
}
h1.page-title {
  color: #004080;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.3rem;
  margin: 0 0 1rem;
  font-size: 1.9rem;
}
h2 {
  color: #004080;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

/* ── Footer ── */
footer {
  background: #072f5f;
  color: white;
  text-align: center;
  padding: 1.5rem 1rem;
}
footer a { color: #aad4ff; }

/* ── Language Toggle ── */
.language-toggle {
  display: inline-block;
  text-decoration: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: #004080;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}
.language-toggle:hover { background: #0055a5; }

/* ── Contact Icons ── */
.contact-icons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.contact-icons img { height: 40px; }
.contact-icons a:hover { opacity: 0.8; }

/* ── Twitter Feed ── */
.twitter-feed {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

/* ── People Page ── */
.person {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
}
.person img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
}
.person-info { flex: 1; }
.person-info h3 {
  margin: 0 0 0.3rem;
  color: #004080;
}
.position {
  font-weight: bold;
  color: #000;
  margin-bottom: 0.5rem;
}
.links a {
  margin-right: 1rem;
  text-decoration: none;
  color: #072f5f;
}
.links img {
  height: 40px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}
.links a:hover { opacity: 0.8; }

/* ── Privacy Policy ── */
.privacyp h3 {
  text-align: left;
  color: #004080;
}

/* ── Publications Page ── */
.year {
  font-size: 1.5rem;
  margin-top: 2rem;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.5rem;
  color: #072f5f;
  font-weight: 600;
}
.pub {
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.pub a { color: #004080; text-decoration: none; }
.pub a:hover { text-decoration: underline; }
.pub em { font-style: italic; }
.pub strong { font-weight: 600; }

/* ── Conferences / Posters Page ── */
.poster-layout {
  display: flex;
  align-items: flex-start;
  text-align: left;
  gap: 2rem;
  margin: 2rem 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 2rem;
}
.poster-info { flex: 1; }
.poster-image { flex: 1; max-width: 45%; }
.poster-image img {
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.conference-header img { width: auto; height: auto; }
.conference-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

/* ── Activities Page ── */
.activity {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid #e0e0e0;
}
.activity:last-of-type {
  border-bottom: none;
}
.activity img {
  /* Activity images range from 0.75 to 1.48 in aspect ratio (portrait photos,
     landscape photos, near-square article screenshots). Without a fixed frame
     each row is a different height and the column reads as broken. A 4:3 box
     with object-fit: cover crops rather than distorts. */
  max-width: 380px;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* ── Projects Page ── */
.project-layout {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  margin-top: 2rem;
}
.project-card {
  flex: 1 1 280px;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  text-align: center;
}
.project-card a {
  text-decoration: none;
  color: #004080;
  display: block;
  padding: 1rem;
}
.project-card a:hover { background: #f0f4f8; }
.project-card img { width: 100%; height: auto; display: block; }
.project-card h3 {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: #004080;
}

/* ── Visitor Counter ── */
.visitor-counter {
  margin-top: 10px;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  header h1, header .site-title { font-size: 1.6rem; }

  .language-toggle {
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 10px;
  }

  .person {
    flex-direction: column;
    text-align: center;
  }

  .activity {
    flex-direction: column;
    text-align: center;
  }

  .poster-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .poster-image { max-width: 100%; }
}


/* ── Readability & accessibility (added 2026-08-12) ── */
img { max-width: 100%; }
.activity img { height: auto; }   /* aspect-ratio drives the box; see above */

:focus-visible {
  outline: 3px solid #ffb703;
  outline-offset: 2px;
}
.language-toggle:focus-visible,
nav a:focus-visible,
.nav-dropdown-toggle:focus-visible {
  outline-color: #ffd166;
}

/* Skip link for keyboard and screen-reader users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #ffb703;
  color: #072f5f;
  padding: 0.75rem 1rem;
  z-index: 1100;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

@media (max-width: 768px) {
  nav a { padding: 0.75rem 0.9rem; font-size: 0.95rem; }
  main { padding: 1.25rem; }
  h1.page-title { font-size: 1.5rem; }
  h2 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ── News list (moved from news.html, 2026-08-12) ── */
.news-item { margin-bottom: 3rem; }
.news-item .news-date {
  font-size: 0.8rem;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.news-item h3 {
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #ccc;
  color: #004080;
  font-size: 1.17rem;
}
.news-item p  { margin: 0; line-height: 1.6; }
.news-item a  { color: #004080; }

.news-tag {
  display: inline-block;
  background: #004080;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.news-tag.paper    { background: #0a6e3f; }
.news-tag.outreach { background: #8a4a00; }
.news-tag.award    { background: #7a0070; }
.news-tag.event    { background: #004080; }
.news-tag.team     { background: #5a5a5a; }
.news-tag.app      { background: #1a5fa8; }

/* ── Noticias con imagen (elegir la disposición en el HTML) ──
   <div class="news-layout img-right"> <div class="news-info">…</div> <div class="news-image"><img …></div> </div>
   Clases (en .news-layout):
     img-top | img-bottom        → imagen encima / debajo del texto (vertical; por defecto)
     img-left | img-right        → imagen a izquierda / derecha del texto (horizontal)
   Tamaño opcional: style="--img-w:300px" en .news-layout (ancho de la imagen en horizontal;
                    en vertical es el ancho máximo). Por defecto 380px.
   En pantallas estrechas siempre pasa a vertical. */
.news-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}
.news-layout.img-top,
.news-layout.img-bottom { flex-direction: column; }
.news-layout.img-left,
.news-layout.img-right  { flex-direction: row; align-items: flex-start; }
/* la posición la decide la clase, no el orden de los div en el HTML */
.news-layout.img-top .news-image,
.news-layout.img-left .news-image  { order: -1; }
.news-layout.img-bottom .news-image,
.news-layout.img-right .news-image { order: 1; }
.news-info { flex: 1 1 0; min-width: 0; }
.news-image {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.news-layout.img-left .news-image,
.news-layout.img-right .news-image { flex: 0 0 var(--img-w, 380px); max-width: 45%; }
.news-layout.img-top .news-image,
.news-layout.img-bottom .news-image { max-width: var(--img-w, 380px); width: 100%; margin: 0 auto; }
.news-image img {
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.news-layout .news-info p + p { margin-top: 0.6rem; }
@media (max-width: 768px) {
  .news-layout.img-left, .news-layout.img-right { flex-direction: column; }
  .news-layout .news-image { flex: none; max-width: 100%; }
}

/* ── Project detail pages (moved from projects/*.html, 2026-08-12) ── */
.project-details img,
.project-details img.app-screenshot {
  height: auto;
  max-width: 100%;
  width: 450px;
  display: block;
  margin: 20px auto;
}
.project-details img.app-screenshot {
  border: 1px solid #ddd;
  border-radius: 6px;
}

.feature-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.feature-card {
  flex: 1 1 220px;
  background: #f7f9fc;
  border-left: 4px solid #004080;
  border-radius: 0 4px 4px 0;
  padding: 1rem 1.25rem;
}
.feature-card--photo { text-align: center; }
.feature-card h4 { margin: 0 0 0.4rem; color: #004080; font-size: 0.95rem; }
.feature-card p  { margin: 0; font-size: 0.9rem; }
.feature-card p.feature-location { text-align: center; }
.feature-card img.feature-logo {
  display: block;
  height: 60px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto 0.6rem;
}
.feature-card img.feature-photo {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0.6rem;
}

/* Subida de vídeos (projects/IA_caballos) */
.upload-btn {
  display: inline-block; padding: 0.6rem 1.4rem; font: inherit; font-weight: 600; color: #fff;
  background: #004080; border: 0; border-radius: 4px; cursor: pointer;
}
.upload-btn:hover:not(:disabled), .upload-btn:focus-visible { background: #0059b3; }
.upload-btn:disabled { opacity: 0.6; cursor: default; }
#upload-progress { display: block; width: 100%; max-width: 420px; margin-top: 0.75rem; }
#upload-status { margin: 0.5rem 0 0; min-height: 1.4em; }
.upload-consent { margin: 0 0 0.75rem; }
.upload-consent input { margin-right: 0.5rem; }
