/* Templates: Figma desktop 204:11292 and mobile 209:15400 / 204:7365. */
.template-library {
  /* Keep the footer below the first viewport while the catalog loads. */
  min-height: calc(100vh / var(--page-scale, 1) - var(--header-height));
  padding-top: 60px;
  padding-bottom: 80px;
}
.template-library [hidden] { display: none !important; }
.template-intro h1 { font-size: 36px; line-height: 44px; font-weight: 700; letter-spacing: 0; }
.template-intro p { margin-top: 10px; color: var(--text-2); font-size: 20px; line-height: 28px; }
.template-browser { margin-top: 37px; }
.template-filters { border-bottom: 1px solid var(--line); }
.template-categories, .template-subcategories { display: flex; align-items: center; overflow-x: auto; }
.template-subcategories { scrollbar-width: none; }
.template-subcategories::-webkit-scrollbar { display: none; }
.template-categories { gap: 48px; padding-bottom: 23px; }
.template-categories::-webkit-scrollbar { height: 6px; }
.template-categories::-webkit-scrollbar-track { background: var(--surface); border-radius: var(--radius-pill); }
.template-categories::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: var(--radius-pill); }
@supports not selector(::-webkit-scrollbar) {
  .template-categories { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--surface); }
}
.template-categories button { flex: none; padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-size: 20px; line-height: 28px; font-weight: 500; white-space: nowrap; }
.template-categories button[aria-pressed="true"] { background: var(--brand); color: var(--white); font-weight: 700; }
.template-categories button:hover:not([aria-pressed="true"]) { background: var(--brand-08); color: var(--brand); }
.template-categories button:focus-visible, .template-subcategories button:focus-visible { outline-offset: -2px; }
.template-subcategories { gap: 49px; }
.template-subcategories button { flex: none; position: relative; padding-bottom: 20px; color: var(--text-3); font-size: 20px; line-height: 28px; font-weight: 400; white-space: nowrap; }
.template-subcategories button[aria-pressed="true"] { color: var(--brand); font-weight: 600; }
.template-subcategories button[aria-pressed="true"]::after { content: ''; position: absolute; inset: auto 0 0; height: 3px; background: var(--brand); }
.template-gallery { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 24px; margin-top: 48px; }
.template-tile { display: flex; align-items: center; justify-content: center; position: relative; aspect-ratio: 1; min-width: 0; padding: 16px; border-radius: 12px; background: var(--surface); }
.template-tile-art { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.template-tile-art img { width: auto; height: auto; max-width: 100%; max-height: 100%; border-radius: 8px; }
.template-tile:not(.template-tile-unavailable, [data-pointer-focus]):focus-visible { background: var(--brand-08); box-shadow: inset 0 0 0 3px var(--brand); }
@media (hover: hover) {
  .template-tile:not(.template-tile-unavailable):hover { background: var(--brand-08); box-shadow: inset 0 0 0 3px var(--brand); }
}
.template-tile-unavailable { color: var(--text-3); font-size: 12px; line-height: 18px; text-align: center; border: 1px dashed var(--line-2); }
.template-count { margin-top: 24px; color: var(--text-3); font-size: 14px; line-height: 20px; text-align: center; }
.template-pro { position: absolute; z-index: 1; top: var(--pro-badge-offset); right: var(--pro-badge-offset); width: 27px; height: 14px; background: url('../assets/templates/ui/pro.svg') center / contain no-repeat; color: var(--text-2); text-align: center; font-size: 8px; line-height: 14px; font-weight: 700; border-radius: 40px; }
.template-empty button { min-height: 44px; padding: 10px 24px; border: 1px solid var(--brand-32); border-radius: 8px; color: var(--brand); font-size: 16px; line-height: 24px; font-weight: 600; }
.template-empty button:hover { background: var(--brand-08); }
.template-empty { margin-top: 48px; padding: 48px 20px; text-align: center; background: var(--surface); border-radius: 12px; }
.template-empty h2 { font-size: 24px; line-height: 32px; }
.template-empty p { margin: 12px 0 24px; color: var(--text-2); line-height: 24px; }
.template-fallback { margin-top: 32px; line-height: 24px; }
.template-fallback a { color: var(--brand); text-decoration: underline; }
@media (min-width: 768px) and (max-width: 1199px) {
  .template-gallery { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 20px; }
  .template-categories { gap: 24px; }
  .template-categories button { font-size: 18px; }
}
@media (max-width: 767px) {
  .template-library { padding-top: 16px; padding-bottom: 80px; }
  .template-intro h1 { font-size: 20px; line-height: 28px; }
  .template-intro p { margin-top: 4px; font-size: 12px; line-height: 20px; }
  .template-browser { margin-top: 24px; }
  .template-categories { gap: 10px; padding-bottom: 11px; }
  .template-categories::-webkit-scrollbar { height: 4px; }
  .template-categories button { padding: 6px 8px; font-size: 14px; line-height: 20px; font-weight: 600; color: rgba(0,0,0,.42); }
  .template-categories button[aria-pressed="true"] { padding-inline: 8px; }
  .template-subcategories { gap: 24px; }
  .template-subcategories button { padding-bottom: 12px; font-size: 14px; line-height: 20px; }
  .template-subcategories button[aria-pressed="true"]::after { height: 2px; }
  .template-gallery { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 20px 7px 0; }
  .template-tile { padding: 10px; }
  .template-tile-art img { border-radius: 6px; }
  .template-empty { margin-top: 20px; }
}

/* Figma 603:2776: four 312 × 202 tiles with 280 × 170 landscape previews. */
.template-gallery-vcard { grid-template-columns: repeat(4,minmax(0,1fr)); }
.template-gallery-vcard .template-tile { aspect-ratio: auto; }
.template-gallery-vcard .template-tile-art { height: auto; aspect-ratio: 28 / 17; }
/* Center the landscape artwork within both padded square and landscape sources. */
.template-gallery-vcard .template-tile-art img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 1199px) {
  .template-gallery-vcard { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 959px) {
  .template-gallery-vcard { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 599px) {
  .template-gallery-vcard { grid-template-columns: minmax(0,1fr); }
}
