:root {
  --bg: #fdf8fb;
  --bg2: #fffdf8;
  --ink: #261738;
  --ink-soft: #5d4b74;
  --line: #e9d8e9;
  --rose: #f3a3b0;
  --rose-strong: #df6f87;
  --violet: #a58bf2;
  --blue: #7ca8ff;
  --mint: #a4dfc1;
  --card: #ffffffcc;
  --shadow: 0 16px 34px rgba(117, 78, 130, 0.12);
  --radius: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 12%, #ffe8ef 0%, transparent 30%),
    radial-gradient(circle at 94% 4%, #efe9ff 0%, transparent 24%),
    linear-gradient(145deg, var(--bg), var(--bg2));
}

html {
  scroll-behavior: smooth;
}

body {
  line-height: 1.65;
  background-attachment: fixed;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255, 252, 255, 0.9);
  border-bottom: 1px solid #efdde9;
}

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

.logo {
  font-family: "Space Grotesk", Inter, sans-serif;
  text-decoration: none;
  color: #3d245f;
  font-size: 1.2rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 22px;
  height: 22px;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(88, 58, 116, 0.18));
}

.nav nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.nav nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav nav a:hover {
  color: #2f1b4a;
  background: #f7ecf9;
}

.nav nav a.active {
  color: #402a61;
  background: linear-gradient(135deg, #f9dfe9, #ece3ff);
  box-shadow: inset 0 0 0 1px #e9d1e7;
}

.btn {
  border: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 10px 15px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--rose-strong), #a56cf5);
  box-shadow: 0 9px 20px rgba(188, 92, 132, 0.28);
  cursor: pointer;
}

.btn-soft {
  background: #fff;
  color: #4e3669;
  border: 1px solid #e9d0e6;
  box-shadow: none;
}

.btn-sm {
  font-size: 0.88rem;
  padding: 8px 12px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: center;
  padding: 36px 0 20px;
}

.pill {
  display: inline-flex;
  margin: 0 0 10px;
  background: #ffe9ef;
  color: #8a4563;
  border-radius: 999px;
  border: 1px solid #f9ccd8;
  padding: 5px 11px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  line-height: 1.2;
}

