:root {
  --ink: #15202b;
  --muted: #5d6b7a;
  --line: #d9e0e7;
  --soft: #f4f7fa;
  --paper: #ffffff;
  --blue: #00629b;
  --blue-dark: #003b5c;
  --gold: #c69214;
  --green: #24796b;
  --red: #b44436;
  --shadow: 0 14px 35px rgba(21, 32, 43, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--blue-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: white;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 112px;
}

.brand img {
  width: 104px;
  display: block;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  margin-left: auto;
}

.nav-toggle span:not(.sr-only),
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 0.7rem;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.primary-nav a[aria-current="page"],
.primary-nav a:hover {
  background: var(--soft);
  color: var(--blue-dark);
}

.header-search {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  min-width: 44px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.search-input {
  width: 0;
  min-width: 0;
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0;
  transition: width 180ms ease, opacity 160ms ease, padding 180ms ease;
}

.header-search.is-open .search-input {
  width: min(260px, 34vw);
  opacity: 1;
  padding: 0.6rem 0.75rem;
}

.main {
  min-height: 58vh;
}

.container,
.wide {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: clamp(2.25rem, 5vw, 5rem) 0 2.4rem;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}

.hero-media {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--soft);
}

.hero-media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.1rem, 4.8vw, 4.5rem);
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.55rem, 2.6vw, 2.4rem);
}

h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.08rem, 1.6vw, 1.35rem);
}

h4 {
  margin: 1rem 0 0.45rem;
  font-size: 1rem;
}

.lead {
  color: var(--muted);
  font-size: clamp(1.08rem, 1.6vw, 1.3rem);
}

.section {
  padding: clamp(2.5rem, 5vw, 4.6rem) 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-header p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: var(--blue);
  color: white;
  font-weight: 750;
  text-decoration: none;
}

.button:hover {
  background: var(--blue-dark);
  color: white;
}

.button.secondary {
  background: white;
  color: var(--blue);
}

.button.secondary:hover {
  background: var(--soft);
  color: var(--blue-dark);
}

.feature-grid,
.method-grid,
.news-grid,
.person-grid,
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature,
.method-card,
.news-card,
.person-card,
.research-card,
.legacy-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 1px 0 rgba(21, 32, 43, 0.03);
  overflow: hidden;
}

.feature,
.method-card,
.person-card,
.legacy-card {
  padding: 1rem;
}

.feature img,
.method-card img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.method-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 0.9rem;
  border-radius: 8px;
  color: var(--blue);
  background: #e8f2fb;
}

.method-icon svg {
  width: 27px;
  height: 27px;
}

.method-icon img {
  display: block;
  width: 34px;
  height: 34px;
  max-height: none;
  margin: 0;
  object-fit: contain;
}

.method-icon-nemar {
  color: #0f766e;
  background: #e5f4f2;
}

.method-icon-hed {
  color: #9a6415;
  background: #fbefd9;
}

.method-icon-eegdash {
  color: #6d4cc2;
  background: #eee9fb;
}

.method-icon-eegprep {
  color: #1d6c8f;
  background: #e3f5fb;
}

.research-card img,
.news-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--soft);
}

.research-card .body,
.news-card .body {
  padding: 1rem;
}

.metadata {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.band {
  background: var(--soft);
}

.image-band {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.5rem;
  align-items: center;
}

.image-band.text-only {
  grid-template-columns: minmax(0, 780px);
}

.image-band img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.image-band.plain-media img {
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.person-toolbar,
.publication-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0;
}

.filter-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  font: inherit;
}

.group-heading {
  margin: 2.2rem 0 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.person-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.9rem;
  min-height: 150px;
}

.person-card img {
  width: 92px;
  height: 116px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--soft);
}

.person-card ul {
  margin: 0.45rem 0 0;
  padding-left: 1rem;
}

.person-card li {
  margin-bottom: 0.15rem;
}

.person-card .role {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.bottom-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.publication-list {
  display: grid;
  gap: 0.65rem;
}

.publication-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: white;
}

.publication-title {
  margin: 0.15rem 0;
  font-weight: 750;
}

.publication-authors,
.publication-source {
  margin: 0;
  color: var(--muted);
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.year-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #edf4fa;
  color: var(--blue-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

.news-card .summary {
  color: var(--muted);
}

.legacy-content {
  padding-top: 2.2rem;
}

.legacy-content img {
  border-radius: var(--radius);
}

.legacy-content .card,
.legacy-content .article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.legacy-content .float-md-right {
  float: right;
  max-width: 240px;
  margin: 0 0 1rem 1rem;
}

.search-results {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  color: #dbe6ef;
  background: #0f2537;
}

.footer-grid {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
}

.site-footer a {
  color: white;
}

@media (max-width: 920px) {
  .nav-shell {
    flex-wrap: wrap;
    min-height: 64px;
    padding: 0.6rem 0;
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .primary-nav {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0.55rem 0;
  }

  .primary-nav.is-open {
    display: flex;
  }

  .primary-nav a {
    min-height: 38px;
  }

  .header-search {
    margin-left: auto;
  }

  .header-search.is-open {
    width: 100%;
    order: 5;
  }

  .header-search.is-open .search-input {
    width: 100%;
  }

  .hero-grid,
  .image-band {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .method-grid,
  .news-grid,
  .research-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .person-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .feature-grid,
  .method-grid,
  .news-grid,
  .research-grid,
  .bottom-links {
    grid-template-columns: 1fr;
  }

  .section-header,
  .person-toolbar,
  .publication-toolbar {
    display: block;
  }

  .publication-toolbar .button,
  .person-toolbar .metadata {
    margin-top: 0.75rem;
  }

  .person-card {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .person-card img {
    width: 76px;
    height: 96px;
  }
}
