/* ==========================================================================
   Nerfies-Style Academic Project Page — Quarto Theme
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --color-text: #333;
  --color-text-muted: #555;
  --color-heading: #363636;
  --color-link: #4a6cf7;
  --color-link-hover: #3451c7;
  --color-bg: #ffffff;
  --color-section-alt: #f5f5f5;
  --color-border: #dbdbdb;
  --color-btn-bg: #4a6cf7;
  --color-btn-text: #ffffff;
  --progress-current: #15803d;
  --progress-current-dark: #166534;
  --progress-current-muted: rgba(21, 128, 61, 0.12);
  --font-body: 'Noto Sans', 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1120px;
}

/* ---------- Global Resets ---------- */
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Hide Quarto default navbar title — keep it clean */
.navbar-brand {
  display: none !important;
}

/* Override Quarto full-width to keep content centred */
#quarto-content {
  padding-top: 0;
}
.page-layout-full .content {
  max-width: 100%;
  padding: 0;
}

/* ---------- Hero / Title Section ---------- */
.hero-section {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-section .title {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 0.3rem;
  line-height: 1.25;
  border-bottom: none;
}

.hero-section .subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin-bottom: 1.2rem;
  font-weight: 400;
}

/* Author & Affiliation Lists */
.author-list {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  line-height: 2;
}
.author-list a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 600;
}
.author-list a:hover {
  text-decoration: underline;
}
.author-list sup {
  font-size: 0.7em;
}

.affiliation-list {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.affiliation-list sup {
  font-size: 0.7em;
}

/* ---------- Buttons ---------- */
.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.button-row .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  background-color: var(--color-btn-bg);
  color: var(--color-btn-text) !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease, transform 0.15s ease;
  border: none;
}
.button-row .btn:hover {
  background-color: var(--color-link-hover);
  transform: translateY(-1px);
}

/* ---------- Section Container ---------- */
.section-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ---------- Project progress timeline ---------- */
.progress-section {
  background: var(--color-section-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.progress-intro {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 1.35rem;
  font-size: 0.98rem;
  color: var(--color-text-muted);
}

.progress-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto 1.25rem;
  padding: 0.15rem 0 0.15rem 1.85rem;
  border-left: 3px solid rgba(74, 108, 247, 0.28);
}

.progress-milestone {
  position: relative;
  background:
    linear-gradient(180deg, rgba(74, 108, 247, 0.08), rgba(74, 108, 247, 0.02)),
    #ffffff;
  border: 1px solid rgba(74, 108, 247, 0.14);
  border-radius: 16px;
  padding: 1.15rem 1.2rem 3.15rem;
  box-shadow: 0 10px 24px rgba(44, 72, 160, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.progress-milestone::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-btn-bg);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px rgba(74, 108, 247, 0.35);
  top: 1.15rem;
  left: calc(-1.85rem - 9px);
}

.progress-milestone:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(44, 72, 160, 0.11);
  border-color: rgba(74, 108, 247, 0.26);
}

/* Completed weeks — muted to read as “past” */
.progress-milestone-past {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.015)), #f0f1f4;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.progress-milestone-past:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.14);
}

.progress-milestone-past h4 {
  color: #6a6f7a;
}

.progress-milestone-past ul {
  color: #6f7580;
}

.progress-milestone-past::before {
  background: #b4bac8;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.progress-milestone-past .progress-more-btn {
  background-color: #8b93a6;
}

.progress-milestone-past .progress-more-btn:hover {
  background-color: #767d90;
}

/* Current week — green emphasis */
.progress-milestone-current {
  background:
    linear-gradient(180deg, var(--progress-current-muted), rgba(21, 128, 61, 0.03)),
    #ffffff;
  border-color: rgba(21, 128, 61, 0.38);
  box-shadow: 0 12px 28px rgba(21, 128, 61, 0.12);
}

.progress-milestone-current:hover {
  border-color: rgba(21, 128, 61, 0.48);
  box-shadow: 0 14px 32px rgba(21, 128, 61, 0.16);
}

.progress-milestone-current::before {
  width: 14px;
  height: 14px;
  top: 1.1rem;
  left: calc(-1.85rem - 10px);
  background: var(--progress-current);
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.22);
}

.progress-milestone h4 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-heading);
  text-align: left;
}

.progress-milestone-current h4 {
  color: #0f4d2a;
}

.progress-milestone ul {
  margin: 0;
  padding-left: 1.15rem;
  padding-right: 7.5rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-text);
  text-align: left;
}

.progress-milestone li {
  margin-bottom: 0.4rem;
}

.progress-milestone li:last-child {
  margin-bottom: 0;
}

