/* =================================================================
   Academic project page — plain, centered, minimal.
   Inspired by the Nerfies / Academic Project Page template that
   sim2reason.github.io and builderbench.github.io both use.
   ================================================================= */

:root {
  --text: #363636;
  --text-soft: #4a4a4a;
  --text-muted: #7a7a7a;
  --bg: #ffffff;
  --bg-code: #f5f5f5;
  --rule: #e5e5e5;
  --link: #3273dc;
  --link-hover: #1d4f9e;

  --sans: "Noto Sans", "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

strong { font-weight: 700; color: var(--text); }
em { font-style: italic; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow {
  max-width: 760px;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* =================================================================
   HERO  (title, authors, links)
   ================================================================= */

.hero {
  padding: 64px 0 32px;
  text-align: center;
}

.title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.subtitle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.45;
  color: var(--text-soft);
  margin: 0 auto 32px;
  max-width: 720px;
}

.authors {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 6px;
}
.author {
  display: inline-block;
  margin: 0 8px;
  white-space: nowrap;
}
.author a {
  color: var(--text);
  font-weight: 500;
}
.author a:hover {
  color: var(--link);
  text-decoration: none;
}
.author sup {
  font-size: 0.75em;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 1px;
}

.affiliations {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.affiliations span {
  display: inline-block;
  margin: 0 10px;
}
.affiliations sup {
  font-size: 0.85em;
  margin-right: 2px;
}

.venue {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-style: italic;
}

/* Buttons */
.links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: #363636;
  color: #fff;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.link-button:hover {
  background: #1a1a1a;
  color: #fff;
  text-decoration: none;
}
.link-button .icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}

/* =================================================================
   TEASER
   ================================================================= */

.teaser {
  padding: 24px 0 48px;
}
.teaser figure {
  margin: 0;
}
.teaser img {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  border-radius: 4px;
}
.placeholder-figure {
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-code);
  border: 1px dashed var(--rule);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
  font-family: var(--sans);
}
.placeholder-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.teaser figcaption {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-soft);
  margin-top: 14px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.teaser figcaption strong { color: var(--text); }

/* =================================================================
   SECTIONS  (Abstract / Method / Results / BibTeX)
   ================================================================= */

.section {
  padding: 32px 0;
}

.section-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 22px;
  text-align: center;
  margin: 0 0 20px;
  color: var(--text);
}

.section p {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 16px;
  color: var(--text);
  text-align: justify;
  hyphens: auto;
}

/* BibTeX block */
.section pre {
  background: var(--bg-code);
  border-radius: 4px;
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  color: var(--text);
  text-align: left;
}
.section code {
  font-family: var(--mono);
  background: none;
  padding: 0;
}

/* =================================================================
   FOOTER
   ================================================================= */

.footer {
  padding: 32px 0 48px;
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.footer p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 640px) {
  .hero { padding: 40px 0 24px; }
  .author { display: inline-block; margin: 0 6px; }
  .section p { text-align: left; }
  .link-button { padding: 7px 14px; font-size: 13px; }
}

/* =================================================================
   STICKY NAV
   ================================================================= */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--link); text-decoration: none; }
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.nav-links a {
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 500;
}
.nav-links a:hover { color: var(--link); text-decoration: none; }

/* offset anchor jumps so the sticky nav doesn't cover headings */
:target { scroll-margin-top: 64px; }

@media (max-width: 720px) {
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 12px; }
  .nav-brand { font-size: 16px; }
}
@media (max-width: 520px) {
  .nav-inner { height: auto; flex-direction: column; gap: 6px; padding-top: 8px; padding-bottom: 8px; }
}

/* =================================================================
   SECTION VARIANTS / SHARED HELPERS
   ================================================================= */

