/* Standalone academic project portal for TwinEnv-Bench (TraceLite AI). */
:root {
  --ink: #1e293b;
  --sub: #334155;
  --muted: #64748b;
  --blue: #364fc7;
  --peri: #5c7cfa;
  --rose: #e03e5c;
  --rose-soft: #fff0f3;
  --indigo-soft: #eef2ff;
  --teal: #0e879c;
  --line: #e2e8f0;
  --tint: #f8fafc;
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: #fff; font-size: 16px; line-height: 1.72; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 18px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; color: var(--ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.container { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.reading-width { width: min(840px, calc(100% - 56px)); margin-inline: auto; }
.center { text-align: center; }

.skip-link { position: fixed; top: -70px; left: 12px; z-index: 200; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.skip-link:focus { top: 10px; }

/* Top Navigation */
.project-nav {
  height: 72px;
  max-width: 1320px;
  margin: auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.brand span { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: -2px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 13.5px; font-weight: 500; }
.nav-links > a { color: var(--muted); transition: color 0.15s; }
.nav-links > a:hover, .nav-links > a[aria-current="page"] { color: var(--blue); text-decoration: none; font-weight: 600; }
#langToggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  min-width: 40px;
  min-height: 35px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
#langToggle:hover { border-color: var(--blue); background: var(--indigo-soft); color: var(--blue); }

/* Publication Hero */
.publication-header { text-align: center; padding: 52px 0 26px; }
.publication-label { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; color: var(--muted); margin-bottom: 20px; text-transform: uppercase; }
.publication-label > span.sep { color: #cbd5e1; margin: 0 9px; }
.hero-banner-wrap { max-width: 720px; margin: 0 auto 20px; }
.hero-banner-wrap img { margin: 0 auto; width: 100%; }
.title-subtitle {
  font-size: 23px;
  font-weight: 600;
  line-height: 1.38;
  max-width: 900px;
  margin: 0 auto 18px;
  color: var(--sub);
  letter-spacing: -0.4px;
}
.publication-team-row { font-size: 15px; color: var(--muted); margin-bottom: 24px; }
.publication-team-row a { font-weight: 600; color: var(--blue); }

.publication-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 42px;
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.dark { background: #1e293b; color: #fff; }
.button.primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(54, 79, 199, 0.22); }
.button.light { background: #f1f5f9; color: var(--ink); border: 1px solid #e2e8f0; }
.button:hover { background: var(--blue); color: #fff; text-decoration: none; transform: translateY(-1.5px); }

.hero-takeaway {
  display: inline-block;
  background: var(--rose-soft);
  border: 1px solid #fecdd3;
  color: #9f1239;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  margin: 4px auto 0;
}

/* Teaser & Stats */
.teaser { padding-bottom: 36px; }
.paper-figure {
  margin: 24px 0 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 18px 18px 14px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04);
}
.figure-link { position: relative; display: block; border-radius: 8px; overflow: hidden; }
.zoom-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.78);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.18s;
}
.figure-link:hover .zoom-hint { opacity: 1; }
.paper-figure figcaption {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  line-height: 1.62;
  color: var(--muted);
}

.study-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0 0;
}
.study-stats > div {
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
}
.study-stats dt { font-size: 28px; font-weight: 800; color: var(--blue); letter-spacing: -0.8px; line-height: 1.15; }
.study-stats dd { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* Sticky Section Nav */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-block: 1px solid var(--line);
}
.section-nav > div {
  max-width: 1120px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.section-nav a {
  padding: 14px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.section-nav a:hover, .section-nav a[aria-current="location"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
  text-decoration: none;
}

/* Content Sections */
.section { padding: 60px 0; }
.section.tint { background: var(--tint); border-block: 1px solid var(--line); }
.section h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; margin-bottom: 12px; }
.section-intro { font-size: 16.5px; color: var(--muted); margin-bottom: 28px; }
.fine-print { font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.text-link { font-weight: 600; font-size: 14px; color: var(--blue); }

/* Method & Pillar Cards */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.method-grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 20px;
}
.section:not(.tint) .method-grid article { background: var(--tint); }
.step-number {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--indigo-soft);
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.method-grid h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.method-grid p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.62; }

/* E1-E5 Taxonomy Cards */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.dimension-grid article {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.dimension-letter {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--blue);
}
.dimension-letter.e1 { background: #364fc7; }
.dimension-letter.e2 { background: #5f3dc4; }
.dimension-letter.e3 { background: #0e879c; }
.dimension-letter.e4 { background: #d97706; }
.dimension-letter.e5 { background: #e03e5c; }
.dimension-grid h3 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.dimension-grid p { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.48; }
.task-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sub);
  background: var(--tint);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Finding Callouts */
.finding-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0 26px;
}
.finding-grid article {
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 20px;
}
.finding-grid strong {
  display: block;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--rose);
  margin-bottom: 6px;
}
.finding-grid article:nth-child(2) strong { color: var(--blue); }
.finding-grid article:nth-child(3) strong { color: #0e879c; }
.finding-grid p { margin: 0; font-size: 13.5px; color: var(--sub); line-height: 1.55; }

/* Summary Table */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin: 24px 0 12px; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-scroll caption { text-align: left; padding: 14px 18px; font-weight: 700; font-size: 13px; background: var(--tint); border-bottom: 1px solid var(--line); color: var(--sub); }
.table-scroll th, .table-scroll td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll th:first-child, .table-scroll td:first-child { text-align: left; font-weight: 600; }
.table-scroll thead th { background: #f8fafc; color: var(--muted); font-size: 11.5px; font-weight: 600; border-bottom: 1px solid var(--line); }
.table-scroll tbody tr:last-child > * { border-bottom: 0; }
.model-inline { display: inline-flex; align-items: center; gap: 8px; }
.model-inline img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.pill-drop { color: var(--rose); font-weight: 700; }
.pill-rank1 { color: var(--blue); font-weight: 700; }

/* Case Studies Tabs & Paired Terminal Traces */
.case-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.case-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}
.case-tabs a[aria-selected="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.case-tabs a:hover { text-decoration: none; border-color: var(--blue); }
.tab-number { font-size: 11px; opacity: 0.78; font-weight: 700; }
.case-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
}
.case-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge.layer { background: var(--indigo-soft); color: var(--blue); }
.badge.latent { background: var(--rose-soft); color: var(--rose); }
.badge.exposed { background: #e0f2fe; color: #0369a1; }
.case-panel h3 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.case-description { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.env-diff-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.env-cell {
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.env-cell.target { background: #fff8f9; border-color: #fecdd3; }
.env-cell strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; color: var(--muted); }
.env-cell.target strong { color: var(--rose); }
.trace-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trace-card {
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12.5px;
}
.trace-card.fail { border-color: #fda4af; }
.trace-card.pass { border-color: #93c5fd; }
.trace-head {
  padding: 9px 14px;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trace-card.fail .trace-head { background: #4c0519; color: #fecdd3; }
.trace-card.pass .trace-head { background: #1e3a8a; color: #dbeafe; }
.trace-card pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.58;
  white-space: pre-wrap;
}
.cmd-probe { color: #7dd3fc; font-weight: 600; }
.cmd-err { color: #fda4af; }
.cmd-ok { color: #86efac; }

/* BibTeX */
.citation-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.copy-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
}
.copy-button:hover { background: var(--indigo-soft); border-color: var(--blue); }
pre.citation {
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}
#copyStatus { font-size: 13px; color: var(--blue); font-weight: 600; margin-top: 10px; min-height: 20px; }

/* Footer & Dialog */
.project-footer {
  border-top: 1px solid var(--line);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.footer-brand { font-size: 17px; font-weight: 800; color: var(--ink); display: inline-block; margin-bottom: 6px; }
.attribution { font-size: 12.5px; margin-top: 8px; }

dialog#figureDialog {
  max-width: min(94vw, 1560px);
  max-height: 92vh;
  border: 0;
  border-radius: 14px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
}
dialog#figureDialog::backdrop { background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(3px); }
.dialog-close {
  display: block;
  margin-left: auto;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--tint);
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
}
#figureDetail { max-height: 76vh; width: auto; margin: 0 auto; }
#figureCaption { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: center; }

@media (max-width: 860px) {
  .study-stats { grid-template-columns: repeat(2, 1fr); }
  .finding-grid, .env-diff-box, .trace-split { grid-template-columns: 1fr; }
  .title-subtitle { font-size: 18.5px; }
  .project-nav { padding: 0 20px; }
}