/* More Info — bottom-right of each milestone card (matches hero .btn) */
.progress-milestone .progress-more-btn {
  position: absolute;
  bottom: 1rem;
  right: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  background-color: var(--color-btn-bg);
  color: var(--color-btn-text) !important;
  text-decoration: none !important;
  border: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.progress-milestone .progress-more-btn:hover {
  background-color: var(--color-link-hover);
  transform: translateY(-1px);
}

.progress-milestone-current .progress-more-btn {
  background-color: var(--progress-current);
}

.progress-milestone-current .progress-more-btn:hover {
  background-color: var(--progress-current-dark);
}

/* Lone Markdown link is wrapped in <p>; keep layout tight with absolute button */
.progress-milestone p:has(> a.progress-more-btn) {
  margin: 0;
  padding: 0;
  min-height: 0;
  line-height: 0;
}

.progress-status {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  font-size: 0.95rem;
  color: var(--color-text);
}

#progress-week-323,
#progress-week-330,
#progress-week-406,
#progress-week-413,
#progress-week-420,
#video {
  scroll-margin-top: 4.5rem;
}

@media (max-width: 520px) {
  .progress-timeline {
    max-width: none;
    padding-left: 1.45rem;
    margin-left: 0.35rem;
    margin-right: 0.35rem;
  }

  .progress-milestone::before {
    left: calc(-1.45rem - 9px);
  }

  .progress-milestone-current::before {
    left: calc(-1.45rem - 10px);
  }

  .progress-milestone ul {
    padding-right: 6.25rem;
  }

  .progress-milestone .progress-more-btn {
    bottom: 0.75rem;
    right: 0.85rem;
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
  }
}

/* ---------- Section Titles ---------- */
.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-heading);
  text-align: center;
  margin-bottom: 1.25rem;
  border-bottom: none;
}

/* ---------- Text Blocks ---------- */
.abstract-text,
.content-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
  text-align: justify;
  max-width: 800px;
  margin: 0 auto;
}
.content-text ul {
  text-align: left;
  padding-left: 1.25rem;
}
.content-text li {
  margin-bottom: 0.5rem;
}

.overview-intro,
.overview-footnote {
  max-width: 860px;
}

.subsection-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-link-hover);
  text-align: center;
  margin: 2rem 0 1rem;
}

.overview-grid,
.spec-grid {
  display: grid;
  gap: 1.1rem;
  margin-top: 0.75rem;
}

.overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.spec-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.overview-card,
.spec-card {
  background:
    linear-gradient(180deg, rgba(74, 108, 247, 0.08), rgba(74, 108, 247, 0.02)),
    #ffffff;
  border: 1px solid rgba(74, 108, 247, 0.14);
  border-radius: 16px;
  padding: 1.2rem 1.2rem 1rem;
  box-shadow: 0 10px 24px rgba(44, 72, 160, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.overview-card:hover,
.spec-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(44, 72, 160, 0.12);
  border-color: rgba(74, 108, 247, 0.28);
}

.overview-card h4,
.spec-card h4 {
  margin-top: 0;
  margin-bottom: 0.55rem;
  font-size: 1.05rem;
  color: var(--color-heading);
}

.overview-card p,
.spec-card p,
.spec-card ul {
  margin-bottom: 0;
}

.spec-card strong {
  display: inline-block;
  margin-bottom: 0.45rem;
  color: var(--color-link-hover);
}

.spec-card ul {
  text-align: left;
  padding-left: 1.1rem;
  margin-top: 0.35rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  max-width: 860px;
  margin: 0 auto 1.25rem;
}

.stack-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(74, 108, 247, 0.1);
  border: 1px solid rgba(74, 108, 247, 0.16);
  color: var(--color-link-hover);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.mpc-compact {
  max-width: 860px;
  font-size: 0.96rem;
  line-height: 1.7;
}

.mpc-flowchart,
.mpc-cost-grid,
.mpc-term-legend {
  max-width: 980px;
  margin: 0 auto 1.1rem;
}

.mpc-flowchart {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.mpc-flow-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 0.7rem;
}

.mpc-flow-row-bottom {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  max-width: 660px;
  width: 100%;
  margin: 0 auto;
}

.mpc-flow-step,
.mpc-cost-card,
.mpc-term-item {
  background:
    linear-gradient(180deg, rgba(74, 108, 247, 0.08), rgba(74, 108, 247, 0.02)),
    #ffffff;
  border: 1px solid rgba(74, 108, 247, 0.14);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(44, 72, 160, 0.08);
}

.mpc-flow-step {
  padding: 1rem 0.95rem;
  text-align: left;
}

.mpc-flow-step h4,
.mpc-cost-card h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--color-heading);
}

.mpc-flow-step p,
.mpc-cost-card p,
.mpc-term-item p {
  margin-bottom: 0;
}

.mpc-flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-link-hover);
  font-size: 1.4rem;
  font-weight: 700;
}

.mpc-flow-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.mpc-flow-drop-line {
  width: 120px;
  height: 0;
  border-top: 2px dashed rgba(74, 108, 247, 0.35);
}

.mpc-flow-drop-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-link-hover);
  font-size: 1.45rem;
  font-weight: 700;
}

.mpc-cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.mpc-cost-card {
  padding: 1rem 1rem 0.95rem;
}

