/* ==========================================================================
   Lab website stylesheet ("Lumen": minimal, white, UB blue accent)
   Palette taken from the Universitat de Barcelona web and coat of arms.
   ========================================================================== */

:root {
  /* UB palette */
  --ub-navy: #0b2d5b;
  --ub-blue: #0072ce;
  --ub-sky: #009ae5;
  --ub-red: #c8102e;
  --ub-gold: #b8913b;
  --ub-gray-900: #222222;
  --ub-gray-700: #484848;
  --ub-gray-500: #727c81;
  --ub-gray-200: #ebebeb;
  --ub-gray-100: #f8f8f8;

  /* Semantic tokens */
  --bg: #ffffff;
  --bg-alt: var(--ub-gray-100);
  --surface: #ffffff;
  --text: var(--ub-gray-900);
  --muted: var(--ub-gray-500);
  --border: var(--ub-gray-200);
  --accent: var(--ub-blue);
  --accent-2: var(--ub-sky);
  --heading: var(--ub-navy);
  --link: var(--ub-blue);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  --shadow: none;
  --maxw: 1120px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.65 var(--font-body);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); line-height: 1.2; }
address { font-style: normal; }
code { font-family: var(--font-mono); font-size: .9em; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 100; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--heading); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 44px; height: 44px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: .78rem; color: var(--muted); letter-spacing: .02em; }

.site-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 8px 12px; color: var(--text); font-weight: 500; font-size: .95rem; border-radius: 6px; }
.site-nav a:hover { text-decoration: none; color: var(--accent); }
.site-nav a.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--heading); cursor: pointer; }

/* ---------- Hero (home) ---------- */
.hero { position: relative; overflow: hidden; padding: 88px 0 190px; }
.hero-inner { position: relative; z-index: 1; }
.hero-art {
  position: absolute; inset: auto 0 12px 0; height: 160px; opacity: .13;
  background: var(--accent);
  /* one polysome group centred on the page, on an mRNA that repeats to both edges */
  -webkit-mask: url("../img/polysome.svg") center bottom / auto 100% no-repeat, url("../img/rna-line.svg") center bottom / auto 100% repeat-x;
          mask: url("../img/polysome.svg") center bottom / auto 100% no-repeat, url("../img/rna-line.svg") center bottom / auto 100% repeat-x;
}
.hero-avatar { width: 150px; height: 150px; border-radius: 30px; display: block; margin: 0 0 28px; }
.eyebrow { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); max-width: 18ch; margin: 0 0 20px; letter-spacing: -.02em; }
.hero-text { font-size: 1.15rem; max-width: 60ch; color: var(--ub-gray-700); margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.btn { display: inline-block; padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: .95rem; border: 2px solid var(--accent); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover { background: var(--accent); color: #fff; }

/* ---------- Social icons ---------- */
.social { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.social a { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); transition: .15s; }
.social a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.social-hero { margin-left: 8px; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 1.35rem; margin: 0 0 16px; }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.more { font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 16px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s; }
.tile:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); }
.tile-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 1.1rem; margin-bottom: 6px; }
.tile-title { font-family: var(--font-head); font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.tile-text { font-size: .9rem; color: var(--muted); }
.tile-arrow { position: absolute; top: 18px; right: 20px; color: var(--accent); opacity: 0; transition: .15s; }
.tile:hover .tile-arrow { opacity: 1; }

/* ---------- Inner pages ---------- */
.page-hero { padding: 56px 0 32px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 8px; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0; max-width: 60ch; }
.page-body { padding-bottom: 64px; }
.prose { max-width: 72ch; margin-bottom: 32px; }

.research-list { display: grid; gap: 20px; margin-bottom: 48px; }
.research-item { display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: start; }
.research-item.has-image { grid-template-columns: 260px 1fr; gap: 28px; align-items: center; }
.research-item img { width: 100%; border-radius: 12px; display: block; }
.research-item h2 { font-size: 1.2rem; margin: 0 0 6px; }
.research-item p { margin: 0; }
.research-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 1.4rem; }

