/* EpiMEC site stylesheet — built from the 2026 identity (Three curves).
   Tokens first, then base type, then components in page order. */

:root {
  --ink: #0F1B28;
  --ink-2: #14233A;
  --ink-3: #1B2E47;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #E8EDF2;
  --muted: #9AA8B6;
  --blue: #1FAAD0;
  --blue-soft: rgba(31, 170, 208, 0.14);
  --red: #D9362D;
  --white: #F4F6F8;
  --font-display: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --wrap: 1140px;
  --gutter: clamp(20px, 4vw, 40px);
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--white);
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 600; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 14px;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--blue); color: var(--ink); padding: 8px 14px; border-radius: 6px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 27, 40, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 24px;
}
.brand { display: flex; align-items: center; }
.brand img { height: 34px; width: auto; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font: inherit; cursor: pointer;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 6px; white-space: nowrap;
  color: var(--text); font-weight: 500; font-size: 0.98rem;
}
.site-nav a:hover { background: var(--blue-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue); border-radius: 6px 6px 0 0; }
.site-nav .lang a { margin-left: 10px; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.08em; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; }
.site-nav .lang a:hover { border-color: var(--blue); color: var(--blue); background: none; }

@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero .wrap { padding-top: 36px; padding-bottom: 64px; }
  .hero-logo { width: min(420px, 82vw); margin-bottom: 28px; }
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 68px;
    background: rgba(15, 27, 40, 0.97); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: 12px 10px; font-size: 1.05rem; }
  .site-nav .lang a { display: inline-block; margin: 8px 0 0 10px; }
  .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--blue); border-radius: 6px; }
}

/* ---------------------------------------------------------------- hero (home) */
.hero {
  position: relative; min-height: min(92svh, 860px); display: flex; align-items: center;
  overflow: hidden; isolation: isolate;
  margin-top: -68px; padding-top: 68px;
}
.hero video, .hero .poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(15, 27, 40, 0.88) 0%, rgba(15, 27, 40, 0.55) 55%, rgba(15, 27, 40, 0.25) 100%),
    linear-gradient(180deg, rgba(15, 27, 40, 0.1) 60%, var(--ink) 100%);
}
.hero .wrap { padding-top: 64px; padding-bottom: 96px; }
.hero-logo { width: min(560px, 78vw); margin-bottom: 36px; filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.5)); }
.hero h1 { max-width: 16ch; }
.hero .lede { margin-top: 20px; color: #C5CFD9; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 8px; font-weight: 600; font-size: 0.98rem;
  border: 1px solid transparent; transition: background 0.2s, border-color 0.2s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: var(--ink); }
