@font-face { font-family: "Space Grotesk"; src: url(/assets/fonts/spacegrotesk.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/assets/fonts/jetbrainsmono.woff2) format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --bg: #07080c;
  --bg-2: #0c0e14;
  --panel: #11141c;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #e8ebf2;
  --muted: #9097a8;
  --c1: #22d3ee;
  --c2: #8b5cf6;
  --c3: #34d399;
  --grad: linear-gradient(100deg, var(--c1), var(--c2));
  --radius: 18px;
  --wrap: 1180px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.65 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.narrow { max-width: 780px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: .8rem; letter-spacing: .02em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px max(16px, calc((100% - var(--wrap)) / 2)); transition: background .3s, border-color .3s, padding .3s; border-bottom: 1px solid transparent; }
.nav.solid, .inner .nav { background: rgba(7, 8, 12, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); padding-block: 12px; }
.brand img { width: 150px; filter: invert(1); }
.links { display: flex; align-items: center; gap: 26px; font-size: .92rem; }
.links a { text-decoration: none; color: var(--muted); transition: color .2s; }
.links a:hover { color: var(--text); }
.links .cta { color: var(--bg); background: var(--text); padding: 8px 16px; border-radius: 999px; font-weight: 600; }
.links .cta:hover { color: var(--bg); background: var(--c1); }
.burger { display: none; background: none; border: 0; width: 40px; height: 40px; padding: 10px; cursor: pointer; }
.burger span { display: block; height: 2px; background: var(--text); margin: 6px 0; transition: transform .3s; }

/* ---------- hero */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; overflow: hidden; isolation: isolate; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; filter: grayscale(.2) contrast(1.05); }
.hero-shade { position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(120% 80% at 20% 30%, rgba(7, 8, 12, .55), rgba(7, 8, 12, .92) 70%), linear-gradient(180deg, rgba(7, 8, 12, .2), var(--bg) 96%); }
.grid-bg { position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%); }
.hero-content { padding-block: 140px 100px; }
.hero h1 { font-size: clamp(2.4rem, 6.2vw, 5.2rem); font-weight: 700; margin-bottom: .35em; }
.kicker { display: inline-block; color: var(--c1); margin-bottom: 18px; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: #c7ccd8; max-width: 620px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.scroll-hint { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: var(--muted); text-decoration: none; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 24px; border-radius: 999px; font: 600 .95rem var(--body);
  text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform .2s, box-shadow .2s, background .2s; }
