:root {
  --ink: #172033;
  --muted: #5f6878;
  --soft: #f7f8fa;
  --surface: #ffffff;
  --line: #dfe3e8;
  --accent: #34527a;
  --accent-strong: #243d5d;
  --accent-soft: #f1f4f7;
  --shadow: 0 4px 16px rgba(23, 32, 51, 0.07);
}

body[data-theme="samark"] {
  --accent: #465d87;
  --accent-strong: #30466c;
  --accent-soft: #f1f3f7;
}

body[data-theme="pmark"] {
  --accent: #8a5b2b;
  --accent-strong: #68421e;
  --accent-soft: #f7f3ee;
}

body[data-theme="causalembed"] {
  --accent: #316a67;
  --accent-strong: #24504e;
  --accent-soft: #eff5f4;
}

body[data-theme="mmunlearner"] {
  --accent: #845444;
  --accent-strong: #643d31;
  --accent-soft: #f7f1ef;
}

body[data-theme="mmneuron"] {
  --accent: #5c557e;
  --accent-strong: #433d62;
  --accent-soft: #f3f2f6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.project-page {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.project-page::selection {
  color: #fff;
  background: var(--accent);
}

body.project-page a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

body.project-page a:hover {
  color: var(--accent-strong);
}

.page-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.brand {
  color: var(--ink) !important;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-decoration: none !important;
  white-space: nowrap;
}

.brand span {
  color: var(--accent);
  font-weight: 600;
}

.back-link {
  color: var(--muted) !important;
  font-size: 0.86rem;
  text-decoration: none !important;
}

.back-link:hover {
  color: var(--accent-strong) !important;
}

.project-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
}

.project-nav a {
  color: var(--muted) !important;
  font-size: 0.86rem;
  text-decoration: none !important;
}

.project-nav a:hover,
.project-nav a[aria-current="page"] {
  color: var(--accent-strong) !important;
}

.project-nav a[aria-current="page"] {
  font-weight: 750;
}

.project-main {
  overflow: hidden;
}

.directory-hero {
  max-width: 780px;
  padding: 90px 0 54px;
}

.directory-hero h1 {
  margin: 0 0 20px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.directory-hero p:last-child {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.75;
}

.project-directory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 84px;
}

.project-directory-card {
  display: block;
  min-height: 220px;
  padding: 27px 27px 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 5px;
  color: inherit !important;
  text-decoration: none !important;
  transition: border-color 160ms ease, background 160ms ease;
}

.project-directory-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-directory-card > span:first-child {
  display: block;
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.project-directory-card h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.project-directory-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.project-directory-card .directory-link {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(320px, 0.97fr);
  align-items: center;
  gap: clamp(40px, 7vw, 92px);
  min-height: 0;
  padding: 72px 0 84px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow::before,
.section-kicker::before {
  width: 18px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.hero h1 {
  max-width: 700px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(3rem, 6vw, 5.6rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero-lede {
  max-width: 620px;
  margin: 31px 0 23px;
  color: #34435b;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  letter-spacing: -0.018em;
  line-height: 1.5;
}

.authors {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.8;
}

.authors strong {
  color: var(--ink);
  font-weight: 750;
}

.affiliations {
  margin: 8px 0 0;
  color: #8290a4;
  font-size: 0.84rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 29px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 17px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink) !important;
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none !important;
  transition: border-color 160ms ease, background 160ms ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent-strong) !important;
}

.button-primary {
  border-color: var(--accent);
  color: #fff !important;
  background: var(--accent);
}

.button-primary:hover {
  border-color: var(--accent-strong);
  color: #fff !important;
  background: var(--accent-strong);
}

.hero-art {
  position: relative;
}

.media-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.media-frame::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(17, 30, 56, 0.07);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.media-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 590px;
  object-fit: contain;
  background: #fff;
}

.zoomable {
  cursor: zoom-in;
}

.image-note {
  margin: 12px 2px 0;
  color: #8290a4;
  font-size: 0.77rem;
  line-height: 1.5;
}

.scroll-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 54px;
  color: #8b98ab;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scroll-note::after {
  width: 40px;
  height: 1px;
  background: var(--line);
  content: "";
}

.section {
  padding: 76px 0;
}

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

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-heading .section-kicker {
  margin-bottom: 0;
}

.section h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 3.2vw, 2.65rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.section-intro {
  max-width: 530px;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.abstract-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 70px;
  align-items: start;
}

.abstract-copy {
  margin: 0;
  color: #34435b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  letter-spacing: 0;
  line-height: 1.78;
}

.abstract-copy p {
  margin: 0 0 1em;
}

.abstract-copy p:last-child {
  margin-bottom: 0;
}

.meta-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.87rem;
}

.meta-item strong {
  color: var(--ink);
  font-weight: 750;
  text-align: right;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.highlight-card {
  min-height: 170px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.highlight-value {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
}

.highlight-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.idea-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  counter-reset: idea;
}

.idea-card {
  position: relative;
  padding: 28px 25px 26px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  background: #fff;
}

.idea-card::before {
  display: block;
  margin-bottom: 25px;
  color: var(--accent);
  content: "0" counter(idea);
  counter-increment: idea;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.idea-card h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.idea-card p {
  margin: 0;
  color: #536278;
  font-size: 0.9rem;
  line-height: 1.58;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.figure-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.figure-card.wide {
  grid-column: 1 / -1;
}

.figure-card img {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: contain;
  background: #fff;
}

.figure-card.wide img {
  height: auto;
  max-height: 610px;
}

.figure-caption {
  padding: 17px 19px 19px;
  border-top: 1px solid var(--line);
}

.figure-caption strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 0.92rem;
}

.figure-caption span {
  display: block;
  color: var(--muted);
  font-size: 0.81rem;
  line-height: 1.5;
}

.citation-wrap {
  position: relative;
}

.citation {
  overflow-x: auto;
  margin: 0;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #34435b;
  background: #f7f9fc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre;
}

.copy-citation {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 750;
}

.copy-citation:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.site-footer {
  padding: 30px 0 50px;
  color: #8b98ab;
  font-size: 0.78rem;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
}

.lightbox {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(8, 15, 29, 0.86);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  display: block;
  max-width: min(1200px, 94vw);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.reveal {
  opacity: 0;
  transition: opacity 300ms ease;
}

.reveal.is-visible {
  opacity: 1;
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 65px;
  }

  .hero-art {
    max-width: 720px;
  }

  .abstract-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 650px) {
  .page-shell {
    width: min(100% - 32px, 1120px);
  }

  .header-inner {
    min-height: 62px;
  }

  .brand {
    font-size: 0.68rem;
  }

  .back-link {
    font-size: 0.75rem;
  }

  .project-nav {
    gap: 13px;
  }

  .project-nav a {
    font-size: 0.75rem;
  }

  .hero {
    gap: 38px;
    padding: 55px 0 78px;
  }

  .hero h1 {
    font-size: clamp(3.4rem, 19vw, 5.5rem);
  }

  .scroll-note {
    margin-top: 36px;
  }

  .section {
    padding: 67px 0;
  }

  .section-heading {
    display: block;
  }

  .section-intro {
    margin-top: 18px;
  }

  .highlight-grid,
  .idea-grid,
  .figure-grid {
    grid-template-columns: 1fr;
  }

  .directory-hero {
    padding: 60px 0 38px;
  }

  .project-directory-grid {
    grid-template-columns: 1fr;
    padding-bottom: 60px;
  }

  .figure-card.wide {
    grid-column: auto;
  }

  .figure-card img,
  .figure-card.wide img {
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .lightbox {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
