/* EDABK Lab — site styles */
:root {
  --red: #b3121e;
  --red-dark: #8c0d16;
  --red-soft: #fbeaeb;
  --ink: #1d2229;
  --text: #444b53;
  --muted: #626b75;
  --line: #e6e8eb;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --footer: #1d2229;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(20, 24, 31, .08);
  --max: 1140px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
/* Content below the hero is filled in by main.js. Keep it invisible until then so it
   appears once instead of jumping around while it renders (Cumulative Layout Shift). */
.js:not(.rendered) body > :not(.hero):not(.site-header):not(script) { visibility: hidden; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header { min-height: 69px; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 18px; letter-spacing: 1px; }
.brand-text small { font-size: 11.5px; color: var(--muted); }

.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--ink); font-size: 13.5px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  padding: 8px 12px; border-radius: 6px;
}
.nav a:hover { background: var(--bg-alt); text-decoration: none; }
.nav a.active { color: var(--red); background: var(--red-soft); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #7d0b13 0%, var(--red) 55%, #d4323d 100%);
  color: #fff;
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .16;
  background-image: url("../img/circuit.svg");
  background-size: 320px;
}
.hero .container { position: relative; padding-top: 96px; padding-bottom: 96px; text-align: center; }
.hero .eyebrow { letter-spacing: 4px; font-size: 14px; font-weight: 600; opacity: .9; text-transform: uppercase; }
.hero h1 { color: #fff; font-size: clamp(30px, 5vw, 52px); font-weight: 800; letter-spacing: 1px; margin: 10px 0 14px; }
.hero p { max-width: 720px; margin: 0 auto; font-size: 17px; opacity: .92; }
.hero .actions { margin-top: 30px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.page-hero { padding: 0; }
.page-hero .container { padding-top: 56px; padding-bottom: 56px; text-align: left; }
.page-hero h1 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 6px; }
.page-hero p { margin: 0; max-width: 680px; }

.btn {
  display: inline-block; padding: 11px 22px; border-radius: 999px;
  font-weight: 600; font-size: 14.5px; border: 2px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-light { background: #fff; color: var(--red); }
.btn-light:hover { color: var(--red-dark); background: #fff4f4; }
.btn-ghost { border-color: rgba(255, 255, 255, .7); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 26px; letter-spacing: 2px; text-transform: uppercase; }
.section-title h2::after {
  content: ""; display: block; width: 48px; height: 3px;
  background: var(--red); margin: 14px auto 0; border-radius: 2px;
}
.section-title p { color: var(--muted); margin: 10px auto 0; max-width: 640px; }
.section-more { text-align: center; margin-top: 32px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-top: -48px; position: relative; z-index: 2; }
.stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 16px; text-align: center;
}
.stat b { display: block; font-size: 32px; color: var(--red); font-weight: 800; line-height: 1.1; }
.stat span { font-size: 13.5px; color: var(--muted); }

/* Research areas */
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; }
.area {
  text-align: center; padding: 28px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; transition: .2s;
}
.area:hover { border-color: var(--red); box-shadow: var(--shadow); transform: translateY(-3px); }
.area .icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--red-soft); color: var(--red); display: grid; place-items: center;
}
.area .icon svg { width: 32px; height: 32px; }
.area h3 { font-size: 16px; margin-bottom: 6px; }
.area p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* About */
.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.about ul { padding-left: 18px; }
.about li { margin: 4px 0; }
.about-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.about-card h3 { font-size: 17px; }

/* News */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.news-card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--line);
  overflow: hidden; display: flex; flex-direction: column; transition: .2s;
}
.news-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.news-card .head { background: var(--red); color: #fff; padding: 14px 18px; font-weight: 600; font-size: 15.5px; line-height: 1.4; }
.news-card .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 12px 18px 0; }
.news-card .body { padding: 8px 18px 18px; font-size: 14.5px; }
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red);
}

