/* ==========================================================
   TIPOGRAFÍAS — Helvetica autoalojada
   Los archivos viven en la carpeta fonts/ (súbela junto al resto).
   Para cambiar de familia: sustituye los @font-face por los tuyos
   y actualiza --font-primary / --font-secondary más abajo.
   No se usa Google Fonts: todo se sirve desde tu propio hosting.
   ========================================================== */
@font-face {
  font-family: 'Helvetica';
  src: url('fonts/Helvetica-Light.ttf') format('truetype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Helvetica';
  src: url('fonts/Helvetica-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Helvetica';
  src: url('fonts/Helvetica-Oblique.ttf') format('truetype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Helvetica';
  src: url('fonts/Helvetica-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Helvetica';
  src: url('fonts/Helvetica-BoldOblique.ttf') format('truetype');
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  /* COLORES — edítalos aquí */
  --bg: #050505;
  --text: #f1f1f1;
  --muted: #8b8b8b;
  --accent: #3d5afe;

  /* TIPOGRAFÍAS — misma familia Helvetica, se diferencian por font-weight */
  --font-primary: 'Helvetica', Arial, sans-serif;   /* títulos: se usa en weight 700 */
  --font-secondary: 'Helvetica', Arial, sans-serif; /* textos: se usa en weight 300/400 */

  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --header-h: 9.5rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; font-size: 17.5px; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-secondary); font-weight: 400; letter-spacing: -.035em; /* Helvetica Regular, igual que las listas de Marín Ruiz */
  font-size: 1.1rem; /* texto de cuerpo un poco más grande; .title no hereda esto (tiene su propio tamaño) */
  line-height: 1.65; -webkit-font-smoothing: antialiased;
  /* Cursor personalizado: pieza de Lego. Para cambiarlo, sustituye img/cursor-lego.png */
  cursor: url('img/cursor-lego.png') 8 8, auto;
}
/* El ladrillo no cambia nunca: anula el cursor "mano" de los enlaces y cualquier otro cursor especial */
*, a, button, .zoomable, .lightbox, .lightbox-close, .lightbox img { cursor: inherit !important; }
a { color: inherit; text-decoration: none; }
img, video, iframe { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }

/* ---------- Fondo fijo (pieza de Lego sobre negro) ---------- */
.bg-fixed {
  position: fixed; inset: 0; z-index: -1;
  background: url('img/background.jpg') no-repeat right center / cover;
  pointer-events: none;
}

/* ---------- Header fijo ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); padding: 1.25rem var(--pad) 0;
}
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.top .brand { justify-self: start; }
.top .social { justify-self: end; }
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-primary); font-weight: 700; font-size: 1.7rem; color: var(--accent); letter-spacing: .01em; }
.brand-mail { font-family: var(--font-secondary); font-weight: 300; font-size: .8rem; color: var(--muted); }
.social { display: flex; gap: 1.1rem; }
.social a { color: var(--text); transition: color .2s; }
.social a:hover { color: var(--accent); }
.social svg { width: 22px; height: 22px; }
.divider { border: 0; border-top: 1px solid #2a2a2a; margin: 1rem 0 0; }
.menu { display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem 2.2rem; padding: .9rem 0; }
.menu a {
  font-family: var(--font-secondary); font-weight: 700; font-size: .85rem;
  letter-spacing: .12em; color: var(--muted); padding: .2rem 0;
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.menu a:hover { color: var(--text); }
.menu a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }

/* ---------- Estructura común ---------- */
main { padding: 2rem var(--pad) 4rem; min-height: calc(100vh - var(--header-h)); }
.title {
  font-family: var(--font-primary); font-weight: 700; color: var(--accent);
  font-size: clamp(2rem, 5.5vw, 4.5rem); line-height: 1; letter-spacing: -.005em;
}
.title small { font-family: var(--font-secondary); font-size: .5em; color: var(--text); font-weight: 700; }
.prose p + p { margin-top: 1em; }
.prose-link { margin-top: 1.4em; }
.prose-link a { color: var(--accent); font-weight: 500; border-bottom: 1px solid currentColor; padding-bottom: .1em; transition: opacity .2s; }
.prose-link a:hover { opacity: .75; }
.prose { max-width: 62ch; }

/* ---------- Vista 1: portada ---------- */
.home {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(2rem, 6vw, 4rem); min-height: calc(100vh - var(--header-h) - 6rem);
}
.home .title { font-size: clamp(2.4rem, 7vw, 6.5rem); text-align: center; }

/* Ordenador: texto de cuerpo y menú algo más grandes para leer mejor */
@media (min-width: 801px) {
  body { font-size: 1.3rem; }
  .menu a { font-size: .95rem; }
}

/* ---------- Cintas de la portada ---------- */
.marquee-block {
  --gap: clamp(2rem, 4vw, 3.4rem); --cover-h: clamp(110px, 16.5vw, 190px);
  width: calc(100% + 2 * var(--pad)); margin-inline: calc(var(--pad) * -1);
  display: flex; flex-direction: column; gap: clamp(1rem, 2vw, 1.6rem);
  animation: in 1s .25s both;
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.marquee-track { display: flex; width: max-content; will-change: transform; animation: slide-left var(--dur, 60s) linear infinite; }
.marquee-track:hover { animation-play-state: paused; }
.marquee.reverse .marquee-track { animation-name: slide-right; }
.marquee-group { display: flex; align-items: center; flex: none; }
@keyframes slide-left  { from { transform: translate3d(0,0,0); }    to { transform: translate3d(-50%,0,0); } }
@keyframes slide-right { from { transform: translate3d(-50%,0,0); } to { transform: translate3d(0,0,0); } }

.marquee-title {
  font-family: var(--font-primary); font-weight: 400; color: var(--accent);
  font-size: clamp(1.15rem, 2.3vw, 1.9rem); letter-spacing: -.02em; white-space: nowrap;
  padding-right: var(--gap); position: relative; transition: opacity .4s, transform .5s cubic-bezier(.2,.7,.2,1);
}
.marquee-title::after { content: '·'; position: absolute; right: calc(var(--gap) / 2 - .2em); }
.marquee.titles .marquee-track:hover .marquee-title:not(:hover) { opacity: .45; }
.marquee-title:hover { transform: translateY(-2px); }

.marquee-cover { flex: none; height: var(--cover-h); aspect-ratio: 16/9; margin-right: var(--gap); overflow: hidden; }
.marquee-cover img {
  height: 100%; width: 100%; object-fit: cover; display: block;
  transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .5s;
}
.marquee.covers .marquee-track:hover .marquee-cover:not(:hover) img { filter: brightness(.5); }
.marquee-cover:hover img { transform: scale(1.05); }

.about-block { margin-top: clamp(4rem, 10vw, 8rem); scroll-margin-top: var(--header-h); }

@media (max-width: 800px) {
  .marquee-block { --cover-h: 104px; --gap: 1.6rem; }
}
/* Con "reducir movimiento" activado en el móvil las cintas seguían quietas: ahora se deslizan igualmente, más despacio */
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation-duration: calc(var(--dur, 60s) * 2); }
}

/* ---------- Vista 2: sección ---------- */
.section-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: start; }
.section-top .prose { margin-top: 1.5rem; color: #cfcfcf; }
.project-list { list-style: none; padding: 0; padding-top: .8rem; }
.project-list a { display: inline-block; padding: .25rem 0; transition: color .2s, transform .2s; }
.project-list a:hover { color: var(--accent); transform: translateX(4px); }
.thumbs {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 22vw);
  gap: 1rem; overflow-x: auto; margin-top: 3rem; padding-bottom: 1rem;
  scroll-snap-type: x mandatory; scrollbar-color: var(--accent) transparent;
}
.thumb { scroll-snap-align: start; }
.thumb img { aspect-ratio: 16/9; width: 100%; object-fit: cover; background: #111; transition: opacity .2s; }
.thumb:hover img { opacity: .75; }
.thumb span { display: block; margin-top: .5rem; font-size: .85rem; color: var(--muted); }

/* ---------- Vista 3: proyecto ---------- */
.project-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; margin-top: 2rem; align-items: start; }
.media { background: #0e0e0e; aspect-ratio: 16/9; width: 100%; }
.media img, .media video, .media iframe { width: 100%; height: 100%; border: 0; object-fit: cover; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 3rem; }
.gallery img { aspect-ratio: 16/9; width: 100%; object-fit: cover; background: #111; }

/* ---------- Vista 4: sobre mí ---------- */
.about-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; margin-top: 2rem; align-items: start; }
.photo { aspect-ratio: 15/16; max-height: 75vh; width: 100%; background: #111; }
.photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }

/* ---------- Lightbox (ampliar imágenes de proyecto) ---------- */
img.zoomable {}
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 90vh; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: 0; color: var(--text);
  font-size: 2.2rem; line-height: 1; padding: .3rem .6rem;
}
.lightbox-close:hover { color: var(--accent); }

/* ---------- Un solo movimiento: entrada del contenido ---------- */
@keyframes in { from { opacity: 0; } to { opacity: 1; } }
main > * { animation: in .35s ease both; }
@media (prefers-reduced-motion: reduce) { main > * { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  :root { --header-h: 11rem; }
  .site-header { position: static; }
  .home, .section-top, .project-cols, .about-cols { grid-template-columns: 1fr; gap: 1.5rem; }
  .home { min-height: 0; }
  .menu { gap: .25rem 1.2rem; justify-content: flex-start; }
  .thumbs { grid-auto-columns: 70%; }
  .photo { max-height: none; }
}

/* ---------- Pantalla de entrada (minifigura) ---------- */
.site-header, #app, .bg-fixed { transition: filter 1.2s ease; }
body.locked { overflow: hidden; }
body.locked .site-header, body.locked #app, body.locked .bg-fixed { filter: blur(16px); pointer-events: none; user-select: none; }
.gate { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.28); touch-action: none; overflow: hidden; transition: opacity 1s ease; }
.gate.out { opacity: 0; pointer-events: none; }
.gate-title {
  position: absolute; top: clamp(1.5rem, 7vh, 4rem); left: 0; right: 0; margin: 0; text-align: center;
  font-family: var(--font-primary); font-weight: 700; color: var(--accent); line-height: 1;
  font-size: clamp(2.2rem, 6.2vw, 5.2rem); letter-spacing: -.045em; animation: in .8s both;
}
.gate-hint {
  position: absolute; top: calc(clamp(1.5rem, 7vh, 4rem) + clamp(2.8rem, 7.4vw, 6rem)); left: 0; right: 0; margin: 0; padding: 0 1rem;
  text-align: center; color: #bdbdbd; font-size: clamp(.95rem, 1.5vw, 1.2rem); transition: color .3s; animation: in .8s .2s both;
}
.gate-hint.warn { color: #fff; }
.gate-ghost { position: absolute; left: 0; top: 0; pointer-events: none; filter: brightness(0) invert(1); opacity: .1; }
.gate-part {
  position: absolute; left: 0; top: 0; touch-action: none; transform-origin: 50% 50%;
  transition: transform .65s cubic-bezier(.2,.85,.25,1); will-change: transform;
  animation: in .7s calc(.25s + var(--i) * .15s) both; outline-offset: 6px;
}
.gate-part.drag { transition: none; z-index: 20 !important; }
.gate-part img { display: block; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 14px 22px rgba(0,0,0,.55)); }
.gate-part:not(.done):not(.drag) img { animation: gate-float 3.4s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -1.1s); }
.gate-part.shake img { animation: gate-shake .45s; }
@keyframes gate-float { from { transform: translateY(-5px) rotate(-1.5deg); } to { transform: translateY(5px) rotate(1.5deg); } }
@keyframes gate-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.gate-tick { position: absolute; width: 56px; height: 56px; fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; }
.gate-tick.on { animation: gate-draw .7s cubic-bezier(.3,.8,.3,1) forwards; }
@keyframes gate-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .gate-part img { animation: none !important; } }

