/* Templates hub and category pages (Premium 2.0). Layout only: the templates themselves are ordinary tool pages. */
.won-tpl-hub { --tone: var(--ws-primary); color: var(--ws-text); }
.tone-blue { --tone: var(--ws-blue, #2f7df6); } .tone-purple { --tone: #8b5cf6; } .tone-pink { --tone: var(--ws-pink, #f0457f); } .tone-red { --tone: #e5484d; }
.tone-orange { --tone: var(--ws-orange, #f5742c); } .tone-green { --tone: var(--ws-green, #1fb86a); } .tone-violet { --tone: #7c3aed; } .tone-cyan { --tone: var(--ws-cyan, #22b8cf); }
.tone-yellow { --tone: #d9a100; } .tone-indigo { --tone: #4f46e5; }

.tpl-hero { position: relative; overflow: hidden; isolation: isolate; padding: clamp(2rem, 6vw, 4rem) 0 clamp(1.75rem, 4vw, 3rem); text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--ws-primary) 12%, var(--ws-surface)), color-mix(in srgb, var(--ws-primary) 5%, var(--ws-bg))); border-bottom: 1px solid var(--ws-border); }
.tpl-hero-wheel { position: absolute; z-index: -1; width: clamp(9rem, 20vw, 17rem); height: auto; opacity: .95; }
.tpl-hero-wheel--l { left: calc(-1 * clamp(2.5rem, 6vw, 5rem)); top: 12%; transform: rotate(-12deg); }
.tpl-hero-wheel--r { right: calc(-1 * clamp(2.5rem, 6vw, 5rem)); bottom: -12%; transform: rotate(18deg); }
.tpl-hero-inner { position: relative; max-width: 52rem; }
.tpl-hero h1 { margin: 0 0 var(--ws-s3); font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05; letter-spacing: -.035em; font-weight: 800; color: var(--ws-text); }
.tpl-lede { max-width: 40rem; margin: 0 auto var(--ws-s5); font-size: clamp(1rem, 2.1vw, 1.2rem); color: var(--ws-text-muted); line-height: 1.55; }
.tpl-crumbs ol { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; list-style: none; margin: 0 0 var(--ws-s3); padding: 0; font-size: var(--ws-fs-sm); color: var(--ws-text-muted); }
.tpl-crumbs li + li::before { content: "›"; margin-right: .35rem; }
.tpl-crumbs a { color: var(--ws-primary); text-decoration: none; } .tpl-crumbs a:hover { text-decoration: underline; }
.tpl-search { position: relative; display: flex; align-items: center; max-width: 42rem; margin: 0 auto; padding: 0 var(--ws-s4); border: 1.5px solid color-mix(in srgb, var(--ws-primary) 35%, var(--ws-border)); border-radius: var(--ws-r-pill); background: var(--ws-surface); box-shadow: var(--ws-shadow-md); color: var(--ws-text-muted); }
.tpl-search:focus-within { box-shadow: var(--ws-ring); border-color: var(--ws-primary); }
.tpl-search input { flex: 1; min-width: 0; padding: 1rem .8rem; border: 0; background: transparent; color: var(--ws-text); font: inherit; font-size: 1.05rem; outline: none; }
.tpl-search input::placeholder { color: var(--ws-text-muted); opacity: .9; }

.tpl-body { padding-block: var(--ws-s5) var(--ws-s7); }
.tpl-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--ws-s3); list-style: none; margin: 0 0 var(--ws-s6); padding: 0; }
.tpl-cat a { display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; padding: var(--ws-s4) var(--ws-s3); text-align: center; text-decoration: none; color: var(--ws-text); border-radius: var(--ws-r-lg); border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--ws-border)); background: color-mix(in srgb, var(--tone) 9%, var(--ws-surface)); transition: transform var(--ws-dur-fast, .15s) var(--ws-ease, ease), box-shadow var(--ws-dur-fast, .15s); }
.tpl-cat a:hover { transform: translateY(-3px); box-shadow: var(--ws-shadow-md); }
.tpl-cat a:focus-visible { outline: none; box-shadow: var(--ws-ring); }
.tpl-cat-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--ws-surface)); }
.tpl-cat-name { font-weight: 800; line-height: 1.2; font-size: var(--ws-fs-md); } .tpl-cat-count { font-size: var(--ws-fs-xs); color: var(--ws-text-muted); }
.tpl-cat.is-current a { border-color: var(--tone); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tone) 40%, transparent); }

