/*
 * Project pages (/project/ and the pages under it).
 * Academic project-page look after https://nerfies.github.io/ (Google Sans titles,
 * Noto Sans body, centered hero, pill link buttons), with light and dark themes that
 * follow the site toggle (html[data-theme]).
 * Kept outside assets/css/ so the deploy step's PurgeCSS pass leaves it alone.
 */

:root {
  --pj-bg: rgb(255, 255, 255);
  --pj-surface: rgb(246, 247, 249);
  --pj-card: rgb(255, 255, 255);
  --pj-border: rgb(228, 230, 234);
  --pj-title: rgb(54, 54, 54);
  --pj-text: rgb(74, 74, 74);
  --pj-muted: rgb(120, 122, 128);
  --pj-link: rgb(50, 115, 220);
  --pj-btn-bg: rgb(54, 54, 54);
  --pj-btn-fg: rgb(255, 255, 255);
  --pj-btn-hover: rgb(20, 20, 20);
  --pj-code-bg: rgb(245, 245, 245);
  --pj-accent: rgb(42, 120, 214);
  --pj-accent-2: rgb(235, 104, 52);
  --pj-shadow: 0 1px 2px rgba(10, 10, 10, 0.06), 0 4px 16px rgba(10, 10, 10, 0.06);
  --pj-width: 960px;
  --pj-text-width: 800px;
  --pj-radius: 10px;
}

html[data-theme="dark"] {
  --pj-bg: rgb(29, 30, 32);
  --pj-surface: rgb(37, 38, 41);
  --pj-card: rgb(42, 43, 47);
  --pj-border: rgb(58, 59, 63);
  --pj-title: rgb(232, 232, 233);
  --pj-text: rgb(196, 196, 197);
  --pj-muted: rgb(150, 151, 153);
  --pj-link: rgb(110, 168, 254);
  --pj-btn-bg: rgb(218, 218, 219);
  --pj-btn-fg: rgb(29, 30, 32);
  --pj-btn-hover: rgb(255, 255, 255);
  --pj-code-bg: rgb(46, 46, 51);
  --pj-accent: rgb(57, 135, 229);
  --pj-accent-2: rgb(217, 89, 38);
  --pj-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

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

html {
  overflow-y: scroll;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--pj-bg);
  color: var(--pj-text);
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, "helvetica neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.pj-main {
  flex: 1 0 auto;
  width: 100%;
}

.pj-container {
  max-width: calc(var(--pj-width) + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.pj-narrow {
  max-width: calc(var(--pj-text-width) + 48px);
}

.pj-footer {
  padding: 32px 24px 40px;
  text-align: center;
  font-size: 12px;
  line-height: 22px;
  color: var(--pj-muted);
}

.pj-footer a {
  color: inherit;
  border-bottom: 1px solid currentColor;
}

.pj-footer a:hover {
  text-decoration: none;
  color: var(--pj-title);
}

/* ---------- hero ---------- */

.pj-hero {
  padding: 56px 0 16px;
  text-align: center;
}

.pj-venue {
  display: inline-block;
  margin-bottom: 18px;
  padding: 3px 12px;
  border: 1px solid var(--pj-border);
  border-radius: 999px;
  font-family: "Google Sans", sans-serif;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--pj-muted);
}

.pj-title {
  margin: 0 auto;
  max-width: 900px;
  font-family: "Google Sans", sans-serif;
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--pj-title);
}

.pj-title .pj-title-name {
  font-weight: 700;
}

.pj-authors {
  margin: 22px auto 0;
  max-width: 820px;
  font-family: "Google Sans", sans-serif;
  font-size: 1.2rem;
  line-height: 1.8;
}

.pj-authors .author {
  display: inline-block;
  margin: 0 10px;
  white-space: nowrap;
}

.pj-authors sup,
.pj-affils sup {
  font-size: 0.7em;
  color: var(--pj-muted);
}

.pj-affils {
  margin-top: 4px;
  font-family: "Google Sans", sans-serif;
  font-size: 1.05rem;
  color: var(--pj-text);
}

.pj-affils span {
  display: inline-block;
  margin: 0 10px;
}

.pj-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.pj-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--pj-btn-bg);
  color: var(--pj-btn-fg);
  font-family: "Google Sans", sans-serif;
  font-size: 15px;
  line-height: 1.2;
  transition: background-color 0.15s ease;
}