/* Team */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 48px; }
.team-pi { grid-template-columns: 1fr; }
.team-pi .member { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center; }
.team-pi .avatar { width: 200px; height: 200px; font-size: 3.5rem; }
.member { text-align: left; }
.member h3 { margin: 12px 0 2px; font-size: 1.15rem; }
.member-role { color: var(--accent); font-weight: 600; font-size: .9rem; margin: 0 0 10px; }
.member-bio { font-size: .95rem; margin: 0 0 14px; }
.avatar { display: block; width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.avatar-initials { display: grid; place-items: center; background: linear-gradient(135deg, var(--ub-navy), var(--ub-blue)); color: #fff; font-weight: 700; font-size: 2.2rem; font-family: var(--font-head); }
.social-member a { width: 32px; height: 32px; font-size: .9rem; }

/* Software */
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 32px; }
.software h2 { font-size: 1.15rem; margin: 0 0 8px; }
.software h2 i { color: var(--accent); margin-right: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: .75rem; padding: 2px 8px; border-radius: 4px; background: var(--bg-alt); border: 1px solid var(--border); }
.software-links { display: flex; gap: 16px; margin-bottom: 0; font-weight: 600; font-size: .9rem; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; }
.contact-grid .section-title { margin-top: 24px; }
.contact-grid .section-title:first-child { margin-top: 0; }
.map iframe { width: 100%; height: 100%; min-height: 380px; border: 1px solid var(--border); border-radius: var(--radius); }
.contact-card address { margin-bottom: 12px; }

/* ---------- Publications ---------- */
.pub-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.pub-search { flex: 1 1 280px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.pub-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pub-filters { display: inline-flex; gap: 4px; }
.pub-filters button { font: inherit; font-size: .9rem; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; }
.pub-filters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pub-year { display: grid; grid-template-columns: 90px 1fr; gap: 16px; border-top: 1px solid var(--border); padding-top: 20px; margin-bottom: 12px; }
.pub-year-label { font-size: 1.4rem; margin: 0; color: var(--accent); font-family: var(--font-mono); font-weight: 400; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { margin-bottom: 20px; }
.pub-title { font-weight: 600; color: var(--heading); font-size: 1.02rem; }
.pub-title:hover { color: var(--accent); }
.pub-authors { font-size: .9rem; color: var(--ub-gray-700); }
.pub-authors strong { color: var(--heading); }
.pub-meta { font-size: .88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge { font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.badge-preprint { color: var(--ub-gold); }
.badge-oa { color: #2e7d32; }
.badge-cites { color: var(--muted); }
.pub-sources { margin-top: 32px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); margin-top: auto; }
.site-footer .footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; padding-top: 40px; padding-bottom: 32px; flex-wrap: wrap; }
.footer-title { font-family: var(--font-head); font-weight: 700; color: var(--heading); margin: 0 0 8px; }
.footer-lab address { font-size: .9rem; color: var(--ub-gray-700); margin-bottom: 16px; }
.footer-logo { display: block; padding: 12px 0; }
.footer-logo img { width: 240px; display: block; }
.footer-bottom { font-size: .8rem; color: var(--muted); padding: 14px 0; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .split, .contact-grid { grid-template-columns: 1fr; }
  .team-pi .member, .research-item.has-image { grid-template-columns: 1fr; }
  .team-pi .avatar { width: 160px; height: 160px; }
  .pub-year { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .nav-toggle { display: block; }
  .site-nav { display: none; flex-basis: 100%; }
  .site-nav.open { display: block; }
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .brand { flex: 1; }
  .brand-name { font-size: .95rem; }
  .brand-logo { width: 38px; height: 38px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile { padding: 16px; }
  .team-grid, .software-grid { grid-template-columns: 1fr; }
  .site-nav ul { flex-direction: column; padding-bottom: 12px; }
  .hero { padding: 56px 0 150px; }
  .hero-avatar { width: 126px; height: 126px; border-radius: 27px; }
  .hero-art { height: 120px; }
  .footer-logo { padding-bottom: 28px; }
  .footer-logo img { width: 200px; }
}
