/* PDF library (subjects/<slug>/sources/index.html) and the "Solved exams" placeholder
   (subjects/<slug>/exams/index.html). Both pages are generated by tools/build_sources_pages.py.
   Linked after tokens.css and study-surface.css; the title block and page width come from
   subject-index.css and the tab strip from subject-tabs.css, so the pages look like the subject
   indexes. Text uses the page text variables (never the accent), so every reading palette stays AAA. */
body.pdf-library {
  margin: 0; background: var(--bg-primary); color: var(--text-primary);
  font-family: var(--font-body); font-size: 1.04rem; line-height: 1.55;
}
.pdf-library .container { margin: 0 auto; padding: 0 24px; }
.pdf-library .site-header { border-bottom: 1px solid var(--border-subtle); background: var(--bg-secondary); }
.pdf-library .header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; }
.pdf-library .header-left, .pdf-library .header-right { display: flex; align-items: center; gap: 10px; }
.pdf-library .back-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border-card);
  border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); text-decoration: none; font-size: .95rem;
}
.pdf-library .back-link:hover { color: var(--text-primary); border-color: var(--accent); }
.pdf-library h1 { font-family: var(--font-display); font-weight: 400; color: var(--text-primary); }
.pdf-library .page-header .icon { color: var(--accent); }

