/* =========================================================
   M2S Lab — Shared Stylesheet
   Deep blue academic theme
   ========================================================= */

:root {
  --navy:        #0a2540;
  --navy-2:      #103a63;
  --blue:        #1c6dd0;
  --blue-dark:   #144e9a;
  --blue-light:  #e8f1fb;
  --accent:      #2f9ce0;
  --ink:         #1a2433;
  --body:        #43506180;
  --text:        #384252;
  --muted:       #6b7688;
  --line:        #e3e8ef;
  --bg:          #ffffff;
  --bg-soft:     #f5f8fc;
  --bg-softer:   #eef3f9;
  --shadow-sm:   0 1px 3px rgba(10,37,64,.06), 0 1px 2px rgba(10,37,64,.04);
  --shadow-md:   0 6px 24px rgba(10,37,64,.08);
  --shadow-lg:   0 18px 48px rgba(10,37,64,.14);
  --radius:      14px;
  --radius-sm:   9px;
  --maxw:        1120px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); }
h3 { font-size: 1.22rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--blue); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--blue-dark); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Top navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  display: grid; place-items: center; color: #fff; font-weight: 800;
  font-size: .82rem; letter-spacing: .2px; box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .name { font-weight: 800; color: var(--navy); font-size: 1.02rem; letter-spacing: -.01em; }
.brand-text .sub  { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 9px 14px; border-radius: 8px; color: var(--text);
  font-weight: 600; font-size: .95rem; transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--bg-softer); color: var(--navy); }
