:root {
  --ink: #14110f;
  --muted: #5c5750;
  --paper: #f6efe3;
  --paper-deep: #eadfce;
  --card: rgba(255, 252, 246, 0.88);
  --line: rgba(46, 38, 31, 0.14);
  --green: #315f4f;
  --green-soft: #dbe9dc;
  --amber: #b36b2c;
  --clay: #8a4b3a;
  --blue: #234e70;
  --shadow: 0 22px 70px rgba(37, 29, 21, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(179, 107, 44, 0.18), transparent 34rem),
    radial-gradient(circle at top right, rgba(49, 95, 79, 0.18), transparent 30rem),
    linear-gradient(135deg, #f9f3e9 0%, #f4eadc 48%, #eee1cf 100%);
  font-family: "Aptos", "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 17, 15, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 17, 15, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.35rem, 5.2vw, 4.6rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h3 {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

p {
  margin: 0;
}

p + p {
  margin-top: 1rem;
}

a {
  color: var(--blue);
  text-decoration-color: rgba(35, 78, 112, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus {
  color: var(--amber);
  text-decoration-color: currentColor;
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: calc(var(--max) + 48px);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(18px);
}

.wordmark {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.site-header nav a,
.hero-links a,
.links-line a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.78rem;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.58);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.site-header nav a:hover,
.hero-links a:hover,
.links-line a:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 95, 79, 0.42);
  background: rgba(255, 252, 246, 0.92);
}

.section-shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 5rem 0;
}

.section-shell.compact {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 2.4rem;
  align-items: center;
  min-height: calc(100vh - 78px);
  padding-top: 3rem;
}

.hero-copy {
  display: grid;
  gap: 1.35rem;
}

.eyebrow {
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lead {
  color: #2b2722;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.hero-copy > p:not(.eyebrow) {
  max-width: 760px;
}

.hero-links,
.links-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.portrait-card {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-lg) + 4px);
  padding: 0.8rem;
  background: linear-gradient(180deg, rgba(255,252,246,0.72), rgba(255,252,246,0.34));
  box-shadow: var(--shadow);
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 17, 15, 0.08);
}

.quick-facts {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.quick-facts div {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem;
  background: rgba(255, 252, 246, 0.68);
}

.quick-facts span,
.meta,
.small-note,
figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

.quick-facts strong {
  display: block;
  margin-top: 0.1rem;
  line-height: 1.25;
}

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

.metric {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  background: rgba(255, 252, 246, 0.58);
}

.metric strong {
  color: var(--clay);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: -0.05em;
}

.metric span {
  color: var(--muted);
  font-size: 0.94rem;
}

.section-heading {
  display: grid;
  gap: 0.8rem;
  max-width: 820px;
  margin-bottom: 1.8rem;
}

.project-grid,
.system-grid,
.paper-list,
.split-section {
  display: grid;
  gap: 1rem;
}

.two-col,
.split-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card,
.paper-item,
.system-card,
.closing {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2vw, 1.6rem);
  background: var(--card);
  box-shadow: 0 12px 36px rgba(37, 29, 21, 0.075);
}

.project-card {
  display: grid;
  gap: 1.1rem;
  margin-bottom: 1rem;
}

.project-card.featured {
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
  align-items: center;
}

.project-card.featured.reverse {
  grid-template-columns: minmax(310px, 0.85fr) minmax(0, 1.15fr);
}

.project-card.featured.reverse .project-text {
  order: 2;
}

.project-kicker {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-text,
.paper-item,
.system-card,
.split-section > div {
  display: grid;
  gap: 0.75rem;
}

.research-note {
  border-left: 3px solid var(--green);
  border-radius: 0 18px 18px 0;
  padding: 0.85rem 1rem;
  color: #2f2a25;
  background: rgba(255, 252, 246, 0.62);
}

.research-note strong {
  color: var(--green);
}

.tight-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.1rem;
}

.tight-list li::marker {
  color: var(--green);
}

.result-panel {
  border-radius: 24px;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(49, 95, 79, 0.11), rgba(179, 107, 44, 0.11)),
    rgba(255, 252, 246, 0.7);
  border: 1px solid var(--line);
}

.result-panel h4 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 64px;
  gap: 0.6rem;
  align-items: center;
  margin: 0.72rem 0;
  font-size: 0.86rem;
}

.bar {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(20, 17, 15, 0.09);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.flow-diagram {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.4rem 0;
}

.flow-diagram span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 82px;
  border: 1px solid rgba(49, 95, 79, 0.24);
  border-radius: 18px;
  padding: 0.8rem;
  color: #173429;
  background: var(--green-soft);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
}

.flow-diagram span:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.53rem;
  width: 0.58rem;
  height: 1px;
  background: rgba(49, 95, 79, 0.45);
}

.research-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffaf0;
}

.research-figure img {
  width: 100%;
}

.wide-figure {
  background: #fffdf8;
}

.wide-figure img {
  padding: 0.65rem;
  object-fit: contain;
}

.research-figure figcaption {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--line);
}

.figure-stack {
  display: grid;
  gap: 0.8rem;
}

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

.paper-item h3,
.system-card h3 {
  font-size: 1.35rem;
}

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

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud span,
.code-links-panel a,
.code-links-panel span {
  border: 1px solid rgba(49, 95, 79, 0.22);
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  color: #173429;
  background: rgba(219, 233, 220, 0.72);
  font-size: 0.9rem;
  font-weight: 700;
}

.code-links-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: rgba(255, 252, 246, 0.68);
}

.code-links-panel span {
  color: var(--clay);
  background: rgba(179, 107, 44, 0.1);
}

.code-links-panel a {
  text-decoration: none;
}

.closing {
  max-width: var(--max);
  color: #25211d;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header nav {
    justify-content: flex-start;
  }

  .hero,
  .project-card.featured,
  .project-card.featured.reverse,
  .two-col,
  .split-section,
  .paper-list {
    grid-template-columns: 1fr;
  }

  .project-card.featured.reverse .project-text {
    order: 0;
  }

  .portrait-card {
    max-width: 440px;
  }

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

  .flow-diagram {
    grid-template-columns: 1fr;
  }

  .flow-diagram span:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 620px) {
  body {
    line-height: 1.58;
  }

  .section-shell {
    width: min(100% - 1.1rem, var(--max));
    padding: 3.2rem 0;
  }

  .hero {
    min-height: auto;
    padding-top: 1.2rem;
  }

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

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .site-footer {
    flex-direction: column;
  }
}

