:root {
  --bg: #f6fbff;
  --card: #ffffff;
  --ink: #0b1f33;
  --muted: #526b7a;

  --brand: #0646c9;
  --brand-dark: #05339a;
  --accent: #0b63f6;
  --cyan: #baf4ff;

  --line: #d6eaf7;
  --soft: #eaf6ff;

  --radius: 22px;
  --shadow: 0 18px 45px rgba(6, 70, 201, .10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: inherit;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

/* Header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 251, 255, .90);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: .01em;
  color: var(--brand);
}

.brand-name {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  transition: background .18s ease, color .18s ease;
}

.brand.is-active-section .brand-name {
  background: var(--brand);
  color: #ffffff !important;
}

.brand.is-active-section:hover .brand-name,
.brand.is-active-section:focus .brand-name,
.brand.is-active-section:active .brand-name {
  background: var(--brand);
  color: #ffffff !important;
}


.brand.is-active-section:hover,
.brand.is-active-section:focus,
.brand.is-active-section:active {
  background: var(--brand);
  color: #ffffff !important;
}


.brand-mark {
  width: 64px;
  height: 42px;
  display: inline-block;
  background-image: url("../img/begibrainlab-logo.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 0;
  flex: 0 0 auto;
}

.menu {
  display: flex;
  gap: 22px;
  align-items: center;
  font-size: .95rem;
}

.menu a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
}

.menu a:hover {
  color: var(--brand);
}

.langs {
  display: flex;
  gap: 8px;
  margin-left: 10px;
}

.langs a {
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .8rem;
  background: #ffffff;
}

.langs a.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* Active navigation section */

.menu a.is-active-section,
.menu a.is-active-section:hover,
.menu a.is-active-section:focus,
.menu a.is-active-section:active {
  background: var(--brand);
  color: #ffffff !important;
  border-radius: 999px;
  padding: 7px 12px;
}

/* Mobile menu button */

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--brand);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

/* Anchor offset for sticky header */

section[id] {
  scroll-margin-top: 125px;
}

/* Hero */

.hero {
  padding: 38px 0 110px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 54px;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
}

.hero h1 {
  font-size: clamp(2.7rem, 6vw, 5.35rem);
  line-height: .96;
  margin: 16px 0;
}

.lead {
  font-size: 1.22rem;
  color: var(--muted);
  max-width: 760px;
}

.institutional-note {
  margin-top: 1.5rem;
  max-width: 760px;
  font-size: .98rem;
  line-height: 1.7;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

.institutional-note a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.institutional-note a:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid var(--brand);
}

.btn.primary {
  background: var(--brand);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn.secondary {
  background: #ffffff;
  color: var(--brand);
}

.btn.secondary:hover {
  background: var(--soft);
}

/* Hero research map - desktop */

.hero-research-map {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  width: 100%;
  max-width: 560px;
  margin-left: auto;
}

.hero-research-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 24px;
}

.hero-research-item img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.hero-research-item h3 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.25rem, 2vw, 1.9rem);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -0.04em;
}

/* Hero research map - mobile placeholder */

.hero-research-map-mobile {
  display: none;
}

.hero-research-map-desktop {
  display: grid;
}

.hero-actions-mobile {
  display: none !important;
}

/* Sections */

section {
  padding: 58px 0;
}

.section-title {
  font-size: 2rem;
  margin: 0 0 12px;
}

