/*** TEMPLATES SECTION (landing page) ***/
section.templates-section {
    background: linear-gradient(180deg, #F7F2F9 0%, #FFFFFF 75%);
    position: relative;
    overflow: hidden;
}

/* soft brand glow behind the heading */
section.templates-section::before {
    content: "";
    position: absolute;
    top: -160px;
    inset-inline-start: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: rgba(144, 193, 72, .16);
    filter: blur(70px);
    pointer-events: none;
}

.templates-section-inner {
    box-sizing: border-box;
    position: relative;
}

.templates-eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 16px;
    border-radius: 20px;
    background: #C2D8A2;
    color: #4E2053;
    font-size: 15px;
    font-weight: bold;
}

.templates-section .section-heading__title {
    color: #4E2053;
}

/* category filters */
.templates-filters {
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 35px;
}

.templates-filters__btn {
    padding: 6px 18px;
    border: 1px solid #D8D8D8;
    border-radius: 20px;
    background: #fff;
    color: #313131;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    line-height: 22px;
    cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s;
}

.templates-filters__btn:hover {
    border-color: #90C148;
}

.templates-filters__btn--active {
    border-color: #90C148;
    background: #90C148;
    color: #313131;
}

/* cards */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 25px;
    margin-bottom: 40px;
    transition: opacity .2s;
}

.templates-grid--loading {
    opacity: .5;
}

.template-card {
    display: flex;
    flex-flow: column;
    border: 1px solid #D8D8D8;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    text-decoration: none;
    color: #313131;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.template-card:hover {
    border-color: #90C148;
    box-shadow: 0 10px 24px rgba(78, 32, 83, .10);
    transform: translateY(-4px);
}

.template-card__thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* matches the admin thumbnail crop tool's actual 205x185 target
       (TemplateForm.vue) - a mismatched ratio here means object-fit:cover
       crops real thumbnails instead of showing them uncropped */
    aspect-ratio: 205 / 185;
    background: var(--thumb-color, #EFE3EF);
    overflow: hidden;
}

.template-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* shown when a template has no image of its own */
.template-card__initial {
    color: #4E2053;
    font-size: 40px;
    font-weight: bold;
    line-height: 1;
    opacity: .5;
}

.template-card__type {
    position: absolute;
    top: 8px;
    /* inline-end (left in RTL) reads as more secondary than the start corner */
    inset-inline-end: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    /* solid (not translucent) so it stays legible over a photo/image background */
    background: #F0F0F0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
    font-size: 12px;
    font-weight: normal;
    line-height: 16px;
    color: #999999;
}

.template-card__body {
    display: flex;
    flex-flow: column;
    flex: 1 1 auto;
    gap: 6px;
    padding: 16px;
}

.template-card__title {
    color: #4E2053;
    font-size: 1.05em;
    font-weight: bold;
    line-height: 24px;
}

.template-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    line-height: 22px;
    color: #555;
}

.template-card__badges {
    display: flex;
    flex-flow: row wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 10px;
}

.template-card__badge {
    padding: 2px 10px;
    border-radius: 12px;
    background: #F0F0F0;
    font-size: 13px;
    line-height: 20px;
    color: #4E2053;
}

/* call to action */
.templates-cta {
    text-align: center;
}

.templates-cta__note {
    margin: 12px 0 0;
    font-size: 15px;
    color: #666;
}

/* reveal on scroll */
.template-card {
    opacity: 0;
    transform: translateY(16px);
}

.template-card--visible {
    opacity: 1;
    transform: none;
    transition: opacity .45s ease, transform .45s ease, border-color .2s, box-shadow .2s;
}

.template-card--visible:hover {
    transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
    .template-card,
    .template-card--visible {
        opacity: 1;
        transform: none;
        transition: border-color .2s, box-shadow .2s;
    }
}

@media screen and (max-width: 1090px) {
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 767px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 15px;
    }

    .template-card__body {
        padding: 12px;
    }

    .templates-filters {
        margin-bottom: 25px;
    }
}

@media screen and (max-width: 420px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }
}