/* ---------- Selector de idioma, logo de Behance ---------- */
.lang { display: flex; align-items: center; gap: .55rem; font-family: var(--font-primary); font-size: 1.15rem; color: var(--text); }
.lang-btn { background: none; border: 0; padding: .2rem .1rem; font: inherit; color: inherit; transition: color .25s; }
.lang-btn:hover, .lang-btn[aria-pressed="true"] { color: var(--accent); }
.icon-behance { display: block; width: 24px; height: 24px; background-color: currentColor; transition: background-color .2s;
  -webkit-mask: url('img/behance.png') center / contain no-repeat; mask: url('img/behance.png') center / contain no-repeat; }

/* ---------- Marín Ruiz: experiencia, formación, idiomas, programas ---------- */
.about-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.6rem, 3vw, 2.6rem) clamp(1.5rem, 3vw, 3rem); margin-top: clamp(2rem, 4vw, 3.2rem); }
.about-block-title { font-family: var(--font-primary); font-weight: 700; color: var(--accent); font-size: clamp(1.9rem, 3.6vw, 3.2rem); letter-spacing: -.05em; line-height: 1; margin: 0 0 .7rem; }
.about-list { list-style: none; margin: 0; padding: 0; font-weight: 400; letter-spacing: -.035em; line-height: 1.5; color: var(--text); font-size: .95em; }