.pj-btn:hover {
  background: var(--pj-btn-hover);
  text-decoration: none;
}

.pj-btn i {
  font-size: 15px;
}

/* ---------- teaser ---------- */

.pj-teaser {
  padding: 24px 0 8px;
}

.pj-teaser video {
  display: block;
  width: 100%;
  border-radius: var(--pj-radius);
  box-shadow: var(--pj-shadow);
  background: #000;
}

.pj-teaser .pj-caption {
  text-align: center;
}

.pj-caption {
  margin: 12px auto 0;
  max-width: var(--pj-text-width);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--pj-muted);
}

.pj-caption strong {
  color: var(--pj-text);
}

/* ---------- sections ---------- */

.pj-section {
  padding: 40px 0 8px;
}

.pj-section.is-shaded {
  margin-top: 40px;
  padding: 44px 0 40px;
  background: var(--pj-surface);
}

.pj-section-title {
  margin: 0 0 22px;
  text-align: center;
  font-family: "Google Sans", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--pj-title);
}

.pj-sub {
  margin: 34px 0 12px;
  font-family: "Google Sans", sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--pj-title);
}

.pj-sub + p {
  margin-top: 0;
}

.pj-text p,
.pj-text li {
  text-align: justify;
}

.pj-text p {
  margin: 0 0 14px;
}

.pj-text ul,
.pj-text ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.pj-text li {
  margin-bottom: 6px;
}

.pj-text strong {
  color: var(--pj-title);
}

.pj-text code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--pj-code-bg);
  font-size: 0.88em;
}

/* MathJax: keep wide display equations inside the column. */
.pj-text mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

/* ---------- key numbers ---------- */

.pj-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 8px 0 0;
}

.pj-stat {
  padding: 18px 14px 16px;
  border: 1px solid var(--pj-border);
  border-radius: var(--pj-radius);
  background: var(--pj-card);
  text-align: center;
}

.pj-stat .num {
  display: block;
  font-family: "Google Sans", sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--pj-title);
}

.pj-stat .label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--pj-muted);
}

/* ---------- videos ---------- */

.pj-videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.pj-video-card h3 {
  margin: 0 0 10px;
  font-family: "Google Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--pj-title);
  text-align: center;
}

.pj-yt {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--pj-radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--pj-shadow);
  cursor: pointer;
}

.pj-yt img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

.pj-yt:hover img {
  transform: scale(1.02);
  filter: brightness(0.85);
}

.pj-yt .play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px;
  height: 48px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.pj-yt .play::after {
  content: "";
  margin-left: 4px;
  border-style: solid;
  border-width: 11px 0 11px 19px;
  border-color: transparent transparent transparent #fff;
}

.pj-yt:hover .play {
  background: rgb(255, 0, 0);
}

.pj-yt .badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-family: "Google Sans", sans-serif;
}

.pj-yt iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.pj-video-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  font-size: 14px;
}

.pj-video-links a {
  color: var(--pj-muted);
}

.pj-video-links a:hover {
  color: var(--pj-link);
  text-decoration: none;
}

.pj-video-card p {
  margin: 8px 0 0;
  font-size: 14.5px;
  color: var(--pj-muted);
  text-align: center;
}

/* ---------- figures ---------- */

.pj-figure {
  margin: 22px 0 26px;
}

.pj-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.pj-figure.is-rounded img {
  border-radius: var(--pj-radius);
  box-shadow: var(--pj-shadow);
}

/* Plots drawn on white: keep them on a white card in both themes. */
.pj-figure.is-paper img {
  padding: 10px;
  border-radius: var(--pj-radius);
  background: #fff;
}

.pj-figure figcaption {
  margin: 10px auto 0;
  max-width: var(--pj-text-width);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--pj-muted);
  text-align: center;
}

.pj-figure figcaption strong {
  color: var(--pj-text);
}

.pj-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.pj-two .pj-figure {
  margin: 0;
}

/* Images that exist in a light and a dark version. */
html[data-theme="dark"] .only-light,
html:not([data-theme="dark"]) .only-dark {
  display: none !important;
}

/* ---------- pipeline diagram ---------- */

.pj-pipeline {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin: 18px 0 8px;
}

.pj-pipeline .step {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--pj-border);
  border-radius: 8px;
  background: var(--pj-card);
  text-align: center;
  font-size: 13.5px;
  line-height: 1.4;
}

