/* ==========================================================================
   Portafolio — estilos generales
   Tokens, base, cabecera, portada (hero), marcos de navegador/móvil y proyectos
   ========================================================================== */

:root {
  --fondo: #f6f4ef;
  --superficie: #ffffff;
  --suave: #eeeae2;
  --tinta: #0f1422;
  --texto-2: #585e6e;
  --texto-3: #878c98;
  --borde: #e3ded4;
  --acento: #2f5cff;
  --acento-hover: #1d46e8;
  --acento-texto: #2f5cff;
  --acento-suave: #e6ecff;
  --verde: #1f9d55;
  --tinte: #e7e2d8;
  --oscuro: #0f1422;
  --sombra-s: 0 1px 2px rgb(15 20 34 / .05), 0 2px 8px rgb(15 20 34 / .04);
  --sombra-m: 0 14px 34px -14px rgb(15 20 34 / .25), 0 2px 6px rgb(15 20 34 / .05);
  --sombra-l: 0 40px 90px -30px rgb(15 20 34 / .45), 0 4px 12px rgb(15 20 34 / .06);
  --radio: 24px;
  --fuente: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fuente-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
html.sin-scroll { overflow: hidden; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 500 16px/1.6 var(--fuente);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }
[hidden] { display: none !important; }

.contenedor { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.oculto { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.saltar {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--tinta); color: var(--fondo); font-weight: 700;
}
.saltar:focus { top: 16px; }

.icono {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Palabras destacadas con *asteriscos* */
.hero__titulo em, .seccion__titulo em, .contacto h2 em {
  font-family: var(--fuente-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
}

/* ---------- Botones ---------- */

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 26px;
  border-radius: 999px;
  font-size: 15px; font-weight: 700; letter-spacing: -.005em;
  white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s, transform .2s;
}
.boton .icono { width: 18px; height: 18px; }
.boton--primario { background: var(--acento); color: #fff; box-shadow: 0 10px 24px -10px rgb(47 92 255 / .7); }
.boton--primario:hover { background: var(--acento-hover); transform: translateY(-1px); }
.boton--secundario { background: var(--superficie); color: var(--tinta); box-shadow: inset 0 0 0 1px var(--borde); }
.boton--secundario:hover { box-shadow: inset 0 0 0 1.5px var(--tinta); }
.boton--peq { height: 42px; padding: 0 18px; font-size: 14px; }

/* ---------- Cabecera ---------- */

.cabecera {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--fondo) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.cabecera.con-borde { border-bottom-color: var(--borde); }
.cabecera__interior { display: flex; align-items: center; gap: 24px; height: 76px; }
/* Logo: icono «d.» + «DEC» + «Creative Studio»; en modo oscuro el icono se invierte solo */
.logo { --logo: 40px; display: flex; align-items: center; gap: calc(var(--logo) * .28); min-width: 0; }
.logo--pie { --logo: 36px; }
.logo__marca {
  position: relative; flex: none; width: var(--logo); height: var(--logo);
  border-radius: calc(var(--logo) * .2576); background: var(--tinta); overflow: hidden;
}
.logo__marca span {
  position: absolute; left: 25%; top: 3%;
  font: italic 400 calc(var(--logo) * .8485)/1 var(--fuente-display); color: var(--fondo);
}
.logo__marca i { position: absolute; left: 65.9%; top: 65.2%; width: 11.4%; height: 11.4%; border-radius: 50%; background: var(--acento); }
.logo__texto { display: flex; flex-direction: column; min-width: 0; }
.logo__texto b { font: 400 calc(var(--logo) * .86)/.74 var(--fuente-display); letter-spacing: .015em; padding-top: .09em; white-space: nowrap; }
.logo__texto small { margin-top: calc(var(--logo) * .17); font-size: 9.5px; font-weight: 700; letter-spacing: .3em; line-height: 1; text-transform: uppercase; color: var(--texto-2); white-space: nowrap; }
.menu { display: flex; gap: 4px; margin-left: auto; }
.menu a {
  padding: 8px 14px; border-radius: 999px;
  font-size: 15px; font-weight: 600; color: var(--texto-2);
  transition: color .2s, background .2s;
}
.menu a:hover { color: var(--tinta); background: var(--suave); }

/* Selector de idioma */
.idiomas { position: relative; flex: none; }
.idiomas summary {
  display: inline-flex; align-items: center; gap: 4px; height: 42px; padding: 0 10px 0 14px;
  border-radius: 999px; background: var(--superficie); box-shadow: inset 0 0 0 1px var(--borde);
  font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; user-select: none;
  transition: box-shadow .2s;
}
.idiomas summary::-webkit-details-marker { display: none; }
.idiomas summary:hover, .idiomas[open] summary { box-shadow: inset 0 0 0 1.5px var(--tinta); }
.idiomas summary .icono { width: 16px; height: 16px; transition: transform .2s; }
.idiomas[open] summary .icono { transform: rotate(180deg); }
.idiomas ul {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 170px;
  margin: 0; padding: 6px; list-style: none; border-radius: 16px;
  background: var(--superficie); box-shadow: var(--sombra-m), inset 0 0 0 1px var(--borde);
}
.idiomas a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--texto-2); }
.idiomas a:hover { background: var(--suave); color: var(--tinta); }
.idiomas a[aria-current] { color: var(--tinta); font-weight: 800; }
.idiomas a small { color: var(--texto-3); font-size: 12px; font-weight: 700; letter-spacing: .06em; }

/* ---------- Portada (perfil + titular) ---------- */

.hero { position: relative; padding: 56px 0 96px; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute; top: -260px; right: -220px;
  width: 820px; height: 820px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--acento) 16%, transparent), transparent);
  pointer-events: none;
}
.hero__rejilla {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 56px;
  align-items: center;
}

