/* =============================================
   Memory Transfer Learning — Project Page
   ============================================= */

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

:root {
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --accent-light: #eff6ff;
  --green:        #16a34a;
  --green-light:  #f0fdf4;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted:   #9ca3af;
  --bg:           #ffffff;
  --bg-alt:       #f9fafb;
  --border:       #e5e7eb;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --nav-h:        60px;
  --max-w:        1100px;
  --max-w-wide:   1280px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

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

/* ---------- Navbar ---------- */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 6px;
}

.nav-links a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-h) + 64px) 0 72px;
  text-align: center;
}

.venue-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.paper-title {
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.title-sub {
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 400;
  color: var(--text-secondary);
}

.authors {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
}

.author {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
}

.author a,
.author-nolink {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1.5px solid var(--border);
  transition: color .15s, border-color .15s;
}

.author a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.affiliations {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-muted);
}

.correspondence {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text-muted);
}

.hero-buttons {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
  text-decoration: none !important;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--bg);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-alt); }

.tldr {
  margin: 36px auto 0;
  max-width: 680px;
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 18px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 17px;
  color: var(--text-primary);
  text-align: left;
}

/* ---------- Sections ---------- */
.section-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.subsection-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 44px 0 10px;
}

.section-desc {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ---------- Abstract ---------- */
.abstract-text {
  font-size: 17.5px;
  line-height: 1.85;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ---------- Figures ---------- */
.figure-block {
  margin: 28px auto;
  text-align: center;
}

.figure-wide {
  max-width: var(--max-w);
}

.figure-medium {
  max-width: 680px;
}

.figure-block img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  background: #fff;
}

.figure-block figcaption {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  text-align: left;
}

.two-col-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .two-col-figures { grid-template-columns: 1fr; }
}

/* ---------- Concept Figure two-panel ---------- */
.concept-figure-row {
  display: flex;
  flex-direction: row;
  gap: 24px;
  margin-bottom: 36px;
  align-items: flex-start;
}

.concept-figure-row > figure {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 !important;
  text-align: center;
}

.concept-figure-row > figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

.concept-figure-row > figure figcaption {
  margin-top: 10px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  text-align: left;
}

@media (max-width: 640px) {
  .concept-figure-row { flex-direction: column; }
}

/* ---------- RQ List (one per row) ---------- */
.rq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.rq-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 22px;
}

.rq-label {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 5px 14px;
  border-radius: 6px;
}

.rq-item p {
  font-size: 16.5px;
  font-weight: 500;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

/* ---------- Memory Type Cards ---------- */
.memory-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 28px;
}

@media (max-width: 800px) {
  .memory-types { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .memory-types { grid-template-columns: 1fr; }
}

.memory-card {
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}

.memory-card:hover { box-shadow: var(--shadow); }

.memory-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.memory-card h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.memory-card p {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ---------- Pipeline ---------- */
.pipeline-steps {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 28px;
  flex-wrap: wrap;
}

.pipeline-step {
  flex: 1;
  min-width: 200px;
  display: flex;
  gap: 14px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow-sm);
}

.pipeline-arrow {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 22px;
  font-weight: 300;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .pipeline-steps { flex-direction: column; }
  .pipeline-arrow { transform: rotate(90deg); align-self: center; }
}

.step-num {
  width: 30px; height: 30px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.step-body p {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ---------- Finding Box ---------- */
.finding-box {
  position: relative;
  background: var(--green-light);
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 24px;
  font-size: 17px;
  color: var(--text-primary);
  line-height: 1.7;
}

.finding-label {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 999px;
  margin-right: 10px;
  vertical-align: middle;
}

/* ---------- Negative Transfer ---------- */
.negative-transfer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 640px) {
  .negative-transfer-grid { grid-template-columns: 1fr; }
}

.nt-card {
  background: #fff7f7;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius);
  padding: 18px 16px;
}

.nt-card h4 {
  font-size: 15.5px;
  font-weight: 600;
  color: #b91c1c;
  margin-bottom: 8px;
}

.nt-card p {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ---------- Abstraction 2-column row (Fig6 + Table3) ---------- */
.abstraction-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

@media (max-width: 700px) {
  .abstraction-row { grid-template-columns: 1fr; }
}

/* ---------- Case Study Tables ---------- */
.case-study-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 36px 0 8px;
}

.case-study-table-wrap {
  margin-top: 4px;
}

.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--bg);
  table-layout: fixed;
}

.case-table thead tr {
  background: #1e293b;
  color: #e2e8f0;
}

.case-table thead th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  border: none;
}

.case-table tbody tr {
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.case-table tbody tr:last-child {
  border-bottom: none;
}

.case-table tbody td {
  padding: 16px 16px;
  color: var(--text-primary);
  line-height: 1.7;
  vertical-align: top;
}

.case-label {
  font-weight: 700;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted) !important;
  background: #f8fafc;
  text-align: center !important;
  vertical-align: middle !important;
}

.case-source {
  display: inline-block;
  background: #eff6ff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.case-error {
  color: #dc2626;
  font-weight: 500;
}

.case-success {
  color: var(--green);
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-pass {
  background: #dcfce7;
  color: #15803d;
}

.badge-fail {
  background: #fee2e2;
  color: #b91c1c;
}

code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  color: #1e293b;
}