/* ---------- Charlamos?: una línea sutil, sin caja ---------- */
.contact { margin-top: clamp(4rem, 9vw, 7rem); padding-bottom: 2rem; max-width: 64rem; }
.contact-line { display: flex; align-items: flex-end; gap: 1.2rem; margin-top: clamp(1rem, 2vw, 1.6rem); border-bottom: 1px solid #3a3a3a; transition: border-color .4s; }
.contact-line:focus-within { border-color: var(--accent); }
.contact-input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; resize: none; overflow: hidden; color: var(--text);
  font: inherit; font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.5; padding: .5rem 0; min-height: 2.8rem; max-height: 14rem; }
.contact-input::placeholder { color: #6d6d6d; }
.contact-send { background: none; border: 0; color: var(--accent); font-family: var(--font-primary); font-weight: 700; letter-spacing: .08em; font-size: .85rem;
  padding: .8rem 0; opacity: 0; transform: translateX(-6px); transition: opacity .35s, transform .35s; pointer-events: none; }
.contact-line.has-text .contact-send { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 800px) {
  .top { grid-template-columns: 1fr auto auto; gap: .7rem; }
  .social { gap: .8rem; } .lang { font-size: 1rem; } .brand-mail { font-size: .72rem; overflow-wrap: anywhere; }
  .about-blocks { grid-template-columns: 1fr; }
}

.lang { letter-spacing: 0; }

/* Cartas para Daisy: los contenidos (no la portada) se ven a su proporción original, sin recortar */
.gallery.natural { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); align-items: start; }
.gallery.natural img { aspect-ratio: auto; height: auto; object-fit: contain; }

/* En pantallas táctiles no hay "hover": una pulsación nunca debe pausar las cintas */
@media (hover: none) {
  .marquee-track:hover { animation-play-state: running; }
  .marquee.titles .marquee-track:hover .marquee-title:not(:hover) { opacity: 1; }
  .marquee.covers .marquee-track:hover .marquee-cover:not(:hover) img { filter: none; }
}
