/* ============================================================
   ReFine-RFT — Project Page Stylesheet
   Design: Dark hero, amber accent, card-based layout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sora:wght@600;700;800&display=swap');

/* ── Reset / Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --navy:    #0f172a;
  --navy2:   #1e293b;
  --amber:   #f59e0b;
  --amber2:  #fbbf24;
  --sky:     #0ea5e9;
  --sky2:    #38bdf8;
  --white:   #ffffff;
  --gray50:  #f8fafc;
  --gray100: #f1f5f9;
  --gray200: #e2e8f0;
  --gray500: #64748b;
  --gray700: #334155;
  --text:    #1e293b;
  --radius:  12px;
  --shadow:  0 4px 24px rgba(15,23,42,0.10);
  --shadow-lg: 0 8px 40px rgba(15,23,42,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  background: var(--white);
  margin: 0;
  line-height: 1.7;
}

/* ── Sticky Nav ─────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 2rem;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--amber);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.2s;
}

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

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

.hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1a0a2e 50%, #0c1929 100%);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* subtle grid overlay */
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245,158,11,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,158,11,0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.4);
  color: var(--amber2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  margin-bottom: 1.6rem;
}

.hero-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--white);
  line-height: 1.2;
  margin: 0 0 0.6rem;
  letter-spacing: -0.5px;
}

.hero-title .highlight {
  background: linear-gradient(90deg, var(--amber), var(--sky2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-authors {
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  margin: 1.4rem 0 0.4rem;
}

.hero-authors a {
  color: var(--sky2);
  text-decoration: none;
  font-weight: 500;
}

.hero-authors a:hover { text-decoration: underline; }

.hero-affiliations {
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.hero-affiliations sup { font-size: 0.7em; }

.hero-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  cursor: pointer;
  border: none;
}

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

.btn-amber {
  background: var(--amber);
  color: var(--navy);
}

.btn-amber:hover { background: var(--amber2); }

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.25);
  color: var(--white);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}

/* ── TL;DR Banner ───────────────────────────────────────── */

.tldr-banner {
  background: linear-gradient(90deg, #fef3c7 0%, #ffe4b5 100%);
  border-left: 4px solid var(--amber);
  padding: 1.2rem 2rem;
}

.tldr-inner {
  max-width: 860px;
  margin: 0 auto;
  font-size: 1.05rem;
  color: #78350f;
  line-height: 1.65;
}

.tldr-inner strong { color: #92400e; }

/* ── Layout Wrapper ─────────────────────────────────────── */

.page-section {
  padding: 4rem 1.5rem;
}

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

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Section Heading ────────────────────────────────────── */

.section-heading {
  font-family: 'Sora', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--amber) 0%, transparent 100%);
  border-radius: 2px;
}

/* ── Abstract ───────────────────────────────────────────── */

.abstract-text {
  font-size: 1.03rem;
  line-height: 1.8;
  color: var(--gray700);
  max-width: 820px;
}

.abstract-text p + p { margin-top: 1rem; }

/* ── Contribution Cards ─────────────────────────────────── */

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin-top: 0.5rem;
}

.contrib-card {
  background: var(--white);
  border: 1px solid var(--gray200);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.contrib-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.contrib-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--sky));
}

.contrib-number {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--amber), var(--amber2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 0.9rem;
  flex-shrink: 0;
}

.contrib-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.contrib-desc {
  font-size: 0.88rem;
  color: var(--gray500);
  line-height: 1.6;
}

/* ── Finding Box ────────────────────────────────────────── */

.finding-box {
  background: linear-gradient(135deg, #fef3c7, #fff7ed);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.finding-box .finding-label {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #b45309;
  margin-bottom: 0.4rem;
}

.finding-box p {
  margin: 0;
  font-size: 0.95rem;
  color: #78350f;
  line-height: 1.6;
}

/* ── Figure Cards ───────────────────────────────────────── */

.figure-card {
  background: var(--white);
  border: 1px solid var(--gray200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.figure-card img {
  max-width: 100%;
  height: auto;
  align-self: center;
  display: block;
}

.figure-caption {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--gray500);
  line-height: 1.6;
  border-top: 1px solid var(--gray200);
  background: var(--gray50);
}

.figure-caption strong { color: var(--gray700); }

.figure-caption .fig-num {
  display: inline-block;
  background: var(--amber);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.4rem;
  letter-spacing: 0.3px;
}

/* Two/Three column figure grids */
.fig-row {
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.fig-row.col-2 { grid-template-columns: 1fr 1fr; }
.fig-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Method Steps ───────────────────────────────────────── */

.method-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.method-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--gray200);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
}

.step-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
  font-size: 1.1rem;
}

