/* Template gallery. Site chrome, fonts, and --navy come from the shared header. */

.tpl-page {
    --tpl-blue: #155dfc;
    --tpl-blue-dark: #1447e6;
    --tpl-blue-soft: #dbeafe;
    --tpl-ink: #0a0a0a;
    --tpl-ink-2: #404040;
    --tpl-muted: #525252;
    --tpl-line: #e5e5e5;
    --tpl-line-strong: #d4d4d4;
    --tpl-surface: #f5f5f5;
    --tpl-card-line: #f5f5f5;
    --tpl-card-media: #fcfcfc;
    --tpl-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #fff;
    color: var(--tpl-ink);
    font-family: var(--tpl-font);
}

.tpl-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tpl-wrap {
    max-width: 1280px;
}

.tpl-hero {
    background:
        radial-gradient(900px 280px at 80% -40px, rgba(0, 63, 219, 0.08), transparent 70%),
        #f8fafc;
    padding: 148px 0 28px;
}

.tpl-breadcrumb {
    font-family: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    margin: 8px 0 22px;
    list-style: none;
}

.tpl-breadcrumb__item {
    font-size: 14px;
    line-height: 1.35;
    color: #94a3b8;
}

.tpl-breadcrumb__item + .tpl-breadcrumb__item::before {
    content: "/";
    padding: 0 8px;
    color: #94a3b8;
}

.tpl-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.tpl-breadcrumb a:hover {
    color: #0f172a;
}

.tpl-hero__content {
    max-width: 720px;
}

.tpl-page .tpl-hero__title {
    font-family: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.035em;
    color: #0f172a;
    margin: 0 0 14px;
}

.tpl-page .tpl-hero__title em {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 400;
    color: #003fdb;
}

.fonts-loaded .tpl-page .tpl-hero__title em {
    font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
}

.tpl-page .tpl-hero__subtitle {
    font-family: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.55;
    color: #475569;
    max-width: 620px;
    margin: 0;
}

.tpl-gallery {
    padding: 24px 0 96px;
}

.tpl-layout {
    display: grid;
    grid-template-columns: 304px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

/* Sidebar */

.tpl-sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    --tpl-head-h: 70px;
    display: flex;
    flex-direction: column;
    padding: 0 20px 20px;
    background: #fff;
    border: 1px solid var(--tpl-line);
    border-radius: 16px;
}

.tpl-sidebar:hover,
.tpl-sidebar:focus-within {
    scrollbar-color: var(--tpl-line-strong) transparent;
}

.tpl-step__head {
    position: sticky;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
}

.tpl-step__head--cat {
    top: 0;
    height: var(--tpl-head-h);
    padding: 20px 0 12px;
}

.tpl-step__head--type {
    top: var(--tpl-head-h);
    z-index: 2;
    margin-top: 12px;
    padding: 24px 0 12px;
    border-top: 1px solid var(--tpl-line);
}

.tpl-page .tpl-step__heading {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
}

.tpl-page .tpl-step__toggle {
    appearance: none;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tpl-ink);
    font-family: var(--tpl-font);
    text-align: left;
    cursor: pointer;
}

.tpl-step__chevron {
    flex: 0 0 auto;
    margin-top: 2px;
    color: var(--tpl-muted);
    transition: transform 0.15s ease;
}

.tpl-step__toggle:hover .tpl-step__chevron {
    color: var(--tpl-ink);
}

.tpl-step__toggle[aria-expanded="false"] .tpl-step__chevron {
    transform: rotate(-90deg);
}

.tpl-step__head.is-stuck {
    box-shadow: 0 1px 0 var(--tpl-line);
}

.tpl-step__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.tpl-step__title {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tpl-ink);
}

