/* ---------- Fuentes (alojadas en la propia web) ---------- */
@font-face { font-family: "Hanken"; src: url(/assets/fonts/hanken-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken"; src: url(/assets/fonts/hanken-latin-ext.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-latin-ext.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Mono"; src: url(/assets/fonts/dmmono-latin.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Mono"; src: url(/assets/fonts/dmmono-latin-ext.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Variables ---------- */
:root {
  --bg: #f5f5f5;
  --fg: #000;
  --muted: #5c5c5c;
  --line: #d9d9d9;
  --radius: 12px;
  --gap: clamp(14px, 2.2vw, 28px);
  --pad: clamp(16px, 3.5vw, 48px);
  --row-h: 360px;
  --f-display: "Hanken", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
body.oscuro { --bg: #111; --fg: #f2f2f2; --muted: #a6a6a6; --line: #333; color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100svh; display: flex; flex-direction: column;
}
main { flex: 1; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--pad); top: 8px; z-index: 20; background: var(--bg); padding: 6px 10px; }
.meta { font-family: var(--f-mono); font-size: 13px; letter-spacing: .01em; color: var(--muted); margin: 0; }

/* ---------- Cabecera fija ---------- */
/* Logo y "+" flotan sobre la página, sin barra de fondo (como en Cargo) */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--pad); pointer-events: none;
}
.top a { pointer-events: auto; }
main { padding-top: 62px; }
.home main { padding-top: 0; }
.top a { text-decoration: none; font: 400 26px/1 var(--f-display); padding: 4px; }
.top .plus { font-size: 32px; font-weight: 300; }

/* ---------- Portada ---------- */
.hero {
  min-height: 100svh;
  display: grid; place-content: center; text-align: center;
  padding: 0 var(--pad) 12vh; position: relative;
}
.hero h1 { font: 400 clamp(46px, 8.5vw, 112px)/1 var(--f-display); letter-spacing: -.02em; margin: 0; }
.hero .ast { font-size: .55em; vertical-align: baseline; margin-left: .02em; }
.lema { font-family: var(--f-mono); font-style: italic; font-size: clamp(14px, 1.6vw, 19px); margin: 1.1em 0 0; }
.flechas {
  position: absolute; left: 50%; bottom: 7vh; transform: translateX(-50%);
  font-family: var(--f-mono); font-size: 20px; letter-spacing: .25em; text-decoration: none;
  animation: baja 2.4s ease-in-out infinite;
}
@keyframes baja { 50% { transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .flechas { animation: none; } }

.proyectos { padding: 0 var(--pad) calc(var(--pad) * 1.5); scroll-margin-top: 64px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); align-items: start; }
.grid.masonry { display: flex; }
.grid.masonry .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.card { display: block; text-decoration: none; }
.card img { width: 100%; border-radius: var(--radius); transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .3s; background: #e6e6e6; }
.card:hover img { transform: scale(1.012); opacity: .92; }
.card-title { display: block; margin-top: 10px; font-family: var(--f-mono); font-size: 13px; }
.card:hover .card-title { text-decoration: underline; }

/* ---------- Página de proyecto ---------- */
.proyecto { padding: clamp(24px, 5vw, 64px) var(--pad) var(--pad); }
.p-cab h1 { font: 400 clamp(28px, 2.7vw, 40px)/1.1 var(--f-display); letter-spacing: -.01em; margin: 0 0 6px; }
.texto { min-width: 0; }
.texto p { margin: 0 0 1em; break-inside: avoid-column; }

.bloque + .bloque { margin-top: var(--gap); }
.zoom { display: block; cursor: zoom-in; }

/* Ancho completo: una pieza debajo de otra, sin superar la altura de pantalla */
.b-completa { display: flex; flex-direction: column; gap: var(--gap); }
.c-item { margin: 0; display: flex; justify-content: center; }
.c-item .zoom { width: 100%; max-width: calc(var(--ar, 1.5) * 92vh); }
.c-item img { width: 100%; height: auto; border-radius: var(--radius); background: #e6e6e6; }
.c-item picture { display: block; }
.c-item video { width: 100%; max-height: 92vh; border-radius: var(--radius); background: #000; }

/* Carrusel */
.b-carrusel { position: relative; }
.car-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; border-radius: var(--radius);
}
.car-track::-webkit-scrollbar { display: none; }
.car-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: flex; justify-content: center; align-items: center; height: min(80vh, 62vw); }
.car-slide .zoom, .car-slide picture { height: 100%; display: flex; justify-content: center; }
.car-slide img { height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: var(--radius); }
.car-ui { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 12px; font-family: var(--f-mono); font-size: 13px; }
.car-ui button, .lb button {
  font: 400 18px/1 var(--f-mono); color: inherit; background: none; border: 1px solid var(--line);
  border-radius: 999px; width: 40px; height: 40px; cursor: pointer;
}
.car-ui button:hover { border-color: currentColor; }
@media (max-width: 700px) { .car-slide { height: 70vw; } }

/* Visor a pantalla completa */
.lb-open { overflow: hidden; }
.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12,12,12,.96); color: #f2f2f2; }
.lb::backdrop { background: transparent; }
.lb[open] { display: grid; place-items: center; }
.lb img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 120px); width: auto; height: auto; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.lb button { position: fixed; border-color: #444; background: rgba(12,12,12,.6); }
.lb button:hover { border-color: #f2f2f2; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-count { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); font: 400 13px var(--f-mono); color: #bbb; }
@media (max-width: 700px) { .lb-prev, .lb-next { top: auto; bottom: 10px; transform: none; } .lb-count { bottom: 22px; } }

/* Mosaico */
.gallery { display: flex; flex-wrap: wrap; gap: var(--gap); }
.gallery::after { content: ""; flex-grow: 100000; }
.gallery--few { justify-content: center; }
.gallery--few::after { display: none; }
.g-item {
  margin: 0;
  flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row-h));
  max-width: calc(var(--ar) * 86vh);
}
.g-item img, .g-item video { width: 100%; height: auto; border-radius: var(--radius); background: #e6e6e6; }
.g-full { flex: 1 1 100%; max-width: 100%; }
@media (max-width: 700px) { :root { --row-h: 240px; } }

.p-nav {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: clamp(40px, 6vw, 80px); padding-top: 18px; border-top: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 14px;
}
.p-nav a { text-decoration: none; }
.p-nav a:hover { text-decoration: underline; }

/* ---------- Sobre mí ---------- */
.sobre { padding: clamp(24px, 5vw, 64px) var(--pad) var(--pad); display: grid; gap: clamp(28px, 5vw, 72px); max-width: 1280px; }
@media (min-width: 900px) { .sobre { grid-template-columns: minmax(240px, 360px) 1fr; } .sobre .foto { position: sticky; top: 90px; align-self: start; } }
.sobre .foto img { width: 100%; border-radius: var(--radius); }
.sobre h1 { font: 400 clamp(30px, 4vw, 52px)/1.05 var(--f-display); margin: 0 0 24px; }
.sobre .cuerpo > p:first-of-type { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.45; }
.sobre .cuerpo { max-width: 68ch; }
.sobre h2 { font: 400 13px/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 2.4em 0 .8em; padding-top: 14px; border-top: 1px solid var(--line); }
.sobre ul { list-style: none; padding: 0; margin: 0; }
.sobre li { margin: 0 0 .9em; }
.sobre li small { display: block; font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }

/* ---------- Pie ---------- */
.pie {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px var(--pad) 24px; font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
}
.pie p { margin: 0; color: var(--muted); }
.redes { display: flex; gap: 18px; }
.redes a { text-decoration: none; }
.redes a::before { content: "> "; }
.redes a:hover { text-decoration: underline; }

.vacio { min-height: 60vh; display: grid; place-content: center; text-align: center; }
.vacio h1 { font: 400 96px/1 var(--f-display); margin: 0 0 8px; }

/* ---------- Maquetación de proyecto como en Cargo ---------- */
.proyecto { --gal-gap: clamp(8px, .9vw, 13px); }
.proyecto .meta { font-size: clamp(14px, 1.25vw, 18px); color: var(--fg); }
.texto { font-size: clamp(15px, 1.25vw, 18px); line-height: 1.3; }
.texto p { margin: 0 0 1.3em; }
.texto p:last-child { margin-bottom: 0; }
.p-intro { display: grid; gap: 28px 2rem; margin: clamp(22px, 2.6vw, 34px) 0 clamp(28px, 3.4vw, 48px); align-items: start; }
@media (min-width: 900px) {
  .p-intro { grid-template-columns: 1fr 1fr; }
  .p-intro.texto-2col .texto { grid-column: 1 / -1; columns: 2; column-gap: 2rem; }
  .p-intro.texto-2col .texto p { break-inside: avoid-column; }
}
.lateral { display: flex; flex-direction: column; gap: var(--gal-gap); min-width: 0; }
.lat-item { margin: 0; display: flex; justify-content: center; }
.lat-item .zoom, .lat-item video { width: var(--escala, 100%); }
.lat-item img, .lat-item video { width: 100%; height: auto; display: block; border-radius: var(--radius); }

.bloque + .bloque { margin-top: var(--gal-gap); }
.b-mosaico { display: flex; flex-direction: column; gap: var(--gal-gap); }
.m-fila { display: flex; gap: var(--gal-gap); }
.m-fila > .g-item { flex: var(--ar) 1 0; min-width: 0; max-width: none; margin: 0; }
.m-fila img, .m-fila video { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: var(--radius); }
/* En móvil, como en Cargo: una pieza por fila a todo el ancho */
@media (max-width: 700px) {
  .m-fila { flex-direction: column; }
  .m-fila > .g-item { flex: none; width: 100%; }
  .m-fila img, .m-fila video, .m-fila .zoom, .m-fila picture { height: auto; }
}
.gallery { gap: var(--gal-gap); }

/* Carrusel junto al texto: las diapositivas se ajustan al ancho de la columna */
.lat-car .car-slide { height: auto; align-items: center; }
.lat-car .car-slide .zoom, .lat-car .car-slide picture { height: auto; width: 100%; display: block; }
.lat-car .car-slide img { width: 100%; height: auto; }
.m-fila .zoom, .m-fila picture { display: block; height: 100%; }

/* Redes siempre visibles abajo a la izquierda, como en Cargo */
body { padding-bottom: 50px; }
.redes {
  position: fixed; left: var(--pad); bottom: 14px; z-index: 9;
  padding: 5px 10px; margin-left: -10px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font: 400 14px/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .04em;
}
.pie { justify-content: flex-end; }

/* Navegación entre proyectos: anterior · proyectos · siguiente */
.p-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; }
.p-nav .nav-centro { text-align: center; }
.p-nav .nav-sig { text-align: right; }
@media (max-width: 600px) {
  .p-nav { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .p-nav .nav-centro { grid-column: 1 / -1; grid-row: 2; }
}

/* Sobre mí: herramientas a dos columnas */
.sobre ul.dos-col { columns: 2; column-gap: 2rem; }
.sobre ul.dos-col li { break-inside: avoid; }
