/* ============================================================
   ÁLVARO PORTILLA — DIRECTOR
   Hoja de estilos principal
   ============================================================ */

/* --- 0. FUENTE PROPIA --- */
@font-face {
  font-family: "Tomolens";
  src: url("../assets/fonts/tomolens.woff2") format("woff2"),
       url("../assets/fonts/tomolens.woff")  format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- 1. VARIABLES: cambia aquí los colores de todo el sitio --- */
:root {
  --hueso:    #EDEAE4;   /* fondo principal */
  --hueso-2:  #E3DFD7;   /* fondo alterno */
  --tinta:    #16130F;   /* texto principal */
  --tinta-60: rgba(22, 19, 15, 0.60);
  --tinta-35: rgba(22, 19, 15, 0.35);
  --tinta-12: rgba(22, 19, 15, 0.12);
  --acento:   #B24A20;   /* naranja quemado */

  /* TIPOGRAFÍA
     --mono ....... la fuente de TODO el sitio (textos, títulos, etiquetas)
     --titular .... SOLO el titular gigante del home ("Historias con textura").
                    Archivo en assets/fonts/, declarado arriba en @font-face. */
  --mono:    "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --titular: "Tomolens", "Instrument Serif", Georgia, serif;

  --sans:   var(--mono);   /* compatibilidad: todo apunta a la mono */
  --serif:  var(--mono);

  --margen: clamp(20px, 4.5vw, 64px);
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- 2. RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--hueso);
  color: var(--tinta);
  font-family: var(--mono);
  font-size: 14px;              /* la mono es más ancha: pide cuerpo menor */
  line-height: 1.65;
  font-weight: 300;
  letter-spacing: 0.03em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

/* --- 3. TEXTURA: grano sutil sobre todo el sitio --- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- 4. TIPOGRAFÍA --- */

/* Títulos: mono en mayúsculas, tracking cerrado para compensar el ancho */
.display {
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

/* El titular gigante del home es la excepción: usa la fuente aparte.
   Tomolens tiene altura de x igual a la de mayúsculas, así que ocupa más
   de lo normal: por eso el cuerpo va algo menor y la interlínea cerrada. */
.hero__titulo {
  font-family: var(--titular);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.015em;
  text-transform: none;
}

.etiqueta {
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tinta-60);
}

/* La mono no tiene cursiva real: el énfasis se hace bajando el peso */
.italica, .tarjeta__titulo em, .siguiente__titulo em {
  font-style: normal;
  font-weight: 300;
  color: var(--tinta-60);
}

/* --- 5. NAVEGACIÓN --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--margen);
  mix-blend-mode: difference;
  color: #fff;
  transition: transform 0.45s var(--ease);
}
.nav--oculta { transform: translateY(-105%); }

.nav__marca {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav__marca span { color: rgba(255,255,255,0.5); font-weight: 300; }

.nav__links { display: flex; gap: 26px; }
.nav__links a {
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 2px;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav__links a:hover::after,
.nav__links a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

.nav__toggle { display: none; }

/* --- 6. HERO --- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--margen) clamp(32px, 6vh, 64px);
  position: relative;
  overflow: hidden;
}
.hero__fondo {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tinta);
}
.hero__fondo img,
.hero__fondo video {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.62;
  filter: grayscale(0.35) contrast(1.05);
}
.hero--claro { color: var(--hueso); }

.hero__titulo {
  font-size: clamp(2.9rem, 10.5vw, 9.5rem);
  margin-bottom: 0.2em;
  max-width: 15ch;
}
.hero__pie {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 48px;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1px solid rgba(237,234,228,0.25);
  padding-top: 18px;
}
.hero__frase { max-width: 46ch; font-size: clamp(0.8rem, 0.95vw, 0.92rem); line-height: 1.7; opacity: 0.82; }
.hero .etiqueta { color: rgba(237,234,228,0.6); }

/* --- 7. SECCIONES --- */
.seccion { padding: clamp(70px, 11vh, 150px) var(--margen); }
.seccion--alt { background: var(--hueso-2); }

.seccion__cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--tinta-12);
  padding-bottom: 14px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.seccion__titulo {
  font-family: var(--mono);
  font-size: clamp(1rem, 2.4vw, 1.85rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* --- 8. GRID DE PROYECTOS --- */
.trabajos {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(28px, 4vw, 64px) clamp(20px, 2.5vw, 40px);
}

.tarjeta {
  grid-column: span 6;
  display: block;
  position: relative;
}
/* Ritmo editorial: algunas tarjetas se desfasan */
.tarjeta:nth-child(4n+1) { grid-column: span 7; }
.tarjeta:nth-child(4n+2) { grid-column: span 5; align-self: end; }
.tarjeta:nth-child(4n+3) { grid-column: span 5; }
.tarjeta:nth-child(4n+4) { grid-column: span 7; align-self: end; }

.tarjeta__medio {
  position: relative;
  overflow: hidden;
  background: var(--tinta-12);
  aspect-ratio: 16 / 10;
}
.tarjeta__medio img,
.tarjeta__medio video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
  filter: grayscale(0.5) contrast(1.03);
}
.tarjeta__preview {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.tarjeta:hover .tarjeta__medio img { transform: scale(1.045); filter: grayscale(0) contrast(1.03); }
.tarjeta:hover .tarjeta__preview { opacity: 1; }

.tarjeta__ver {
  position: absolute;
  left: 16px; bottom: 16px;
  background: var(--hueso);
  color: var(--tinta);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.45s var(--ease);
}
.tarjeta:hover .tarjeta__ver { opacity: 1; transform: translateY(0); }

.tarjeta__info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  border-top: 1px solid var(--tinta-12);
  padding-top: 10px;
}
.tarjeta__titulo {
  font-family: var(--mono);
  font-size: clamp(0.85rem, 1.25vw, 1.05rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.tarjeta__meta { text-align: right; white-space: nowrap; }

/* --- 9. FILTROS --- */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.filtro {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: 1px solid var(--tinta-12);
  border-radius: 100px;
  color: var(--tinta-60);
  transition: all 0.3s var(--ease);
}
.filtro:hover { border-color: var(--tinta-35); color: var(--tinta); }
.filtro[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: var(--hueso); }

/* --- 10. PÁGINA DE PROYECTO --- */
.proyecto__cabecera {
  padding: clamp(110px, 16vh, 190px) var(--margen) clamp(28px, 4vh, 48px);
}
.proyecto__titulo { font-size: clamp(1.5rem, 4.4vw, 3.4rem); margin-bottom: 0.35em; }
.proyecto__bajada { max-width: 58ch; font-size: clamp(0.85rem, 1.05vw, 1rem); color: var(--tinta-60); }

.reproductor {
  margin: 0 var(--margen);
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--tinta);
  overflow: hidden;
}
.reproductor iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ficha {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(48px, 8vh, 100px) var(--margen);
}
.ficha__texto { grid-column: span 7; }
.ficha__texto p { font-size: clamp(0.85rem, 1vw, 0.95rem); line-height: 1.75; margin-bottom: 1.3em; max-width: 68ch; }
.ficha__datos { grid-column: 9 / span 4; }

.dato {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--tinta-12);
  font-size: 13px;
}
.dato { font-size: 12px; }
.dato dt { color: var(--tinta-35); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; padding-top: 2px; }
.dato dd { text-align: right; }

/* --- 11. STILLS --- */
.stills {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(12px, 1.6vw, 22px);
  padding: 0 var(--margen) clamp(60px, 10vh, 120px);
}
.stills figure { overflow: hidden; background: var(--tinta-12); }
.stills img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.stills figure:hover img { transform: scale(1.03); }
.still--ancho  { grid-column: span 8; aspect-ratio: 16/9; }
.still--medio  { grid-column: span 4; aspect-ratio: 4/5; }
.still--total  { grid-column: span 12; aspect-ratio: 21/9; }
.still--mitad  { grid-column: span 6; aspect-ratio: 3/2; }

/* --- 12. NAVEGACIÓN ENTRE PROYECTOS --- */
.siguiente {
  border-top: 1px solid var(--tinta-12);
  padding: clamp(40px, 7vh, 80px) var(--margen);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.siguiente__titulo {
  font-family: var(--mono);
  font-size: clamp(1rem, 2.6vw, 2rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-top: 6px;
  transition: color 0.4s var(--ease);
}
.siguiente:hover .siguiente__titulo { color: var(--acento); }

/* --- 13. BIO --- */
.bio { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.bio__retrato { grid-column: span 5; aspect-ratio: 4/5; overflow: hidden; background: var(--tinta-12); }
.bio__retrato img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.35); }
.bio__texto { grid-column: 7 / span 6; }
.bio__texto p { font-size: clamp(0.85rem, 1.05vw, 1rem); line-height: 1.75; margin-bottom: 1.2em; max-width: 62ch; }
.bio__texto p:first-child {
  font-size: clamp(0.95rem, 1.5vw, 1.25rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.listado { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 24px; margin-top: 8px; }
.listado li { list-style: none; padding: 9px 0; border-bottom: 1px solid var(--tinta-12); font-size: 12px; }

/* --- 14. CONTACTO / PIE --- */
.pie { background: var(--tinta); color: var(--hueso); padding: clamp(60px, 10vh, 130px) var(--margen) 32px; }
.pie a { transition: color 0.3s var(--ease); }
.pie a:hover { color: var(--acento); }
.pie__grande {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 3.2vw, 2.6rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  display: inline-block;
  word-break: break-word;
}
.pie__fila {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 56px;
  justify-content: space-between;
  margin-top: clamp(40px, 7vh, 80px);
  padding-top: 20px;
  border-top: 1px solid rgba(237,234,228,0.18);
}
.pie .etiqueta { color: rgba(237,234,228,0.45); display: block; margin-bottom: 8px; }
.pie__redes { display: flex; gap: 22px; font-size: 13px; }

/* --- 15. ANIMACIÓN DE ENTRADA --- */
.revelar { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.revelar.visible { opacity: 1; transform: none; }

/* --- 16. RESPONSIVE --- */
@media (max-width: 900px) {
  .ficha__texto, .ficha__datos { grid-column: span 12; }
  .bio__retrato, .bio__texto { grid-column: span 12; }
  .bio__retrato { aspect-ratio: 3/2; }
  .still--ancho, .still--medio, .still--mitad { grid-column: span 6; }
}

@media (max-width: 680px) {
  .tarjeta,
  .tarjeta:nth-child(4n+1),
  .tarjeta:nth-child(4n+2),
  .tarjeta:nth-child(4n+3),
  .tarjeta:nth-child(4n+4) { grid-column: span 12; align-self: auto; }

  .still--ancho, .still--medio, .still--mitad, .still--total { grid-column: span 12; aspect-ratio: 3/2; }

  .nav__links {
    position: fixed;
    inset: 0;
    background: var(--tinta);
    color: var(--hueso);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 26px;
    font-size: 18px;
    transform: translateY(-100%);
    transition: transform 0.5s var(--ease);
  }
  .nav__links a { font-size: 15px; }
  body.menu-abierto .nav__links { transform: none; }
  .nav__toggle { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; z-index: 2; }
  body.menu-abierto { overflow: hidden; }
  body.menu-abierto .nav { mix-blend-mode: normal; color: var(--hueso); }
  body.menu-abierto .nav__marca span { color: rgba(237,234,228,0.5); }
  .seccion__cabecera { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .revelar { opacity: 1; transform: none; }
}
