/* =========================
   Reset & Base
   ========================= */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: #111;
  color: #eee;
  font-family: system-ui, sans-serif;
}

/* =========================
   Index (grid de 6)
   ========================= */
#index {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.grid {
  display: grid;
  height: 100%;
  width: 100%;
  gap: 4px;
  padding: 4px;
}

/* Retrato: 2 x 3 */
@media (max-aspect-ratio: 1/1) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
  }
}

/* Apaisado/cuadrado: 3 x 2 */
@media (min-aspect-ratio: 1/1) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

/* Móvil: 1 x 6 + scroll vertical */
@media (max-width: 640px) {
  #index {
    height: auto;
  }

  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, min(50vh, 360px));
    height: auto;
  }

  body {
    overflow: auto;
  }
}

/* Tiles */
.tile {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* (Compat) Fondo del tile si existiera .bg como <img> */
.tile .bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.9) contrast(1);
  pointer-events: none;
}

/* Logo centrado en tile */
.tile .logo-link {
  position: relative;
  z-index: 2;
  display: block;
}

.tile .logo {
  max-width: 62%;
  max-height: 62%;
  display: block;
  margin: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .65));
}

/* Overlay 7º proyecto (home) */
#unlock7 {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10;
  pointer-events: none;
  /* la capa no intercepta clics */
}

#unlock7.show {
  display: flex;
}

#unlock7 a {
  pointer-events: auto;
  display: inline-block;
  text-decoration: none;
}

#unlock7 img {
  max-width: clamp(160px, 30vw, 420px);
  max-height: 40vh;
  filter: none;
}

/* =========================
   Project page
   ========================= */

/* Contenedor principal */
#project-root {
  padding: 16px;
  margin: 0 auto;
  max-width: 1200px;
  color: #000;
  /* texto negro en detalle */
  background: transparent;
  /* deja ver el fondo si lo hay */
  padding-block: 10vh;
}

@media (min-width: 641px) {
  #project-root {
    width: 80dvw;
  }
}

/* Fondo: usa var --bg-color si está definida desde JS */
.project-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-color, transparent);
}

.project-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Header / logo / sinopsis */
.project-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.project-logo {
  max-width: 420px;
  width: 60vw;
  height: auto;
  display: block;
}

/* Sinopsis: usar párrafos normales (no pre-wrap) */
.project-sinopsis {
  white-space: normal;       /* override del pre-wrap anterior */
  line-height: 1.35;
  text-align: center;
  max-width: 800px;
  margin: 0 auto 1em;
  overflow-wrap: anywhere;

  font-family: "Spectral SC", serif;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Inicial un pelín más grande al inicio de cada P */
.project-sinopsis p::first-letter {
  font-size: 1.22em;
  line-height: 1;
  font-weight: 400;
}


/* Textos */
.project-textos p {
  max-width: 800px;
  margin: 0 auto 1em;
  line-height: 1.6;
}

/* Galería: vertical (una imagen/vídeo tras otro) */
.project-galeria {
  display: block;
  padding: 8px 0;
}

.project-galeria.column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-galeria .gal-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  cursor: pointer;
}

.project-galeria .gal-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  outline: none;
}

/* Overlay para ampliar (img + video) */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .96);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.overlay.show {
  display: flex;
}

.overlay .overlay-media {
  max-width: 92vw;
  max-height: 92vh;
  display: block;
}

/* Elemento divertido */
.fun {
  position: fixed;
  left: 0;
  top: 0;
  width: 72px;
  pointer-events: none;
}

.fun.touchable {
  pointer-events: auto;
}

/* Botón de permiso para giroscopio (iOS) */
.gyro-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10000;
  padding: 8px 12px;
  border-radius: 999px;
  background: #0008;
  color: #fff;
  border: 1px solid #fff3;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

/* Botón volver (si lo usas) */
.back-row {
  text-align: center;
}

.back-bottom {
  display: inline-block;
  margin: 40px auto 10px;
  padding: 10px 16px;
  border: 1px solid #0003;
  border-radius: 6px;
  color: #000;
  text-decoration: none;
}

.back-bottom:hover {
  background: #00000010;
}

.back {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  text-decoration: none;
  font-size: 1.2em;
  padding: 8px;
  border-radius: 6px;
}

/* ===== Comodín (bloques libres con anclas) ===== */
.comodin {
  margin: 16px auto;
  max-width: 800px;
}

.comodin.align-center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.comodin.align-left {
  margin-left: 0;
  text-align: left;
}

.comodin.align-right {
  margin-right: 0;
  text-align: right;
}

.comodin.width-auto {
  max-width: 800px;
}

.comodin.width-half {
  max-width: 600px;
}

.comodin.width-full {
  max-width: none;
  width: min(100%, 1200px);
}

.comodin-image img,
.comodin-video video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.comodin figcaption {
  font-size: .9rem;
  opacity: .75;
  margin-top: 6px;
}