/*
 * =============================================================================
 * Pubroot — Main Stylesheet
 * =============================================================================
 *
 * Design: ResearchGate-inspired — white background, teal accent, professional
 * academic aesthetic. Clean, spacious, credible. Typography mixes a serif for
 * headings (Source Serif 4, academic gravitas) with Inter for body (modern
 * readability).
 *
 * Color palette:
 *   Background:    #FFFFFF (white, like a research paper)
 *   Surface:       #F5F5F5 (light gray, cards/sections)
 *   Border:        #E0E0E0 (subtle dividers)
 *   Text primary:  #1A1A2E (near-black, high readability)
 *   Text secondary:#6B7280 (gray, metadata)
 *   Accent:        #00B4A0 (teal — trust, science, ResearchGate vibe)
 *   Accent hover:  #009688 (darker teal)
 *   Success:       #10B981 (accepted/verified green)
 *   Error:         #EF4444 (rejected red)
 *   Warning:       #F59E0B (amber)
 * =============================================================================
 */

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

:root {
  --bg: #FFFFFF;
  --surface: #F5F5F5;
  --surface-hover: #EBEBEB;
  --border: #E0E0E0;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --accent: #00B4A0;
  --accent-hover: #009688;
  --accent-light: #E0F7F4;
  --success: #10B981;
  --success-light: #ECFDF5;
  --error: #EF4444;
  --error-light: #FEF2F2;
  --warning: #F59E0B;
  --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --container: 1140px;
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text);
  line-height: 1.3;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.header-left {
  display: flex;
  align-items: center;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.logo:hover { text-decoration: none; color: var(--text); }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 6px;
}
.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

/* Navigation */
.main-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.main-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 0;
}
.main-nav a:hover { color: var(--text); text-decoration: none; }
.nav-submit {
  background: var(--accent) !important;
  color: white !important;
  padding: 8px 18px !important;
  border-radius: var(--radius);
  font-weight: 600 !important;
  transition: background 0.15s;
}
.nav-submit:hover {
  background: var(--accent-hover) !important;
  text-decoration: none !important;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(180deg, #F8FFFE 0%, var(--bg) 100%);
  padding: 60px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.hero-sub {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* Hero search */
.hero-search {
  max-width: 560px;
  margin: 0 auto;
}
/* Pagefind overrides for light theme */
.pagefind-ui .pagefind-ui__search-input {
  background: var(--bg) !important;
  border: 2px solid var(--border) !important;
  border-radius: 30px !important;
  padding: 14px 20px !important;
  font-size: 1rem !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: border-color 0.2s !important;
}
.pagefind-ui .pagefind-ui__search-input:focus {
  border-color: var(--accent) !important;
  outline: none !important;
}
.pagefind-ui .pagefind-ui__result-link {
  color: var(--accent) !important;
}

/* ============================================================
   TOPICS BAR — Two-Level Journal/Topic Navigation
   ============================================================
   Redesigned Feb 2026 to support the 18-journal, 97-topic taxonomy.
   Top row: journal-level pills in a horizontally scrollable bar.
   Bottom row: topic-level pills (sub-bar) that appear when a journal
   is selected. Both rows are populated dynamically from journals.json
   by JavaScript to avoid template updates when the taxonomy changes.
   ============================================================ */
.topics-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 0 0;
}

/* ---- Journal pills (top row) ---- */
.journal-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  /* Hide the scrollbar but keep scroll functionality for cleaner look */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.journal-pills::-webkit-scrollbar {
  height: 4px;
}
.journal-pills::-webkit-scrollbar-track {
  background: transparent;
}
.journal-pills::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
.journal-pill {
  white-space: nowrap;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.journal-pill:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.journal-pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.journal-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* ---- Topic sub-bar (bottom row) ---- */
.topic-subbar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 12px;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}
.topic-subbar.visible {
  max-height: 60px;
  opacity: 1;
  padding-top: 8px;
  padding-bottom: 12px;
  border-top: 1px solid var(--border);
}
.topic-subbar::-webkit-scrollbar {
  height: 3px;
}
.topic-subbar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
.topic-pill {
  white-space: nowrap;
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.topic-pill:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.topic-pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ============================================================
   PAPER LIST
   ============================================================ */
.paper-list {
  padding: 40px 0 60px;
}
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.list-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}
.btn-submit {
  background: var(--accent);
  color: white;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-submit:hover { background: var(--accent-hover); text-decoration: none; color: white; }

/* Paper cards */
.paper-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.paper-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #ccc;
}
.card-left { flex: 1; min-width: 0; }
.card-right {
  margin-left: 24px;
  flex-shrink: 0;
}

.card-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-verified_open {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #D1FAE5;
}
.badge-verified_private {
  background: #FFFBEB;
  color: var(--warning);
  border: 1px solid #FEF3C7;
}
.badge-text_only {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.category-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.paper-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}
.paper-card h3 a { color: var(--text); }
.paper-card h3 a:hover { color: var(--accent); text-decoration: none; }

.card-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.card-meta .author { font-weight: 500; }
.card-meta .sep { margin: 0 6px; }
.card-meta .paper-id { font-family: var(--font-mono); font-size: 0.8rem; }

.card-abstract {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Score circle (right side of card) */
.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--accent-light);
}
.score-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.score-max {
  font-size: 0.65rem;
  color: var(--text-secondary);
  line-height: 1;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}
.empty-icon {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.btn-submit-large {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
}
.btn-submit-large:hover { background: var(--accent-hover); text-decoration: none; color: white; }

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how-it-works {
  background: var(--surface);
  padding: 60px 0;
  border-top: 1px solid var(--border);
}
.how-it-works h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 40px;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 768px) {
  .steps-grid { grid-template-columns: 1fr; }
}
.step {
  text-align: center;
  padding: 24px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.step h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.step p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================================
   SINGLE PAPER PAGE
   ============================================================ */
.paper-full { padding: 32px 0 80px; }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; }

/* Paper header */
.paper-header { margin-bottom: 32px; }
.header-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.paper-id-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.paper-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.paper-byline {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.author-name { font-weight: 600; color: var(--text); }

/* Abstract */
.abstract-block {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 40px;
}
.abstract-block h4 {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}
.abstract-block p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

/* Content grid: article + review */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
}

/* Article body */
.article-body {
  font-size: 1rem;
  line-height: 1.8;
}
.article-body h1, .article-body h2, .article-body h3 {
  margin-top: 36px;
  margin-bottom: 12px;
}
.article-body h2 { font-size: 1.4rem; }
.article-body h3 { font-size: 1.15rem; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.article-body li { margin-bottom: 6px; }
.article-body code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.88em;
  border: 1px solid var(--border);
}
.article-body pre {
  background: #1A1A2E;
  color: #E4E4EB;
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

/* Review panel */
.review-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 80px;
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.panel-header h3 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.reviewer-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 3px;
}

/* Score display */
.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 8px;
}
.score-big {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.score-label {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-left: 2px;
}

.verdict {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 0;
  border-radius: 4px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.verdict-accepted {
  background: var(--success-light);
  color: var(--success);
}
.verdict-rejected {
  background: var(--error-light);
  color: var(--error);
}

/* Review detail sections */
.review-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.review-section:last-child { border-bottom: none; }
.review-section h4 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.review-section ul {
  list-style: none;
  padding: 0;
}
.review-section li {
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--text);
  line-height: 1.5;
}
.review-section p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Confidence bars */
.confidence-list {
  list-style: none;
  padding: 0;
}
.confidence-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.8rem;
}
.dim-name {
  flex: 0 0 100px;
  color: var(--text-secondary);
  text-transform: capitalize;
  font-size: 0.78rem;
}
.bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.dim-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex: 0 0 30px;
  text-align: right;
}

