/* Frame around the printables. Each document is rendered by <doc-page>, which
   owns its own desk background and page geometry, so nothing here touches the
   sheet itself. The whole bar is screen-only and disappears at print time.
   Font sizes stay at or above 16px per the library's minimum-size rule. */

.pr-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(14px, 2.4vw, 28px);
  background: var(--sage-dark, #1f3d24);
  color: #f4f1e8;
  border-bottom: 1px solid rgba(201, 169, 97, .3);
  font-family: var(--font-gentium, Georgia, "Times New Roman", serif);
  font-size: 16px;
  line-height: 1.3;
}

.pr-brand { font-family: var(--font-palatino, Palatino, Georgia, serif); font-size: 20px; }
.pr-eyebrow { font-size: 16px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(244, 241, 232, .62); }
.pr-sep { width: 1px; height: 20px; background: rgba(244, 241, 232, .25); }
.pr-title { font-size: 16px; color: rgba(244, 241, 232, .92); }
.pr-count { font-size: 16px; color: rgba(244, 241, 232, .58); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-grow { flex: 1; min-width: 8px; }

.pr-link {
  color: #f4f1e8;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(244, 241, 232, .35);
}
.pr-link:hover { border-bottom-color: #f4f1e8; }

.pr-btn {
  font-family: inherit;
  font-size: 16px;
  padding: 5px 16px;
  border-radius: 999px;
  border: 1px solid rgba(244, 241, 232, .45);
  background: transparent;
  color: #f4f1e8;
  cursor: pointer;
}
.pr-btn:hover { background: rgba(244, 241, 232, .12); }

/* On narrow screens the document title is the first thing worth dropping. */
@media (max-width: 700px) {
  .pr-title, .pr-eyebrow, .pr-sep { display: none; }
}

@media print {
  .pr-bar { display: none !important; }
  .pr-stage { margin: 0 !important; padding: 0 !important; }
}

/* Library filtering. The controls stick to the top of the scroll area so a long result set can be
   narrowed without scrolling back up, and they are removed from print. */
.pr-filters {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 38px 0 20px;
  padding: 16px 0 14px;
  background: var(--parchment-light, #faf7ef);
  border-bottom: 1px solid var(--line, #e7e1cf);
}
.pr-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.pr-field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.pr-field-grow { flex: 1 1 260px; }
.pr-field > span {
  font-size: 13px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-light, #7a7263);
  font-weight: 700;
}
.pr-field input,
.pr-field select {
  font-family: inherit;
  font-size: 16px;
  padding: 9px 12px;
  border: 1px solid var(--line, #e7e1cf);
  border-radius: 8px;
  background: var(--card, #fff);
  color: var(--text-dark, #2b2b26);
}
.pr-field input:focus,
.pr-field select:focus { outline: 2px solid var(--sage-green, #265c2f); outline-offset: 1px; }
.pr-clear {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 18px;
  border: 1px solid var(--line, #e7e1cf);
  border-radius: 8px;
  background: transparent;
  color: var(--sage-green, #265c2f);
  cursor: pointer;
}
.pr-clear:hover { border-color: var(--sage-green, #265c2f); }
.pr-count-line { margin: 12px 0 0; font-size: 15px; font-style: italic; color: var(--text-light, #7a7263); }

.pr-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
  align-items: stretch;
}
.pr-results .lib-card { display: flex; flex-direction: column; }
.pr-results .lib-desc { flex: 1; }
.lib-meta {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 15px;
  color: var(--text-light, #7a7263);
  border-top: 1px dashed var(--line, #e7e1cf);
  padding-top: 9px;
}
.lib-std {
  font-size: 13px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-light, #7a7263);
  margin: 6px 0 10px;
  word-break: break-word;
}
.pr-empty { font-size: 17px; font-style: italic; color: var(--text-light, #7a7263); }

@media print {
  .pr-filters, .pr-clear, .pr-count-line { display: none !important; }
}

/* The edit affordance. Rendered only for an admin session: /api/printables answers 403 to
   anyone else, and that answer is what decides. A card is a whole anchor, so the edit link
   sits beside it in a wrapper rather than inside it, which would be an anchor in an anchor. */
.lib-cardwrap { position: relative; display: flex; }
.lib-cardwrap > .lib-card { flex: 1; }
.lib-cardwrap > .lib-edit {
  position: absolute; right: 12px; top: 12px; z-index: 2;
  font-size: 12px; padding: 3px 10px; border-radius: 10px;
  background: var(--chip-green, #e3ecdf); color: var(--accent-text, #265c2f);
  text-decoration: none; border: 1px solid rgba(38, 92, 47, 0.22);
}
.lib-cardwrap > .lib-edit:hover { background: var(--accent, #265c2f); color: #fff; }
.pr-rowwrap { display: flex; align-items: center; gap: 10px; }
.pr-rowwrap > .pr-row { flex: 1; min-width: 0; }
.pr-rowwrap > .lib-edit {
  flex: 0 0 auto; font-size: 12px; padding: 3px 10px; border-radius: 10px;
  background: var(--chip-green, #e3ecdf); color: var(--accent-text, #265c2f);
  text-decoration: none; border: 1px solid rgba(38, 92, 47, 0.22);
}
.pr-rowwrap > .lib-edit:hover { background: var(--accent, #265c2f); color: #fff; }