/* Filters */
.filters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 32px; }
.filters button {
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.filters button.active, .filters button:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Publications */
.pub-year { font-size: 22px; color: var(--red); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 36px 0 8px; }
.pub { display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: 0; }
.pub .title { color: var(--ink); font-weight: 600; font-size: 16px; }
.pub .authors { font-size: 14.5px; }
.pub .venue { font-size: 14px; color: var(--muted); font-style: italic; }
.pub .tag { align-self: start; justify-self: start; }
.publication-tools { display: flex; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.publication-tools > div { min-width: 0; }
.publication-search { flex: 1 1 280px; }
.publication-tools label, .citation-dialog label { display: block; color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.publication-tools input, .publication-tools select, .citation-dialog textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: #fff; color: var(--ink); font: inherit; }
.publication-tools :focus-visible, .publication-button:focus-visible, .publication-actions a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.publication-button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--red); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.publication-button:hover { background: var(--red-soft); border-color: var(--red); }
.publication-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; }
.publication-actions a { padding: 10px 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.publication-actions .publication-button { padding: 8px 10px; }
.pub > div { min-width: 0; overflow-wrap: anywhere; }
.publication-pending { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.publication-feedback { color: var(--red); font-size: 14px; overflow-wrap: anywhere; }
.publication-feedback:empty { margin: 0; }
.publication-empty { text-align: center; padding: 24px 0; }
.citation-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.citation-dialog::backdrop { background: rgba(10, 12, 16, .75); }
.citation-dialog h2 { font-size: 22px; }
.citation-dialog textarea { resize: vertical; min-height: 180px; font: 13px/1.6 ui-monospace, monospace; }
.citation-dialog form { margin-top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* People */
.people-group { margin-bottom: 56px; }
.people-group > h2 { font-size: 22px; letter-spacing: 1px; text-transform: uppercase; border-left: 4px solid var(--red); padding-left: 12px; margin-bottom: 24px; }
.prof { display: grid; grid-template-columns: 180px 1fr; gap: 28px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; background: #fff; }
.prof h3 { margin-bottom: 2px; font-size: 20px; }
.prof .role { color: var(--red); font-weight: 600; font-size: 13.5px; letter-spacing: .6px; text-transform: uppercase; }
.prof .contact { font-size: 14px; margin-top: 10px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.person { text-align: center; padding: 24px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.person h3 { font-size: 16.5px; margin: 12px 0 2px; }
.person .role { font-size: 13px; color: var(--red); font-weight: 600; }
.person p { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.avatar {
  width: 112px; height: 112px; border-radius: 50%; margin: 0 auto; object-fit: cover;
  background: var(--red-soft); color: var(--red); display: grid; place-items: center;
  font-weight: 800; font-size: 30px; letter-spacing: 1px;
}
.prof .avatar { width: 180px; height: 180px; border-radius: 12px; font-size: 44px; }

.alumni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.alumni-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; }
.alumni-card h3 { font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.alumni-card h3 .count { font-size: 12px; background: var(--red-soft); color: var(--red); padding: 2px 9px; border-radius: 999px; }
.alumni-card p { font-size: 14px; margin: 0; }
.company-list { display: flex; flex-wrap: wrap; gap: 10px; }
.company { border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font-size: 14px; background: #fff; }
.company b { color: var(--red); margin-left: 6px; }

/* Research page */
.project { display: grid; grid-template-columns: 64px 1fr; gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; background: #fff; }
.project .icon { width: 64px; height: 64px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.project .icon svg { width: 30px; height: 30px; }
.project h3 { font-size: 18px; }
.project p { margin: 0; }
.highlight { background: linear-gradient(120deg, #1d2229, #39414b); color: #e9ecef; border-radius: var(--radius); padding: 32px; margin-bottom: 40px; }
.highlight h3 { color: #fff; }
.highlight .tag { background: rgba(255, 255, 255, .15); color: #fff; }

/* Partners */
.partners { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.partners span { padding: 10px 18px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-weight: 600; color: var(--ink); font-size: 14px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.contact-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: #fff; }
.contact-card dt { font-weight: 700; color: var(--ink); margin-top: 14px; }
.contact-card dd { margin: 2px 0 0; }
.map { width: 100%; height: 100%; min-height: 360px; border: 0; border-radius: var(--radius); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: #b8bec5; font-size: 14.5px; }
.site-footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-top: 56px; padding-bottom: 40px; }
.site-footer h4 { color: #fff; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 12px; }
.site-footer a { color: #fff; }
.site-footer p { margin: 0 0 6px; }
.site-footer .copy { grid-column: 1 / -1; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 20px; font-size: 13px; }

/* ---------- Images ---------- */
.brand-logo { height: 44px; width: auto; }
.news-card .cover { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--bg-alt); }
.news-card .title { font-size: 16px; padding: 8px 18px 0; margin: 0; }
.news-card .body { padding: 6px 18px 18px; }
.news-card .title:last-child { padding-bottom: 18px; }
.avatar { object-position: center 20%; }
.about-photo { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 20px; }
.partners-logos { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; width: 100%; max-width: 860px; margin: 0 auto 28px; }
.highlight { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center; }
.research-image { display: block; min-width: 0; cursor: zoom-in; }
.highlight img { border-radius: 8px; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.project.has-image { grid-template-columns: 240px 1fr; }
.project.has-image img { width: 240px; height: 160px; object-fit: contain; border-radius: 8px; background: var(--bg-alt); }
.alumni-card { padding: 0; overflow: hidden; }
.alumni-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.alumni-card .pad { padding: 16px 20px; }
.company-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.company { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 12px; border-radius: var(--radius); }
.company img { height: 48px; width: 100%; object-fit: contain; }
.company span { font-weight: 600; color: var(--ink); font-size: 14px; }
.company b { margin: 0; font-size: 12.5px; }

/* Posters, products, lab poster */
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.poster { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; color: var(--ink); transition: .2s; }
.poster:hover { box-shadow: var(--shadow); transform: translateY(-3px); text-decoration: none; color: var(--ink); }
.poster img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; background: var(--bg-alt); }
.poster span { display: block; padding: 12px 16px; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.poster-grid.wide .poster img { aspect-ratio: 16 / 9; object-position: center; }
.lab-poster { display: grid; grid-template-columns: 2.2fr 1fr; gap: 22px; align-items: start; }
.lab-poster a { display: block; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.lab-poster .hint { color: var(--muted); font-size: 13.5px; text-align: center; margin-top: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 16, .88); display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img {
  width: auto; height: auto; min-width: 0; min-height: 0; max-width: 100%;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  object-fit: contain; border-radius: 6px;
}
.lightbox-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 50%; background: #1d2229; color: #fff; font-size: 28px; cursor: pointer; }
html.lightbox-open, html.lightbox-open body { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .about, .contact-grid, .lab-poster { grid-template-columns: 1fr; }
  .site-footer .container { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
    max-height: calc(100vh - 69px); max-height: calc(100dvh - 69px);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .nav.open { display: flex; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .hero .container { padding-top: 48px; padding-bottom: 60px; }
  .hero h1 { font-size: clamp(28px, 7.5vw, 36px); }
  .hero p { font-size: 15px; }
  .hero .actions { margin-top: 24px; }
  .page-hero .container { padding-top: 32px; padding-bottom: 32px; }
  .section { padding: 40px 0; }
  .section-title { margin-bottom: 24px; }
  .section-title h2 { font-size: 23px; letter-spacing: 1px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: -24px; }
  .stat { padding: 18px 12px; }
  .stat b { font-size: 28px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .areas { grid-template-columns: 1fr; gap: 12px; }
  .area { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 16px; padding: 20px; text-align: left; }
  .area .icon { grid-row: span 2; width: 48px; height: 48px; margin: 0; }
  .area .icon svg { width: 26px; height: 26px; }
  .about { gap: 24px; }
  .about-card, .contact-card, .highlight, .project { padding: 20px; }
  .people-grid, .alumni-grid, .poster-grid { grid-template-columns: minmax(0, 1fr); }
  .prof { grid-template-columns: 1fr; text-align: center; }
  .prof .avatar { margin: 0 auto; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .prof .contact, .contact-card dd, .site-footer a { overflow-wrap: anywhere; }
  .project, .project.has-image, .highlight { grid-template-columns: 1fr; }
  .project.has-image img { width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .news-grid { grid-template-columns: 1fr; }
  .site-footer .container { gap: 24px; padding-top: 36px; padding-bottom: 28px; }
  .brand-text small { display: none; }
}
