:root {
  --bg: #000;
  --panel: #0a0a0a;
  --line: #242424;
  --ink: #fff;
  --muted: #8d8d8d;
  --soft: #c6c6c6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Helvetica, Arial, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.container { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; }
.nav { display: flex; gap: .8rem; padding: 1rem max(1.25rem, calc((100% - 1180px) / 2)); border-bottom: 1px solid #161616; color: #444; font-size: .82rem; }
.nav a { color: #888; text-decoration: none; }
.nav a:hover { color: var(--ink); }
.library-header { padding: 4.8rem 0 3rem; border-bottom: 1px solid var(--line); background: #080808; }
.eyebrow { margin: 0 0 .75rem; color: #777; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 850px; margin: 0; font-size: clamp(2.45rem, 6vw, 4.7rem); letter-spacing: -.06em; line-height: .98; }
.library-header p:last-child { max-width: 700px; margin: 1rem 0 0; color: var(--muted); font-size: 1.08rem; }

main { padding: 2.5rem 0 4rem; }
.stats { display: flex; justify-content: center; gap: 5rem; margin-bottom: 2rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.stats div { display: grid; text-align: center; }
.stats strong { color: #aaa; font-size: 2rem; line-height: 1.15; }
.stats span { margin-top: .35rem; color: #666; font-size: .82rem; }

.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.filters label { color: #777; font-size: .8rem; }
.filters input, .filters select { display: block; width: 100%; margin-top: .45rem; padding: .65rem; border: 1px solid #333; border-radius: 4px; background: #000; color: var(--ink); font: inherit; font-size: .92rem; }
.filters input:focus, .filters select:focus { outline: none; border-color: #888; }
.results { min-height: 1.3rem; margin: 0 0 1rem; color: #666; font-size: .88rem; }

.documents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(335px, 1fr)); gap: 1rem; }
.document-card { display: flex; gap: 1rem; min-height: 186px; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); transition: border-color .2s, transform .2s; }
.document-card:hover { border-color: #555; transform: translateY(-2px); }
.document-cover { width: 78px; min-width: 78px; height: 118px; object-fit: cover; border: 1px solid #292929; border-radius: 4px; background: #161616; }
.placeholder { display: grid; place-items: center; color: #4c4c4c; font-size: 1.1rem; font-weight: 700; letter-spacing: .08em; }
.document-info { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.document-info h2 { margin: 0; color: var(--ink); font-size: 1rem; line-height: 1.28; }
.author { margin: .3rem 0 0; color: #aaa; font-size: .9rem; }
.format { margin: .15rem 0 .55rem; color: #666; font-size: .78rem; }
.format span { padding: 0 .15rem; }
.note { margin: 0 0 .85rem; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.open-link, .source-link { color: #c9c9c9; text-decoration: none; font-size: .83rem; }
.open-link { margin-top: auto; font-weight: 700; }
.source-link { margin-top: .3rem; color: #767676; }
.open-link:hover, .source-link:hover { color: #fff; text-decoration: underline; }
.empty { padding: 3rem; color: #777; text-align: center; }
.footer { padding-bottom: 3rem; color: #666; font-size: .8rem; }

@media (max-width: 760px) {
  .container { width: min(100% - 2rem, 1180px); }
  .library-header { padding: 3.25rem 0 2rem; }
  .stats { gap: 1.25rem; justify-content: space-around; padding: 1rem .5rem; }
  .stats strong { font-size: 1.5rem; }
  .stats span { font-size: .7rem; }
  .filters { grid-template-columns: 1fr; }
  .documents-grid { grid-template-columns: 1fr; }
}