.tpl-step__hint {
    max-width: 100%;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    color: var(--tpl-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-step__head--cat:has(.tpl-step__toggle[aria-expanded="false"]) .tpl-seg {
    display: none;
}

.tpl-step__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tpl-step__body[hidden] {
    display: none;
}

.tpl-cats,
.tpl-types {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tpl-page .tpl-cat,
.tpl-page .tpl-type {
    appearance: none;
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--tpl-ink);
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tpl-page .tpl-type {
    gap: 10px;
}

.tpl-cat:hover,
.tpl-type:hover {
    background: var(--tpl-surface);
}

.tpl-page .tpl-cat__label,
.tpl-page .tpl-type__label {
    flex: 0 1 auto;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-cat__check {
    flex: 0 0 auto;
    display: inline-flex;
}

.tpl-count-badge {
    flex: 0 0 auto;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--tpl-surface);
    color: var(--tpl-ink);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
}

.tpl-cat.is-active {
    background: var(--tpl-blue);
    color: #fff;
}

.tpl-cat.is-active .tpl-count-badge {
    background: #fff;
    color: var(--tpl-blue);
    font-weight: 600;
}

.tpl-cat.is-empty:not(.is-active),
.tpl-type.is-empty:not(.is-active) {
    color: var(--tpl-muted);
}

.tpl-type__radio {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--tpl-line-strong);
    background: #fff;
    transition: border-color 0.15s ease, border-width 0.15s ease;
}

.tpl-type.is-active {
    background: var(--tpl-blue-soft);
    border-color: var(--tpl-blue);
    box-shadow: inset 0 0 0 0.5px var(--tpl-blue);
    color: var(--tpl-blue);
}

.tpl-type.is-active .tpl-type__radio {
    border: 6px solid var(--tpl-blue);
}

.tpl-type.is-active .tpl-count-badge {
    background: var(--tpl-blue);
    color: #fff;
}

.tpl-page .tpl-types__empty {
    margin: 0;
    padding: 4px 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--tpl-muted);
}

.tpl-more {
    appearance: none;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--tpl-blue);
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
}

.tpl-more:hover {
    color: var(--tpl-blue-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tpl-more svg {
    transition: transform 0.15s ease;
}

.tpl-more[aria-expanded="true"] svg {
    transform: rotate(-90deg);
}

/* Segmented controls */

.tpl-seg {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 2px;
    padding: 2px;
    background: var(--tpl-surface);
    border-radius: 9999px;
}

.tpl-seg__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--tpl-muted);
    font-family: var(--tpl-font);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tpl-seg__btn:hover {
    color: var(--tpl-ink);
}

.tpl-seg__btn.is-active {
    background: #fff;
    color: var(--tpl-ink);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tpl-seg--sm .tpl-seg__btn {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    line-height: 16px;
}

.tpl-seg--plan {
    padding: 2px;
    border-radius: 12px;
    border: 1px solid var(--tpl-line);
    background: #fcfcfc;
}

.tpl-seg--plan .tpl-seg__btn {
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 14px;
    line-height: 20px;
}

/* Toolbar */

.tpl-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: -24px 0 8px;
    padding: 24px 0 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
}

.tpl-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.tpl-search {
    position: relative;
    flex: 1 1 280px;
    min-width: 0;
}

.tpl-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tpl-muted);
    pointer-events: none;
}

.tpl-search input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--tpl-line);
    border-radius: 12px;
    background: #fff;
    padding: 0 16px 0 44px;
    font-family: var(--tpl-font);
    font-size: 14px;
    line-height: 20px;
    color: var(--tpl-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tpl-search input::placeholder {
    color: var(--tpl-muted);
    opacity: 1;
}

.tpl-search input:hover {
    border-color: var(--tpl-line-strong);
}

.tpl-search input:focus {
    border-color: var(--tpl-blue);
    box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.15);
    outline: none;
}

.tpl-sort {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    height: 46px;
    border: 1px solid var(--tpl-line);
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.15s ease;
}

.tpl-sort:hover {
    border-color: var(--tpl-line-strong);
}

.tpl-sort__label {
    padding-left: 16px;
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--tpl-muted);
    white-space: nowrap;
    cursor: pointer;
}

.tpl-sort select {
    appearance: none;
    -webkit-appearance: none;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0 44px 0 8px;
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tpl-ink);
    cursor: pointer;
}

.tpl-sort__icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tpl-ink);
    pointer-events: none;
}

.tpl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-height: 34px;
}

.tpl-page .tpl-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tpl-ink);
}

.tpl-count.is-loading::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tpl-blue);
    animation: tplPulse 1s ease-in-out infinite;
}

@keyframes tplPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.tpl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tpl-chips:empty {
    display: none;
}

