:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #8b8b88;
  --line: #e6e5e1;
  --ph: #eeeeec;
  --accent: #ff5a1f;
  --gutter: clamp(16px, 3vw, 40px);
  --side: max(clamp(24px, 12vw, 240px), calc((100vw - 1400px) / 2)); /* en pantallas grandes el contenido se limita a 1400px y se centra */
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter Tight", system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- header ---------- */
.site-header {
  position: relative; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--side);
}
.logo { font-weight: 600; letter-spacing: .02em; font-size: 18px; }
.nav { display: flex; gap: clamp(16px, 3vw, 40px); font-size: 15px; }
.nav a { position: relative; color: var(--muted); transition: color .3s; }
.nav a:hover, .nav a.active { color: var(--fg); }
.nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px;
  height: 1px; background: var(--fg);
}

main { padding: 0 var(--side); min-height: 80vh; }

/* ---------- intro ---------- */
.intro { padding: clamp(60px, 12vh, 140px) 0 clamp(40px, 6vh, 70px); }
.intro h1 {
  font-weight: 700; letter-spacing: -.035em; line-height: .98;
  font-size: clamp(32px, 6vw, 96px);
}
.intro .handle { font-size: clamp(12px, 1.8vw, 29px); letter-spacing: -.02em; line-height: 1; margin-bottom: .6em; color: var(--fg); }
.intro h1 em { font-style: normal; color: var(--muted); }

/* ---------- filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.filters button {
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; color: var(--muted); text-transform: capitalize;
  transition: all .25s var(--ease);
}
.filters button:hover { color: var(--fg); border-color: var(--muted); }
.filters button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filters .count { opacity: .5; margin-left: 4px; font-size: 12px; }

/* ---------- grid ---------- */
/* Filas alternadas de 2 y 3 cajas (6 columnas: 2 cajas = span 3, 3 cajas = span 2) */
.grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: clamp(8px, 1vw, 14px);
}
.card { grid-column: span 3; }
.card.s2 { grid-column: span 2; }
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .card, .card.s2 { grid-column: auto; }
}

.card { display: block; opacity: 0; transform: translateY(30px); animation: rise .8s var(--ease) forwards; }
.card.hidden { display: none; }
@keyframes rise { to { opacity: 1; transform: none; } }

.card .media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--ph); border-radius: clamp(14px, 2vw, 28px);
  isolation: isolate;
}
.card .media > img, .card .media > video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity .5s var(--ease), transform 1.2s var(--ease);
}
.card .media .preview { opacity: 0; }
.card.playing .media .preview { opacity: 1; }
.card:hover .media > img, .card:hover .media > video { transform: scale(1.04); }

/* nombre dentro de la caja */
.card .label {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: clamp(28px, 4vw, 56px) clamp(14px, 1.6vw, 24px) clamp(12px, 1.4vw, 20px);
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  pointer-events: none;
  opacity: 0; transform: translateY(8px); transition: all .4s var(--ease);
}
.card:hover .label, .card.playing .label { opacity: 1; transform: none; }
@media (hover: none) { .card .label { opacity: 1; transform: none; } }
.card h2 { font-size: clamp(21px, 2.1vw, 31.5px); font-weight: 500; letter-spacing: -.01em; color: #fff; }
.card.s2 h2 { font-size: clamp(19.5px, 1.65vw, 25.5px); }
.card .tags { font-size: 12px; color: rgba(255,255,255,.75); white-space: nowrap; text-transform: capitalize; }
.card.s2 .tags { display: none; }

/* cursor que sigue al mouse */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--fg); color: var(--bg);
  transform: translate(-50%, -50%) scale(0); transition: transform .3s var(--ease);
}
.cursor.on { transform: translate(-50%, -50%) scale(1); }
@media (hover: none) { .cursor { display: none; } }

/* ---------- project page ---------- */
.project { padding-top: clamp(40px, 8vh, 90px); }
.project .back { color: var(--muted); font-size: 14px; display: inline-block; margin-bottom: 28px; }
.project .back:hover { color: var(--fg); }
.project h1 {
  font-weight: 400; letter-spacing: -.035em; line-height: 1;
  font-size: clamp(40px, 7vw, 110px); margin-bottom: 24px;
}
.project .info {
  display: flex; flex-wrap: wrap; gap: 8px 40px; color: var(--muted); font-size: 14px;
  padding-bottom: 32px; margin-bottom: 32px; border-bottom: 1px solid var(--line);
  text-transform: capitalize;
}
.project .info b { color: var(--fg); font-weight: 500; margin-right: 8px; text-transform: none; }
.project .hero, .project .hero > *, .project .gallery > * { width: 100%; height: auto; border-radius: clamp(7px, 1vw, 14px); background: var(--ph); }
.project .gallery { display: grid; gap: var(--gutter); margin-top: var(--gutter); }
.project .next {
  display: block; margin-top: clamp(60px, 10vh, 120px); padding-top: 32px;
  border-top: 1px solid var(--line);
}
.project .next span { color: var(--muted); font-size: 14px; }
.project .next strong {
  display: block; font-weight: 400; letter-spacing: -.03em;
  font-size: clamp(32px, 5vw, 72px); transition: color .3s;
}
.project .next:hover strong { color: var(--accent); }