.nav-links a.active { color: var(--blue); background: var(--blue-light); }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer; padding: 8px;
  width: 42px; height: 42px; border-radius: 8px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--navy); margin: 4px auto; border-radius: 2px; transition: .2s; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(47,156,224,.30), transparent 60%),
    radial-gradient(900px 600px at 5% 120%, rgba(28,109,208,.28), transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--blue-dark) 100%);
  color: #eaf2fb;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(80% 80% at 70% 20%, #000, transparent 75%);
}
.hero-inner { position: relative; z-index: 1; padding: 92px 24px 84px; max-width: var(--maxw); margin: 0 auto; }
.hero .eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: #9fd0f5; margin-bottom: 18px;
  border: 1px solid rgba(159,208,245,.35); padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.05);
}
.hero h1 { color: #fff; max-width: 16ch; margin-bottom: 20px; }
.hero h1 .m2s { color: #63c2ff; font-weight: 800; }
.hero p.lead { font-size: 1.18rem; color: #cfe0f2; max-width: 62ch; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .97rem;
  padding: 13px 24px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: #fff; color: var(--navy); box-shadow: var(--shadow-md); }
.btn-primary:hover { color: var(--blue-dark); }
.btn-ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; }
.btn-blue { background: var(--blue); color:#fff; box-shadow: var(--shadow-md); }
.btn-blue:hover { color:#fff; background: var(--blue-dark); }

/* ---------- Page header (non-hero pages) ---------- */
.page-head {
  background:
    radial-gradient(700px 320px at 90% -40%, rgba(47,156,224,.20), transparent 60%),
    linear-gradient(135deg, var(--navy), var(--blue-dark));
  color: #fff; padding: 64px 24px 56px;
}
.page-head .container { padding: 0 24px; }
.page-head .kicker { color:#9fd0f5; font-weight:700; letter-spacing:.14em; text-transform:uppercase; font-size:.78rem; margin-bottom:12px; }
.page-head h1 { color: #fff; margin-bottom: 10px; }
.page-head p { color: #cfe0f2; max-width: 60ch; margin: 0; font-size: 1.08rem; }

/* ---------- Sections ---------- */
section { padding: 76px 0; }
section.tight { padding: 56px 0; }
.section-alt { background: var(--bg-soft); }
.section-head { max-width: 62ch; margin-bottom: 44px; }
.section-head .kicker { color: var(--blue); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin-bottom: 12px; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #cfe0f2; }
.card .icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--blue-light); color: var(--blue); margin-bottom: 18px;
}
.card .icon svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); margin: 0; font-size: .98rem; }

/* ---------- Research area accent bar ---------- */
.area-card { position: relative; overflow: hidden; }
.area-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--blue), var(--accent));
}

/* ---------- Director / profile ---------- */
.profile {
  display: grid; grid-template-columns: 260px 1fr; gap: 40px; align-items: start;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 36px; box-shadow: var(--shadow-sm);
}
.avatar {
  position: relative;
  aspect-ratio: 1/1.15; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(150deg, var(--navy), var(--blue));
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-md);
}
.avatar .initials { font-size: 3.4rem; font-weight: 800; letter-spacing: 1px; }
.avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 68% 32%; display: block;
}
.profile-body h3 { font-size: 1.5rem; margin-bottom: 2px; }
.profile-role { color: var(--blue); font-weight: 700; margin-bottom: 4px; }
.profile-affil { color: var(--muted); margin-bottom: 18px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 22px; font-size: .95rem; }
.contact-row span { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.contact-row svg { width: 16px; height: 16px; color: var(--blue); }

.cv-block { margin-top: 20px; }
.cv-block h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 132px 1fr; gap: 16px; padding: 7px 0; font-size: .96rem; }
.timeline .yr { color: var(--blue-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline .what { color: var(--text); }

/* member placeholder cards */
.member { text-align: center; }
.member .avatar { width: 140px; aspect-ratio: 448/576; border-radius: 14px; margin: 0 auto 16px; }
.member .avatar .initials { font-size: 2.2rem; }
.member h4 { margin: 0 0 3px; font-size: 1.05rem; color: var(--ink); }
.member .role { color: var(--blue); font-weight: 600; font-size: .9rem; }
.member .topic { color: var(--muted); font-size: .86rem; margin-top: 6px; }

/* alumni cards */
.alum { text-align: center; }
.alum .avatar { width: 140px; aspect-ratio: 448/576; border-radius: 14px; margin: 0 auto 16px; }
.alum .avatar .initials { font-size: 2.2rem; }
.alum-degree {
  display: inline-block; background: var(--blue-light); color: var(--blue-dark);
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 11px; border-radius: 999px; margin-bottom: 12px;
}
.alum h4 { margin: 0 0 8px; font-size: 1.1rem; color: var(--ink); }
.alum-now { color: var(--muted); font-size: .92rem; }
.alum-now strong { color: var(--text); font-weight: 700; }

/* member & alumni photos are pre-normalized square crops */
.member .avatar img, .alum .avatar img { object-position: center; }

/* ---------- Projects ---------- */
.project {
  display: grid; grid-template-columns: 108px 1fr; gap: 26px; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 30px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.project .years {
  text-align: center; background: var(--blue-light); color: var(--blue-dark); border-radius: 12px;
  padding: 14px 8px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15;
}
.project .years small { display:block; font-size:.7rem; font-weight:700; color: var(--blue); letter-spacing:.06em; }
.project h3 { font-size: 1.12rem; margin-bottom: 8px; }
.project .funder { display: inline-flex; align-items:center; gap:7px; font-size: .85rem; font-weight:600; color: var(--muted); }
.project .funder::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--accent); }

/* ---------- Publications ---------- */
.pub-toolbar { display:flex; flex-wrap: wrap; align-items:center; gap: 14px; margin-bottom: 30px; }
.pub-count { background: var(--navy); color:#fff; border-radius: 999px; padding: 7px 16px; font-weight:700; font-size:.9rem; }
.year-group { margin-bottom: 40px; }
.year-label {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: 18px;
  padding-bottom: 8px; border-bottom: 3px solid var(--blue-light);
}
.year-label span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.pub-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.pub-item {
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  margin-bottom: 12px; box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .15s ease;
}
.pub-item:hover { border-color: #cfe0f2; box-shadow: var(--shadow-md); }
.pub-title-link { color: inherit; text-decoration: none; transition: color .12s ease; }
.pub-title-link:hover { color: var(--blue-dark); text-decoration: underline; }
.pub-num {
  font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums;
  background: var(--blue-light); border-radius: 8px; height: 34px; display: grid; place-items: center; font-size: .9rem;
}
.pub-body { font-size: .97rem; }
.pub-title { color: var(--ink); font-weight: 600; }
.pub-authors { color: var(--text); }
.pub-authors .me { color: var(--blue-dark); font-weight: 800; }
.pub-venue { color: var(--muted); font-style: italic; }
.pub-venue b { color: var(--navy); font-style: normal; }

/* ---------- Openings ---------- */
.pill-list { display:flex; flex-wrap:wrap; gap: 10px; margin: 4px 0 0; padding: 0; list-style:none; }
.pill { background: var(--blue-light); color: var(--blue-dark); font-weight:600; font-size:.9rem; padding: 7px 14px; border-radius: 999px; }
.req-list { list-style: none; margin: 12px 0 0; padding: 0; }
.req-list li { position: relative; padding-left: 28px; margin-bottom: 12px; color: var(--text); }
.req-list li::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue-light);
  box-shadow: inset 0 0 0 2px var(--blue);
}
.callout {
  background: linear-gradient(135deg, var(--navy), var(--blue-dark)); color:#fff;
  border-radius: var(--radius); padding: 34px 36px; box-shadow: var(--shadow-md);
}
.callout h3 { color:#fff; }
.callout p { color:#cfe0f2; }

/* ---------- News ---------- */
.news-item {
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm); padding: 22px 26px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.news-item:hover { transform: translateX(4px); box-shadow: var(--shadow-md); }
.news-item h3 { font-size: 1.05rem; margin: 0 0 6px; }
.news-item .outlet { font-size: .82rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .05em; }
.news-tag { flex: none; background: var(--bg-softer); color: var(--muted); font-size:.78rem; font-weight:700; padding:6px 12px; border-radius: 999px; white-space: nowrap; }

/* ---------- Journal cover showcase ---------- */
.cover-showcase {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 34px 38px; margin-bottom: 44px; box-shadow: var(--shadow-sm);
}
.cover-showcase .kicker { color: var(--blue); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin-bottom: 8px; }
.cover-showcase h2 { font-size: 1.5rem; margin-bottom: 6px; }
.cover-showcase .sub { color: var(--muted); margin-bottom: 26px; font-size: 1rem; }
.cover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.cover-card {
  display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cover-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.cover-frame {
  position: relative; aspect-ratio: 3/4; background: var(--bg-softer);
  display: grid; place-items: center; overflow: hidden;
}
.cover-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* placeholder shown only when the <img> fails to load (before you add the file) */
.cover-frame img { background: var(--bg-softer); }
.cover-ph {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px;
  color: var(--muted); font-size: .82rem; padding: 20px;
  background: repeating-linear-gradient(45deg, #eef3f9, #eef3f9 12px, #e6eef7 12px, #e6eef7 24px);
}
.cover-ph strong { color: var(--blue-dark); font-size: .9rem; }
.cover-frame img[src]:not([src=""]) + .cover-ph { display: none; }
.cover-frame { border-bottom: 1px solid var(--line); }
.cover-meta { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.cover-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-light); color: var(--blue-dark);
  font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.cover-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cover-journal { color: var(--navy); font-weight: 800; font-size: 1rem; line-height: 1.25; }
.cover-desc { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.cover-link { margin-top: auto; font-weight: 700; font-size: .85rem; color: var(--blue); }

/* Cover badge on individual publications */
.pub-badge {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  background: linear-gradient(135deg, var(--blue), var(--accent)); color: #fff;
  font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.pub-item.is-cover { border-color: #bcd8f4; box-shadow: 0 0 0 1px #bcd8f4, var(--shadow-sm); }

/* News cards as links */
a.news-item { color: inherit; }
a.news-item:hover { color: inherit; }

@media (max-width: 860px) {
  .cover-grid { grid-template-columns: 1fr; }
  .cover-frame { aspect-ratio: 3/4; max-width: 280px; margin: 0 auto; width: 100%; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #b9cbe0; padding: 56px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.site-footer h4 { color:#fff; font-size:.85rem; text-transform:uppercase; letter-spacing:.1em; margin-bottom:16px; }
.site-footer a { color:#b9cbe0; }
.site-footer a:hover { color:#fff; }
.footer-links { list-style:none; margin:0; padding:0; }
.footer-links li { margin-bottom: 9px; }
.footer-brand .name { color:#fff; font-weight:800; font-size:1.1rem; margin-bottom:8px; }
.footer-brand p { color:#8fa6c0; font-size:.92rem; max-width: 34ch; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 22px; font-size:.85rem; color:#7f97b3; display:flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch;
    background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 2px;
    box-shadow: var(--shadow-md); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; font-size: 1rem; }
  .nav-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .profile { grid-template-columns: 1fr; }
  .avatar { max-width: 200px; }
  .project { grid-template-columns: 1fr; }
  .project .years { max-width: 120px; }
  .timeline li { grid-template-columns: 110px 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .news-item { grid-template-columns: 1fr; }
}
@media (min-width: 861px) and (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