.mpc-cost-card p {
  text-align: left;
}

.mpc-cost-card mjx-container[jax="CHTML"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 0.15rem 0 0.3rem;
  font-size: 108% !important;
}

.mpc-cost-card mjx-container[display="true"] {
  margin: 0.15rem 0 0.5rem !important;
}

.mpc-equation mjx-container[jax="CHTML"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 0.2rem;
}

.mpc-term-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.mpc-term-item {
  padding: 0.85rem 0.95rem;
  font-size: 0.94rem;
  line-height: 1.6;
}

.mpc-equation {
  max-width: 860px;
  margin: 0.75rem auto 1rem;
  padding: 0.85rem 1rem 0.25rem;
  background: rgba(74, 108, 247, 0.03);
  border-left: 3px solid rgba(74, 108, 247, 0.35);
  border-radius: 6px;
}

.mpc-equation p {
  margin-bottom: 0;
}

.mpc-equation mjx-container {
  font-size: 92% !important;
}

#tentative-plan-and-work-allocation table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: none;
  margin-top: 0.5rem;
}

#tentative-plan-and-work-allocation thead th {
  background: #f3f5f8;
  color: #2f3b52;
  font-weight: 600;
  text-align: left;
  border: 1px solid #d8dee8;
  padding: 0.7rem 0.8rem;
}

#tentative-plan-and-work-allocation tbody td {
  border: 1px solid #d8dee8;
  padding: 0.75rem 0.8rem;
  vertical-align: top;
  text-align: left;
}

#tentative-plan-and-work-allocation tbody tr:nth-child(even) {
  background: #fafbfd;
}

#tentative-plan-and-work-allocation strong {
  font-weight: 600;
}

/* ---------- Teaser ---------- */
.hero-teaser {
  text-align: center;
  margin: 0 auto;
  max-width: 100%;
}
.hero-teaser .teaser-img {
  width: 100%;
  max-width: 860px;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ---------- Video Embed ---------- */
.video-container {
  max-width: 1000px;
  margin: 0 auto;
}
.video-container iframe,
.video-container video {
  width: 100%;
  border-radius: 10px;
}

.mpc-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.75rem;
  align-items: start;
  max-width: min(1080px, 100%);
  margin: 0 auto;
}
.mpc-video-item {
  min-width: 0;
}
.mpc-video-grid .video-container {
  max-width: 100%;
}
.video-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 0.65rem;
}
@media (max-width: 720px) {
  .mpc-video-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Results Grid ---------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}
.result-card {
  text-align: center;
}
.result-card img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}
.result-card img:hover {
  transform: scale(1.02);
}

/* ---------- Comparison Grid ---------- */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}
.comparison-item {
  text-align: center;
}
.comparison-item img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 0.5rem;
}

/* ---------- Interpolation ---------- */
.interpolation-panel {
  max-width: 700px;
  margin: 1rem auto 0;
  text-align: center;
}
.interpolation-endpoints {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}
.endpoint-img {
  width: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.interpolation-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  margin-top: 0.5rem;
}
.interpolation-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-btn-bg);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.interpolation-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.interpolation-value {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.3rem;
}

/* ---------- BibTeX ---------- */
.section-container pre {
  background: var(--color-section-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  overflow-x: auto;
  max-width: 800px;
  margin: 0 auto;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  max-width: var(--max-width);
  margin: 2rem auto 0;
}
.site-footer a {
  color: var(--color-link);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero-section .title {
    font-size: 1.8rem;
  }
  .section-title {
    font-size: 1.4rem;
  }
  .subsection-title {
    font-size: 1rem;
  }
  .button-row {
    gap: 0.4rem;
  }
  .button-row .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
  }
  .overview-card,
  .spec-card {
    padding: 1rem;
  }
  .mpc-compact {
    font-size: 0.93rem;
  }
  .mpc-flow-row,
  .mpc-flowchart {
    grid-template-columns: 1fr;
  }
  .mpc-flow-arrow {
    transform: rotate(90deg);
    min-height: 20px;
  }
  .mpc-flow-row-bottom {
    max-width: none;
  }
  .mpc-flow-drop {
    flex-direction: column;
  }
  .mpc-flow-drop-line {
    width: 0;
    height: 26px;
    border-top: none;
    border-left: 2px dashed rgba(74, 108, 247, 0.35);
  }
  .mpc-equation {
    padding: 0.75rem 0.8rem 0.2rem;
  }
  #tentative-plan-and-work-allocation table {
    font-size: 0.84rem;
  }
  #tentative-plan-and-work-allocation thead th,
  #tentative-plan-and-work-allocation tbody td {
    padding: 0.6rem 0.65rem;
  }
  .interpolation-endpoints {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------- Hide Quarto footer (we use our own) ---------- */
.nav-footer {
  display: none !important;
}

/* ---------- Image alt-text captions (keep subtle) ---------- */
figure figcaption {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.4rem;
}