.tpl-chip {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 260px;
    padding: 6px 8px 6px 12px;
    border: 1px solid var(--tpl-line);
    border-radius: 9999px;
    background: #fff;
    color: var(--tpl-ink);
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tpl-chip:hover {
    border-color: var(--tpl-line-strong);
    background: var(--tpl-surface);
}

.tpl-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-chip svg {
    flex: 0 0 auto;
}

.tpl-clear {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--tpl-blue);
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    padding: 6px 4px;
    cursor: pointer;
}

.tpl-clear:hover {
    color: var(--tpl-blue-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Cards */

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    gap: 24px;
}

.tpl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--tpl-card-line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.tpl-card:hover {
    border-color: var(--tpl-card-line);
    box-shadow: 0 0 0 1px var(--tpl-card-line), 0 12px 24px rgba(0, 0, 0, 0.16);
    transform: translateY(-2px);
}

.tpl-card:has(.tpl-card__preview:focus-visible) {
    box-shadow: 0 0 0 2px var(--tpl-blue), 0 12px 24px rgba(0, 0, 0, 0.16);
}

.tpl-card__media {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--tpl-card-media);
}

.tpl-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
}

.tpl-card__frame {
    position: relative;
    aspect-ratio: 296 / 176;
    background: #fff;
    border: 1px solid var(--tpl-line);
    border-radius: 8px;
    overflow: hidden;
}

.tpl-card__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    filter: blur(16px);
    transform: scale(1.08);
    transition: filter 0.55s ease, transform 0.55s ease;
}

.tpl-card__frame img.is-loaded {
    filter: blur(0);
    transform: none;
}

.tpl-card:hover .tpl-card__frame img.is-loaded {
    transform: scale(1.02);
}

.tpl-card__placeholder,
.tpl-modal__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 140px;
    color: var(--tpl-muted);
    font-size: 14px;
    background: var(--tpl-surface);
}

.tpl-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    white-space: nowrap;
}

.tpl-badge--free {
    background: #dcfce7;
    color: #166534;
}

.tpl-badge--paid {
    background: var(--tpl-blue);
    color: #fff;
}

.tpl-badge--unknown {
    background: #e5e5e5;
    color: var(--tpl-ink-2);
}

.tpl-badge--default {
    background: var(--tpl-blue-dark);
    color: #fff;
}

.tpl-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}

.tpl-card__text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.tpl-page .tpl-card__name {
    margin: 0;
    font-family: var(--tpl-font);
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    color: var(--tpl-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpl-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.tpl-card__widget,
.tpl-card__category {
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-card__widget {
    color: var(--tpl-muted);
}

.tpl-card__category {
    color: var(--tpl-blue);
}

.tpl-card__actions {
    display: flex;
    gap: 8px;
}

.tpl-card__actions .tpl-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
}

.tpl-card__preview::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.tpl-card__use {
    position: relative;
    z-index: 2;
}

/* Buttons */

.tpl-btn,
.tpl-status__btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 12px 20px;
    border-radius: 9999px;
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tpl-btn--primary {
    background: var(--tpl-blue);
    color: #fff;
    border: 1px solid var(--tpl-blue);
}

.tpl-btn--primary:hover {
    background: var(--tpl-blue-dark);
    border-color: var(--tpl-blue-dark);
    color: #fff;
}

.tpl-btn--outline {
    background: #fff;
    color: var(--tpl-blue);
    border: 1px solid var(--tpl-blue);
}

.tpl-btn--outline:hover {
    background: var(--tpl-blue-soft);
    color: var(--tpl-blue-dark);
}

.tpl-status__btn {
    background: #fff;
    color: var(--tpl-ink);
    border: 1px solid var(--tpl-line);
}

.tpl-status__btn:hover {
    border-color: var(--tpl-line-strong);
    background: var(--tpl-surface);
}

/* Loading */

.tpl-skeleton {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 16px;
    border: 1px solid var(--tpl-card-line);
    border-radius: 16px;
    background: #fff;
}

.tpl-skeleton__media,
.tpl-skeleton__line,
.tpl-skeleton__button {
    border-radius: 8px;
    background: linear-gradient(90deg, #f5f5f5 0%, #fafafa 50%, #f5f5f5 100%);
    background-size: 200% 100%;
    animation: tplShimmer 1.2s ease-in-out infinite;
}

.tpl-skeleton__media {
    aspect-ratio: 296 / 200;
}

.tpl-skeleton__line {
    width: 60%;
    height: 12px;
    margin-top: 6px;
}

.tpl-skeleton__line--short {
    width: 40%;
    height: 8px;
    margin-top: 0;
}

.tpl-skeleton__button {
    height: 36px;
    margin-top: 8px;
}

@keyframes tplShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Empty and error states */

.tpl-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 24px;
    background: var(--tpl-surface);
    border-radius: 16px;
}

.tpl-status__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    color: var(--tpl-muted);
}

.tpl-page .tpl-status__title {
    margin: 0;
    font-family: var(--tpl-font);
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    color: var(--tpl-ink);
    overflow-wrap: anywhere;
}

.tpl-page .tpl-status__text {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--tpl-muted);
}

