/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fc;
  --text: #1a1a2e;
  --text-secondary: #555770;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --accent-bg: #eff4ff;
  --border: #e2e6ef;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Fira Code", monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

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

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

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

a:hover {
  color: var(--accent-dark);
}

/* ===== Layout ===== */
.container {
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
}

.narrow {
  max-width: 820px;
}

/* ===== Nav ===== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 1.6rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

/* ===== Hero ===== */
.hero {
  background: #ffffff;
  color: var(--text);
  padding: 4rem 0 3rem;
  position: relative;
}

.hero-inner {
  position: relative;
  text-align: center;
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.hero-sub {
  margin-top: 0.5rem;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: 500;
  color: var(--text-secondary);
}

.hero-stats {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Dark pill buttons (SurgSigma style) */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: opacity 0.2s;
  cursor: pointer;
  border: none;
  background: #363636;
  color: #ffffff;
  text-decoration: none;
}

.btn-pill:hover {
  opacity: 0.9;
}

.btn-pill.btn-disabled {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}

.hero-teaser {
  margin-top: 2rem;
  max-width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #ffffff;
}

.hero-teaser img {
  width: 100%;
  height: auto;
  display: block;
  background: #ffffff;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-white {
  background: #fff;
  color: #1e3a8a;
}

.btn-white:hover {
  background: #e0e7ff;
  color: #1e3a8a;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-alt);
}

/* ===== Sections ===== */
.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

.section-desc {
  margin-top: 0.5rem;
  text-align: center;
  color: var(--text-secondary);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Abstract ===== */
.abstract-card {
  margin-top: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.2rem;
  box-shadow: var(--shadow-sm);
}

.abstract-card p {
  color: var(--text-secondary);
  margin-bottom: 0.9rem;
}

.abstract-card p:last-child {
  margin-bottom: 0;
}

.abstract-card strong {
  color: var(--text);
}

/* ===== Figures ===== */
.figure-block {
  margin-top: 2rem;
}

.figure-block + .figure-block {
  margin-top: 2.5rem;
}

.figure-block figure {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.figure-block figure img {
  width: 100%;
  display: block;
  background: #ffffff;
  vertical-align: top;
}

.figure-block figcaption {
  padding: 0.85rem 1.3rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

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

/* ===== Method Grid ===== */
.method-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.method-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
}

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

.method-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 0.8rem;
}

.method-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.method-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Authors ===== */
.author-list {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.6rem;
}

.author {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.author.equal {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.author.corresponding {
  border-color: #7c3aed;
  background: #f3f0ff;
}

.author sup {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-left: 0.1rem;
}

.affil-block {
  margin-top: 1.5rem;
  text-align: center;
}

.affil-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.affil-list {
  display: inline-block;
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-left: 1.5rem;
  line-height: 1.75;
}

.contact-card {
  margin-top: 2rem;
  background: var(--accent-bg);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.contact-card h3 {
  font-size: 0.95rem;
  color: var(--accent-dark);
  margin-bottom: 0.3rem;
}

.contact-card h3 i {
  margin-right: 0.4rem;
}

.contact-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.contact-card a {
  font-weight: 600;
}

/* ===== Citation ===== */
.cite-box {
  margin-top: 1.2rem;
  position: relative;
  background: #1a1a2e;
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
}

.cite-box pre {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #c5c8d4;
  line-height: 1.65;
  white-space: pre;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #9ca3af;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ===== Footer ===== */
.footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ===== Sub-page Elements ===== */
.back-link {
  margin-bottom: 0.5rem;
}

.back-link a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.back-link a:hover {
  color: var(--accent);
}

.back-link a i {
  margin-right: 0.3rem;
}

.page-title {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 720px;
}

.table-wrapper {
  margin-top: 0.8rem;
  overflow-x: auto;
}

.phase-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.phase-table th,
.phase-table td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

.phase-table thead th {
  font-weight: 700;
  color: var(--text);
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
}

.phase-table tbody td {
  color: var(--text-secondary);
}

.phase-table tbody tr:last-child td {
  font-weight: 600;
  color: var(--accent-dark);
}

/* ===== Pipeline Explanation ===== */
.pipeline-explain {
  margin-top: 2.5rem;
}

.pipeline-explain > h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pipeline-explain > h3:not(:first-child) {
  margin-top: 2rem;
}

.pipeline-explain > p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  max-width: 820px;
}

.pipeline-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-bottom: 0.5rem;
}

.pipe-node {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}

.pipe-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-top: 0.15rem;
}

.pipe-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.pipe-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.pipe-node:first-child .pipe-tag {
  background: #fef3c7;
  color: #92400e;
}

.pipe-node:last-child .pipe-tag {
  background: #dbeafe;
  color: #1e40af;
}

.pipe-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.pipe-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0;
  color: #b0b8c9;
  font-size: 1rem;
}

.pipe-arrow-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.design-note {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding: 1rem 1.2rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}

.design-note > i {
  flex-shrink: 0;
  color: #d97706;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.design-note > p {
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.65;
  margin: 0;
}

.design-note strong {
  color: #92400e;
}

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

.contra-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}

.contra-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.contra-header i {
  color: var(--accent);
  font-size: 1rem;
}

.contra-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.contra-card > p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero {
    padding: 3.5rem 0 3rem;
  }

  .hero-stats {
    gap: 0.8rem;
    padding: 0.7rem 1rem;
  }

  .stat-val {
    font-size: 1.1rem;
  }

  .nav-links {
    display: none;
  }

  .method-grid {
    grid-template-columns: 1fr;
  }

  .abstract-card {
    padding: 1.2rem 1rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.6rem;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stat-divider {
    display: none;
  }

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

  .btn {
    width: 100%;
    justify-content: center;
  }
}
