:root {
  --bg: #faf9f6;
  --bg2: #ffffff;
  --ink: #1c1c1c;
  --ink-dim: #55554f;
  --ink-faint: #86867e;
  --accent: #1e3a5f;
  --accent2: #6e2c2c;
  --line: #d8d5cc;
  --line-soft: #e8e5db;
  --card: #ffffff;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  --sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
}

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 64px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: color 0.2s;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.nav-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Sections ── */
section {
  max-width: 960px;
  margin: 0 auto;
  padding: 4.5rem 2.5rem;
}

.section-label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.6rem;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* ── Hero ── */
#hero {
  padding-top: 4.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent2);
  background: #f4efe6;
}

.hero-logo-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.logo-placeholder {
  width: 68px; height: 68px;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 0.58rem;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
  background: var(--bg2);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

.hero-tagline {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--accent);
  font-family: var(--serif);
  font-style: italic;
  max-width: 700px;
  line-height: 1.6;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

.hero-names-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  width: 100%;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  font-weight: 700;
  color: var(--ink);
}

.hero-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--accent);
}

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

.btn-primary:hover {
  background: #16283f;
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f4efe6;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--line);
}

section + hr.divider,
hr.divider + section {
  margin: 0;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1.75rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.card-icon {
  width: 40px; height: 40px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.card-num {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent2);
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
}

.card h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.7;
}

.card ul {
  margin-top: 0.75rem;
  padding-left: 1.1rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.8;
}

.card ul li { margin-bottom: 0.1rem; }

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: #f4efe6;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent2);
  margin: 0.2rem 0.15rem 0 0;
}

/* ── Research Goals ── */
.goals-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.goal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1.75rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.goal-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-color: var(--accent);
}

.goal-num {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 0.6rem;
}

.goal-card h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.goal-card p {
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.7;
}

.goal-readmore {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.goal-readmore::after {
  content: "→";
  transition: transform 0.2s;
}

.goal-card:hover .goal-readmore::after {
  transform: translateX(3px);
}

/* ── Formula box (used on research goal detail pages) ── */
.formula-box {
  margin-top: 1.25rem;
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent2);
  border-radius: 2px;
  background: var(--bg2);
}

.formula-box p {
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.formula-box p:last-child {
  margin-bottom: 0;
}

.formula-box ul {
  margin: 0 0 0.9rem 1.1rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.8;
}

.math-block {
  margin: 1rem 0;
  padding: 1.75rem 1.5rem;
  background: #14161c;
  border-radius: 5px;
  overflow-x: auto;
  text-align: center;
}

.math-block:first-child {
  margin-top: 0;
}

.math-block:last-child {
  margin-bottom: 0;
}

.math-block .katex {
  color: #f4f2ec;
  font-size: 1.15em;
}

.math-block .katex-display {
  margin: 0;
}

.math-inline .katex {
  font-size: 1.05em;
}

/* ── Failure criteria highlight ── */
.criteria-intro {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.criteria-card {
  padding: 2rem 1.75rem;
  border: 2px solid var(--accent2);
  border-radius: 4px;
  background: #f4efe6;
  text-align: center;
}

.criteria-label {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 1.1rem;
}

.criteria-value {
  margin-bottom: 0.9rem;
}

.criteria-value .katex {
  font-size: 1.9em;
  font-weight: 700;
  color: var(--accent);
}

.criteria-sub {
  color: var(--ink-dim);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ── Variable definition table ── */
.var-table-wrap {
  margin: 1.25rem 0 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.var-table {
  width: 100%;
  min-width: 600px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.var-table col:nth-child(1) { width: 18%; }
.var-table col:nth-child(2) { width: 54%; }
.var-table col:nth-child(3) { width: 28%; }

.var-table th,
.var-table td {
  text-align: left;
  vertical-align: middle;
  padding: 1.05rem 1.5rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: break-word;
}

.var-table th {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent2);
  background: #f4efe6;
  border-bottom: 2px solid var(--ink);
}

.var-table td:first-child {
  white-space: nowrap;
}

.var-table td:last-child {
  color: var(--ink-dim);
}

.var-table tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 640px) {
  .var-table { font-size: 0.84rem; }
  .var-table th, .var-table td { padding: 0.75rem 1rem; }
}

/* ── Detail (research goal) pages ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 2rem;
}

.back-link::before {
  content: "←";
  transition: transform 0.2s;
}

.back-link:hover::before {
  transform: translateX(-3px);
}

.detail-section {
  padding-top: 3.5rem;
}

.detail-section > p {
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

.detail-section h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2rem 0 1rem;
}

.status-note {
  margin-top: 1.5rem;
  padding: 1.1rem 1.35rem;
  border: 1px dashed var(--line);
  border-radius: 2px;
  background: var(--bg2);
  color: var(--ink-faint);
  font-size: 0.88rem;
  font-style: italic;
}

/* ── Results ── */
#results {
  background: #f4f2ec;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-end;
  margin-bottom: 2.5rem;
}

.results-header > div:first-child { flex: 1; min-width: 260px; }

.stat-block {
  text-align: right;
}

.stat-block .big-stat {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-block .stat-label {
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 0.3rem;
}

.simulators {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.sim-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.sim-info { min-width: 0; }

.sim-name {
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-track {
  height: 6px;
  background: #e2ded2;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 1s ease;
  width: 0;
}

.progress-fill.active { width: var(--target-width); }

.sim-pct {
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  min-width: 48px;
  text-align: right;
}

.sim-coming {
  opacity: 0.55;
}

.sim-coming .sim-name { font-style: italic; }

.baseline-note {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent2);
  border-radius: 2px;
  background: var(--bg2);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.baseline-note p {
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.baseline-note strong { color: var(--accent2); }

/* ── Tech stack ── */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tech-badge {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
  font-size: 0.9rem;
  color: var(--ink);
}

.tech-badge .tech-icon {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  width: 28px; height: 28px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tech-badge .tech-name {
  font-weight: 600;
  color: var(--ink);
}

.tech-badge .tech-sub {
  font-size: 0.76rem;
  color: var(--ink-faint);
  display: block;
  margin-top: 0.05rem;
}

/* ── Authors ── */
#authors {
  background: #f4f2ec;
}

.authors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.author-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1.75rem;
  text-align: center;
  transition: box-shadow 0.2s;
}

.author-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.author-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  margin: 0 auto 1.1rem;
  display: block;
  background: var(--bg2);
}

.author-name {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.9rem;
}

.author-bio {
  text-align: left;
  color: var(--ink-dim);
  font-size: 0.86rem;
  line-height: 1.65;
}

/* ── Research ── */
.citations {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.citation {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  transition: box-shadow 0.2s;
  text-decoration: none;
  display: block;
  color: inherit;
}

.citation:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }

.citation-meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent2);
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.citation-meta::after {
  content: "↗";
  font-weight: 700;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

.citation:hover .citation-meta::after {
  opacity: 1;
  transform: translate(2px, -2px);
}

.citation-title {
  font-family: var(--serif);
  font-size: 0.98rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.citation-authors {
  font-size: 0.84rem;
  color: var(--ink-dim);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.82rem;
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 640px) {
  nav { padding: 0 1.25rem; }
  .nav-links { gap: 1.2rem; }
  .nav-links a { font-size: 0.78rem; }
  section { padding: 3rem 1.25rem; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .stat-block { text-align: left; }
  .sim-row { grid-template-columns: 1fr auto; gap: 0.75rem; }
}