h1 {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(2rem, 4.8vw, 3.7rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  margin-bottom: 16px;
}

h3 {
  font-size: 1.04rem;
}

.subtitle {
  color: var(--ink-soft);
  font-size: 1.06rem;
  max-width: 720px;
}

.author-hero {
  margin-top: 14px;
  border: 1px solid #ecd8ea;
  background: linear-gradient(160deg, #fff6fa, #f6efff);
  border-radius: 14px;
  padding: 10px 12px;
}

.author-hero-names {
  margin: 0;
  color: #5f477f;
  font-weight: 600;
  line-height: 1.45;
}

.author-hero-affils {
  margin: 7px 0 0;
  color: #7a6295;
  font-size: 0.9rem;
}

.author-hero-affils span {
  display: block;
}

.cta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 38px rgba(117, 78, 130, 0.16);
  border-color: #e1c7e6;
}

.hero-visual {
  padding: 10px;
  background: linear-gradient(160deg, rgba(255, 244, 248, 0.95), rgba(244, 236, 255, 0.82));
}

.hero-visual img {
  width: 100%;
  border-radius: 14px;
  display: block;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.metric-strip article {
  background: #fff;
  border: 1px solid #ecd8e8;
  border-radius: 15px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.metric-strip h3 {
  margin-bottom: 1px;
  color: #4f2e72;
  font-size: 1.45rem;
}

.metric-strip p {
  margin: 0;
  color: #7d6295;
  font-size: 0.86rem;
}

.section {
  padding: 38px 0 8px;
  scroll-margin-top: 96px;
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.stack-col {
  display: grid;
  gap: 16px;
}

.grid2,
.grid3 {
  display: grid;
  gap: 16px;
  align-items: start;
}

.grid2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

p,
li {
  color: var(--ink-soft);
}

ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

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

.gallery-more {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subhead {
  margin-top: 20px;
}

.figure-card {
  padding: 12px;
  overflow: hidden;
}

.figure-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #e8d9eb;
  cursor: zoom-in;
  background: #fff;
  display: block;
  margin: 0 auto;
}

.figure-card figcaption {
  padding: 10px 6px 2px;
  color: #5f477e;
  font-size: 0.92rem;
  border-top: 1px dashed #e4d3e8;
  margin-top: 8px;
}

.figure-wide img {
  max-height: 820px;
}

.figure-compact img {
  max-height: 620px;
}

.insight-card {
  background: linear-gradient(160deg, rgba(255, 248, 251, 0.96), rgba(248, 241, 255, 0.92));
}

.compact-insight p {
  margin-bottom: 0;
}

.dataset-stats-grid {
  align-items: stretch;
}

.dataset-stats-grid .card {
  height: 100%;
}

.insight-band {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.insight-band span {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.84rem;
  color: #5d457b;
  border: 1px solid #e5d2eb;
  background: linear-gradient(140deg, #fff4f8, #f4edff);
}

.results-top {
  align-items: stretch;
}

.results-top .card {
  height: 100%;
}

.mechanism-pair {
  align-items: stretch;
}

.mechanism-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.mechanism-card.is-linked {
  border-color: #c79bd9;
  box-shadow: 0 24px 40px rgba(117, 78, 130, 0.2);
  background: linear-gradient(165deg, rgba(255, 250, 253, 0.97), rgba(249, 241, 255, 0.95));
}

.mechanism-card.is-linked figcaption {
  color: #513971;
  border-top-color: #d8bce3;
}

.full-width-table-card {
  margin-top: 16px;
}

.table-scroll {
  margin-top: 10px;
  overflow-x: auto;
  border: 1px solid #ebd8ed;
  border-radius: 12px;
  background: #fff;
}

.wide-table {
  min-width: 1750px;
  border: 0;
  margin: 0;
}

.wide-table th,
.wide-table td {
  white-space: nowrap;
  font-size: 0.79rem;
  padding: 7px 8px;
}

.wide-table tbody tr:hover td {
  background: #fdf7ff;
}

.wide-table thead tr:first-child th {
  background: linear-gradient(90deg, #ffe6ef, #ebe3ff);
  font-size: 0.8rem;
}

.wide-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.wide-table th:first-child,
.wide-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 #efdff0;
}

.wide-table thead th:first-child {
  z-index: 4;
  background: #f9edf7;
}

.wide-table .mean-row td {
  background: #f3ecff;
  font-weight: 700;
}

.trend-box {
  margin-top: 10px;
  border: 1px solid #ead8ec;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.trend-box svg {
  width: 100%;
  height: auto;
  display: block;
}

.axis {
  stroke: #9d86b5;
  stroke-width: 2;
}

.gridline {
  stroke: #eddff2;
  stroke-width: 1;
}

.axis-label {
  fill: #775f93;
  font-size: 13px;
  font-weight: 600;
}

.line-a {
  fill: none;
  stroke: #df6f87;
  stroke-width: 3.5;
}

.line-b {
  fill: none;
  stroke: #7f70e8;
  stroke-width: 3.5;
}

.dot-a {
  fill: #df6f87;
}

.dot-b {
  fill: #7f70e8;
}

.legend-bg {
  fill: #fff;
  stroke: #e8dcec;
}

.legend-label {
  fill: #614a7d;
  font-size: 12px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #eddbe8;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

th,
td {
  border-bottom: 1px solid #f0e5ef;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
}

thead {
  background: linear-gradient(90deg, #ffe8f0, #eee7ff);
}

.note {
  margin: 10px 0 0;
  color: #7e678f;
  font-size: 0.86rem;
}

.takeaway {
  margin: 12px 4px 2px;
  padding: 9px 12px;
  border-left: 3px solid #b790dc;
  background: linear-gradient(160deg, rgba(255, 247, 252, 0.95), rgba(248, 241, 255, 0.95));
  color: #614a7a;
  border-radius: 8px;
  font-size: 0.93rem;
}

.takeaway strong {
  white-space: nowrap;
}

.authors {
  margin-top: 0;
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  border-radius: 999px;
  background: #f4ebff;
  color: #5f477f;
  border: 1px solid #e2d2fb;
  padding: 5px 10px;
  font-size: 0.83rem;
}

.resource {
  text-decoration: none;
}

.resource h3 {
  color: #4c2d71;
}

.resource p {
  margin-bottom: 0;
}

.contact-card {
  margin-top: 14px;
}

.contact-link {
  color: #6b3fa2;
  font-weight: 600;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

.bib-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

pre {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #f8f3ff;
  border: 1px solid #e6d8ff;
  color: #3f2b57;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  font-size: 0.86rem;
}

.footer {
  margin-top: 26px;
  padding: 10px 0 24px;
}

.footer p {
  margin: 0;
  color: #886ea2;
  text-align: center;
  font-size: 0.9rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 7, 33, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 26px;
}

.lightbox.show {
  display: flex;
}

.lightbox img {
  max-width: min(1220px, 95vw);
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 22px;
  border: 0;
  background: #fff;
  color: #4f3368;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .gallery-more {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .hero,
  .story-grid,
  .grid2,
  .grid3,
  .gallery {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    order: 2;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .container {
    width: calc(100% - 26px);
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .nav nav {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
}
