/* ==========================================
   Amora — templates page
========================================== */

.templates-hero {
    padding: clamp(76px, 9vw, 128px) 0 clamp(54px, 7vw, 92px);
    overflow: hidden;
    background:
        radial-gradient(
            circle at 84% 24%,
            rgba(235, 207, 196, 0.75),
            transparent 28%
        ),
        linear-gradient(
            135deg,
            #fffdfb 0%,
            #f9f2ed 52%,
            #f4e5dd 100%
        );
}

.templates-hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
    gap: clamp(36px, 7vw, 100px);
    align-items: end;
}

.templates-hero-copy {
    max-width: 880px;
}

.templates-hero h1 {
    margin: 14px 0 24px;
    max-width: 900px;

    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(3.4rem, 7vw, 7rem);
    font-weight: 500;
    line-height: 0.94;
    letter-spacing: -0.045em;
}

.templates-hero h1 em {
    display: block;
    color: #b8745e;
    font-weight: 500;
}

.templates-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.templates-hero-note {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    align-items: center;

    padding: 22px;

    border: 1px solid rgba(185, 119, 96, 0.2);
    border-radius: 24px;

    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 22px 55px rgba(80, 55, 42, 0.09);

    backdrop-filter: blur(14px);
}

.templates-hero-note span {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 3.6rem;
    line-height: 1;
    color: #b8745e;
}

.templates-hero-note p {
    margin: 0;
    color: #6d5e59;
    font-size: 0.92rem;
    line-height: 1.55;
}

.templates-toolbar {
    position: sticky;
    top: 76px;
    z-index: 12;

    padding: 18px 0;

    border-top: 1px solid rgba(47, 47, 47, 0.06);
    border-bottom: 1px solid rgba(47, 47, 47, 0.08);

    background: rgba(249, 246, 242, 0.92);

    backdrop-filter: blur(15px);
}

.template-filters {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.template-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex: 0 0 auto;

    padding: 10px 16px;

    border: 1px solid rgba(47, 47, 47, 0.12);
    border-radius: 999px;

    background: #ffffff;
    color: #655b56;

    font-size: 0.78rem;
    font-weight: 600;
}

.filter-chip.active,
.filter-chip:hover {
    color: #ffffff;
    border-color: #2f2f2f;
    background: #2f2f2f;
}

.templates-section {
    padding: clamp(76px, 8vw, 120px) 0;
    background: #ffffff;
}

.templates-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
    gap: 40px;
    align-items: end;

    margin-bottom: 48px;
}

.templates-heading p {
    margin: 0;
    max-width: 580px;
    color: #756962;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px;
}

.template-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;

    border: 1px solid rgba(47, 47, 47, 0.08);
    border-radius: 30px;

    background: #fbfaf8;
    box-shadow: 0 22px 60px rgba(60, 45, 35, 0.08);

    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.template-card:hover {
    transform: translateY(-6px);
    border-color: rgba(201, 168, 106, 0.4);
    box-shadow: 0 32px 78px rgba(60, 45, 35, 0.13);
}

.template-card-large,
.template-card-wide {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.14fr) minmax(360px, 0.86fr);
}

.template-card-wide {
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
}

.template-preview {
    position: relative;
    overflow: hidden;

    min-height: 560px;

    background: #eee8e3;
}

.template-card:not(.template-card-large):not(.template-card-wide) .template-preview {
    min-height: 620px;
}

.template-preview img {
    width: 100%;
    height: 100%;
    min-height: inherit;

    object-fit: cover;
    object-position: top center;

    transition: transform 0.7s ease;
}

.template-card:hover .template-preview img {
    transform: scale(1.018);
}

.template-badge {
    position: absolute;
    top: 20px;
    left: 20px;

    padding: 9px 14px;

    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;

    color: #413733;
    background: rgba(255, 253, 251, 0.88);
    box-shadow: 0 10px 30px rgba(55, 38, 30, 0.12);

    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    backdrop-filter: blur(12px);
}

.template-content {
    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: clamp(30px, 4vw, 58px);
}

.template-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 18px;

    color: #9a7568;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.template-content h3 {
    margin: 0 0 16px;

    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2rem, 3.4vw, 3.6rem);
    font-weight: 500;
    line-height: 1.02;
}

