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

:root {
  --primary:   #1a6bb5;
  --primary-dk:#145490;
  --accent:    #0ea5e9;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --radius:    8px;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 0.9rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.site-header nav a {
  color: rgba(255,255,255,.85);
  margin-left: 1.5rem;
  font-size: .95rem;
}
.site-header nav a:hover { color: #fff; text-decoration: none; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 4.5rem 0 3.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero .lead {
  font-size: 1.1rem;
  max-width: 680px;
  margin: 0 auto 1.5rem;
  opacity: .9;
}

.badge-row {
  display: flex;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 20px;
  padding: .25rem .85rem;
  font-size: .82rem;
  font-weight: 500;
}

/* ── Hero CTA buttons ── */
.hero-btn {
  display: inline-block;
  padding: .6rem 1.5rem;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  transition: opacity .15s;
}
.hero-btn:hover { opacity: .88; text-decoration: none; }

.hero-btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.7);
}
.hero-btn-outline:hover { background: rgba(255,255,255,.1); opacity: 1; }

/* ── Stats band ── */
.stats-band {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: .9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Features ── */
.features {
  padding: 4rem 0;
}

.features h2,
.jsonld-section h2,
.downloads h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1200px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow .2s;
}

.feature-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: .75rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

.feature-card p {
  font-size: .9rem;
  color: var(--muted);
}

/* ── JSON-LD section ── */
.jsonld-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 0;
}

.jsonld-section p {
  margin-bottom: 1rem;
  font-size: .95rem;
  color: var(--muted);
}

.code-block {
  background: #0f172a;
  color: #94d9f7;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.55;
  padding: 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

/* ── Downloads ── */
.downloads {
  padding: 3.5rem 0;
}

.download-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-size: .95rem;
  font-weight: 500;
}

.mime {
  background: var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .75rem;
  padding: .15rem .55rem;
  border-radius: 4px;
}

/* ── Study table ── */
.study-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.study-table th:nth-child(1),
.study-table td:nth-child(1) {
  width: 15%;
}

.study-table th:nth-child(2),
.study-table td:nth-child(2) {
  width: 50%;
}

.study-table th:nth-child(3),
.study-table td:nth-child(3) {
  width: 15%;
}

.study-table th:nth-child(4),
.study-table td:nth-child(4) {
  width: 20%;
}

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

.study-table thead th {
  background: var(--surface);
  font-weight: 600;
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  position: sticky;
  top: 52px;
}

.study-table tbody tr:hover {
  background: #f1f5f9;
}

.sid-link {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 600;
}

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-published {
  background: #dcfce7;
  color: #15803d;
}

.status-preprint {
  background: #fef9c3;
  color: #854d0e;
}

.status-withdrawn {
  background: #fee2e2;
  color: #b91c1c;
}

.dir-up {
  background: #dcfce7;
  color: #15803d;
}

.dir-down {
  background: #fee2e2;
  color: #b91c1c;
}

/* ── Study detail page ── */
.study-hero { padding: 2.25rem 0; }

.breadcrumb {
  font-size: .83rem;
  opacity: .75;
  margin-bottom: .5rem;
}
.breadcrumb a { color: rgba(255,255,255,.85); }
.bc-sep { margin: 0 .35rem; }

.study-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .study-layout { grid-template-columns: 1fr; }
}

/* Cards */
.study-card,
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.study-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar-card h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .85rem;
}

/* Metadata definition list */
.meta-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.meta-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: .5rem 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.meta-row:last-child { border-bottom: none; }

.meta-row dt {
  color: var(--muted);
  font-weight: 500;
}

.meta-row dd { word-break: break-word; }

.meta-note {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* Toggle button */
.toggle-btn {
  background: var(--border);
  border: none;
  border-radius: 4px;
  padding: .2rem .65rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.toggle-btn:hover { background: #cbd5e1; }

/* Sidebar links */
.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  transition: background .15s;
}
.sidebar-link:hover { background: #f1f5f9; text-decoration: none; }

.link-icon {
  font-size: 1rem;
  color: var(--primary);
  flex-shrink: 0;
}

.sidebar-link span { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-link strong { color: var(--text); font-weight: 600; }
.sidebar-link small { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }

/* Prev / next navigation */
.study-nav {
  display: flex;
  gap: .5rem;
  margin-bottom: .85rem;
}

.study-nav-btn {
  flex: 1;
  display: inline-block;
  text-align: center;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  transition: background .15s;
}
.study-nav-btn:hover { background: #f1f5f9; text-decoration: none; }
.study-nav-btn.disabled {
  color: var(--muted);
  cursor: default;
  pointer-events: none;
}

.back-link {
  display: block;
  font-size: .85rem;
  text-align: center;
}

/* ── Autocomplete ── */
.autocomplete-item:hover {
  background: #f1f5f9;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

/* ── Footer ── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 1.5rem 0;
  font-size: .85rem;
}

.site-footer a { color: rgba(255,255,255,.8); }
