/* ==========================================================================
   ESTILOS DE LA WEB
   ========================================================================== */

:root {
  --header-height: 70px;
  /* Altura del difuminado de las obras bajo el menú al hacer scroll */
  --fade-height: 90px;
  --font-serif: 'Mongolian Baiti', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --text: #eaeaea;
  --text-soft: #d6d6d6;
  --text-muted: rgba(255, 255, 255, 0.55);
  --hover: #666666;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-serif);
  background-color: #0b0b0b;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

/* Las imágenes no se pueden arrastrar ni seleccionar (ni mantener pulsado en móvil) */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ==========================================================================
   FONDOS FIJOS
   ========================================================================== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.bg-layer.active { opacity: 1; }

/* Velo oscuro para que se lea bien el texto */
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* ==========================================================================
   CABECERA Y MENÚ
   ========================================================================== */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2.5rem;
}

.logo-container {
  position: absolute;
  left: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.logo-img {
  height: 28px;
  width: auto;
  transition: filter 0.3s ease;
}

.logo-container:hover .logo-img { filter: brightness(0.35); }

.nav-menu ul {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.nav-link:hover { color: #555555; }

.nav-link.active {
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  padding-bottom: 2px;
}

/* ==========================================================================
   PORTADA (HOME)
   ========================================================================== */
body.is-home .main-header {
  inset: 0;
  height: 100%;
  flex-direction: column;
  padding: 2rem;
}

body.is-home .logo-container {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  margin-bottom: 2rem;
}

/* En la portada el logo es solo una imagen: sin enlace ni oscurecido */
body.is-home .logo-container { pointer-events: none; }

body.is-home .logo-img {
  height: clamp(55px, 11vh, 110px);
  max-width: 85vw;
  object-fit: contain;
}

body.is-home .nav-menu { margin-bottom: 2.5rem; }

body.is-home .nav-menu ul {
  flex-direction: column;
  gap: 1.1rem;
  text-align: center;
}

body.is-home .nav-link {
  font-size: 1.2rem;
  letter-spacing: 0.06em;
}

body.is-home #main-content { display: none; }

/* Redes sociales */
.home-social-block {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

body.is-home .home-social-block { display: flex; }

.social-links-list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.social-icon-btn {
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  transition: color 0.3s ease, transform 0.2s ease;
}

.social-icon-btn:hover {
  color: var(--hover);
  transform: translateY(-2px);
}

.social-icon-btn svg,
.social-icon-btn img {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* El logo de IMDb es una imagen: se oscurece igual que los demás iconos */
.social-icon-btn img { opacity: 0.85; transition: filter 0.3s ease, opacity 0.3s ease; }
.social-icon-btn:hover img { opacity: 1; filter: brightness(0.4); }

.email-link {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
}

.email-link:hover { color: var(--hover); }

/* ==========================================================================
   ZONA DE CONTENIDO CON DIFUMINADO BAJO EL MENÚ
   El contenido hace scroll dentro de esta capa; su parte superior se
   desvanece gradualmente para que el menú siempre se lea sobre el fondo.
   ========================================================================== */
#main-content {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--header-height) + 25px) 3rem 4rem;
  --fade: linear-gradient(to bottom,
    transparent 0,
    transparent var(--header-height),
    #000 calc(var(--header-height) + var(--fade-height)));
  -webkit-mask-image: var(--fade);
  mask-image: var(--fade);
}

.page-title {
  font-size: 1.9rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #ffffff;
  margin: 0 0 1.5rem;
}

.empty-msg {
  text-align: center;
  padding: 5rem 0;
  color: #777;
}

/* ==========================================================================
   CUADRÍCULA DE OBRAS
   ========================================================================== */
.works-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 0;
}

/* Cada obra: la imagen y, debajo, el año */
.work-item {
  display: block;
  flex: 0 0 290px;
  width: 290px;
  max-width: 100%;
}

.work-year {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-align: left;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.work-card {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
}

/* Audiovisual, Publicaciones y Exposiciones: formato A4 vertical */
.works-grid.is-a4 .work-card,
.related-works.is-a4 .related-thumb { aspect-ratio: 210 / 297; }

.work-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.88);
  transition: filter 0.45s ease, transform 0.6s ease;
}

/* Título que solo aparece al pasar el ratón */
.work-card .title-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-size: 1.25rem;
  color: #ffffff;
  opacity: 0; /* Oculto: solo aparece al pasar el ratón */
  transition: opacity 0.4s ease, background 0.4s ease;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.work-card:hover img {
  filter: brightness(0.45);
  transform: scale(1.03);
}

.work-card:hover .title-overlay {
  opacity: 1;
  background: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   DETALLE DE OBRA
   ========================================================================== */
.work-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding-top: 1rem;
}

.work-detail-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: #ffffff;
  /* Sombra para que se lea sobre fondos claros y oscuros */
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.work-detail-nav a:hover { color: #bbbbbb; text-decoration: underline; }

.media-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.media-nav-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: color 0.3s ease;
}

.media-nav-btn:hover { color: #bbbbbb; text-decoration: underline; }

.media-counter {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  min-width: 3rem;
  text-align: center;
}

.work-media-list {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-slide {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.media-slide[hidden] { display: none; }

/* Descripción de la obra: sin recuadro, centrada bajo la imagen */
.work-caption {
  margin: 2.5rem auto 0;
  max-width: 720px;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.95), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.work-caption h2 {
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #ffffff;
  margin: 0 0 0.25rem;
}

.work-meta {
  font-size: 0.8rem;
  color: #c4c4c4;
  margin: 0 0 0.75rem;
}

.work-text {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0;
}

.work-details {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #cfcfcf;
}

.work-details p { margin: 0 0 0.35rem; }

/* Botones Ver vídeo / Ver en IMDb */
.work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.work-btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-shadow: none;
  transition: background 0.3s ease, color 0.3s ease;
}

.work-btn:hover { background: #ffffff; color: #000000; }

/* Enlaces de interés */
.work-links { font-size: 0.82rem; line-height: 1.5; }
.work-links p { margin: 0 0 0.45rem; }
.work-links a { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.work-links a:hover { color: #bbbbbb; }

/* Encabezados dentro de la ficha, como "Selecciones y reconocimientos" */
.details-heading {
  margin: 1.4rem 0 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
}

/* Miniaturas del resto de obras de la sección */
.related-works {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 1.25rem;
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.related-card {
  flex: 0 0 150px;
  width: 150px;
  max-width: 100%;
  color: #ffffff;
}

.related-thumb {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
}

.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.88);
  transition: filter 0.4s ease, transform 0.5s ease;
}

.related-card:hover img {
  filter: brightness(0.5);
  transform: scale(1.04);
}

.related-title {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
  transition: color 0.3s ease;
}

.related-card:hover .related-title { color: #ffffff; }

/* ==========================================================================
   SOBRE MÍ
   ========================================================================== */
.bio-container {
  max-width: 720px;
  margin: 2rem auto;
  line-height: 1.85;
  font-size: 1.05rem;
  color: var(--text-soft);
}

.bio-container > p { margin: 0 0 1.25rem; }

.cv-btn {
  display: inline-block;
  margin: 1.5rem 0 2rem;
  padding: 0.8rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  transition: all 0.3s ease;
}

.cv-btn:hover { background: #ffffff; color: #000000; }

.bio-contact {
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
}

.bio-contact a[href^="mailto"] { text-decoration: underline; margin-left: 0.25rem; }
.bio-contact a[href^="mailto"]:hover { color: #9ca3af; }
.bio-contact .social-links-list { margin-top: 1rem; }

/* ==========================================================================
   MÓVIL
   ========================================================================== */
.burger-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
}

@media (max-width: 960px) {
  body:not(.is-home) .burger-btn { display: block; }

  body:not(.is-home) .nav-menu {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(10, 10, 10, 0.96);
    backdrop-filter: blur(14px);
    padding: 3rem 2rem;
    z-index: 55;
  }

  body:not(.is-home) .nav-menu.open { display: block; }

  body:not(.is-home) .nav-menu ul {
    flex-direction: column;
    gap: 1.75rem;
  }

  body:not(.is-home) .nav-link { font-size: 1.25rem; }

  .logo-container { left: 1.25rem; }

  #main-content { padding-left: 1rem; padding-right: 1rem; }

  /* Cuadrícula: obras más anchas en el móvil */
  .work-item { flex: 0 0 min(100%, 420px); width: min(100%, 420px); }
  .works-grid { gap: 2.25rem; }

  /* Miniaturas de "otras obras": dos por fila */
  .related-works { gap: 1.5rem 1rem; }
  .related-card { flex: 0 0 calc(50% - 0.5rem); width: calc(50% - 0.5rem); }

  /* Página de obra: botones grandes y fáciles de pulsar con el dedo */
  .work-detail-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .work-detail-nav > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 1rem;
  }

  .media-nav { justify-content: space-between; gap: 0.5rem; }

  .media-nav-btn {
    flex: 1;
    min-height: 48px;
    padding: 0.7rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.35);
    font-size: 1rem;
  }

  .media-nav-btn:hover { text-decoration: none; }

  .media-counter { flex: 0 0 auto; font-size: 0.95rem; }

  .media-slide { max-height: 70vh; }

  .work-caption { margin-top: 2rem; }
  .work-text { font-size: 0.98rem; }
  .work-details { font-size: 0.88rem; }
  .work-links { font-size: 0.92rem; }
  .work-links p { margin-bottom: 0.8rem; }

  .work-btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
  }

  /* Menú y redes */
  body:not(.is-home) .nav-link { display: inline-block; padding: 0.4rem 1rem; }
  .burger-btn { min-width: 48px; min-height: 48px; right: 0.75rem; }
  .social-links-list { gap: 2rem; }
  .social-icon-btn { min-width: 44px; min-height: 44px; justify-content: center; }
  body.is-home .nav-link { display: inline-block; padding: 0.3rem 1rem; }
}

/* ==========================================================================
   PANTALLAS TÁCTILES (sin ratón): el título va debajo de la imagen
   ========================================================================== */
.work-caption-mobile { display: none; }

@media (hover: none) {
  .work-card .title-overlay { display: none; }
  .work-card img { filter: none; }

  .work-caption-mobile {
    display: block;
    margin-top: 0.6rem;
    font-size: 1.05rem;
    line-height: 1.3;
    color: #ffffff;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.9);
  }

  .work-caption-mobile + .work-year { margin-top: 0.2rem; }
}

.work-media-list.is-clickable { cursor: pointer; }
