/* ─────────────────────────────────────────────────────────────
   TinySDP Project Page
   Clean academic project-page style
───────────────────────────────────────────────────────────── */

:root {
  --text:      #1a1a1a;
  --muted:     #5e5e5e;
  --faint:     #9a9a9a;
  --link:      #2563eb;
  --accent:    #b83020;
  --line:      #e4e4e4;
  --line-soft: #efefef;
  --max-w:     1080px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a { color: inherit; text-decoration: none; }

sup {
  font-size: 0.62em;
  vertical-align: super;
  line-height: 0;
}

/* ── Page wrapper ─────────────────────────────────────────── */

.page { padding-bottom: 88px; }

/* Centered content column used by most sections */
.content-column {
  width: min(100%, var(--max-w));
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Top nav ──────────────────────────────────────────────── */

.top-nav {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 16px 32px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.top-nav a { transition: color 100ms; }
.top-nav a:hover { color: var(--text); }

/* ── Hero ─────────────────────────────────────────────────── */

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

.hero-shell {
  width: min(100%, var(--max-w));
  margin: 0 auto;
}

/* Title */
h1, h2, h3 {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  letter-spacing: -0.025em;
}

h1 {
  margin: 44px auto 26px;
  max-width: 800px;
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.13;
  font-weight: 700;
  color: var(--text);
}

.hero-title-line {
  display: block;
  white-space: nowrap;
}

/* Authors */
.authors {
  margin: 0 auto 10px;
  max-width: 760px;
  font-size: clamp(0.9rem, 1.7vw, 1.06rem);
  line-height: 1.7;
  color: var(--link);
  font-weight: 500;
}

.authors a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.authors a:hover {
  color: #0e5fcc;
  text-decoration: underline;
}

/* Affiliations */
.affiliations {
  display: flex;
  justify-content: center;
  gap: 4px 20px;
  flex-wrap: wrap;
  margin: 0 auto 6px;
  max-width: 820px;
  font-size: clamp(0.78rem, 1.35vw, 0.88rem);
  color: var(--muted);
  line-height: 1.55;
}

/* Footnotes (equal contribution / advising) */
.notes {
  margin: 0 auto 6px;
  font-size: 0.81rem;
  color: var(--faint);
}

/* Venue / accepted line */
.accepted {
  min-height: 1.4em;
  margin: 0 auto 22px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* CTA buttons */
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 22px;
  border-radius: 5px;
  background: #1c1c1c;
  color: #ffffff;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 100ms ease;
}

.button:hover { background: #000; }

/* Hero video: remove the extra top margin since hero-actions already adds spacing */
.hero-shell .media-frame {
  margin-top: 0;
}

/* ── Content sections ─────────────────────────────────────── */

.section {
  padding: 60px 32px;
  border-top: 1px solid var(--line);
}

.section-compact {
  padding-top: 52px;
  padding-bottom: 44px;
}

.section-head { margin-bottom: 22px; }

.section-kicker {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
  line-height: 1.1;
  font-weight: 700;
  text-align: center;
}

/* Inside section-head the div carries the bottom spacing, not h2 */
.section-head h2 { margin-bottom: 0; }

h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  line-height: 1.18;
  font-weight: 600;
  text-align: center;
}

/* Body text within sections */
.content-column > p,
.experiment-block > p,
.lead {
  margin-top: 0;
  font-size: 0.97rem;
  line-height: 1.8;
  color: #3d3d3d;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.lead { margin-bottom: 16px; }

/* ── Video ────────────────────────────────────────────────── */

.media-frame {
  margin-top: 28px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  /* Thin border so video doesn't bleed on white */
  border: 1px solid var(--line);
}

.media-frame video { width: 100%; }

/* ── Experiment blocks ────────────────────────────────────── */

/* First block just gets margin from the intro paragraph */
.experiment-block {
  margin-top: 36px;
}

/* Subsequent blocks get a separator line */
.experiment-block + .experiment-block {
  margin-top: 0;
  padding-top: 48px;
  border-top: 1px solid var(--line-soft);
}

.subsection-head { margin-bottom: 12px; }

/* ── Safety indicators ────────────────────────────────────── */

.safe-yes {
  color: #16a34a;
  font-weight: 700;
  font-size: 1.05em;
}

.safe-no {
  color: #dc2626;
  font-weight: 700;
  font-size: 1.05em;
}

/* ── Tables ───────────────────────────────────────────────── */

.table-wrap {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  background: #fff;
}

caption {
  padding: 14px 18px 10px;
  text-align: left;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: #fafafa;
  border-bottom: 1px solid var(--line);
}

th, td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  background: #f8f8f8;
}

tbody tr.group-start td {
  border-top: 2px solid #ddd;
}

tbody tr:last-child td { border-bottom: none; }

/* 2×2 grid of small tables (U-shape breakdown) */
.table-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.table-grid .table-wrap {
  margin-top: 0;
}

/* ── Figures ──────────────────────────────────────────────── */

figure { margin: 0; }

.figure-card {
  margin-top: 28px;
}

.figure-card img {
  width: 100%;
  border-radius: 5px;
  border: 1px solid var(--line);
  /* Prevent antialiasing gaps on white bg */
  background: #fff;
}

.figure-card figcaption {
  margin-top: 10px;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--muted);
}

/* ── Layout grids ─────────────────────────────────────────── */

.experiment-split,
.image-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.experiment-split {
  grid-template-columns: 3fr 2fr;
  margin-top: 28px;
}

/* Ensure the figure inside a split column fills the column */
.experiment-split .figure-card,
.experiment-split .table-wrap {
  margin-top: 0;
}

.two-up {
  grid-template-columns: 1fr 1fr;
  margin-top: 28px;
}

/* U-shape: slightly smaller than full width */
.figure-sm {
  max-width: 82%;
  margin-left: auto;
  margin-right: auto;
}

/* Dynamic table: narrow and centered below the figure */
.table-compact {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Hardware deployment: stacked, certificate smaller beneath */
.figure-cert img {
  max-width: 72%;
  margin-left: auto;
  margin-right: auto;
}

/* ── Citation code block ──────────────────────────────────── */

.code-card {
  margin-top: 22px;
  padding: 22px 26px;
  background: #1b1d23;
  color: #cfd3dc;
  border-radius: 8px;
  overflow: hidden;
}

.code-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.87rem;
  line-height: 1.7;
}

/* ── Responsive: tablet ───────────────────────────────────── */

@media (max-width: 860px) {
  .experiment-split { grid-template-columns: 1fr; }
  .two-up           { grid-template-columns: 1fr; }
  .table-grid       { grid-template-columns: 1fr; }

  .experiment-split .figure-card,
  .experiment-split .table-wrap {
    margin-top: 24px;
  }

  .experiment-split .figure-card:first-child,
  .experiment-split .table-wrap:first-child {
    margin-top: 0;
  }
}

/* ── Responsive: mobile ───────────────────────────────────── */

@media (max-width: 600px) {
  .hero { padding: 0 16px 36px; }
  .top-nav { padding: 14px 16px; gap: 20px; }
  .content-column { padding: 0 16px; }
  .section { padding: 44px 16px; }

  h1 {
    font-size: 1.7rem;
    margin-top: 32px;
    margin-bottom: 20px;
  }

  .hero-title-line { white-space: normal; }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .button {
    width: 100%;
    max-width: 260px;
  }
}