.template-content p {
    margin: 0;
    color: #70645e;
    line-height: 1.75;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 24px 0 30px;
}

.template-tags span {
    padding: 7px 11px;

    border: 1px solid rgba(185, 119, 96, 0.18);
    border-radius: 999px;

    color: #7c645b;
    background: #fff8f4;

    font-size: 0.68rem;
    font-weight: 600;
}

.template-content .btn {
    align-self: flex-start;
    margin-top: auto;
}

.templates-custom {
    padding: 0 0 clamp(76px, 8vw, 120px);
    background: #ffffff;
}

.custom-template-card {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    align-items: center;

    padding: clamp(36px, 5vw, 68px);

    border-radius: 34px;

    background:
        radial-gradient(
            circle at 90% 30%,
            rgba(255, 255, 255, 0.42),
            transparent 32%
        ),
        linear-gradient(135deg, #eed6cb, #f7ebe5);

    box-shadow: 0 25px 65px rgba(70, 50, 35, 0.1);
}

.custom-template-card h2 {
    margin: 10px 0 14px;

    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    font-weight: 500;
    line-height: 1.05;
}

.custom-template-card p {
    max-width: 720px;
    margin: 0;
    color: #6c5c56;
}

.nav-links .active {
    color: #b8745e;
}

/* MacBook и небольшие ноутбуки */
@media (max-width: 1280px) {
    .template-preview {
        min-height: 500px;
    }

    .template-card:not(.template-card-large):not(.template-card-wide) .template-preview {
        min-height: 560px;
    }
}

/* Планшеты и небольшие ноутбуки */
@media (max-width: 1024px) {
    .templates-hero-layout {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .templates-hero-note {
        max-width: 520px;
    }

    .templates-heading {
        grid-template-columns: 1fr;
    }

    .template-grid {
        gap: 26px;
    }

    .template-card-large,
    .template-card-wide {
        grid-template-columns: 1fr;
    }

    .template-card-large .template-preview,
    .template-card-wide .template-preview {
        min-height: 720px;
    }

    .template-content .btn {
        margin-top: 0;
    }
}

/* Планшеты */
@media (max-width: 820px) {
    .templates-toolbar {
        top: 76px;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    .template-card-large,
    .template-card-wide {
        grid-column: auto;
    }

    .template-preview,
    .template-card:not(.template-card-large):not(.template-card-wide) .template-preview,
    .template-card-large .template-preview,
    .template-card-wide .template-preview {
        min-height: 680px;
    }

    .custom-template-card {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Большие телефоны */
@media (max-width: 640px) {
    .templates-hero {
        padding-top: 58px;
    }

    .templates-hero h1 {
        font-size: clamp(3.1rem, 15vw, 5rem);
    }

    .templates-hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .templates-hero-actions .btn {
        width: 100%;
    }

    .templates-hero-note {
        grid-template-columns: auto 1fr;
        padding: 18px;
    }

    .templates-hero-note span {
        font-size: 3rem;
    }

    .templates-toolbar {
        top: 76px;
        padding: 14px 0;
    }

    .templates-heading {
        margin-bottom: 30px;
    }

    .template-card {
        border-radius: 24px;
    }

    .template-preview,
    .template-card:not(.template-card-large):not(.template-card-wide) .template-preview,
    .template-card-large .template-preview,
    .template-card-wide .template-preview {
        min-height: 560px;
    }

    .template-content {
        padding: 28px 22px 30px;
    }

    .template-content h3 {
        font-size: 2.35rem;
    }

    .template-meta {
        flex-direction: column;
        gap: 6px;
    }

    .template-content .btn {
        width: 100%;
    }

    .custom-template-card .btn {
        width: 100%;
    }
}

/* Маленькие телефоны */
@media (max-width: 390px) {
    .template-preview,
    .template-card:not(.template-card-large):not(.template-card-wide) .template-preview,
    .template-card-large .template-preview,
    .template-card-wide .template-preview {
        min-height: 490px;
    }

    .template-badge {
        top: 14px;
        left: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .template-card,
    .template-preview img {
        transition: none;
    }

    .template-card:hover,
    .template-card:hover .template-preview img {
        transform: none;
    }
}
