/* Color variables (light default, dark overrides via .dark on html) */
:root{
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --muted-2:#4b5563;
  --primary: #3b82f6;
  --secondary: #10b981;
  --radius: 12px;
  --shadow: 0 6px 18px rgba(15,23,42,0.06);
  --card-shadow-hover: 0 10px 25px -5px rgba(0,0,0,0.1);
  --container-max: 1100px;
  --focus-ring: 3px solid rgba(59,130,246,0.18);
}

html.dark{
  --bg: #0f1724;
  --card-bg: #0f1724;
  --text: #ffffff;
  --muted: #cbd5e1;
  --muted-2:#94a3b8;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.45;
}

.container{
  max-width:var(--container-max);
  margin:0 auto;
  padding:32px 20px;
}

header.text-center{
  text-align:center;
  margin-bottom:48px;
}
header h1{
  font-size:34px;
  margin:0 0 8px 0;
  font-weight:700;
  color:var(--primary);
}
html.dark header h1{ color: #fff; }
header p{ margin:0; color:var(--muted); }

.panel{
  background:linear-gradient(var(--card-bg), var(--card-bg));
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  margin-bottom:32px;
  border:1px solid rgba(15,23,42,0.04);
}
html.dark .panel{
  border-color: rgba(148,163,184,0.06);
  background: #0b1220;
  box-shadow:none;
}

.panel-row{
  display:flex;
  flex-direction:column;
  gap:12px;
}
@media(min-width:768px){
  .panel-row{ flex-direction:row; align-items:center; }
}

.search-wrap{ position:relative; flex:1; }
.search-input{
  width:100%;
  padding:10px 12px 10px 38px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,0.08);
  font-size:15px;
  background:rgba(255,255,255,0.98);
  color:var(--text);
  outline:none;
  transition:box-shadow 0.15s, border-color 0.15s;
}
html.dark .search-input{
  background:#0b1522;
  border:1px solid rgba(148,163,184,0.08);
  color:var(--text);
}
.search-input:focus{ box-shadow: var(--focus-ring); border-color:var(--primary); }
.search-icon{
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-50%);
  pointer-events:none;
  color:var(--muted-2);
  height:18px; width:18px;
}

.filters{
  display:flex;
  gap:8px;
  margin-left:0;
  justify-content:flex-end;
}
@media(min-width:768px){ .filters{ margin-left:12px; } }

.select, .btn{
  padding:9px 12px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,0.08);
  background:rgba(255,255,255,0.98);
  color:var(--text);
  font-size:14px;
  cursor:pointer;
  outline:none;
}
html.dark .select, html.dark .btn{
  background:#08202b;
  border:1px solid rgba(148,163,184,0.06);
  color:var(--muted);
}
.select:focus, .btn:focus{ box-shadow:var(--focus-ring); border-color:var(--primary); }

.btn.primary{
  background:var(--primary);
  color:#fff;
  border-color:transparent;
}
.btn.primary:hover{ filter:brightness(.95); }

#studies-container{
  display:grid;
  grid-template-columns:1fr;
  gap:20px;
  margin-bottom:16px;
}
@media(min-width:768px){ #studies-container{ grid-template-columns: repeat(2, 1fr); } }
@media(min-width:1024px){ #studies-container{ grid-template-columns: repeat(3, 1fr); } }

.card{
  background:var(--card-bg);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--shadow);
  border:1px solid rgba(15,23,42,0.04);
  transition:transform .25s ease, box-shadow .25s ease;
  display:flex;
  flex-direction:column;
  min-height:100%;
}
html.dark .card{ border-color: rgba(148,163,184,0.04); background: #071223; }

.card:hover{ transform:translateY(-6px); box-shadow: var(--card-shadow-hover); }
.card .media{ height:200px; overflow:hidden; }
.card .media img{ width:100%; height:100%; object-fit:cover; display:block; }

.card .content{ padding:18px; display:flex; flex-direction:column; gap:10px; flex:1; }

.card .title-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.card h3{
  margin:0;
  font-size:16px;
  line-height:1.2;
  font-weight:700;
  color:var(--text);
}
.chip{
  display:inline-block;
  padding:6px 8px;
  font-size:12px;
  border-radius:999px;
  border:1px solid rgba(59,130,246,0.15);
  color:var(--primary);
  background: rgba(59,130,246,0.06);
  white-space:nowrap;
}
html.dark .chip{ background: rgba(16,185,129,0.04); color:var(--secondary); border-color: rgba(16,185,129,0.08) }

.authors{
  font-size:13px;
  color:var(--muted-2);
  margin:0;
}
html.dark .authors{ color:var(--muted); }

.published{
  font-size:12px;
  color:var(--muted);
}

.abstract{
  color:var(--text);
  margin:0;
  font-size:14px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
}
html.dark .abstract{ color:var(--muted); }

.card .card-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-top:auto;
}

.link {
  text-decoration:none;
  font-size:13px;
  color:var(--primary);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
html.dark .link{ color:var(--secondary); }

.icon-btn{
  padding:8px;
  border-radius:999px;
  background:transparent;
  border:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.icon-btn:hover{ background: rgba(15,23,42,0.03); }
html.dark .icon-btn:hover{ background: rgba(148,163,184,0.03); }

.pagination{
  display:inline-flex;
  border-radius:8px;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.pagination a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  text-decoration:none;
  border-right:1px solid rgba(15,23,42,0.06);
  background:var(--card-bg);
  color:var(--muted);
  font-size:14px;
}
.pagination a:last-child{ border-right:none; }
.pagination a.active{
  background:var(--primary);
  color:#fff;
  font-weight:600;
  border-right:1px solid rgba(0,0,0,0.06);
}
html.dark .pagination a{ background: #071223; color: var(--muted); border-right:1px solid rgba(148,163,184,0.04); }
html.dark .pagination a.active{ background:var(--primary); color:#fff; }

.flex{ display:flex; align-items:center; }
.space-x-2 > * + *{ margin-left:8px; }
.sr-only{ position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }
.muted-note{ color:var(--muted); font-size:14px; text-align:center; padding:20px 0; }