:root {
  --bg: #f7f7f2;
  --panel: #ffffff;
  --ink: #161616;
  --muted: #666a70;
  --line: #e6e2d8;
  --accent: #1f9d7a;
  --accent-soft: #e6f5ef;
  --shadow: 0 24px 60px rgba(24, 31, 27, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 157, 122, 0.12), transparent 34rem),
    linear-gradient(180deg, #fbfaf6 0%, var(--bg) 42%, #f4f2ea 100%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(20px, 5vw, 72px);
  background: rgba(247, 247, 242, 0.82);
  border-bottom: 1px solid rgba(230, 226, 216, 0.8);
  backdrop-filter: blur(16px);
}

.brand, .nav-links, .hero-actions, .quick-row, .results-toolbar { display: flex; align-items: center; }
.brand { gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 50%;
  font-size: 13px;
}
.nav-links { gap: 18px; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }

.section-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 72px 0;
}
.compact { padding-top: 40px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 40px;
  align-items: center;
  min-height: 78vh;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 780px;
  margin-bottom: 16px;
  font-size: clamp(46px, 8vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.075em;
}
h2 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.045em; line-height: 1; }
h3 { margin-bottom: 8px; font-size: 17px; letter-spacing: -0.02em; }
.subtitle { font-size: clamp(21px, 3vw, 32px); letter-spacing: -0.04em; color: #2d3430; }
.hero-text, .muted { color: var(--muted); line-height: 1.7; }
.hero-text { max-width: 710px; font-size: 17px; }
.hero-actions { flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  font-weight: 700;
  font-size: 14px;
}
.button.primary { color: white; background: var(--ink); border-color: var(--ink); }
.button:hover { transform: translateY(-1px); }

.hero-card, .search-panel, .filters, .results-panel, .level-grid article, .figure-grid figure {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.hero-card { overflow: hidden; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
}
.metric-grid div { padding: 18px; background: white; }
.metric-grid strong { display: block; font-size: 30px; letter-spacing: -0.05em; }
.metric-grid span { color: var(--muted); font-size: 12px; }
.hero-card img { width: 100%; aspect-ratio: 1.55 / 1; object-fit: cover; border-top: 1px solid var(--line); }

.section-heading { margin-bottom: 24px; }
.section-heading.split {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}
.section-heading.split .muted { max-width: 430px; margin-bottom: 0; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.level-grid article { padding: 20px; box-shadow: none; }
.level-grid span {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}
.level-grid p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.figure-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.figure-grid figure { overflow: hidden; margin: 0; box-shadow: none; }
.figure-grid img { width: 100%; height: 230px; object-fit: cover; background: white; }
.figure-grid figcaption { padding: 14px 16px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

.search-panel { padding: 18px; margin-bottom: 18px; }
.search-box span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.search-box input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 16px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,157,122,0.12); }
.quick-row { flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip, .filter-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 8px 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover, .filter-button:hover, .chip.active, .filter-button.active {
  color: var(--ink);
  border-color: rgba(31,157,122,0.45);
  background: var(--accent-soft);
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.insight-card {
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.insight-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}
.year-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 7px;
  align-items: end;
  height: 150px;
}
.year-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.year-bar span {
  width: 100%;
  min-height: 10px;
  border-radius: 10px 10px 3px 3px;
  background: #d8d2c4;
  transition: background 0.15s ease, transform 0.15s ease;
}
.year-bar:hover span, .year-bar.active span {
  background: var(--accent);
  transform: translateY(-2px);
}
.year-bar em {
  writing-mode: vertical-rl;
  font-style: normal;
}
.task-cloud, .active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.active-filters { margin: 0 0 18px; }

.filter-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.filters, .results-panel { padding: 18px; }
.filters { position: sticky; top: 86px; }
.filters h3 { margin: 12px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.filter-stack, .chip-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-stack { flex-direction: column; align-items: stretch; }
.filter-button { display: flex; justify-content: space-between; width: 100%; }
.text-button {
  margin-top: 18px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.results-toolbar { justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.results-toolbar p { margin: 0; color: var(--muted); }
.results-toolbar select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}
.paper-grid { display: grid; gap: 12px; }
.paper-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.paper-card:hover { border-color: rgba(31,157,122,0.55); transform: translateY(-1px); }
.paper-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.paper-meta span { padding: 4px 8px; border-radius: 999px; background: #f4f2ea; }
.paper-title { margin-bottom: 8px; font-size: 18px; line-height: 1.35; letter-spacing: -0.02em; }
.paper-title a { border-bottom: 1px solid transparent; }
.paper-title a:hover { border-color: var(--ink); }
.paper-note { margin-bottom: 12px; color: var(--muted); line-height: 1.6; }
.paper-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.paper-tags span { color: #236d59; background: var(--accent-soft); border-radius: 999px; padding: 4px 8px; font-size: 12px; }
.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}
.paper-actions .text-button { margin-top: 0; padding: 0; }
.load-more {
  width: 100%;
  margin-top: 16px;
  background: white;
}
.empty-state { padding: 36px; text-align: center; color: var(--muted); }

.stress-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.control-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.chip span { color: var(--muted); }
.stress-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.stress-toolbar p { margin: 0; color: var(--muted); }
.stress-case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stress-case-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.stress-cover {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #f4f2ea;
  cursor: pointer;
}
.stress-cover img {
  width: 100%;
  height: 230px;
  object-fit: cover;
}
.stress-case-body { padding: 18px; }
.stress-case-body p { color: var(--muted); line-height: 1.55; }
.mini-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.mini-gallery img {
  width: 100%;
  aspect-ratio: 1 / 0.75;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.stress-open { padding-left: 0; }

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 13, 0.56);
  backdrop-filter: blur(10px);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  padding: 24px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
}
.modal-close {
  position: sticky;
  top: 0;
  float: right;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.modal-summary, .modal-finding {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.65;
}
.modal-finding strong { color: var(--ink); }
.modal-tags { margin: 18px 0; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.modal-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.modal-gallery figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
}
.modal-gallery img {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #f5f3ec;
}
.modal-gallery figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.modal-open { overflow: hidden; }
.citation-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.citation-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.citation-toolbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.citation-toolbar .text-button { margin-top: 0; }
.citation-card pre {
  margin: 0;
  padding: 20px;
  overflow: auto;
  background: #111513;
  color: #edf7f2;
  font-size: 13px;
  line-height: 1.6;
}
.citation-card code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre;
}
.site-footer {
  padding: 36px 20px 54px;
  color: var(--muted);
  text-align: center;
}
.site-footer a { color: var(--ink); font-weight: 800; }

@media (max-width: 980px) {
  .hero, .filter-layout { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .figure-grid, .insight-grid { grid-template-columns: 1fr; }
  .stress-controls, .stress-case-grid { grid-template-columns: 1fr; }
  .filters { position: static; }
  .section-heading.split { display: block; }
  .modal-gallery { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .nav-links { flex-wrap: wrap; gap: 12px; }
  .section-shell { width: min(100% - 24px, 1180px); padding: 48px 0; }
  h1 { font-size: 48px; }
  .metric-grid, .level-grid { grid-template-columns: 1fr; }
  .results-toolbar, .stress-toolbar { align-items: stretch; flex-direction: column; }
  .modal { padding: 12px; }
  .modal-card { padding: 16px; border-radius: 22px; }
}
