/* --- Base styles --- */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
  background: #ffffff;
  text-align: center;
  padding: 40px 20px;
}

/* --- Title --- */
h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  margin: 0;
  line-height: 1.3;
}

/* --- Authors section --- */
.authors {
  margin-top: 16px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 18px;
  color: #0f172a;
}
.authors .author {
  text-decoration: none;
  color: #3b82f6;
  font-weight: 600;
  font-size: clamp(20px, 2.5vw, 26px);
}
.authors .author:hover { text-decoration: underline; color: #2563eb; }
.authors .sep { opacity: 0.35; }
.authors sup { font-size: 0.7em; vertical-align: super; margin-left: 2px; }

/* --- Affiliations --- */
.affiliations {
  margin-top: 12px;
  font-size: 18px;
  color: #374151;
  line-height: 1.4;
}

/* --- Link buttons row --- */
.links {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: 9999px;
  background: #1f2937;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease;
}
.btn:hover { background: #374151; }
.btn .icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  display: inline-block;
  vertical-align: middle;
  filter: invert(1); /* make dark SVGs appear white on dark bg */
}

/* --- Sections --- */
.section {
  margin: 100px auto;
  max-width: 1000px;
  text-align: center;
}
.section h2 {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #0f172a;
}
/* Paragraphs inside centered sections */
.section p {
  font-size: 18px;
  line-height: 1.65;
  color: #334155;
  max-width: 1000px;
  margin: 0 auto;
  text-align: justify; /* academic look */
}

/* --- Left-aligned section (Citations) --- */
.section-left {
  margin: 100px 0;
  width: 100%;
  text-align: left;
  padding-left: 40px;
}
.section-left h2 {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #0f172a;
}
.section-left pre {
  background: #f3f4f6;
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  color: #111827;
}
.section-left code { white-space: pre; }

/* --- Responsive YouTube embed --- */
.video-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 40px auto;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
}
.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}

/* --- Method figure --- */
.figure { max-width: 1000px; margin: 0 auto 18px auto; }
.figure-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}
/* Default captions are left-aligned (academic) */
.caption {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.55;
  color: #4b5563;
  text-align: left;
}
.caption.center { text-align: center; }

#method h2 { margin-bottom: 16px; }

/* --- Method body --- */
.method-body {
  max-width: 1000px;
  margin: 18px auto 0;
  text-align: left; /* left-align text under centered figure */
}

/* --- Experiment body (separate from method) --- */
.exp-body {
  max-width: 1000px;
  margin: 18px auto 0;
  text-align: left;
}

/* --- Primary subsection headings (24px, bold)
   Problem / Key Idea / Stage I-II / Ablations / Experiments subheads */
.subheading,
#method .phase-heading {
  font-size: 24px;
  font-weight: 700;
  margin: 14px 0 12px;
  color: #0f172a;
  text-align: left; /* force left across contexts */
}
/* Ensure subheadings in Experiments section align left (extra guard) */
#experiments .subheading {
  text-align: left;
  margin-left: 0;
}

/* --- Method paragraph text --- */
.method-text {
  font-size: 18px;
  line-height: 1.65;
  color: #334155;
  margin: 0 0 22px 0;
}

/* --- Method cards (two-column responsive grid) --- */
.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px; /* unify spacing between rows */
}
.card {
  background: #f8fafc;       /* very light slate */
  border: 1px solid #e5e7eb; /* subtle border */
  border-radius: 8px;
  padding: 16px;
  text-align: left;
}
/* Secondary titles (20px, bold) — card titles */
.card h4 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #0f172a;
}
.card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #374151;
}

/* Phase headings inside Method (keep alignment/spacing) */
#method .phase-heading {
  text-align: left;
  margin: 18px 0 8px; /* slightly extra top spacing before grids */
}
#method .phase-heading + .method-grid {
  margin-top: 10px; /* comfy gap after heading */
}

/* --- Ablations layout: text left, figure/table right --- */
.ablation {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 32px 0;
}
.ablation-text { flex: 1; }
/* Secondary titles in Ablations (20px, bold) */
.ablation-text h4 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: #0f172a;
}
.ablation-fig {
  flex: 1;
  text-align: center;
}
.ablation-fig img {
  max-width: 85%;           /* slightly smaller than container */
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
/* Center captions inside ablation figures/tables */
.ablation-fig .caption {
  margin-top: 8px;
  font-size: 15px;
  color: #4b5563;
  text-align: center;
}

/* --- Experiments table --- */
.exp-table {
  width: 85%;               /* slightly smaller table */
  margin: 8px auto 0 auto;
  border-collapse: collapse;
  font-size: 15px;
}
.exp-table th,
.exp-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: center;
}
.exp-table th {
  background: #f3f4f6;
  font-weight: 600;
}
.exp-table tr:nth-child(even) {
  background: #fafafa;
}
.exp-table + .caption {
  text-align: center;
  margin-top: 6px;
  font-size: 15px;
  color: #4b5563;
}

/* --- Experiments: three videos in one row --- */
.exp-video-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
}
.exp-video-row .vid {
  margin: 0;
  text-align: center;
  flex: 1 1 0;
}
.exp-video-row video {
  height: 425px;           /* larger for better visibility */
  width: auto;             /* keep aspect ratio */
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  background: #000;
}

/* --- Experiment figure layout: text + image (non-ablation) --- */
.exp-figure-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 32px 0;
}
.exp-fig {
  flex: 1;
  text-align: center;
}
.exp-fig img {
  max-width: 85%;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.exp-fig .caption {
  margin-top: 8px;
  font-size: 15px;
  color: #4b5563;
  text-align: center;
}

/* --- Responsive tweaks (single consolidated block) --- */
@media (max-width: 720px) {
  .method-grid { grid-template-columns: 1fr; }

  .ablation { flex-direction: column; }
  .ablation-fig img { max-width: 100%; }

  .exp-video-row { flex-direction: column; }
  .exp-video-row video { height: auto; width: 100%; }

  .exp-figure-row { flex-direction: column; }
  .exp-fig img { max-width: 100%; }

  .exp-table { width: 100%; }
}

@media (max-width: 600px) {
  h1 {
    font-size: clamp(22px, 6vw, 32px);
    line-height: 1.25;
  }
  .authors { font-size: 14px; gap: 8px; margin-top: 10px; }
}
