/*
 * Survey template gallery (/templates) and template search results.
 * The theme stylesheet is purged, so these components carry their own styles instead of
 * relying on utility classes that may not exist in the build. Colours follow the site brand.
 */

.tpl {
    --tpl-primary: var(--bs-primary, #12715B);
    --tpl-primary-600: var(--bs-primary-600, #0e5a49);
    --tpl-primary-700: var(--bs-primary-700, #0b4437);
    --tpl-primary-50: var(--bs-primary-50, #e7f1ef);
    --tpl-primary-100: var(--bs-primary-100, #d0e3de);
    --tpl-beige: var(--bs-secondary, #f5eee9);
    --tpl-border: var(--color-gray-50, #ececed);
    --tpl-border-strong: var(--color-gray-100, #dadadb);
    --tpl-muted: var(--color-gray-400, #6a6a70);
    --tpl-text: var(--color-gray-500, #45454c);
    --tpl-heading: var(--color-gray-900, #0e0e0f);
}

.tpl-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

.tpl-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 720px;
    margin: 0 auto;
    /* The site navigation overlays the top of the page, so the header clears it. */
    padding: 104px 0 40px;
    text-align: center;
}

@media (min-width: 992px) {
    .tpl-header {
        padding: 128px 0 48px;
    }
}

.tpl-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--tpl-primary-50);
    color: var(--tpl-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tpl-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--tpl-muted);
}

.tpl-breadcrumb a {
    color: var(--tpl-primary);
    font-weight: 500;
    text-decoration: none;
}

.tpl-breadcrumb a:hover {
    text-decoration: underline;
}

.tpl-title {
    margin: 0;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.1;
    color: var(--tpl-heading);
}

.tpl-title--search {
    font-size: clamp(30px, 4vw, 44px);
}

.tpl-subtitle {
    max-width: 560px;
    margin: 0;
    font-size: 18px;
    line-height: 1.6;
    color: var(--tpl-text);
}

.tpl-summary {
    margin: 4px 0 0;
    font-size: 15px;
    color: var(--tpl-muted);
}

/* ------------------------------------------------------------------ */
/* Search bar                                                          */
/* ------------------------------------------------------------------ */

.tpl-searchbar {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 640px;
    margin: 8px auto 0;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--tpl-border-strong);
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(14, 14, 15, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tpl-searchbar:focus-within {
    border-color: var(--tpl-primary);
    box-shadow: 0 0 0 4px rgba(18, 113, 91, 0.12), 0 10px 30px rgba(14, 14, 15, 0.06);
}

.tpl-searchbar-icon {
    flex: none;
    margin-inline-start: 14px;
    font-size: 20px;
    line-height: 1;
    color: var(--tpl-muted);
}

.tpl-searchbar-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 16px;
    color: var(--tpl-heading);
}

.tpl-searchbar-input::placeholder {
    color: var(--color-gray-300, #8f8f94);
}

.tpl-searchbar-button {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 26px;
    border: 0;
    border-radius: 999px;
    background: var(--tpl-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tpl-searchbar-button:hover,
.tpl-searchbar-button:focus-visible {
    background: var(--tpl-primary-600);
}

.tpl-searchbar-button .unicon-search {
    display: none;
    font-size: 20px;
}

@media (max-width: 575.98px) {
    .tpl-searchbar-icon {
        margin-inline-start: 10px;
    }

    .tpl-searchbar-button {
        width: 48px;
        padding: 0;
    }

    .tpl-searchbar-button .unicon-search {
        display: inline-block;
    }

    .tpl-searchbar-button-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ------------------------------------------------------------------ */
/* Category chips                                                      */
/* ------------------------------------------------------------------ */

.tpl-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

/* One scrollable row on phones instead of a tall stack of chips. */
@media (max-width: 767.98px) {
    .tpl-chips {
        flex-wrap: nowrap;
        justify-content: flex-start;
        margin: 0 -16px 24px;
        padding: 0 16px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tpl-chips::-webkit-scrollbar {
        display: none;
    }
}

.tpl-chips-label {
    margin-inline-end: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tpl-muted);
    white-space: nowrap;
}

.tpl-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    padding: 8px 16px;
    border: 1px solid var(--tpl-border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--tpl-heading);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tpl-chip:hover {
    border-color: var(--tpl-primary);
    color: var(--tpl-primary);
}

.tpl-chip--active,
.tpl-chip--active:hover {
    background: var(--tpl-primary);
    border-color: var(--tpl-primary);
    color: #fff;
}

.tpl-chip-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--tpl-beige);
    color: var(--tpl-text);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.tpl-chip--active .tpl-chip-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ------------------------------------------------------------------ */
/* Gallery layout: categories on the left, templates on the right      */
/* ------------------------------------------------------------------ */

.tpl-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.tpl-sidebar {
    position: sticky;
    top: 104px;
    padding: 20px 12px;
    border-radius: 20px;
    background: var(--tpl-beige);
}

.tpl-sidebar-title {
    margin: 0 0 12px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tpl-muted);
}

.tpl-cats {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tpl-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--tpl-heading);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tpl-cat:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--tpl-primary);
}

.tpl-cat--active,
.tpl-cat--active:hover {
    background: #fff;
    color: var(--tpl-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(14, 14, 15, 0.06);
}

.tpl-cat .tpl-chip-count {
    background: rgba(255, 255, 255, 0.8);
}

.tpl-cat--active .tpl-chip-count {
    background: var(--tpl-primary);
    color: #fff;
}

.tpl-cat-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-sidebar-note {
    margin: 12px 12px 0;
    font-size: 14px;
    color: var(--tpl-muted);
}

/* Next to the sidebar there is room for two cards per row until the page is wide. */
@media (max-width: 1199.98px) {
    .tpl-content .tpl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Below desktop the sidebar becomes a scrollable row of chips above the templates. */
@media (max-width: 991.98px) {
    .tpl-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .tpl-sidebar {
        position: static;
        padding: 0;
        background: none;
        border-radius: 0;
    }

    .tpl-sidebar-title {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .tpl-cats {
        flex-direction: row;
        gap: 8px;
        margin: 0 -16px 24px;
        padding: 0 16px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tpl-cats::-webkit-scrollbar {
        display: none;
    }

    .tpl-cat {
        flex: none;
        padding: 8px 16px;
        border: 1px solid var(--tpl-border-strong);
        border-radius: 999px;
        background: #fff;
        font-size: 14px;
    }

    .tpl-cat .tpl-chip-count {
        background: var(--tpl-beige);
    }

    .tpl-cat--active,
    .tpl-cat--active:hover {
        background: var(--tpl-primary);
        border-color: var(--tpl-primary);
        color: #fff;
        box-shadow: none;
    }

    .tpl-cat--active .tpl-chip-count {
        background: rgba(255, 255, 255, 0.2);
    }

    .tpl-sidebar-note {
        margin: -12px 0 24px;
    }
}

@media (max-width: 575.98px) {
    .tpl-content .tpl-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ------------------------------------------------------------------ */
/* Template cards                                                      */
/* ------------------------------------------------------------------ */

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 991.98px) {
    .tpl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 575.98px) {
    .tpl-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.tpl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--tpl-border);
    border-radius: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tpl-card:hover {
    border-color: var(--tpl-primary-100);
    box-shadow: 0 16px 40px rgba(14, 14, 15, 0.08);
    transform: translateY(-3px);
}

.tpl-card-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--tpl-beige);
}

.tpl-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.tpl-card:hover .tpl-card-thumb img {
    transform: scale(1.04);
}

.tpl-card-category {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    max-width: calc(100% - 24px);
    padding: 4px 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--tpl-primary-700);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-shadow: 0 2px 8px rgba(14, 14, 15, 0.08);
}

.tpl-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
}

.tpl-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

.tpl-card-title a {
    color: var(--tpl-heading);
    text-decoration: none;
}

.tpl-card-title a:hover {
    color: var(--tpl-primary);
}

.tpl-card-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--tpl-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpl-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tpl-muted);
}

.tpl-card-meta i {
    font-size: 15px;
}

.tpl-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.tpl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tpl-btn--primary {
    background: var(--tpl-primary);
    border: 1px solid var(--tpl-primary);
    color: #fff;
}

.tpl-btn--primary:hover {
    background: var(--tpl-primary-600);
    border-color: var(--tpl-primary-600);
    color: #fff;
}

.tpl-btn--ghost {
    background: #fff;
    border: 1px solid var(--tpl-border-strong);
    color: var(--tpl-heading);
}

.tpl-btn--ghost:hover {
    border-color: var(--tpl-primary);
    color: var(--tpl-primary);
}

/* How a search result was found. Only the informative cases get a badge. */
.tpl-match {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.tpl-match--hybrid {
    background: var(--tpl-primary-50);
    color: var(--tpl-primary);
}

.tpl-match--semantic {
    background: var(--tpl-beige);
    color: var(--tpl-text);
}

/* Highlighted search terms: a soft tint instead of solid green with white text. */
.tpl mark,
.tpl mark[class] {
    padding: 0 0.15em;
    border-radius: 4px;
    background-color: rgba(18, 113, 91, 0.12) !important;
    color: var(--tpl-primary-700) !important;
    font-weight: inherit;
}

/* ------------------------------------------------------------------ */
/* Empty state                                                         */
/* ------------------------------------------------------------------ */

.tpl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 880px;
    margin: 0 auto;
    padding: 56px 24px;
    text-align: center;
    background: var(--tpl-beige);
    border-radius: 24px;
}

.tpl-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    font-size: 28px;
    color: var(--tpl-primary);
}

.tpl-empty h2 {
    margin: 8px 0 0;
    font-size: 24px;
}

.tpl-empty p {
    max-width: 460px;
    margin: 0;
    color: var(--tpl-text);
}

.tpl-empty .tpl-btn {
    margin-top: 8px;
    padding: 0 22px;
}

/* ------------------------------------------------------------------ */
/* Pagination                                                          */
/* ------------------------------------------------------------------ */

.tpl-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 40px;
}

.tpl-pagination--center {
    justify-content: center;
}

.tpl-pagination-info {
    font-size: 14px;
    color: var(--tpl-muted);
}

.tpl-pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tpl-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border: 1px solid var(--tpl-border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--tpl-heading);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.tpl-page:hover {
    border-color: var(--tpl-primary);
    color: var(--tpl-primary);
}

.tpl-page--active,
.tpl-page--active:hover {
    background: var(--tpl-primary);
    border-color: var(--tpl-primary);
    color: #fff;
    font-weight: 700;
}

.tpl-page--disabled {
    opacity: 0.4;
    pointer-events: none;
}

.tpl-page-ellipsis {
    padding: 0 2px;
    color: var(--tpl-muted);
}

/* ------------------------------------------------------------------ */
/* Bottom call to action                                               */
/* ------------------------------------------------------------------ */

.tpl-cta {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 72px 0 0;
    padding: 56px 24px;
    overflow: hidden;
    border-radius: 24px;
    background: var(--tpl-primary);
    text-align: center;
}

.tpl-cta::before,
.tpl-cta::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.tpl-cta::before {
    width: 320px;
    height: 320px;
    top: -140px;
    inset-inline-end: -80px;
}

.tpl-cta::after {
    width: 220px;
    height: 220px;
    bottom: -120px;
    inset-inline-start: -60px;
}

.tpl-cta h2 {
    position: relative;
    margin: 0;
    font-size: clamp(26px, 3vw, 36px);
    color: #fff;
}

.tpl-cta p {
    position: relative;
    max-width: 520px;
    margin: 0;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
}

.tpl-cta a {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 52px;
    margin-top: 12px;
    padding: 0 28px;
    border-radius: 999px;
    background: #fff;
    color: var(--tpl-primary-700);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tpl-cta a:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    color: var(--tpl-primary-700);
}

.tpl-section {
    padding-bottom: 80px;
}

/* Text for screen readers only. */
.tpl-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