/* ---- search and filters ---- */
.lib-tools {
  display: grid; gap: 12px; margin: 0 auto 22px; padding: 16px 18px; max-width: 980px;
  border: 1px solid var(--border-card); border-radius: var(--radius-lg, 18px); background: var(--bg-card);
}
.lib-search { position: relative; display: block; }
.lib-search::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  background-color: var(--accent);
  -webkit-mask: var(--lib-ico-search) center / contain no-repeat; mask: var(--lib-ico-search) center / contain no-repeat;
}
.lib-search input {
  width: 100%; box-sizing: border-box; padding: 11px 14px 11px 42px; border: 1px solid var(--border-card);
  border-radius: 999px; background: var(--bg-input, transparent); color: var(--text-primary);
  font: inherit; font-size: 1rem;
}
.lib-search input::placeholder { color: var(--text-secondary); opacity: 1; }
.lib-search input:focus-visible, .lib-chip:focus-visible, .lib-select:focus-visible, .lib-item a:focus-visible, .lib-reset:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.lib-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lib-row[hidden] { display: none; }
.lib-label {
  flex: none; min-width: 3.6rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-secondary);
}
.lib-chip {
  padding: 6px 13px; border: 1px solid var(--border-card); border-radius: 999px; background: transparent;
  color: var(--text-secondary); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.lib-chip:hover { color: var(--text-primary); background: var(--bg-input, rgba(127, 127, 127, .08)); }
.lib-chip[aria-pressed="true"] {
  color: var(--text-primary); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.lib-chip .n { margin-left: 6px; font-family: var(--font-mono); font-size: .74rem; font-weight: 500; }
.lib-select {
  padding: 6px 30px 6px 12px; border: 1px solid var(--border-card); border-radius: 999px;
  background: var(--bg-input, transparent); color: var(--text-primary); font: inherit; font-size: .95rem; max-width: 100%;
}
.lib-select option { background: var(--bg-secondary); color: var(--text-primary); }
.lib-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lib-count { margin: 0; font-family: var(--font-mono); font-size: .8rem; color: var(--text-secondary); }
.lib-reset {
  border: 0; background: none; padding: 2px 4px; color: var(--text-primary); font: inherit; font-size: .92rem;
  text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; cursor: pointer;
}
.lib-reset[hidden] { display: none; }

/* ---- groups and files ---- */
.lib-group { margin: 0 0 22px; }
.lib-group[hidden], .lib-item[hidden] { display: none; }
.lib-group > h2 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; padding: 0 0 6px 12px;
  font-family: var(--font-display); font-weight: 400; font-size: 1.18rem; color: var(--text-primary);
  border-left: 3px solid var(--accent); border-bottom: 0;
}
.lib-group > h2 .count { font-family: var(--font-mono); font-size: .74rem; color: var(--text-secondary); letter-spacing: .04em; }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
.lib-item { margin: 0; padding: 0; border: 0; display: block; }
.lib-item a {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
  height: 100%; box-sizing: border-box; padding: 10px 14px; border: 1px solid var(--border-card);
  border-radius: var(--radius-md, 14px); background: var(--bg-card); color: var(--text-primary); text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}
.lib-item a:hover { border-color: var(--accent); transform: translateY(-1px); }
.lib-item a::before {
  content: ""; grid-row: 1 / span 2; width: 20px; height: 20px; background-color: var(--accent);
  -webkit-mask: var(--lib-ico, var(--lib-ico-file)) center / contain no-repeat; mask: var(--lib-ico, var(--lib-ico-file)) center / contain no-repeat;
}
.lib-name { grid-column: 2; overflow-wrap: anywhere; line-height: 1.3; }
.lib-meta { grid-column: 2; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-secondary); }
.lib-size { grid-column: 3; grid-row: 1 / span 2; font-family: var(--font-mono); font-size: .76rem; color: var(--text-secondary); white-space: nowrap; }
.lib-empty { margin: 30px 0; text-align: center; color: var(--text-secondary); }
.lib-empty[hidden] { display: none; }
.lib-note { margin: 30px auto 0; max-width: 980px; padding: 12px 16px; border: 1px solid var(--border-card); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-secondary); font-size: .93rem; }
.pdf-library .site-footer { margin-top: 26px; padding: 16px 0 22px; text-align: center; color: var(--text-secondary); font-size: .9rem; border-top: 1px solid var(--border-subtle); }
.pdf-library .site-footer .footer-inner { display: inline-flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; }
.lib-seal { flex: none; width: 20px; height: 20px; display: block; }
.lib-seal .sideris-stroke { stroke: #E1C170; fill: none; }
.lib-seal .sideris-fill { fill: #E1C170; stroke: none; }
html[data-theme="light"] .lib-seal .sideris-stroke { stroke: #9a6e17; }
html[data-theme="light"] .lib-seal .sideris-fill { fill: #9a6e17; }

/* icons: the same 24 px grid and 1.8 stroke as the tab strip */
.pdf-library {
  --lib-ico-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  --lib-ico-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M8.5 12.5h7M8.5 16.5h7'/%3E%3C/svg%3E");
}
.lib-item[data-kind="teoria"] { --lib-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6.5C10.2 5.2 7.6 4.5 4 4.5v13c3.6 0 6.2.7 8 2 1.8-1.3 4.4-2 8-2v-13c-3.6 0-6.2.7-8 2z'/%3E%3Cpath d='M12 6.5v13'/%3E%3C/svg%3E"); }
.lib-item[data-kind="slides"] { --lib-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='12' rx='2'/%3E%3Cpath d='M12 16.5v3M8.5 20.5h7'/%3E%3C/svg%3E"); }
.lib-item[data-kind="problemas"] { --lib-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4.5L15.5 5a2.1 2.1 0 0 1 3 3L8 18.5 4 20z'/%3E%3Cpath d='M13.5 7l3 3'/%3E%3Cpath d='M13 20h7'/%3E%3C/svg%3E"); }
.lib-item[data-kind="exam"] { --lib-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4.5' width='14' height='16.5' rx='2'/%3E%3Cpath d='M9 4.5v-.7a.8.8 0 0 1 .8-.8h4.4a.8.8 0 0 1 .8.8v.7a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1z'/%3E%3Cpath d='M8.8 13.2l2.2 2.2 4.4-4.6'/%3E%3C/svg%3E"); }

/* ---- "Solved exams" placeholder ---- */
.soon-card {
  max-width: 620px; margin: 10px auto 0; padding: 34px 28px; text-align: center;
  border: 1px dashed var(--border-card); border-radius: var(--radius-lg, 18px); background: var(--bg-card);
}
.soon-badge {
  display: inline-block; margin: 0 0 12px; padding: 3px 12px; border: 1px solid var(--accent); border-radius: 999px;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-primary);
}
.soon-card h2 { margin: 0 0 8px; padding: 0; border: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; color: var(--text-primary); }
.soon-card p { margin: 0 auto 20px; max-width: 46ch; color: var(--text-secondary); }
.soon-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text-primary); text-decoration: none; font-weight: 600;
}
.soon-link:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }

@media (max-width: 700px) {
  .pdf-library .container { padding: 0 14px; }
  .lib-list { grid-template-columns: 1fr; }
  .lib-label { min-width: 100%; }
}
@media print { .lib-tools, .pdf-library .site-header { display: none; } }