.pj-pipeline .step b {
  display: block;
  margin-bottom: 3px;
  font-family: "Google Sans", sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--pj-title);
}

.pj-pipeline .step.is-learned {
  border-color: var(--pj-accent-2);
  box-shadow: inset 0 0 0 1px var(--pj-accent-2);
}

.pj-pipeline .step.is-solver {
  border-color: var(--pj-accent);
  box-shadow: inset 0 0 0 1px var(--pj-accent);
}

.pj-pipeline .arrow {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pj-muted);
}

.pj-pipeline .arrow::after {
  content: "\2192";
  font-size: 18px;
}

/* ---------- tables ---------- */

.pj-table-wrap {
  margin: 18px 0 8px;
  overflow-x: auto;
}

.pj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.pj-table caption {
  caption-side: bottom;
  padding-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--pj-muted);
  text-align: center;
}

.pj-table th,
.pj-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--pj-border);
  text-align: center;
  white-space: nowrap;
}

.pj-table th:first-child,
.pj-table td:first-child {
  text-align: left;
}

.pj-table thead th {
  border-bottom: 2px solid var(--pj-title);
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  color: var(--pj-title);
}

.pj-table tbody tr:last-child td {
  border-bottom: 2px solid var(--pj-title);
}

.pj-table tr.is-best td {
  font-weight: 700;
  color: var(--pj-title);
}

.pj-table .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 2px;
  vertical-align: 0;
}

/* ---------- callout ---------- */

.pj-note {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--pj-accent);
  border-radius: 0 8px 8px 0;
  background: var(--pj-surface);
  font-size: 15px;
}

.pj-section.is-shaded .pj-note {
  background: var(--pj-card);
}

.pj-note p:last-child {
  margin-bottom: 0;
}

/* ---------- BibTeX ---------- */

.pj-bib {
  position: relative;
}

.pj-bib pre {
  margin: 0;
  padding: 18px 20px;
  border-radius: 8px;
  background: var(--pj-code-bg);
  color: var(--pj-text);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
}

.pj-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border: 1px solid var(--pj-border);
  border-radius: 6px;
  background: var(--pj-bg);
  color: var(--pj-muted);
  font-size: 12px;
  cursor: pointer;
}

.pj-copy:hover {
  color: var(--pj-title);
}

.pj-refs {
  padding-left: 22px;
  font-size: 15px;
}

.pj-refs li {
  margin-bottom: 6px;
  text-align: left;
}

/* ---------- /project/ index ---------- */

.pj-index-header {
  padding: 48px 0 8px;
}

.pj-index-header h1 {
  margin: 0;
  font-family: "Google Sans", sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--pj-title);
}

.pj-cards {
  display: grid;
  gap: 22px;
  margin: 28px 0 24px;
}

.pj-card {
  position: relative;
  display: grid;
  grid-template-columns: 320px 1fr;
  border: 1px solid var(--pj-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--pj-card);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.pj-card:hover {
  box-shadow: var(--pj-shadow);
  transform: translateY(-2px);
}

.pj-card-media {
  position: relative;
  background: #000;
}

.pj-card-media img,
.pj-card-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 10;
}

.pj-card-body {
  padding: 20px 24px 20px;
}

.pj-card-meta {
  font-family: "Google Sans", sans-serif;
  font-size: 13px;
  color: var(--pj-muted);
}

.pj-card-title {
  margin: 4px 0 8px;
  font-family: "Google Sans", sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--pj-title);
}

.pj-card-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.pj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.pj-tags li {
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--pj-surface);
  font-size: 12.5px;
  color: var(--pj-muted);
}

.pj-card-link {
  position: absolute;
  inset: 0;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .pj-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .pj-pipeline {
    flex-direction: column;
  }
  .pj-pipeline .arrow {
    flex-basis: 22px;
  }
  .pj-pipeline .arrow::after {
    content: "\2193";
  }
}

@media (max-width: 768px) {
  .pj-container {
    padding: 0 16px;
  }
  .pj-hero {
    padding-top: 36px;
  }
  .pj-title {
    font-size: 1.85rem;
  }
  .pj-authors {
    font-size: 1.05rem;
  }
  .pj-section-title {
    font-size: 1.6rem;
  }
  .pj-videos,
  .pj-two {
    grid-template-columns: 1fr;
  }
  .pj-card {
    grid-template-columns: 1fr;
  }
  .pj-text p,
  .pj-text li {
    text-align: left;
  }
}