/* ---------- about / contact ---------- */
.page { padding: clamp(60px, 12vh, 140px) 0 40px; max-width: 1200px; }
.page h1 {
  font-weight: 400; letter-spacing: -.035em; line-height: 1;
  font-size: clamp(40px, 7vw, 110px); margin-bottom: clamp(40px, 6vh, 70px);
}
.page .lead { font-size: clamp(20px, 2.2vw, 30px); line-height: 1.3; letter-spacing: -.01em; max-width: 30ch; }
.page .lead + .lead { margin-top: 1em; color: var(--muted); }
.cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px var(--gutter);
  margin-top: clamp(50px, 8vh, 90px); padding-top: 32px; border-top: 1px solid var(--line);
}
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
.cols h3 { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.cols li { list-style: none; font-size: 18px; padding: 6px 0; }
.big-mail {
  display: inline-block; font-size: clamp(30px, 6vw, 96px); letter-spacing: -.035em; line-height: 1;
  border-bottom: 2px solid var(--line); padding-bottom: 8px; transition: border-color .3s, color .3s;
  word-break: break-all;
}
.big-mail:hover { color: var(--accent); border-color: var(--accent); }
.cols a:hover { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  display: flex; justify-content: space-between;
  padding: 60px var(--side) 28px; color: var(--muted); font-size: 13px;
}

.fade-in { animation: rise .7s var(--ease) both; }

/* about: textos largos */
.page .headline { font-size: clamp(18px, 1.8vw, 24px); letter-spacing: -.01em; margin: -20px 0 clamp(28px, 4vh, 48px); color: var(--muted); max-width: 40ch; }
.page .prose { max-width: 62ch; }
.page .prose p { font-size: clamp(17px, 1.4vw, 21px); line-height: 1.5; margin-bottom: 1.2em; }
.cols { grid-template-columns: 1fr 1fr; }
.cols > :only-child { grid-column: 1 / -1; }
.page .cols li { font-size: 16px; }

/* texto descriptivo + créditos en la página de proyecto */
.project .text {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px var(--gutter);
  padding-bottom: 32px; margin-bottom: 32px; border-bottom: 1px solid var(--line);
}
.project .text:empty { display: none; }
.project .desc p { font-size: clamp(18px, 1.6vw, 24px); line-height: 1.35; letter-spacing: -.01em; max-width: 36ch; }
.project .desc p + p { margin-top: 1em; font-size: clamp(15px, 1.1vw, 17px); color: var(--muted); max-width: 60ch; }
.project .credits h3 { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.project .credits li { list-style: none; font-size: 14px; padding: 3px 0; color: var(--muted); }
@media (max-width: 720px) { .project .text { grid-template-columns: 1fr; } }

/* logo en el encabezado */
.logo { display: block; line-height: 0; }
.logo img { height: clamp(32px, 3.52vw, 48px); width: auto; }
.nav a { white-space: nowrap; }
@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .logo img { height: 37px; }
}

/* logo en el pie de página */
.site-footer { align-items: flex-end; }
.footer-logo { height: clamp(18px, 1.8vw, 26px); width: auto; opacity: .35; }

/* título de la portada: enlace a About me */
.intro-link { display: inline-block; transition: color .3s; }
.intro-link:hover, .intro-link:hover .handle { color: var(--accent); }
.intro .handle { transition: color .3s; }

/* ---------- interna: fila de posteos y mockup de celular ---------- */
.project .gallery > .row { display: grid; gap: clamp(8px, 1vw, 14px); background: none; border-radius: 0; }
.project .gallery > .row.n4 { grid-template-columns: repeat(4, 1fr); }
.project .gallery > .row.n5 { grid-template-columns: repeat(5, 1fr); }
.project .gallery > .row.n3 { grid-template-columns: repeat(3, 1fr); }
.project .gallery > .row.n2 { grid-template-columns: repeat(2, 1fr); }
.project .row > * {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: clamp(7px, 1vw, 14px); background: var(--ph);
}
@media (max-width: 560px) { .project .gallery > .row.n4, .project .gallery > .row.n5 { grid-template-columns: repeat(2, 1fr); } }

.project .gallery > .phone-stage {
  display: flex; justify-content: center; align-items: center;
  padding: clamp(28px, 6vw, 80px) 0;
  background: linear-gradient(135deg, #f4f2ee, #e9e7e2);
}
.phone {
  position: relative; width: min(280px, 62vw); aspect-ratio: 9 / 19;
  padding: 10px; border-radius: 38px; background: #0d0d0d;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08) inset;
}
.phone::before { /* isla de la cámara */
  content: ""; position: absolute; top: 18px; left: 50%; width: 30%; height: 18px; z-index: 3;
  transform: translateX(-50%); border-radius: 999px; background: #000;
}
.phone video {
  display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 29px; background: #111;
}
.project .phone video { aspect-ratio: auto; }
.phone .ui-rail {
  position: absolute; right: 18px; bottom: 90px; z-index: 2;
  display: flex; flex-direction: column; gap: 16px;
}
.phone .ico {
  display: block; width: 26px; height: 26px; background: rgba(255,255,255,.92);
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4));
}
.ico.heart { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-8-5.3-8-11.2C4 6.6 6.4 4.5 9 4.5c1.3 0 2.5.6 3 1.6.5-1 1.7-1.6 3-1.6 2.6 0 5 2.1 5 5.3C20 15.700 12 21 12 21z'/%3E%3C/svg%3E"); }
.ico.chat { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H9l-5 4V5a1 1 0 0 1 1-1z'/%3E%3C/svg%3E"); }
.ico.mark { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 3h12a1 1 0 0 1 1 1v17l-7-4.500L5 21V4a1 1 0 0 1 1-1z'/%3E%3C/svg%3E"); }
.ico.share { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 4l8 8-8 8v-5c-6 0-9 2-11 5 1-7 5-11 11-12V4z'/%3E%3C/svg%3E"); }
.phone .ui-caption {
  position: absolute; left: 20px; right: 64px; bottom: 26px; z-index: 2;
  display: flex; flex-direction: column; gap: 7px;
}
.ui-caption b, .ui-caption span { display: block; height: 8px; border-radius: 4px; background: rgba(255,255,255,.85); }
.ui-caption b { width: 42%; height: 10px; }
.ui-caption span:nth-of-type(1) { width: 85%; opacity: .7; }
.ui-caption span:nth-of-type(2) { width: 60%; opacity: .7; }

/* texto intercalado entre imágenes de la interna */
.project .gallery > .note { width: 100%; max-width: 62ch; height: auto; background: none; border-radius: 0; padding: clamp(12px, 3vw, 40px) 0; }
.project .note p { font-size: clamp(17px, 1.4vw, 21px); line-height: 1.5; letter-spacing: -.005em; }
.project .note p + p { margin-top: 1.1em; }
.project .note h3 { font-size: clamp(20px, 1.8vw, 26px); font-weight: 600; letter-spacing: -.01em; margin-bottom: .6em; }
.project .row.n5 > *, .project .row.free > * { aspect-ratio: auto; object-fit: contain; }

/* ---------- hero 3D (home) ---------- */
.hero3d {
  position: relative; overflow: hidden;   /* fondo blanco de la página: funciona como wallpaper */
  height: calc(clamp(460px, 74vh, 760px) + var(--hdr, 0px));
  margin: calc(var(--hdr, 0px) * -1) calc(var(--side) * -1) clamp(20px, 4vh, 40px);   /* sube hasta el borde superior, por detrás del menú */   /* de punta a punta de la pantalla */
  touch-action: pan-y;
}
.hero3d-canvas, .hero3d-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero3d-fallback { object-fit: cover; border-radius: 0; transition: opacity .6s; }
.hero3d-ready .hero3d-fallback { opacity: 0; pointer-events: none; }
.hero3d-failed .hero3d-canvas { display: none; }
.hero3d .intro { position: absolute; left: 0; top: 50%; transform: translateY(-50%); padding: 0 var(--side); pointer-events: none; }
.hero3d .intro .intro-link { pointer-events: auto; }

/* ---------- cierre: "Let's work together" con un globo de fondo ---------- */
.cta { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; min-height: clamp(280px, 42vh, 430px); margin-top: clamp(40px, 8vh, 96px);
  padding: clamp(72px, 14vh, 150px) var(--side); border-top: 1px solid var(--line); }
.cta-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 0; }
.cta-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: clamp(12px, 2vh, 22px); }
.cta-title { display: inline-flex; align-items: center; gap: .25em; font-size: clamp(27px, 4.9vw, 76px); font-weight: 500;
  letter-spacing: -.035em; line-height: 1; transition: color .3s; }
.cta-arrow { width: .8em; height: .8em; flex: none; transition: transform .4s var(--ease); }
.cta-title:hover { color: var(--accent); }
.cta-title:hover .cta-arrow { transform: translateX(.18em); }
.cta-mail { font-size: clamp(17px, 1.8vw, 26px); letter-spacing: -.01em; color: var(--fg); border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color .3s, border-color .3s; }
.cta-mail:hover { color: var(--accent); border-color: var(--accent); }

/* hero con peso: agarrar y lanzar los globos */
.hero3d { user-select: none; -webkit-user-select: none; }
.hero3d a { -webkit-user-drag: none; }
.hero3d.hero3d-grab { cursor: grab; }
.hero3d.hero3d-grab .intro-link { cursor: grab; }
.hero3d.hero3d-dragging, .hero3d.hero3d-dragging * { cursor: grabbing !important; }