/* ---------- Results Tables ---------- */
.table-wrap {
  margin: 24px 0;
}

.table-caption {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--bg);
  white-space: nowrap;
}

.results-table thead tr {
  background: var(--accent);
  color: #fff;
}

.results-table thead th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .02em;
  text-align: center;
  border: none;
}

.results-table thead th:first-child {
  text-align: left;
}

.results-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.results-table tbody tr:last-child {
  border-bottom: none;
}

.results-table tbody tr:hover {
  background: #f0f7ff;
}

.results-table tbody td {
  padding: 11px 16px;
  text-align: center;
  color: var(--text-primary);
}

.results-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}

/* Model header rows (gray bg) */
.results-table .model-header-row td {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  text-align: left;
  letter-spacing: .02em;
  padding: 8px 16px;
}

/* Delta rows (blue tint) */
.results-table .delta-row td {
  background: #eff6ff;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

/* Highlight rows (amber tint for best method) */
.results-table .highlight-row td {
  background: #fffbeb;
}

/* ---------- BibTeX ---------- */
.bibtex-block {
  position: relative;
  background: #1e293b;
  border-radius: var(--radius);
  padding: 24px 28px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.bibtex-block pre {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 15px;
  color: #e2e8f0;
  line-height: 1.8;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.copy-btn:hover { background: rgba(255,255,255,.25); }

/* ---------- Finding dividers ---------- */
.finding-box + .subsection-title {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

/* Case study: spacing after figure/table rows */
.abstraction-row + .case-study-title,
.figure-block + .case-study-title {
  margin-top: 40px;
}

/* =============================================
   MOBILE / RESPONSIVE
   ============================================= */

/* Navbar: collapse links to scrollable strip on small screens */
@media (max-width: 768px) {
  .nav-brand { display: none; }
  .nav-inner { padding: 0 8px; }
  .nav-links {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    width: 100%;
    justify-content: flex-start;
    padding: 0 4px;
  }
  .nav-links a {
    font-size: 12.5px;
    padding: 5px 8px;
    white-space: nowrap;
  }
}

/* Hero */
@media (max-width: 600px) {
  .hero {
    padding: calc(var(--nav-h) + 40px) 0 48px;
  }
  .hero .container { padding: 0 16px; }
  .paper-title { font-size: clamp(22px, 6vw, 32px); }
  .title-sub   { font-size: clamp(17px, 5vw, 24px); }
  .authors { gap: 4px 12px; }
  .author  { font-size: 15px; }
  .affiliations { font-size: 13px; }
  .tldr { font-size: 15px; padding: 14px 16px; }
}

/* Sections */
@media (max-width: 600px) {
  .section { padding: 52px 0; }
  .container { padding: 0 16px; }
  .section-title    { font-size: 24px; }
  .subsection-title { font-size: 18px; }
  .section-desc     { font-size: 15px; }
  .abstract-text    { font-size: 15.5px; }
  .finding-box      { font-size: 15px; padding: 14px 16px; }
  .figure-medium { max-width: 100%; }
}

/* Concept figure: stack on mobile */
@media (max-width: 640px) {
  .concept-figure-row { flex-direction: column; }
}

/* Memory type cards */
@media (max-width: 600px) {
  .memory-types { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .memory-types { grid-template-columns: 1fr; }
}

/* Pipeline: stack on mobile */
@media (max-width: 640px) {
  .pipeline-steps { flex-direction: column; gap: 12px; }
  .pipeline-arrow { transform: rotate(90deg); align-self: center; padding: 4px 0; }
  .pipeline-step  { min-width: 0; }
}

/* RQ items */
@media (max-width: 500px) {
  .rq-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .rq-item p { font-size: 15px; }
}

/* Negative transfer grid */
@media (max-width: 600px) {
  .negative-transfer-grid { grid-template-columns: 1fr; }
}

/* Abstraction row */
@media (max-width: 700px) {
  .abstraction-row { grid-template-columns: 1fr; }
}

/* Two-col figures */
@media (max-width: 600px) {
  .two-col-figures { grid-template-columns: 1fr; }
}

/* Results tables: already wrapped in .table-scroll with overflow-x:auto */
@media (max-width: 600px) {
  .results-table { font-size: 12.5px; }
  .results-table thead th,
  .results-table tbody td { padding: 9px 10px; }
  .table-caption { font-size: 13.5px; }
}

/* Case study column widths (desktop) */
.case-table .col-label   { width: 9%; }
.case-table .col-content { width: 45.5%; }

/* Case study tables: mobile */
@media (max-width: 700px) {
  .case-table { table-layout: auto; font-size: 12.5px; }
  .case-table .col-label,
  .case-table .col-content { width: auto; }
  .case-table thead th,
  .case-table tbody td { padding: 10px 10px; }
}

/* BibTeX */
@media (max-width: 600px) {
  .bibtex-block { padding: 16px 14px; }
  .bibtex-block pre { font-size: 12px; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--text-primary);
  color: #9ca3af;
  padding: 32px 0;
  text-align: center;
  font-size: 15px;
  line-height: 2;
}

.footer a { color: #93c5fd; }
.footer a:hover { color: #60a5fa; }
.footer-ack { font-size: 14px; margin-top: 4px; }
