:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #e3e7ee;
  --bg: #f5f7fa;
  --card: #ffffff;
  --accent: #d99a00;
  --link: #134e9c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.break { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--accent); color: var(--navy); font-weight: 800; font-size: 13px; letter-spacing: .5px; padding: 7px 8px; border-radius: 6px; }
.brand-text { font-weight: 700; font-size: 18px; display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-weight: 400; font-size: 12px; opacity: .75; }
.nav { display: flex; gap: 4px; }
.nav a { color: #dbe4f3; padding: 8px 12px; border-radius: 6px; font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }

/* Hero & search */
.hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 56px 0 64px; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 700; max-width: 760px; }
.lede { font-size: 1.1rem; color: #c9d5ea; max-width: 680px; margin: 0 0 24px; }
.searchbar { display: flex; max-width: 760px; background: #fff; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.18); overflow: hidden; }
.searchbar input { flex: 1; min-width: 0; border: 0; padding: 16px 18px; font-size: 1.05rem; font-family: inherit; color: var(--ink); }
.searchbar input:focus { outline: none; }
.searchbar button, .filter-row button { border: 0; background: var(--accent); color: var(--navy); font-weight: 700; padding: 0 26px; font-size: 1rem; cursor: pointer; font-family: inherit; }
.searchbar button:hover, .filter-row button:hover { filter: brightness(1.05); }
.searchbar.compact { box-shadow: none; border: 1px solid var(--line); }
.searchbar.compact input { padding: 12px 14px; font-size: 1rem; }
.popular { margin: 18px 0 0; color: #c9d5ea; font-size: .92rem; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.guide-link { margin: 12px 0 0; color: #c9d5ea; font-size: .92rem; }
.guide-link a { color: #f0c45a; font-weight: 600; }
.popular a { color: #fff; background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 999px; }
.subhero { background: #fff; border-bottom: 1px solid var(--line); padding: 24px 0; margin-bottom: 24px; }
.subhero h1 { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2rem); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: -32px; margin-bottom: 24px; position: relative; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .9rem; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.panel h2 { font-size: 1.1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2 .panel { margin-bottom: 0; }
.grid-2 + .panel { margin-top: 24px; }

.faculty-list { list-style: none; padding: 0; margin: 0; }
.faculty-list a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.faculty-list li:last-child a { border-bottom: 0; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.faculty-list .count { background: var(--bg); padding: 1px 10px; border-radius: 999px; }

.bars { list-style: none; padding: 0; margin: 0; }
.bars li, .bars a { display: grid; grid-template-columns: 76px 1fr 40px; align-items: center; gap: 10px; padding: 5px 0; color: var(--ink); }
.bars a:hover { text-decoration: none; background: var(--bg); }
.bars li:has(> a) { display: block; padding: 0; }
.bar { background: var(--bg); height: 12px; border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--navy-2); border-radius: 6px; min-width: 2px; }
.bar-label { font-size: .9rem; color: var(--muted); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }

/* SINTA & index badges */
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #e8edf5; color: var(--navy); white-space: nowrap; }
.sinta-1 { background: #0f5132; color: #fff; }
.sinta-2 { background: #198754; color: #fff; }
.sinta-3 { background: #2f9e8f; color: #fff; }
.sinta-4 { background: #1c7ed6; color: #fff; }
.sinta-5 { background: #748ffc; color: #fff; }
.sinta-6 { background: #adb5bd; color: #1d2433; }
.bar-fill.sinta-6 { background: #adb5bd; }
.badge.scopus { background: #ff8200; color: #fff; }
.badge.doaj { background: #fdb913; color: #1d2433; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 0; }

/* Results */
.result { padding: 16px 0; border-bottom: 1px solid var(--line); }
.result:last-of-type { border-bottom: 0; }
.result-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin-bottom: 4px; }
.result-authors { margin: 0 0 4px; color: var(--ink); font-size: .95rem; }
.result-source { margin: 0; color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.result-source .doi { overflow-wrap: anywhere; }

.layout-sidebar { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.results { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 22px 16px; margin-bottom: 24px; min-width: 0; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.count-line { margin: 0 0 12px; color: var(--muted); }
.count-line strong { color: var(--ink); }
.clear { font-size: .9rem; }
.empty { padding: 32px 0; text-align: center; }

.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 80px; }
.filters fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.filters legend, .facet h3 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.filters select, .filters input, .filter-row input, .filter-row select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: .95rem; background: #fff; color: var(--ink); }
.year-range { display: flex; align-items: center; gap: 6px; }
.facet { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.facet ul { list-style: none; padding: 0; margin: 0; }
.facet li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: .92rem; }
.facet li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn, .btn-secondary { display: inline-block; padding: 9px 16px; border-radius: 6px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.btn { background: var(--navy); color: #fff; }
.btn:hover { background: var(--navy-2); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--line); overflow-wrap: anywhere; }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.filters .btn-secondary { width: 100%; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; font-size: .95rem; }
.pagination .disabled { color: #b0b7c3; }
.page-info { color: var(--muted); }

/* Query interpretation */
.query-info { background: #f3f6fb; border: 1px solid #dde5f1; border-radius: 8px; padding: 10px 14px; margin: 12px 0 4px; font-size: .92rem; }
.query-info p { margin: 2px 0; display: block; }
.query-info a { margin-left: 8px; white-space: nowrap; }
.query-info s { color: #9aa3b2; }
.did-you-mean { margin: 12px 0 0; font-size: 1rem; }
.semantic-info { background: #f4f1fb; border-color: #e1d9f3; }
.badge-sem { display: inline-block; font-size: .72rem; font-weight: 600; color: #5b3fa8; background: #efe9fb; border-radius: 4px; padding: 1px 7px; margin: 0 0 4px; }
.filters .check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .92rem; cursor: pointer; }
.filters .check input { width: auto; accent-color: var(--navy); }
.did-you-mean a { font-style: italic; }

/* Selection & export */
.result.selectable { display: flex; gap: 12px; align-items: flex-start; }
.result-body { min-width: 0; flex: 1; }
.pick { margin-top: 5px; width: 17px; height: 17px; accent-color: var(--navy); flex-shrink: 0; cursor: pointer; }
.results-head p { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0; }
.export-menu { position: relative; }
.export-menu summary { list-style: none; cursor: pointer; background: var(--navy); color: #fff; font-weight: 600; font-size: .92rem; padding: 7px 14px; border-radius: 6px; display: inline-flex; align-items: center; gap: 8px; user-select: none; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu summary::after { content: "▾"; font-size: .8rem; }
.export-menu[open] summary { background: var(--navy-2); }
.pick-count { background: var(--accent); color: var(--navy); border-radius: 999px; padding: 0 7px; font-size: .78rem; }
.export-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 300px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.14); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.export-panel button { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; display: flex; flex-direction: column; }
.export-panel button:hover { border-color: var(--navy-2); background: #fff; }
.export-panel button small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.export-scope { margin: 0 0 4px; font-size: .9rem; font-weight: 600; }
.export-hint { margin: 4px 0 0; font-size: .8rem; }
.cite-links { display: flex; flex-wrap: wrap; gap: 8px; }
.cite-links a { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font-size: .9rem; font-weight: 600; }
.cite-links a:hover { background: var(--bg); text-decoration: none; }

/* Journals */
.filter-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: 10px; margin-top: 12px; }
.filter-row button { border-radius: 6px; padding: 10px 20px; }
.journal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.journal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, border-color .15s; }
.journal-card:hover { text-decoration: none; border-color: #c5cfdd; box-shadow: var(--shadow); }
.journal-card h2 { font-family: var(--serif); font-size: 1.05rem; color: var(--navy); }
.journal-card p { margin: 0; font-size: .9rem; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }

/* Article detail */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; margin-top: 24px; }
.subhero + .article-layout { margin-top: 0; }
.article-main { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; min-width: 0; }
.article-main section { margin-top: 28px; }
.article-main h2 { font-size: 1.05rem; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.doc-type { text-transform: uppercase; letter-spacing: .6px; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0 0 6px; }
.article-title { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2rem); }
.author-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 1.02rem; }
.author-list li:not(:last-child)::after { content: ","; margin-right: 8px; }
.orcid { font-size: .75rem; background: #a6ce39; color: #fff; padding: 1px 5px; border-radius: 3px; }
.article-source { color: var(--muted); margin: 0 0 16px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.abstract { text-align: justify; hyphens: auto; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { background: var(--bg); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; font-size: .9rem; color: var(--ink); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: .93rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; }
.related { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.related li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.related li:last-child { border-bottom: 0; }
.history-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.history-item:last-child { border-bottom: 0; }
.history-item small { width: 100%; }

/* Footer */
.site-footer { background: var(--navy); color: #c9d5ea; margin-top: 40px; padding: 32px 0; font-size: .92rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner p { max-width: 520px; margin: 6px 0 0; }
.footer-inner strong { color: #fff; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: #fff; }

/* Responsive */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .layout-sidebar, .article-layout, .grid-2 { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filter-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:first-child { grid-column: span 2; }
  .hero { padding: 36px 0 52px; }
  .searchbar button { padding: 0 16px; }
  .filter-row { grid-template-columns: 1fr; }
  .article-main { padding: 20px; }
  .results { padding: 4px 16px 12px; }
  .nav a { padding: 6px 8px; font-size: 14px; }
  .header-inner { padding-top: 8px; padding-bottom: 8px; }
  .brand-text small { display: none; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .export-panel { left: 0; right: auto; }
}
