/* Página "Lo que sé hacer" (/stack/). Usa las variables y componentes de styles.css (cabecera, botones,
   pie, botón de WhatsApp). El movimiento lo activa stack.js con la clase .js en <html>; sin JS o con
   "reducir movimiento" todo se ve quieto. */

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span {
  display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--sun), #FFE2A8); box-shadow: 0 0 12px rgba(255, 184, 77, 0.8);
}

/* Cabecera de la página con aurora */
.stack-hero { position: relative; overflow: hidden; padding-bottom: 28px; }
/* La aurora va detrás de la barra superior y de la cabecera, y se funde hacia abajo. */
.aurora {
  position: absolute; top: 0; left: 0; right: 0; height: min(120vh, 1100px); z-index: -1; pointer-events: none; overflow: hidden;
  mask-image: linear-gradient(#000 55%, transparent); -webkit-mask-image: linear-gradient(#000 55%, transparent);
}
.aurora span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.9; will-change: transform; }
.aurora span:nth-child(1) { width: 52vw; height: 52vw; right: -8vw; top: -18vw; background: radial-gradient(circle, rgba(255, 184, 77, 0.42), transparent 65%); animation: drift1 18s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { width: 40vw; height: 40vw; left: -12vw; top: 10vw; background: radial-gradient(circle, rgba(127, 209, 168, 0.22), transparent 65%); animation: drift2 22s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { width: 34vw; height: 34vw; left: 38vw; top: 18vw; background: radial-gradient(circle, rgba(255, 138, 91, 0.16), transparent 65%); animation: drift3 26s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-10vw, 8vw) scale(1.15); } }
@keyframes drift2 { to { transform: translate(12vw, -4vw) scale(1.2); } }
@keyframes drift3 { to { transform: translate(-14vw, -6vw) scale(0.85); } }

.stack-hero-inner { display: flex; flex-direction: column; gap: 22px; padding-top: clamp(40px, 7vw, 96px); }
.stack-hero h1 {
  margin: 0; max-width: 15ch;
  font-family: var(--display); font-weight: 650; font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-size: clamp(42px, 7vw, 96px); line-height: 1.0; letter-spacing: -0.03em;
}
.stack-hero h1 .w { display: inline-block; }
.stack-hero h1 .w.hi { color: var(--sun); }
.js .stack-hero h1 .w {
  opacity: 0; transform: translateY(0.45em) rotate(3deg);
  animation: wordIn .8s cubic-bezier(.2, .8, .2, 1) calc(120ms + var(--i) * 70ms) forwards;
}
@keyframes wordIn { to { opacity: 1; transform: none; } }
.js .stack-hero .jump { opacity: 0; animation: fadeUp .8s cubic-bezier(.2, .8, .2, 1) .9s forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.stats { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 12px; }
.stats li {
  display: flex; align-items: baseline; gap: 12px; padding: 16px 22px; border-radius: 20px;
  background: rgba(20, 50, 41, 0.78); border: 1px solid var(--line-2);
}
.count { display: inline-block; text-align: right; }
.stats strong { font-family: var(--display); font-weight: 650; font-size: 38px; line-height: 1; color: var(--sun); font-variation-settings: 'SOFT' 100; font-variant-numeric: tabular-nums; }
.stats li > span { font-size: 15px; color: var(--ink-2); max-width: 28ch; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; }
.jump a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid var(--line-2); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  background: rgba(14, 38, 32, 0.5); transition: border-color .2s ease, background .2s ease;
}
.jump a:hover { border-color: var(--sun); color: var(--ink); background: rgba(255, 184, 77, 0.08); }

/* Cinta de tecnologías en movimiento */
.marquees { display: flex; flex-direction: column; gap: 10px; margin-top: clamp(40px, 6vw, 72px); transform: rotate(-1.5deg); }
.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 60s linear infinite; }
.marquee.is-reverse .marquee-track { animation-direction: reverse; animation-duration: 70s; }
.marquee-track > span { display: flex; align-items: center; gap: 22px; padding-right: 22px; white-space: nowrap; }
.marquee b { font-family: var(--display); font-weight: 600; font-size: clamp(22px, 3vw, 38px); color: var(--ink); opacity: 0.9; font-variation-settings: 'SOFT' 100; }
.marquee.is-reverse b { color: transparent; -webkit-text-stroke: 1px rgba(246, 239, 228, 0.45); }
.marquee i { width: 10px; height: 10px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 12px rgba(255, 184, 77, 0.8); flex: 0 0 auto; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Secciones */
.stack-main { gap: clamp(72px, 10vw, 128px); padding-top: clamp(56px, 8vw, 104px); }
.stack-main section { scroll-margin-top: 20px; }
.stack-main h2 {
  margin: 0 0 26px; font-family: var(--display); font-weight: 600; font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -0.02em; line-height: 1.05; font-variation-settings: 'SOFT' 100, 'opsz' 96; max-width: 20ch;
}
/* Palabras largas (alemán: "Einwanderungsformalitäten") se parten con guion en vez de ensanchar la página. */
.stack-main h2, .stack-main h3, .stack-main p, .stack-hero h1 { overflow-wrap: break-word; hyphens: auto; }
.stack-main h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 21px; line-height: 1.2; font-variation-settings: 'SOFT' 100; }

/* Aparición al hacer scroll */
.js .reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .8s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms), transform .8s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

.chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font: 600 13px var(--body); color: var(--ink-2); padding: 5px 10px; border-radius: 999px;
  background: rgba(246, 239, 228, 0.06); border: 1px solid var(--line-2);
}