.section-intro {
  color: var(--muted);
  max-width: 820px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.cards {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 26px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
}

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

.tag {
  display: inline-block;
  background: var(--soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 800;
  margin-bottom: 12px;
}

/* People */

.person-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.person-photo {
  width: 132px;
  height: 132px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  margin-bottom: 12px;
}

.person-card h3 {
  margin-top: 8px;
  margin-bottom: 0;
}

.person-card .tag {
  white-space: normal;
  line-height: 1.35;
  max-width: 100%;
  width: fit-content;
}

/* ORCID links */

.orcid-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  width: fit-content !important;
  max-width: fit-content !important;
  margin: -2px 0 6px !important;
  padding: 0 !important;
  font-size: .82rem !important;
  font-weight: 800 !important;
  color: #4c7f16 !important;
  text-decoration: none !important;
  line-height: 1 !important;
}

.orcid-link:hover {
  text-decoration: underline !important;
}

.orcid-dot {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: #a6ce39 !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  flex: 0 0 22px !important;
  overflow: hidden !important;
  text-align: center !important;
}

.orcid-dot::before {
  content: "iD" !important;
  display: block !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

/* Projects */

.project-list {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 26px;
}

.project {
  border-left: 5px solid var(--accent);
}

/* Software cards */

.software-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 26px;
}

.software-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.software-card h3 {
  margin-bottom: 0;
}

.software-card > a {
  display: block !important;
  width: fit-content !important;
  max-width: fit-content !important;
  margin: 10px auto 16px !important;
}

.software-card .software-logo {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 150px !important;
  max-height: 80px !important;
  object-fit: contain !important;
  object-position: center !important;
  margin: 10px auto 16px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.software-card > a .software-logo {
  margin: 0 !important;
}

.software-card .btn {
  width: fit-content;
  margin-top: auto;
}

/* Callout */

.callout {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #ffffff;
  border-radius: 32px;
  padding: 34px;
  margin-top: 24px;
}

.callout p {
  color: #e8f7ff;
}

/* Footer */

.footer {
  background: #061b3d;
  color: #d6e6ec;
  margin-top: 60px;
  padding: 40px 0;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.footer a {
  color: #d6e6ec;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: .9rem;
}

.image-note {
  font-size: .85rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

/* Responsive */

@media (max-width: 1100px) {
  .hero-grid {
    grid-template-columns: 1fr .9fr;
    gap: 34px;
  }

  .hero-research-item {
    grid-template-columns: 128px 1fr;
    gap: 18px;
  }

  .hero-research-item img {
    width: 128px;
    height: 128px;
  }

  .hero-research-item h3 {
    font-size: 1.35rem;
  }
}

@media (max-width: 900px) {
  .nav {
    position: relative;
  }

  .menu-toggle {
    display: flex;
    margin-left: auto;
  }

  .menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    z-index: 999;
  }

  .menu.is-open {
    display: flex;
  }

  .menu a {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .95rem;
  }

  .menu a:hover {
    background: #eef7ff;
  }

  .menu a.is-active-section,
  .menu a.is-active-section:hover,
  .menu a.is-active-section:focus,
  .menu a.is-active-section:active {
    background: var(--brand);
    color: #ffffff !important;
    border-radius: 12px;
  }

  .langs {
    display: flex;
    gap: 6px;
    padding: 10px 8px 4px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
  }

  .langs a {
    padding: 8px 10px;
  }
}

/* Mobile hero */

@media (max-width: 850px) {
  .hero {
    padding: 16px 0 76px;
  }

  .hero-grid {
    display: block;
  }

  .eyebrow {
    margin-top: 0;
    margin-bottom: 14px;
  }

  .hero h1 {
    font-size: clamp(2.45rem, 14vw, 3.7rem);
    margin-bottom: 14px;
  }

  .hero-research-map-desktop {
    display: none !important;
  }

  .hero-research-map-mobile {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin: 8px auto 24px;
  }

  .hero-research-map-mobile .hero-research-icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hero-research-map-mobile .hero-research-icon img {
    width: 66px;
    height: 66px;
    object-fit: contain;
    display: block;
  }

  .lead {
    font-size: 1.08rem;
  }

  .hero-actions-desktop {
    display: flex !important;
    justify-content: center;
    margin-top: 26px;
  }

  .hero-actions-mobile {
    display: none !important;
  }

  .grid.cards,
  .project-list,
  .software-grid {
    grid-template-columns: 1fr;
  }

  .software-card > a {
    margin: 10px auto 16px !important;
  }

  .software-card .software-logo {
    max-width: 150px !important;
    max-height: 80px !important;
  }

  #people {
    padding-top: 76px;
  }

  .footer-grid {
    display: block;
  }
}

@media (max-width: 420px) {
  .hero {
    padding-top: 10px;
  }

  .hero-research-map-mobile {
    max-width: 340px;
    gap: 6px;
    margin: 6px auto 22px;
  }

  .hero-research-map-mobile .hero-research-icon img {
    width: 60px;
    height: 60px;
  }

  .hero-actions-desktop {
    gap: 10px;
  }

  .hero-actions-desktop .btn {
    padding: 12px 15px;
    font-size: .92rem;
  }
}

@media (max-width: 370px) {
  .hero-research-map-mobile .hero-research-icon img {
    width: 54px;
    height: 54px;
  }

  .hero-actions-desktop .btn {
    padding: 11px 13px;
    font-size: .86rem;
  }
}

/* Brand active state - clean final version */

.brand {
  background: transparent !important;
  color: var(--brand) !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

.brand:hover,
.brand:focus,
.brand:active {
  background: transparent !important;
  color: var(--brand) !important;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: var(--brand);
  transition: background .18s ease, color .18s ease;
}

.brand:hover .brand-name,
.brand:focus .brand-name,
.brand:active .brand-name {
  background: transparent !important;
  color: var(--brand) !important;
}

.brand.is-active-section .brand-name {
  background: var(--brand) !important;
  color: #ffffff !important;
}

.brand.is-active-section:hover .brand-name,
.brand.is-active-section:focus .brand-name,
.brand.is-active-section:active .brand-name {
  background: var(--brand) !important;
  color: #ffffff !important;
}

/* Project logos */

.project-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 110px;
  max-height: 70px;
  object-fit: contain;
  margin: 0 auto 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.project-logo-wide {
  max-width: 130px;
  max-height: 76px;
}

