/* assets/css/templates.css
   TEMPLATES (per-category) page only. */

/* Hero backdrop */
.tpl-hero-glow {
    position: absolute;
    top: -6rem;
    left: 50%;
    transform: translateX(-50%);
    width: 46rem;
    height: 30rem;
    background: radial-gradient(ellipse at center, rgba(79,70,229,0.14) 0%, transparent 65%);
    z-index: 0;
    pointer-events: none;
}
.dark .tpl-hero-glow {
    background: radial-gradient(ellipse at center, rgba(99,102,241,0.22) 0%, transparent 65%);
}

/* Card entrance */
.tpl-card {
    opacity: 0;
    transform: translateY(18px);
    animation: tplIn 0.5s ease forwards;
}
@keyframes tplIn { to { opacity: 1; transform: translateY(0); } }

/* Preview screenshot */
.tpl-shot-wrap {
    aspect-ratio: 16 / 10;
    background: #f1f5f9;
    overflow: hidden;
}
.dark .tpl-shot-wrap { background: #1e293b; }

.tpl-shot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
}
.tpl-card:hover .tpl-shot { transform: scale(1.05); }

/* Fallback when image is missing */
.tpl-fallback {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #94a3b8;
    font-size: 0.8rem;
}
.tpl-fallback i { font-size: 2rem; }

/* Hover overlay with Preview button */
.tpl-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0);
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}
.tpl-shot-wrap:hover .tpl-overlay {
    opacity: 1;
    background: rgba(15, 23, 42, 0.45);
}
.tpl-overlay-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 9999px;
    background: #fff;
    color: #4f46e5;
    font-size: 0.85rem;
    font-weight: 600;
    transform: translateY(6px);
    transition: transform 0.3s ease;
}
.tpl-shot-wrap:hover .tpl-overlay-btn { transform: translateY(0); }

/* Loader */
.tpl-loader {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--color-primary);
    animation: tplSpin 0.7s linear infinite;
}
.dark .tpl-loader { border-color: #334155; border-top-color: #818cf8; }
@keyframes tplSpin { to { transform: rotate(360deg); } }

#tpl-spinner.show { display: flex; }

@media (prefers-reduced-motion: reduce) {
    .tpl-card { opacity: 1 !important; transform: none !important; animation: none !important; }
    .tpl-shot { transition: none !important; }
}
