:root {
  color-scheme: light;
  --navy: #08294b;
  --navy-2: #0d3a67;
  --ink: #12202e;
  --muted: #586877;
  --paper: #f4f6f8;
  --white: #ffffff;
  --line: #ced7e0;
  --line-strong: #9dadbb;
  --red: #a92d2d;
  --amber: #a85e12;
  --blue-soft: #eaf2f9;
  --shadow: 0 14px 38px rgba(8, 41, 75, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: var(--navy-2);
}

a:hover {
  color: var(--red);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--navy);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4.5rem);
  color: var(--white);
  background: var(--navy);
  border-bottom: 4px solid #e1a047;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3.15rem;
  height: 3.15rem;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.25rem;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  line-height: 1.2;
}

.text-button,
.clear-button {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font-weight: 760;
  text-decoration: underline;
  text-underline-offset: 0.24rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-link {
  color: var(--white);
  font-weight: 760;
  text-underline-offset: 0.24rem;
}

.header-link:hover {
  color: #ffd99d;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.75fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(2.6rem, 6vw, 5.8rem) clamp(1rem, 4vw, 4.5rem) 2.4rem;
  background:
    linear-gradient(112deg, rgba(8, 41, 75, 0.98), rgba(13, 58, 103, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 56px, rgba(255, 255, 255, 0.08) 57px 58px);
  color: var(--white);
}

.intro-copy {
  max-width: 800px;
}

.intro h2 {
  max-width: 720px;
  margin: 0 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5.7vw, 5.45rem);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.intro-copy > p:last-child {
  max-width: 760px;
  margin: 0;
  color: #dfe9f2;
  font-size: clamp(1rem, 1.5vw, 1.16rem);
}

.summary {
  display: grid;
  align-content: end;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.summary div {
  padding: 1rem;
  background: rgba(4, 26, 47, 0.82);
}

.summary div:last-child {
  grid-column: 1 / -1;
}

.summary dt {
  color: #bfd0df;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary dd {
  margin: 0.2rem 0 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 850;
  line-height: 1.1;
}

.inference-note {
  margin: 0 clamp(1rem, 4vw, 4.5rem);
  padding: 1rem 1.15rem;
  color: #3e250b;
  background: #fff2df;
  border: 1px solid #e4bd7f;
  border-top: 0;
}

.workspace {
  padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1rem, 4vw, 4.5rem) 5rem;
}

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

.workspace .section-kicker,
.method-shell .section-kicker {
  color: var(--red);
}

.workspace h2,
.method-shell h2 {
  margin: 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.08;
}

.definition {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(160px, 1fr));
  gap: 0.9rem;
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(8, 41, 75, 0.07);
}

.controls label {
  display: grid;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.035em;
}

.controls input,
.controls select,
.profile-search input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 0;
}

.controls input:focus,
.controls select:focus,
.profile-search input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #df9d39;
  outline-offset: 2px;
}

.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.2rem;
  color: var(--muted);
}

.results-meta p {
  margin: 0;
}

.clear-button {
  color: var(--navy-2);
}

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

.researcher-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 310px;
  padding: 1.1rem;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  box-shadow: 0 5px 16px rgba(8, 41, 75, 0.06);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.researcher-card:hover,
.researcher-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card-rank {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  color: #778796;
  font-size: 0.78rem;
  font-weight: 850;
}

.researcher-card h3 {
  max-width: calc(100% - 3rem);
  margin: 0.25rem 0 0.45rem;
  color: var(--navy);
  font-size: 1.35rem;
  line-height: 1.17;
}

.institution {
  min-height: 2.9em;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.4;
}

.paper-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.paper-counts div {
  padding: 0.72rem;
  background: var(--blue-soft);
  border-left: 3px solid var(--navy-2);
}

.paper-counts strong {
  display: block;
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1;
}

.paper-counts span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.25;
  text-transform: uppercase;
}

.connections,
.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.connections {
  align-content: start;
  margin-bottom: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.22rem 0.48rem;
  color: #31495f;
  background: #eef3f7;
  border: 1px solid #d4dfe8;
  font-size: 0.72rem;
  font-weight: 720;
  line-height: 1.2;
}

.badge.topic {
  color: #5b3008;
  background: #fff4e5;
  border-color: #e5c18c;
}

.open-profile {
  width: 100%;
  padding: 0.7rem 0.9rem;
  color: var(--white);
  background: var(--navy);
  border: 1px solid var(--navy);
  font-weight: 790;
  text-align: left;
}

.open-profile::after {
  content: "→";
  float: right;
}

.empty-state {
  padding: 4rem 1rem;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
}

.empty-state h3 {
  color: var(--navy);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem clamp(1rem, 4vw, 4.5rem);
  color: #cad6e1;
  background: #061f39;
  font-size: 0.86rem;
}

footer p {
  max-width: 850px;
  margin: 0;
}

footer a {
  color: var(--white);
}

dialog {
  width: min(1100px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 0;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}

dialog::backdrop {
  background: rgba(2, 14, 26, 0.76);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  position: relative;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.dialog-close {
  position: sticky;
  z-index: 4;
  top: 0;
  float: right;
  width: 2.8rem;
  height: 2.8rem;
  color: var(--white);
  background: var(--navy);
  border: 0;
  font-size: 1.75rem;
  line-height: 1;
}

.profile-heading {
  padding-right: 4rem;
}

.profile-heading h2 {
  margin: 0.2rem 0 0.5rem;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.profile-links,
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 0.75rem 0;
  color: var(--muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.4rem 0;
}

.profile-stats div {
  padding: 1rem;
  background: var(--blue-soft);
  border-top: 4px solid var(--navy-2);
}

.profile-stats strong {
  display: block;
  color: var(--navy);
  font-size: 1.8rem;
  line-height: 1;
}

.profile-stats span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.profile-warning {
  padding: 0.85rem 1rem;
  color: #4c2c0a;
  background: #fff2df;
  border-left: 4px solid var(--amber);
}

.profile-search {
  display: grid;
  gap: 0.35rem;
  margin: 1.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.article-list {
  display: grid;
  gap: 0.8rem;
}

.article-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy-2);
}

.article-card h3 {
  margin: 0 0 0.4rem;
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.35;
}

.article-meta,
.connection-line,
.abstract-excerpt {
  margin: 0.45rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.article-actions a {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 760;
  text-decoration: none;
  border: 1px solid var(--line-strong);
}

.article-actions a:first-child {
  color: var(--white);
  background: var(--navy);
  border-color: var(--navy);
}

.method-shell {
  max-width: 800px;
  margin: 0 auto;
}

.method-content h3 {
  margin-top: 1.5rem;
  color: var(--navy);
}

.method-content code {
  overflow-wrap: anywhere;
  color: #5b3008;
}

@media (max-width: 1050px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

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

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
  }

  .brand-mark {
    width: 2.75rem;
    height: 2.75rem;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .workspace-head,
  footer {
    display: grid;
  }

  .controls,
  .card-grid,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .search-field {
    grid-column: auto;
  }

  .researcher-card {
    min-height: 0;
  }

  .summary {
    align-content: stretch;
  }

  dialog {
    width: 100%;
    max-width: none;
    max-height: 100%;
    margin: 0;
  }

  .dialog-shell {
    min-height: 100vh;
  }
}

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

  .researcher-card {
    transition: none;
  }
}