.btn-primary:hover { background: #3FBCDD; }
.btn-ghost { border-color: var(--line-strong); color: var(--white); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* the film: hero button, overlay player, inline player on the team page */
.btn-film { cursor: pointer; font-family: inherit; background: transparent; line-height: inherit; }
.btn-film .play { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; display: inline-block; }
.film-modal { border: 0; padding: 0; background: transparent; max-width: min(1120px, 94vw); width: 94vw; overflow: visible; }
.film-modal::backdrop { background: rgba(6, 12, 20, 0.88); backdrop-filter: blur(6px); }
.film-modal video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; display: block; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.film-close { position: absolute; top: -44px; right: 0; background: none; border: 1px solid var(--line-strong); color: var(--white); border-radius: 999px; width: 36px; height: 36px; font-size: 22px; line-height: 1; cursor: pointer; }
.film-close:hover { border-color: var(--blue); color: var(--blue); }
.film-inline { margin: 0 0 clamp(8px, 2vw, 16px); }
.film-inline video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; border: 1px solid var(--line); }
.film-inline figcaption { margin-top: 10px; color: var(--muted); font-size: 0.92rem; }

/* affiliation strip (home) and footer logos */
.affil { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--ink-2); }
.affil .wrap { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.affil-label { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.affil img { height: 34px; width: auto; opacity: 0.9; transition: opacity 0.2s; }
.affil a:hover img { opacity: 1; }
.foot-affil { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-top: 22px; }
.foot-affil img { height: 28px; width: auto; opacity: 0.85; }
.affil .partners { border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 18px; gap: 30px; }
.affil .partners img { height: 26px; opacity: 0.8; }
.institutions { padding: 8px 0 clamp(40px, 6vw, 72px); }
.institutions .logos { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 36px; margin-top: 14px; }
.institutions img { height: 30px; width: auto; opacity: 0.85; }
@media (max-width: 600px) { .affil .wrap { gap: 20px; } .affil img { height: 28px; } .affil .partners img { height: 22px; } .institutions img { height: 24px; } }

/* ---------------------------------------------------------------- sections */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.section-head .lede { margin-top: 12px; }
.more { font-weight: 600; white-space: nowrap; }

.page-head { padding: clamp(48px, 7vw, 80px) 0 clamp(28px, 4vw, 48px); }
.page-head .lede { margin-top: 16px; }

/* three pillars: Modelación · Estadística · Computación */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar { padding: 28px 26px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.pillar .letter { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--blue); margin-bottom: 14px; }
.pillar h3 { margin-bottom: 10px; }
.pillar p { color: var(--muted); font-size: 0.98rem; }
@media (max-width: 800px) { .pillars { grid-template-columns: 1fr; } }

/* research theme cards */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.theme {
  display: block; padding: 26px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; transition: border-color 0.2s, transform 0.2s;
}
.theme:hover { text-decoration: none; border-color: rgba(31, 170, 208, 0.5); transform: translateY(-2px); }
.theme .icon { width: 56px; height: 56px; margin-bottom: 18px; }
.theme h3 { margin-bottom: 8px; }
.theme p { color: var(--muted); font-size: 0.96rem; }
.theme .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; }
@media (max-width: 960px) { .themes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .themes { grid-template-columns: 1fr; } }

/* research page: full theme rows */
.theme-row { display: grid; grid-template-columns: 96px 1fr; gap: 28px; padding: 36px 0; border-top: 1px solid var(--line); }
.theme-row:last-child { border-bottom: 1px solid var(--line); }
.theme-row .icon { width: 96px; height: 96px; }
.theme-row h2 { font-size: 1.5rem; margin-bottom: 10px; }
.theme-row p { color: var(--muted); max-width: 68ch; }
.theme-row .pubs { margin: 14px 0 0; padding: 0; list-style: none; }
.theme-row .pubs li { font-size: 0.95rem; margin-bottom: 6px; padding-left: 16px; position: relative; }
.theme-row .pubs li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
@media (max-width: 600px) { .theme-row { grid-template-columns: 1fr; gap: 16px; } .theme-row .icon { width: 64px; height: 64px; } }

.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 32px; margin: 0; padding: 0; list-style: none; }
.methods li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.98rem; }
.methods li strong { color: var(--white); font-weight: 600; }

/* publications */
.pub-year { display: grid; grid-template-columns: 110px 1fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); }
.pub-year .year { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--blue); line-height: 1; padding-top: 4px; }
.pub-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 22px; }
.pub { display: grid; gap: 4px; }
.pub .journal { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pub .title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 500; color: var(--white); line-height: 1.35; }
.pub .title a { color: inherit; }
.pub .title a:hover { color: var(--blue); }
.pub .authors { color: var(--muted); font-size: 0.94rem; }
.pub .link { font-size: 0.9rem; font-weight: 600; }
.pub.compact { padding: 18px 20px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.pub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .pub-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .pub-year { grid-template-columns: 1fr; gap: 12px; } }