/* Claims */
.claim-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.83rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--surface);
}
.claim-yes {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--success);
  background: var(--success-light);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.claim-no {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--error);
  background: var(--error-light);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.claim-text { color: var(--text); }

.loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: #1A1A2E;
  color: #B0B0C0;
  padding: 48px 0 24px;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
.footer-brand .logo-mark {
  background: var(--accent);
}
.footer-brand .logo-text {
  color: #E4E4EB;
}
.footer-tagline {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #8888A0;
}
.footer-links-group h4 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #E4E4EB;
  margin-bottom: 12px;
}
.footer-links-group a {
  display: block;
  color: #8888A0;
  font-size: 0.85rem;
  padding: 3px 0;
}
.footer-links-group a:hover { color: var(--accent); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid #2A2A3E;
  padding-top: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: #6B6B80;
}

/* ============================================================
   LUCIDE ICON UTILITIES
   ============================================================
   These classes control the sizing and coloring of Lucide SVG icons
   used across the site. Lucide icons replace all emoji usage for
   a consistent, professional, cross-platform appearance.
   
   Lucide icons inherit color from their parent element via
   stroke="currentColor" by default, so they automatically match
   the surrounding text color. Override with specific classes below.
   
   WHY LUCIDE: We chose Lucide (MIT license, lucide.dev) over
   emoji because emojis render differently on every OS/browser,
   can't be styled with CSS, and look unprofessional on an academic
   platform. Lucide gives us clean, consistent line icons that
   match the "Nature meets Vercel" aesthetic.
   ============================================================ */

/* Base icon sizing — matches inline text flow */
.lucide {
  display: inline-block;
  vertical-align: -0.125em;
}

/* Icon size variants for different contexts */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-2xl { width: 40px; height: 40px; }
.icon-3xl { width: 48px; height: 48px; }

/* Icon color overrides — uses the site color system */
.icon-accent { color: var(--accent); }
.icon-success { color: var(--success); }
.icon-error { color: var(--error); }
.icon-warning { color: var(--warning); }
.icon-muted { color: var(--text-secondary); }
