/* PDF template gallery (/templates/) and template pages */
.tp-search { position: relative; max-width: 560px; margin: 8px auto 0; }
.tp-search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.tp-search input { width: 100%; height: 50px; padding: 0 16px 0 42px; font: inherit; font-size: 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); }
.tp-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.tp-gallery { padding-top: 28px; }
.tp-cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin-bottom: 18px; scrollbar-width: none; position: sticky; top: var(--header-h, 0); z-index: 3; background: var(--bg); }
.tp-cats::-webkit-scrollbar { display: none; }
.tp-cats .chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.tp-cats .chip:hover { border-color: var(--border-strong); }
.tp-cats .chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.tp-group { margin-bottom: 40px; }
.tp-group > h2 { font-size: 20px; letter-spacing: -.015em; margin: 0 0 14px; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.tp-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.tp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tp-thumb { display: block; background: var(--surface-2); padding: 14px 14px 0; border-bottom: 1px solid var(--border); aspect-ratio: 595 / 600; overflow: hidden; }
.tp-thumb img { display: block; width: 100%; height: auto; border-radius: 4px 4px 0 0; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); transition: transform .2s; }
.tp-card:hover .tp-thumb img { transform: translateY(-3px); }
.tp-meta { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 6px; flex: 1; }
.fx .tp-card .tp-meta a.tp-name.tp-name, .fx .tp-card a.tp-thumb.tp-thumb { color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; }
.fx .tp-card .tp-meta a.tp-name.tp-name:hover { color: var(--accent-text); }
.tp-meta span { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tp-use { margin: 6px 14px 14px; }
.tp-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.tp-hero { text-align: left; }
.tp-hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.tp-hero .fx-crumbs { justify-content: flex-start; }
.tp-hero h1 { margin-left: 0; }
.tp-hero .fx-sub { margin-left: 0; }
.tp-hero .fx-ctas.left, .tp-hero .fx-trust { justify-content: flex-start; align-items: center; }
.tp-hero .fx-ctas .btn .i { margin-right: 6px; }
.tp-preview { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.tp-preview img { display: block; width: 100%; height: auto; box-shadow: 0 6px 24px rgba(16, 24, 40, .14); border-radius: 3px; }
.tp-note { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) {
  .tp-hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .tp-preview { max-width: 420px; }
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tp-meta span { display: none; }
  .tp-use { margin: 4px 10px 10px; }
}
/* Busy overlay while a template opens (same as Create PDF) */
.cr-busy { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(16, 24, 40, .32); }
.cr-busy .card { display: flex; gap: 12px; align-items: center; padding: 18px 26px; font-weight: 600; }

/* FormsBat: form thumbnails are 4 by 3 screenshots of the real public form */
.tp-thumb { padding: 0; aspect-ratio: 4 / 3; }
.tp-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 0; box-shadow: none; }
.tp-card:hover .tp-thumb img { transform: scale(1.02); }
.tp-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tp-tags em { font-style: normal; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.tp-preview img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); display: block; }
.tp-questions { list-style: none; padding: 0; display: grid; gap: 6px; }
.tp-questions li { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.tp-questions li .i { color: var(--accent-text); width: 16px; height: 16px; }
.tp-questions li.tp-break { background: var(--surface-2); font-weight: 600; }
.tp-questions small { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* Category chips wrap at every width so none is cut off at the edge; they stay pinned under the header on wide screens only */
.tp-cats { flex-wrap: wrap; overflow: visible; padding: 12px 0 14px; margin-bottom: 22px; }
.tp-cats .chip { height: 34px; font-size: 13.5px; }
@media (max-width: 899px) { .tp-cats { position: static; padding-top: 0; } }
@media (max-width: 600px) { .tp-cats { gap: 6px; } .tp-cats .chip { height: 32px; padding: 0 12px; font-size: 13px; } }
/* Two cards across on phones so the gallery is not one very long column */
@media (max-width: 600px) {
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tp-meta { padding: 10px 10px 4px; }
  .fx .tp-card .tp-meta a.tp-name.tp-name { font-size: 14px; }
  .tp-tags em:nth-child(n+2) { display: none; }
  .tp-use { margin: 4px 10px 10px; font-size: 13px; }
}