/* Capacidades: rejilla con foco de luz que sigue al ratón */
.cap-grid { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.cap-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line-2); transition: border-color .3s ease;
}
.cap-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 184, 77, 0.16), transparent 70%);
}
.cap-card:hover::before { opacity: 1; }
.cap-card:hover { border-color: rgba(255, 184, 77, 0.45); }
.cap-num { font: 700 13px var(--body); letter-spacing: 0.08em; color: var(--faint); }
.cap-card h3 { color: var(--sun); font-size: 23px; }
.cap-card p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
.cap-card .chips { margin-top: auto; }

/* Proyectos: una tarjeta por fila, imagen grande alternando lados */
.section-head { display: flex; flex-direction: column; gap: 18px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head h2 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  font: 600 14px var(--body); color: var(--ink-2); background: transparent; cursor: pointer;
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-2);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.filter:hover { color: var(--ink); border-color: var(--ink-2); }
.filter[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); }

.project-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: clamp(56px, 8vw, 112px); }
.project { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.project.is-alt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.project.is-alt .project-media { order: 2; }
.project[hidden] { display: none; }
.project { scroll-margin-top: 40px; }
.project-media { position: relative; perspective: 1200px; }
.tilt {
  position: relative; border-radius: 26px; overflow: hidden; aspect-ratio: 3 / 2;
  background: linear-gradient(160deg, #1E4236, var(--panel)); border: 1px solid var(--line-2);
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.9);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease;
}
.project-media:hover .tilt { box-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.95), 0 0 60px -10px rgba(255, 184, 77, 0.35); }
.tilt::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgba(255, 255, 255, 0.10), transparent 40%); mix-blend-mode: overlay; }
.parallax { position: absolute; inset: -6% 0; transform: translateY(var(--py, 0px)); }
.parallax img { display: block; width: 100%; height: 100%; object-fit: cover; }
.js .project-media.reveal { transform: none; }
.js .project-media.reveal .tilt {
  clip-path: inset(0 0 100% 0 round 26px);
  transition: clip-path 1.1s cubic-bezier(.7, 0, .2, 1), transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease;
}
.js .project-media.reveal.is-in .tilt { clip-path: inset(0 0 0 0 round 26px); }
.js .project-media.reveal img { transform: scale(1.18); transition: transform 1.6s cubic-bezier(.2, .8, .2, 1); }
.js .project-media.reveal.is-in img { transform: scale(1); }
.project-num {
  display: block; margin-bottom: -4px; pointer-events: none;
  font-family: var(--display); font-weight: 700; font-size: clamp(56px, 7vw, 96px); line-height: 0.9;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255, 184, 77, 0.65); font-variation-settings: 'SOFT' 100, 'opsz' 144;
}
.project-body { display: flex; flex-direction: column; gap: 14px; }
.js .project-body.reveal { --d: 200ms; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tags span {
  font: 700 11.5px var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--sun);
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 184, 77, 0.1);
}
.project h3 { font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -0.02em; line-height: 1.08; }
.project .kind { margin: 0 0 -6px; font-family: var(--hand); font-weight: 700; font-size: 26px; line-height: 1.15; color: var(--sun); }
.project-body > p:not(.kind) { margin: 0; font-size: 17px; line-height: 1.65; color: var(--ink-2); max-width: 48ch; }
.visit {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content; min-height: 46px; padding: 0 20px; margin-top: 4px;
  border-radius: 999px; border: 1.5px solid var(--sun); font-weight: 700; font-size: 15px; text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.visit:hover { background: var(--sun); color: var(--sun-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tecnologías */
.tech-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.tech-group { display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 22px; border: 1px solid var(--line-2); background: rgba(20, 50, 41, 0.45); }
.tech-group h3 { font-family: var(--body); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sun); }
.tech-group .chips li { font-size: 14px; color: var(--ink); transition: background .2s ease, border-color .2s ease; }
.tech-group .chips li:hover { background: rgba(255, 184, 77, 0.12); border-color: var(--sun); }

/* Llamada final */
.stack-cta {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: clamp(28px, 5vw, 64px);
  border-radius: 32px; background: var(--ink); color: #18302A;
}
.stack-cta::before {
  content: ''; position: absolute; z-index: -1; width: 70%; aspect-ratio: 1; right: -20%; top: -60%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 184, 77, 0.45), transparent 65%); animation: drift1 14s ease-in-out infinite alternate;
}
.stack-cta h2 { margin: 0; color: #11241F; }
.stack-cta p { margin: 0; font-size: 18px; line-height: 1.6; color: #3B4F48; max-width: 52ch; }

.filter:focus-visible, .jump a:focus-visible, .visit:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.stack-cta .btn:focus-visible { outline: 3px solid #B86A00; outline-offset: 3px; }

@media (max-width: 900px) {
  /* minmax(0, …): la columna no crece con la palabra más larga, la palabra se parte. */
  .project, .project.is-alt { grid-template-columns: minmax(0, 1fr); }
  .project.is-alt .project-media { order: 0; }
}
@media (max-width: 760px) {
  .aurora span { animation: none; filter: blur(40px); }
}
@media (max-width: 480px) {
  .stats li { flex: 1 1 100%; }
  .marquees { transform: rotate(-2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora span, .marquee-track, .stack-cta::before { animation: none; }
  .js .stack-hero h1 .w, .js .stack-hero .jump { animation: none; opacity: 1; transform: none; }
  .js .reveal, .js .project-media.reveal .tilt, .js .project-media.reveal img { opacity: 1; transform: none; clip-path: none; transition: none; }
  .tilt, .parallax { transform: none !important; transition: none; }
}

/* Llamada final: dos botones, uno por cada cara de la portada. */
.stack-cta .cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stack-cta .btn-ghost { color: #11241F; border-color: rgba(17, 36, 31, 0.3); }
.stack-cta .btn-ghost:hover { color: #11241F; border-color: #11241F; }