.tpl-status__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tpl-suggestion {
    appearance: none;
    padding: 8px 14px;
    border: 1px solid var(--tpl-line);
    border-radius: 9999px;
    background: #fff;
    color: var(--tpl-ink);
    font-family: var(--tpl-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.tpl-suggestion:hover {
    border-color: var(--tpl-blue);
    color: var(--tpl-blue);
}

.tpl-page .tpl-noscript {
    margin-top: 16px;
    color: var(--tpl-muted);
    font-size: 15px;
}

/* Preview dialog */

.tpl-modal[hidden] { display: none; }

.tpl-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.tpl-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
}

.tpl-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: min(760px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.tpl-modal__preview {
    position: relative;
    flex: 0 0 auto;
}

.tpl-modal__media {
    max-height: min(52vh, 440px);
    min-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    background: #f5f5f5;
}

.tpl-modal__media img {
    display: block;
    width: 100%;
    height: auto;
}

.tpl-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #0a0a0a;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tpl-modal__close:hover {
    background: #f5f5f5;
}

.tpl-modal__body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tpl-modal__text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpl-modal__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.tpl-modal__badges {
    display: inline-flex;
    gap: 6px;
}

.tpl-modal__badges .tpl-badge {
    padding: 8px 12px;
    font-size: 16px;
}

.tpl-modal__widget {
    font-size: 14px;
    font-weight: 500;
    line-height: 16px;
    color: #525252;
}

.tpl-page .tpl-modal__title {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 32px;
    color: #0a0a0a;
}

.tpl-page .tpl-modal__desc {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 20px;
    color: #525252;
}

.tpl-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Focus */

.tpl-page button:focus-visible,
.tpl-page a:focus-visible,
.tpl-page select:focus-visible,
.tpl-modal button:focus-visible,
.tpl-modal a:focus-visible {
    outline: 2px solid #155dfc !important;
    outline-offset: 2px;
}

.tpl-sort:has(select:focus-visible) {
    border-color: #155dfc;
    box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.15);
}

.tpl-sort select:focus-visible {
    outline: none !important;
}

/* Responsive */

@media (max-width: 1100px) {
    .tpl-layout { grid-template-columns: 272px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 860px) {
    .tpl-hero { padding: 118px 0 18px; }
    .tpl-gallery { padding-top: 8px; }
    .tpl-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .tpl-sidebar { position: static; max-height: none; overflow: visible; }
    .tpl-step__head { position: static; }
    .tpl-toolbar { gap: 16px; margin-top: -12px; padding-top: 12px; padding-bottom: 8px; }
    .tpl-search { flex-basis: 100%; }
    .tpl-seg--plan { flex: 1 1 auto; }
    .tpl-seg--plan .tpl-seg__btn { flex: 1 1 0; padding-left: 8px; padding-right: 8px; }
    .tpl-grid { gap: 16px; }
}

@media (max-width: 519px) {
    .tpl-page .tpl-hero__subtitle { font-size: 16px; }
    .tpl-sort { flex: 1 1 100%; }
    .tpl-sort select { flex: 1 1 auto; }
    .tpl-grid { grid-template-columns: minmax(0, 1fr); }
    .tpl-modal { padding: 12px; }
    .tpl-modal__dialog { padding: 16px; border-radius: 20px; max-height: calc(100vh - 24px); }
    .tpl-modal__actions .tpl-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .tpl-card,
    .tpl-card__frame img,
    .tpl-skeleton__media,
    .tpl-skeleton__line,
    .tpl-skeleton__button,
    .tpl-count.is-loading::before {
        transition: none;
        animation: none;
        filter: none;
        transform: none;
    }
    .tpl-card:hover,
    .tpl-card:hover .tpl-card__frame img.is-loaded { transform: none; }
}