.method-step h4 {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  margin: 0 0 0.4rem;
}

.method-step p {
  font-size: 0.84rem;
  color: var(--gray500);
  margin: 0;
  line-height: 1.55;
}

/* ── Results Tabs ───────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--gray200);
  padding-bottom: 0;
}

.tab-btn {
  padding: 0.55rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray500);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
  border-radius: 4px 4px 0 0;
}

.tab-btn:hover { color: var(--navy); }

.tab-btn.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Result Table ───────────────────────────────────────── */

.result-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray200);
}

.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.rtable caption {
  caption-side: top;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  text-align: left;
  background: var(--gray50);
  border-bottom: 1px solid var(--gray200);
}

.rtable thead tr {
  background: var(--navy);
}

.rtable thead th {
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.7rem 0.75rem;
  text-align: center;
  white-space: nowrap;
}

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

.rtable tbody td {
  padding: 0.55rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--gray200);
  color: var(--gray700);
  vertical-align: middle;
}

.rtable tbody td:first-child { text-align: left; font-weight: 500; }

.rtable tbody tr:hover { background: #fef9ec; }

.rtable tr.section-sep td {
  border-top: 2px solid var(--gray200);
  padding-top: 0.65rem;
}

.rtable tr.is-best {
  background: #fffbeb;
}

.rtable tr.is-best td {
  color: #92400e;
  font-weight: 700;
}

.rtable tr.is-best td:first-child {
  color: var(--navy);
}

/* ── BibTeX ─────────────────────────────────────────────── */

.bibtex-wrap {
  display: flex;
  justify-content: center;
}

.bibtex-block {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  max-width: 760px;
  width: 100%;
}

.bibtex-block code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.7;
  white-space: pre;
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
}

.site-footer a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}

.site-footer a:hover { color: var(--amber); }

/* ── Utilities ──────────────────────────────────────────── */

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0 !important; }

.pill {
  display: inline-block;
  background: var(--gray100);
  color: var(--gray700);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  margin: 0.15rem;
}

.pill-amber {
  background: #fef3c7;
  color: #92400e;
}

/* ── Reward Cards (5-column) ─────────────────────────────── */

.reward-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.reward-card {
  background: var(--white);
  border: 1px solid var(--gray200);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.reward-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.reward-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--sky));
}

.reward-icon {
  font-size: 1.4rem;
  margin-bottom: 0.7rem;
}

.reward-card h4 {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
  margin: 0 0 0.4rem;
  line-height: 1.3;
}

.reward-card p {
  font-size: 0.78rem;
  color: var(--gray500);
  margin: 0;
  line-height: 1.5;
}

/* ── Subsection heading ─────────────────────────────────── */

.sub-heading {
  font-family: 'Sora', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 2rem 0 0.8rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--amber);
}

/* ── MRN formula box ────────────────────────────────────── */

.formula-box {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 1rem 0;
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.formula-col {
  flex: 1;
  min-width: 220px;
}

.formula-col-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.formula-col-label.grpo { color: #94a3b8; }
.formula-col-label.mrn  { color: var(--amber2); }

.formula-line {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.9;
  white-space: pre;
}

.formula-line .var  { color: #93c5fd; }
.formula-line .op   { color: #fbbf24; }
.formula-line .note { color: #64748b; font-style: italic; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-title { font-size: 1.7rem; }
  .fig-row.col-2,
  .fig-row.col-3 { grid-template-columns: 1fr; }
  .contrib-grid { grid-template-columns: 1fr; }
  .method-steps { grid-template-columns: 1fr; }
  .reward-grid  { grid-template-columns: repeat(2, 1fr); }
  .page-section { padding: 2.5rem 1rem; }
}