.perfil { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 16px; margin-bottom: 30px; }
.disponible {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  background: var(--superficie);
  box-shadow: inset 0 0 0 1px var(--borde);
  font-size: 13px; font-weight: 700;
}
.disponible i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--verde);
  animation: pulso 2.2s infinite;
}
@keyframes pulso {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--verde) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 9px transparent; }
}

.hero__titulo {
  margin-bottom: 22px;
  font-size: clamp(40px, 5.4vw, 70px);
  line-height: 1.02; letter-spacing: -.035em; font-weight: 800;
  text-wrap: balance;
}
.hero__titulo em { font-size: 1.1em; color: var(--acento-texto); }
.hero__bio { max-width: 540px; margin-bottom: 34px; font-size: 18px; line-height: 1.6; color: var(--texto-2); }
.hero__acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }

.cifras { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, max-content); }
.cifras li { padding: 0 28px; border-left: 1px solid var(--borde); }
.cifras li:first-child { padding-left: 0; border-left: 0; }
.cifras b { display: block; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.cifras span { display: block; max-width: 150px; margin-top: 5px; font-size: 13.5px; line-height: 1.35; font-weight: 600; color: var(--texto-2); }

/* Collage de proyectos junto al titular */
.collage { position: relative; aspect-ratio: 1 / .96; }
.collage > .navegador, .collage > .telefono { position: absolute; }
.collage__a { top: 0; left: 0; width: 84%; z-index: 1; }
.collage__b { top: 44%; right: 0; width: 76%; z-index: 2; }
.collage__c { bottom: 0; left: 3%; height: 54%; z-index: 3; }
.collage .navegador, .collage .telefono { box-shadow: var(--sombra-l); }
.collage.solo-uno .collage__a { top: 8%; width: 92%; }
.collage.solo-uno .collage__c { left: auto; right: 2%; }

/* ---------- Marcos: navegador y teléfono ---------- */

.navegador {
  border-radius: 14px;
  background: var(--superficie);
  box-shadow: var(--sombra-m), 0 0 0 1px rgb(15 20 34 / .06);
  overflow: hidden;
}
.navegador__barra {
  display: grid; grid-template-columns: 52px 1fr 52px; align-items: center;
  height: 30px; padding: 0 12px;
  border-bottom: 1px solid var(--borde);
}
.navegador__puntos { display: flex; gap: 6px; }
.navegador__puntos i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.navegador__puntos i:nth-child(2) { background: #febc2e; }
.navegador__puntos i:nth-child(3) { background: #28c840; }
.navegador__url {
  justify-self: center;
  display: flex; align-items: center; gap: 5px;
  max-width: 100%; padding: 3px 12px;
  border-radius: 7px;
  background: var(--suave);
  color: var(--texto-2); font-size: 11px; font-weight: 700;
  overflow: hidden; white-space: nowrap;
}
.navegador__url .icono { width: 10px; height: 10px; stroke-width: 2.6; }
.navegador__url span { overflow: hidden; text-overflow: ellipsis; }
.navegador__pantalla { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--suave); }

.telefono {
  position: relative;
  aspect-ratio: 390 / 844;
  padding: 3.2%;
  border-radius: 15% / 7%;
  background: #0d0f14;
  box-shadow: var(--sombra-m), inset 0 0 0 1.5px #30343d;
}
.telefono::before {
  content: "";
  position: absolute; top: 4.4%; left: 50%; z-index: 3;
  width: 27%; height: 3.1%;
  border-radius: 999px;
  background: #0d0f14;
  transform: translateX(-50%);
}
.telefono__pantalla { position: relative; width: 100%; height: 100%; border-radius: 12.6% / 5.6%; overflow: hidden; background: var(--suave); }

/* Capturas: aparecen con un fundido; si fallan queda la portada generada */
.captura {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  opacity: 0;
  transition: opacity .45s;
}
.captura.cargada { opacity: 1; }

/* Portada generada cuando un proyecto aún no tiene captura */
.portada {
  --c: #2f5cff;
  position: absolute; inset: 0;
  container-type: inline-size;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4.5cqw;
  padding: 6cqw 7cqw;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 20%, #fff), color-mix(in srgb, var(--c) 6%, #fff));
}
.portada__nav { display: flex; align-items: center; gap: 2.5cqw; width: 100%; margin-bottom: 4cqw; }
.portada__nav b { width: 4cqw; height: 4cqw; margin-right: auto; border-radius: 50%; background: var(--c); }
.portada__nav span { width: 7cqw; height: 1.4cqw; border-radius: 2cqw; background: color-mix(in srgb, var(--c) 30%, #d8d8d8); }
.portada__titulo {
  max-width: 75%;
  color: color-mix(in srgb, var(--c) 75%, #000);
  font-size: 7cqw; line-height: 1.05; font-weight: 800; letter-spacing: -.02em;
}
.portada__linea { width: 45cqw; height: 1.8cqw; border-radius: 2cqw; background: color-mix(in srgb, var(--c) 28%, #fff); }
.portada__boton { width: 16cqw; height: 5cqw; margin-top: 1cqw; border-radius: 3cqw; background: var(--c); }

/* ---------- Secciones ---------- */

.seccion { padding: 104px 0; }
.seccion--suave { background: var(--superficie); border-block: 1px solid var(--borde); }
.seccion__cabecera {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 48px;
}
.seccion__titulo {
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.04; letter-spacing: -.032em; font-weight: 800;
  text-wrap: balance;
}
.seccion__titulo em { font-size: 1.08em; color: var(--acento-texto); }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.filtro {
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  background: var(--superficie);
  box-shadow: inset 0 0 0 1px var(--borde);
  color: var(--texto-2);
  font-size: 14px; font-weight: 700;
  transition: background .2s, color .2s;
}
.filtro:hover { color: var(--tinta); }
.filtro[aria-pressed="true"] { background: var(--tinta); color: var(--fondo); box-shadow: none; }
.filtro small { margin-left: 6px; font-size: 12px; opacity: .6; }

/* ---------- Tarjetas de proyecto ---------- */

.proyectos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 40px 32px;
}
.tarjeta { display: flex; flex-direction: column; gap: 22px; }
.tarjeta__vista {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radio);
  background: var(--tinte-p, var(--tinte));
  overflow: hidden;
  isolation: isolate;
}
.tarjeta__vista .navegador {
  position: absolute; top: 9%; left: 7%; right: 7%;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s;
}
.tarjeta__vista .telefono {
  position: absolute; right: 5%; bottom: -7%; z-index: 2;
  height: 64%;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.tarjeta__vista:hover .navegador { transform: translateY(-6px); box-shadow: var(--sombra-l); }
.tarjeta__vista:hover .telefono { transform: translateY(-14px); }
.tarjeta__abrir {
  position: absolute; left: 7%; bottom: 18px; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tinta); color: var(--fondo);
  font-size: 14px; font-weight: 700;
  box-shadow: var(--sombra-m);
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s, transform .3s;
}
.tarjeta__abrir .icono { width: 16px; height: 16px; }
.tarjeta__vista:hover .tarjeta__abrir, .tarjeta__vista:focus-visible .tarjeta__abrir { opacity: 1; transform: none; }
@media (hover: none) { .tarjeta__abrir { display: none; } }

.tarjeta__info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 0 4px; }
.tarjeta__meta {
  grid-column: 1 / -1;
  color: var(--texto-3);
  font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.tarjeta__titulo { align-self: center; font-size: 25px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.tarjeta__titulo a { transition: color .2s; }
.tarjeta__titulo a:hover { color: var(--acento-texto); }
.tarjeta__visitar {
  align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--borde);
  font-size: 14px; font-weight: 700;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tarjeta__visitar .icono { width: 16px; height: 16px; }
.tarjeta__visitar:hover { background: var(--tinta); color: var(--fondo); box-shadow: none; }
.tarjeta__desc { grid-column: 1 / -1; max-width: 560px; color: var(--texto-2); font-size: 15.5px; line-height: 1.55; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chips li {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--suave);
  color: var(--texto-2);
  font-size: 12.5px; font-weight: 700;
}

/* Si la última tarjeta queda sola en su fila, ocupa todo el ancho en horizontal */
@media (min-width: 900px) {
  .proyectos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tarjeta:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
  }
  .tarjeta:last-child:nth-child(odd) .tarjeta__titulo { font-size: 30px; }
}

/* ---------- Aparición al hacer scroll ---------- */

.js .revelar { opacity: 0; transform: translateY(28px); transition: opacity .8s, transform .8s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 90ms); }
.js .revelar.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .hero__rejilla { grid-template-columns: 1fr; gap: 64px; }
  .collage { width: min(100%, 620px); margin: 0 auto; }
}

@media (max-width: 760px) {
  .contenedor { padding: 0 20px; }
  .cabecera__interior { height: 68px; gap: 12px; }
  .menu { display: none; }
  .cabecera .idiomas { margin-left: auto; }
  .hero { padding: 36px 0 72px; }
  .hero__bio { font-size: 17px; }
  .cifras li { padding: 0 18px; }
  .cifras b { font-size: 26px; }
  .seccion { padding: 76px 0; }
  .seccion__cabecera { margin-bottom: 36px; }
  .proyectos { gap: 48px; }
  .tarjeta__titulo { font-size: 22px; }
}

@media (max-width: 480px) {
  .logo__texto small { display: none; }
  .cabecera .boton { padding: 0 16px; }
  .hero__acciones .boton { flex: 1 1 auto; }
  .cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cifras li { padding: 0 12px; }
  .cifras b { font-size: 24px; }
  .cifras span { font-size: 12.5px; }
  .tarjeta__visitar { height: 36px; padding: 0 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .revelar { transform: none; }
}