/* people: round black-and-white portraits that turn to colour on hover (the format the group likes) */
.people { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px 24px; }
.person { text-align: center; flex: 0 1 190px; max-width: 240px; }
.people.cols-4 { max-width: 900px; margin: 0 auto; }   /* four per row, remainder centred */
.person img {
  width: 180px; height: 180px; object-fit: cover; border-radius: 50%; margin: 0 auto;
  border: 4px solid var(--white); background: var(--ink-2);
  filter: grayscale(100%); transition: filter 0.35s ease, transform 0.35s ease, border-color 0.35s ease;
}
.person:hover img, .person:focus-within img { filter: grayscale(0%); transform: scale(1.03); border-color: var(--blue); }
.person .name { font-family: var(--font-display); font-weight: 600; color: var(--white); margin-top: 16px; line-height: 1.3; }
.person .role { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.02em; margin-top: 4px; }
.person .links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.person .links a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600;
  padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text);
}
.person .links a:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.person.lead { flex: 0 1 auto; width: auto; max-width: 460px; }
.person.lead .links { flex-wrap: nowrap; }
.person .links a { white-space: nowrap; }
.person.lead img { width: 220px; height: 220px; }
.person.lead .name { font-size: 1.3rem; }
.leader { display: flex; justify-content: center; }
.people.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 16px; justify-items: center; }
.people.mini .person { flex: none; }
.people.mini img { width: 120px; height: 120px; border-width: 3px; }
.people.mini .name { font-size: 0.95rem; margin-top: 12px; }
.people.mini .role { font-size: 0.8rem; }
.team-home { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: center; }
.leader-card { text-align: center; padding: 32px 24px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.leader-card .person { margin: 0 auto; }
.leader-card p { margin-top: 18px; font-size: 0.95rem; }
@media (max-width: 860px) { .team-home { grid-template-columns: 1fr; } .people.mini { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .people { gap: 28px 12px; } .person { flex-basis: 150px; } .person img { width: 140px; height: 140px; } .people.mini { grid-template-columns: repeat(2, 1fr); } }

.callout {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center;
  padding: 36px; background: var(--ink-2); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius);
}
.callout p { color: var(--muted); }
@media (max-width: 800px) { .callout { grid-template-columns: 1fr; } }

/* contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.contact-card { padding: 28px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.contact-card h3 { margin-bottom: 8px; }
.contact-card .big { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; }
.contact-card p { color: var(--muted); }
.contact-card address { font-style: normal; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 32px; margin-top: clamp(40px, 6vw, 72px); color: var(--muted); font-size: 0.94rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer .brand-block img { width: 260px; }
.site-footer h4 { font-size: 0.8rem; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--text); }
.site-footer .legal { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.85rem; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* subtle reveal on scroll (opt-in with .reveal; no-op if JS is off or motion is reduced) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}

.film-vertical { max-width: 420px; margin: clamp(16px, 3vw, 28px) auto 0; text-align: center; }
.film-vertical video { width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; border: 1px solid var(--line); }
.film-vertical figcaption { margin-top: 10px; color: var(--muted); font-size: 0.92rem; }
.film-vertical-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 28px 0 clamp(40px, 6vw, 72px); }

.film-band { background: var(--ink, #0F1B28); color: #F4F6F8; padding: clamp(48px, 7vw, 96px) 0; }
.film-band h2 { color: #F4F6F8; }
.film-band p { color: #C5CFD9; }
.film-band .eyebrow { color: #1FAAD0; }
.film-band .muted.small { color: #9AA8B6; font-size: 0.92rem; }
.film-band-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.film-band-text .btn { margin-top: 8px; }
.film-wide { margin: 0; }
.film-wide video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; display: block; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.film-wide figcaption { margin-top: 10px; color: var(--muted); font-size: 0.92rem; }
.film-page-wide { max-width: 960px; margin: clamp(16px, 3vw, 28px) auto 0; text-align: center; }
.film-page-wide video { box-shadow: none; border: 1px solid var(--line); }
.film-page-vertical { display: none; }
@media (max-width: 860px) { .film-band-grid { grid-template-columns: 1fr; } }
@media (max-aspect-ratio: 1/1) and (max-width: 700px) { .film-page-wide { display: none; } .film-page-vertical { display: block; } }