.section--alt { background: #fafafa; }
.section--tight { padding: 8px 0 24px; }

.lead {
  font-size: 17px;
  color: var(--text-soft);
  text-align: center !important;
  margin: 0 auto 28px !important;
  line-height: 1.6;
  hyphens: none !important;
}

.subhead {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  margin: 32px 0 12px;
  text-align: center;
}

.note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 14px auto 0;
  padding: 10px 14px;
  background: #fff8e6;
  border: 1px dashed #e6cf8a;
  border-radius: 4px;
}
.section--alt .note { background: #fffdf5; }
.note code { background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 3px; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* =================================================================
   HEADLINE STAT ROW
   ================================================================= */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat {
  text-align: center;
  padding: 18px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
}
.stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--link);
  letter-spacing: -0.01em;
}
.stat-label {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 6px;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* =================================================================
   LEVEL GALLERY
   ================================================================= */

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.level-card {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.level-card--hard { border-color: #e0b4b4; }
.level-media {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-code);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}
.level-card img, .level-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.level-card figcaption {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.level-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.level-desc { font-size: 12.5px; color: var(--text-soft); line-height: 1.4; }
.level-base { font-size: 12px; color: var(--text-muted); }
.tier-tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-code);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  vertical-align: middle;
}
.tier-tag--hard { color: #a33; background: #fbeaea; }

@media (max-width: 900px) { .level-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .level-grid { grid-template-columns: 1fr; } }

/* =================================================================
   API CODE BLOCK
   ================================================================= */

.api-block {
  margin: 16px auto 0;
}
.api-block pre {
  background: #1e1e1e;
  color: #e4e4e4;
  border-radius: 6px;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
}
.api-fn { color: #79c0ff; font-weight: 700; }
.api-cm { color: #8b949e; }

/* =================================================================
   INLINE FIGURES / CHARTS
   ================================================================= */

.inline-fig { margin: 20px auto; max-width: 760px; }
.inline-fig img { display: block; width: 100%; border-radius: 6px; }
.inline-fig figcaption,
.chart-fig figcaption {
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.5;
  margin-top: 10px;
  text-align: left;
}

.placeholder-figure--short { aspect-ratio: 16 / 5; }
.placeholder-figure--chart { aspect-ratio: 16 / 9; }

.chart-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}
.chart-fig { margin: 0; }
.chart-fig img { display: block; width: 100%; border-radius: 6px; }
@media (max-width: 720px) { .chart-2col { grid-template-columns: 1fr; } }

/* =================================================================
   TRACE COMPARISON (episode walkthrough)
   ================================================================= */

.trace-compare { display: flex; flex-direction: column; gap: 16px; }
.trace-row { margin: 0; }
.trace-label { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.trace-media {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-code);
  border: 1px dashed var(--rule);
}
.trace-row img, .trace-row video { display: block; width: 100%; max-width: 440px; margin: 0 auto; border-radius: 6px; }
.trace-row--fail .trace-media { border-color: #e0b4b4; }
.trace-row--win .trace-media { border-color: #a7d3a7; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 8px;
  border-radius: 999px;
}
.badge--fail { color: #a33; background: #fbeaea; }
.badge--win { color: #2c7a2c; background: #e9f6e9; }

/* =================================================================
   CLAIM CARDS
   ================================================================= */

.claim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.claim-card {
  display: block;
  padding: 18px 18px 16px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.claim-card:hover { border-color: var(--link); text-decoration: none; transform: translateY(-2px); }
.claim-h { font-weight: 700; font-size: 15px; line-height: 1.35; margin-bottom: 8px; color: var(--text); }
.claim-card p { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; margin: 0 0 12px; text-align: left; }
.claim-stat {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--link);
}
@media (max-width: 860px) { .claim-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .claim-grid { grid-template-columns: 1fr; } }

/* =================================================================
   CROSS-LEVEL TRANSFER CARDS
   ================================================================= */

.transfer-setup {
  display: flex;
  gap: 20px;
  margin-top: 28px;
}
.transfer-card {
  flex: 1;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 20px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.transfer-card-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.transfer-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.transfer-source {
  font-size: 13.5px;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: #f7f7f7;
  border-radius: 5px;
}
.src-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
}
.transfer-arrow {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}
.transfer-target {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(50,115,220,0.05);
  border: 1px solid rgba(50,115,220,0.15);
  border-radius: 7px;
}
.transfer-target strong { font-size: 14px; }
.transfer-bank {
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--text-muted);
}
.transfer-result {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.transfer-delta {
  font-size: 13px;
  font-weight: 700;
  color: #2c7a2c;
  margin-left: 6px;
}
.transfer-targets-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.table-note {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  margin: 8px 0 0;
  font-style: italic;
}
@media (max-width: 700px) {
  .transfer-setup { flex-direction: column; }
}

/* =================================================================
   RESULTS TABLES
   ================================================================= */

.table-wrap { overflow-x: auto; margin: 0 auto; }
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 4px 0;
}
.results-table th {
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--rule);
  padding: 8px 12px;
}
.results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
}
.results-table tbody tr:hover { background: rgba(50,115,220,0.04); }
.results-table .row-highlight { background: rgba(50,115,220,0.07); }
.results-table .row-highlight:hover { background: rgba(50,115,220,0.10); }

/* =================================================================
   SKILL BANK — TABBED VIEWER (CSS-only tabs)
   ================================================================= */

.skill-tabs { margin-top: 28px; }
.tab-radio { display: none; }

.tab-label-row {
  display: inline-flex;
  gap: 4px;
  background: #eef0f2;
  border-radius: 10px;
  padding: 5px;
  margin-bottom: 30px;
}
.tab-label {
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 7px;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.tab-label:hover { color: var(--text); }

#tab-cat:checked ~ .tab-label-row label[for="tab-cat"],
#tab-dte:checked ~ .tab-label-row label[for="tab-dte"],
#tab-ptp:checked ~ .tab-label-row label[for="tab-ptp"] {
  color: var(--link);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}

.tab-panel { display: none; }
#tab-cat:checked ~ .tab-panel--cat,
#tab-dte:checked ~ .tab-panel--dte,
#tab-ptp:checked ~ .tab-panel--ptp { display: block; }

/* Section headers within a panel */
.bank-section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.bank-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--link);
}
.bank-section-title--mistake { color: #b04545; }
.bank-section-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Skill cards grid */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.skill-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.skill-card:hover {
  border-color: #c9d4e8;
  box-shadow: 0 3px 14px rgba(0,0,0,0.05);
}
.skill-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.skill-card-title {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text);
  flex: 1;
}
.skill-conf-label {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--link);
  white-space: nowrap;
  line-height: 1.4;
}
/* Full-width confidence meter, sits tight under the header */
.conf-bar {
  height: 4px;
  background: #eef0f2;
  border-radius: 999px;
  overflow: hidden;
  margin-top: -3px;
}
.conf-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6c9bf0, var(--link));
}
.skill-principle {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0;
}
.skill-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.skill-field {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}
.skill-field strong {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.skill-field code {
  font-size: 11px;
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 3px;
}
.skill-seeds {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* Mistake cards grid — auto-fit fills the row for 2 or 3 cards */
.mistake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}
.mistake-card {
  background: #fdf7f6;
  border: 1px solid #efdcd9;
  border-radius: 10px;
  padding: 16px 17px 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.mistake-desc {
  font-weight: 600;
  font-size: 13px;
  color: #8a2c2c;
  line-height: 1.45;
  margin: 0;
  padding-left: 24px;
  position: relative;
}
.mistake-desc::before {
  content: "\26A0";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 14px;
  color: #c06b6b;
}
.mistake-field {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}
.mistake-label {
  font-weight: 700;
  color: #b07878;
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

@media (max-width: 820px) {
  .skill-grid { grid-template-columns: 1fr; }
  .mistake-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .tab-label-row { display: flex; }
  .tab-label { padding: 8px 12px; font-size: 12.5px; flex: 1; text-align: center; }
}