.btn.primary { background: var(--grad); color: #05060a; box-shadow: 0 8px 30px -8px rgba(34, 211, 238, .55); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 40px -8px rgba(139, 92, 246, .6); }
.btn.ghost { border-color: var(--line-2); color: var(--text); background: rgba(255, 255, 255, .03); }
.btn.ghost:hover { border-color: var(--c1); }

/* ---------- strip */
.strip { border-block: 1px solid var(--line); background: var(--bg-2); }
.strip-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip-grid div { padding: 28px 20px; border-left: 1px solid var(--line); }
.strip-grid div:first-child { border-left: 0; }
.strip strong { display: block; font: 700 1.6rem var(--display); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.strip span { color: var(--muted); font-size: .9rem; }

/* ---------- sections */
.sec { padding-block: clamp(80px, 11vw, 140px); position: relative; }
.sec.alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.sec-head { margin-bottom: 48px; max-width: 760px; }
.center .sec-head { margin-inline: auto; }
.sec-head h2 { font-size: clamp(2rem, 4.2vw, 3.3rem); }
.sub { color: var(--muted); font-size: 1.1rem; }
.mini { font: 600 .8rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 56px 0 20px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.split .mini { margin-top: 0; }

.prio { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: p; }
.prio li { display: flex; gap: 16px; align-items: baseline; font: 600 1.35rem var(--display); padding: 12px 0; border-bottom: 1px solid var(--line); }
.prio li span { color: var(--c1); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; font-size: .9rem; color: #cfd4df; background: rgba(255, 255, 255, .02); }

.cards { display: grid; gap: 16px; margin-top: 56px; }
.cards.five { grid-template-columns: repeat(5, 1fr); }
.cards.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; text-decoration: none;
  transition: transform .3s, border-color .3s; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: var(--grad); opacity: 0; transition: opacity .3s;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.card:hover { transform: translateY(-4px); }
.card:hover::before { opacity: 1; }
.card h3 { font-size: 1.3rem; }
.card p { color: var(--muted); font-size: .95rem; margin: 0; }
.idx { color: var(--c1); display: block; margin-bottom: 18px; }
.tag { color: var(--c1); display: block; margin-bottom: 12px; }
.more { display: inline-block; margin-top: 16px; font-weight: 600; font-size: .9rem; color: var(--text); }
.project { display: flex; flex-direction: column; }
.project p { flex: 1; }

.units { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.unit { display: grid; grid-template-columns: 170px 1fr; gap: 24px; align-items: start; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; text-decoration: none; transition: border-color .3s, transform .3s; }
.unit:hover { border-color: var(--c1); transform: translateY(-3px); }
.unit p { color: var(--muted); font-size: .95rem; margin: 0; }
.unit-logo { border-radius: 12px; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 14px; }
.unit-logo.light { background: #fff; }
.unit-logo img { max-height: 100%; object-fit: contain; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.timeline li { padding: 22px 20px 22px 0; border-right: 1px solid var(--line); }
.timeline li + li { padding-left: 20px; }
.timeline .yr { color: var(--c1); display: block; margin-bottom: 8px; }
.timeline h4 { font-size: 1.05rem; margin-bottom: 6px; }
.timeline p { color: var(--muted); font-size: .88rem; margin: 0; }

.studies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.study { display: block; padding: 22px; border: 1px dashed var(--line-2); border-radius: var(--radius); text-decoration: none; transition: border-color .3s, background .3s; }
.study:hover { border-color: var(--c2); background: rgba(139, 92, 246, .05); }
.study h4 { font-size: 1.1rem; }
.study p { color: var(--muted); font-size: .9rem; margin: 0; }

.grants { columns: 2 420px; column-gap: 18px; }
.grant { break-inside: avoid; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; margin-bottom: 18px; font-size: .95rem; color: #c9ceda; }
.grant p:last-child { margin-bottom: 0; }
.grant strong { color: var(--text); }
.logo-strip { margin: 14px 0; background: #fff; border-radius: 10px; padding: 10px; }
.logo-strip img { margin-inline: auto; max-height: 120px; object-fit: contain; }

.news-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.news { display: block; padding: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); text-decoration: none; transition: border-color .3s; }
.news:hover { border-color: var(--line-2); }
.news time { color: var(--c1); }
.news h4 { font-size: 1.05rem; margin: 10px 0; }
.news p { color: var(--muted); font-size: .88rem; margin: 0; }

.big { font: 500 clamp(1.3rem, 2.4vw, 1.8rem)/1.4 var(--display); }
#carrera .btn { margin-top: 12px; }

/* ---------- form */
.contact { grid-template-columns: .9fr 1.1fr; }
.form { display: grid; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.form label { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); }
.form input, .form textarea { width: 100%; font: 400 1rem var(--body); color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; transition: border-color .2s, box-shadow .2s; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }
.form .check { display: flex; gap: 10px; align-items: center; }
.form .check input { width: auto; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form button[disabled] { opacity: .6; cursor: wait; }
.form-msg { min-height: 1.4em; margin: 0; font-size: .95rem; }
.form-msg.ok { color: var(--c3); }
.form-msg.err { color: #f87171; }

/* ---------- article */
.article { padding-top: 140px; }
.article h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 28px; }
.back:hover { color: var(--c1); }
.prose { margin-top: 32px; color: #cdd2dd; font-size: 1.05rem; }
.prose strong { color: var(--text); }
.prose a { color: var(--c1); }
.prose ul { padding-left: 1.2em; }

/* ---------- footer */
.foot { border-top: 1px solid var(--line); padding-top: 56px; background: var(--bg-2); }
.foot-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.foot-logo { width: 130px; filter: invert(1); margin-bottom: 16px; }
.foot-links { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 40px; align-content: start; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.foot-links a:hover { color: var(--text); }
.foot-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 28px 0; margin-top: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* ---------- reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- responsive */
@media (max-width: 1080px) {
  .cards.five { grid-template-columns: repeat(3, 1fr); }
  .cards.four, .news-grid { grid-template-columns: repeat(2, 1fr); }
  .units { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .links { position: fixed; inset: 0 0 auto; top: 64px; flex-direction: column; align-items: stretch; gap: 0; padding: 12px 16px 24px;
    background: rgba(7, 8, 12, .97); border-bottom: 1px solid var(--line); transform: translateY(-120%); transition: transform .35s; }
  .links a { padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .links .cta { margin-top: 14px; text-align: center; border: 0; }
  .nav.open .links { transform: none; }
  .burger { display: block; }
  .nav.open .burger span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav.open .burger span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .split, .contact { grid-template-columns: 1fr; gap: 32px; }
  .strip-grid { grid-template-columns: repeat(2, 1fr); }
  .strip-grid div:nth-child(3) { border-left: 0; }
  .strip-grid div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .studies { grid-template-columns: 1fr; }
  .unit { grid-template-columns: 1fr; }
  .unit-logo { max-width: 220px; }
  .timeline li, .timeline li + li { border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 0; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .cards.five, .cards.four, .news-grid { grid-template-columns: 1fr; }
  .brand img { width: 124px; }
  .hero-content { padding-block: 120px 90px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-hint { animation: none; }
}

/* ================================================================ animaciones (fx.js) */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; background: var(--grad); transform: scaleX(0); transform-origin: 0 50%; }
.cursor-glow { position: fixed; left: -300px; top: -300px; width: 600px; height: 600px; border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(34, 211, 238, .07), rgba(139, 92, 246, .04) 40%, transparent 70%); opacity: 0; transition: opacity .6s; }
.cursor-glow.on { opacity: 1; }
main, .foot { position: relative; z-index: 1; }

.hero-net { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; mix-blend-mode: screen; opacity: .9; }
.hero-content { will-change: transform, opacity; }
.caret { color: var(--c2); animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* palabras */
.split-words .w { display: inline-block; opacity: 0; filter: blur(12px); transform: translateY(.45em) rotate(2deg);
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), filter .9s, transform .9s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i) * 55ms + 120ms); }
.split-words.in .w { opacity: 1; filter: none; transform: none; }
.hero h1 .grad { background-size: 200% 100%; animation: shimmer 6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* retardo escalonado para rejillas */
.reveal { transition-delay: var(--d, 0ms); }

/* foco de luz */
.spot { position: relative; isolation: isolate; }
.spot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(34, 211, 238, .12), rgba(139, 92, 246, .06) 35%, transparent 60%); }
.spot:hover::after { opacity: 1; }
.tilt { transform-style: preserve-3d; transition: transform .25s ease-out, border-color .3s; will-change: transform; }
.magnetic { transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .2s, background .2s; }

/* cinta infinita */
.marquee { position: relative; overflow: hidden; padding: 34px 0; border-block: 1px solid var(--line); background: var(--bg);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 38px; width: max-content; animation: marquee 42s linear infinite; font: 700 clamp(1.6rem, 4vw, 3rem) var(--display); letter-spacing: -.02em; }
.marquee-track + .marquee-track { margin-top: 10px; }
.marquee-track.rev { animation-direction: reverse; animation-duration: 52s; }
.marquee-track span { color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .28); white-space: nowrap; transition: color .3s; }
.marquee-track span:nth-child(4n+1) { color: var(--text); -webkit-text-stroke: 0; }
.marquee-track i { font-style: normal; color: var(--c1); align-self: center; font-size: .6em; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* línea de la trayectoria */
.timeline-wrap { position: relative; --tl: 0; }
.timeline-line { position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--line); overflow: hidden; }
.timeline-line span { position: absolute; inset: 0; background: var(--grad); transform: scaleX(var(--tl)); transform-origin: 0 50%; box-shadow: 0 0 18px rgba(34, 211, 238, .7); }
.timeline { border-top: 0; }
.timeline li { position: relative; transition: opacity .5s; opacity: .45; }
.timeline li::before { content: ""; position: absolute; top: -6px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--line-2); transition: all .4s; }
.timeline li + li::before { left: 20px; }
.timeline li.lit { opacity: 1; }
.timeline li.lit::before { background: var(--c1); border-color: var(--c1); box-shadow: 0 0 0 5px rgba(34, 211, 238, .15), 0 0 18px rgba(34, 211, 238, .8); }

/* auroras de fondo en secciones alternas */
.sec.alt { overflow: hidden; }
.sec.alt::before, .sec.alt::after { content: ""; position: absolute; width: 46vw; height: 46vw; border-radius: 50%; filter: blur(90px); opacity: .16; z-index: 0; pointer-events: none; }
.sec.alt::before { background: var(--c1); top: -18vw; left: -12vw; animation: drift 22s ease-in-out infinite alternate; }
.sec.alt::after { background: var(--c2); bottom: -20vw; right: -14vw; animation: drift 26s ease-in-out infinite alternate-reverse; }
.sec.alt > .wrap { position: relative; z-index: 1; }
@keyframes drift { to { transform: translate(8vw, 6vw) scale(1.15); } }

/* grano sutil */
body::after { content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* iconos de valores: brillo al pasar */
.card .idx { transition: letter-spacing .3s, color .3s; }
.card:hover .idx { letter-spacing: .2em; color: var(--c2); }
.btn.primary { background-size: 180% 100%; background-position: 0 0; transition: background-position .5s, transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .2s; }
.btn.primary:hover { background-position: 100% 0; }

@media (max-width: 820px) {
  .timeline-line { display: none; }
  .timeline li { opacity: 1; }
  .timeline li::before, .timeline li + li::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .split-words .w { opacity: 1; filter: none; transform: none; transition: none; }
  .marquee-track, .sec.alt::before, .sec.alt::after, .hero h1 .grad, .caret { animation: none; }
  .hero-net, .cursor-glow { display: none; }
  .timeline li { opacity: 1; }
}

/* trayectoria: 7 hitos en una fila en escritorio, sin desbordes */
@media (min-width: 821px) {
  .timeline { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .timeline li { padding-right: 14px; }
  .timeline li + li { padding-left: 14px; }
  .timeline li + li::before { left: 14px; }
}
.timeline h4 { overflow-wrap: anywhere; hyphens: auto; }