.tpl-listhead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ws-s3); flex-wrap: wrap; margin-bottom: var(--ws-s3); }
.tpl-listhead h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.02em; font-weight: 800; }
.tpl-total { font-weight: 600; font-size: .6em; color: var(--ws-text-muted); }
.tpl-viewall { color: var(--ws-primary); font-weight: 700; text-decoration: none; } .tpl-viewall:hover { text-decoration: underline; }
.tpl-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ws-s3); margin-bottom: var(--ws-s4); }
.tpl-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.tpl-pill { padding: .5rem 1rem; border-radius: var(--ws-r-pill); border: 1px solid var(--ws-border); background: var(--ws-surface); color: var(--ws-text); font: inherit; font-size: var(--ws-fs-sm); font-weight: 600; cursor: pointer; min-height: 40px; }
.tpl-pill:hover { border-color: var(--ws-primary); }
.tpl-pill.is-active { background: var(--ws-primary); border-color: var(--ws-primary); color: #fff; }
.tpl-pill:focus-visible, .tpl-morebtn:focus-visible, .tpl-sort select:focus-visible { outline: none; box-shadow: var(--ws-ring); }
.tpl-sort select { min-height: 44px; padding: 0 2rem 0 1rem; border: 1px solid var(--ws-border); border-radius: var(--ws-r-md); background: var(--ws-surface); color: var(--ws-text); font: inherit; font-weight: 600; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: var(--ws-s4); list-style: none; margin: 0; padding: 0; }
.tpl-card { position: relative; display: flex; flex-direction: column; padding: var(--ws-s4); border: 1px solid var(--ws-border); border-radius: var(--ws-r-lg); background: var(--ws-surface); box-shadow: var(--ws-shadow-sm); transition: transform var(--ws-dur-fast, .15s) var(--ws-ease, ease), box-shadow var(--ws-dur-fast, .15s), border-color var(--ws-dur-fast, .15s); content-visibility: auto; contain-intrinsic-size: auto 26rem; }
.tpl-card:hover, .tpl-card:focus-within { transform: translateY(-4px); box-shadow: var(--ws-shadow-lg); border-color: color-mix(in srgb, var(--tone) 45%, var(--ws-border)); }
.tpl-card[hidden] { display: none; }
.tpl-preview { display: grid; place-items: center; margin-bottom: var(--ws-s3); }
.tpl-preview svg { width: min(12.5rem, 100%); height: auto; filter: drop-shadow(0 6px 10px rgba(40, 30, 100, .18)); transition: transform .6s var(--ws-ease, ease); }
.tpl-card:hover .tpl-preview svg { transform: rotate(40deg); }
.tpl-card-title { margin: 0 0 .3rem; font-size: var(--ws-fs-lg); line-height: 1.25; font-weight: 800; letter-spacing: -.015em; }
.tpl-card-title a { color: var(--ws-text); text-decoration: none; }
.tpl-card-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tpl-card-title a:focus-visible { outline: none; } .tpl-card-title a:focus-visible::after { box-shadow: var(--ws-ring); }
.tpl-card-text { margin: 0 0 var(--ws-s3); color: var(--ws-text-muted); font-size: var(--ws-fs-sm); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-card-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: auto 0 var(--ws-s3); font-size: var(--ws-fs-xs); }
.tpl-chip { padding: .25rem .65rem; border-radius: var(--ws-r-pill); font-weight: 700; color: color-mix(in srgb, var(--tone) 80%, var(--ws-text)); background: color-mix(in srgb, var(--tone) 12%, var(--ws-surface)); }
.tpl-count { color: var(--ws-text-muted); }
.tpl-cta { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; border-radius: var(--ws-r-md); background: var(--ws-primary); color: #fff; font-weight: 700; }
.tpl-card:hover .tpl-cta { background: var(--ws-primary-600, var(--ws-primary)); }
.tpl-empty { padding: var(--ws-s6); text-align: center; color: var(--ws-text-muted); border: 1px dashed var(--ws-border); border-radius: var(--ws-r-lg); }
.tpl-more { display: flex; justify-content: center; margin-top: var(--ws-s5); }
.tpl-morebtn { padding: .8rem 1.6rem; border-radius: var(--ws-r-pill); border: 1.5px solid var(--ws-primary); background: var(--ws-surface); color: var(--ws-primary); font: inherit; font-weight: 800; cursor: pointer; min-height: 48px; }
.tpl-morebtn:hover { background: var(--ws-primary-100); }

.tpl-related { margin-top: var(--ws-s7); } .tpl-related h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 800; }
.tpl-content { max-width: 52rem; margin: var(--ws-s7) auto 0; padding-top: var(--ws-s5); border-top: 1px solid var(--ws-border); }
.tpl-content h2 { margin-top: var(--ws-s5); font-size: clamp(1.3rem, 2.6vw, 1.7rem); letter-spacing: -.02em; font-weight: 800; }
.tpl-content :is(p, li) { line-height: 1.7; } .tpl-content a { color: var(--ws-primary); text-underline-offset: 3px; }

@media (max-width: 640px) {
  .tpl-body, .tpl-listing, .tpl-toolbar, .tpl-grid, .tpl-card { min-width: 0; max-width: 100%; }
  .tpl-card > * { min-width: 0; } .tpl-card-title a, .tpl-card-text { overflow-wrap: anywhere; }
  .tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .tpl-card { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); column-gap: var(--ws-s3); align-items: start; }
  .tpl-card .tpl-preview { grid-row: 1 / span 3; margin: 0; } .tpl-preview svg { width: 6.5rem; }
  .tpl-card-meta, .tpl-cta { grid-column: 1 / -1; }
  .tpl-pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; max-width: 100%; scrollbar-width: thin; } .tpl-pill { white-space: nowrap; flex: none; }
  .tpl-toolbar { flex-direction: column; align-items: stretch; } .tpl-sort select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .tpl-card, .tpl-cat a, .tpl-preview svg { transition: none; } .tpl-card:hover, .tpl-cat a:hover { transform: none; } .tpl-card:hover .tpl-preview svg { transform: none; } }
html[data-theme="dark"] .tpl-hero { background: linear-gradient(180deg, color-mix(in srgb, var(--ws-primary) 22%, var(--ws-bg)), var(--ws-bg)); }
