/* Template gallery (public/js/templates.js); family variables, light and dark, no gradients */
.tpl-section { padding: 32px 24px 72px; }
.tpl-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-search-box { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 16px; min-height: 46px; }
.tpl-search-box:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tpl-search-box .i { color: var(--muted); }
.tpl-search-box input.tpl-search { flex: 1; -webkit-appearance: none; appearance: none; border: 0; border-radius: 0; box-shadow: none; background: transparent; font: inherit; font-size: 15px; color: var(--text); min-width: 0; height: auto; padding: 10px 0; margin: 0; outline: none; }
.tpl-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tpl-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: thin; }
.tpl-chip { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tpl-chip:hover { border-color: var(--border-strong); }
.tpl-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; align-items: start; }
.tpl-card { display: flex; flex-direction: column; gap: 6px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); font: inherit; text-decoration: none; }
.tpl-thumb { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; max-height: 300px; width: 100%; transition: box-shadow .15s, transform .15s; }
.tpl-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tpl-card:hover .tpl-thumb, .tpl-card:focus-visible .tpl-thumb { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tpl-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.tpl-cat { font-size: 12px; color: var(--muted); }
.tpl-empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.tpl-preview .tpl-meta { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }
.tpl-pages { display: grid; gap: 16px; justify-items: center; max-height: 64vh; overflow: auto; padding: 4px; }
.tpl-page { position: relative; overflow: hidden; border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
.tpl-page .db-page { position: absolute; left: 0; top: 0; }
.tpl-big { max-width: 100%; border-radius: 8px; }
.tpl-loading { padding: 40px; }
.tpl-intro { max-width: 760px; margin: 0 auto; }
.tpl-cats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0; }
#tpl-gallery > .tpl-cats { justify-content: flex-start; margin-top: 0; }
.tpl-cats a { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tpl-cats a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 600px) {
  .tpl-section { padding: 22px 16px 56px; }
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tpl-thumb { max-height: 220px; }
}
.tpl-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-filter .sm-btn { min-height: 40px; border-radius: 999px; }
.tpl-colors { display: flex; gap: 5px; flex-wrap: wrap; }
.tpl-color { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer; padding: 0; }
.tpl-color[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.tpl-color[data-color="red"] { background: #dc2626; } .tpl-color[data-color="orange"] { background: #ea580c; } .tpl-color[data-color="yellow"] { background: #facc15; }
.tpl-color[data-color="green"] { background: #16a34a; } .tpl-color[data-color="teal"] { background: #0d9488; } .tpl-color[data-color="blue"] { background: #2563eb; }
.tpl-color[data-color="purple"] { background: #7c3aed; } .tpl-color[data-color="pink"] { background: #db2777; } .tpl-color[data-color="black"] { background: #111111; }
.tpl-color[data-color="white"] { background: #ffffff; } .tpl-color[data-color="grey"] { background: #9ca3af; }
.tpl-more { display: flex; justify-content: center; padding: 28px; }
