/*
 * Session 9b Pete + Filip polish: dark hero title, 4-up grid on xl, preview modal
 * without viewport pills. "Build this with AI" only when Duda catalog marks the
 * template ai_enabled (see docs/phase-2/15-duda-ai-template-research-2026-05-24.md).
 *
 * Cookbook domain: public/components/templates/ mirrors app/Components/Templates/.
 */

/* AVANTIY DESIGN BIBLE compliant — §1b */
:root {
    --avantiy-purple-50:  #f6f2ff;
    --avantiy-purple-100: #ede6ff;
    --avantiy-purple-300: #c9a8ff;
    --avantiy-purple-500: #8b3bff;
    --avantiy-purple-700: #4f1aab;
    --avantiy-purple-900: #3a1180;
}

/* ── Page hero (statement panel) — §1d §2a §3e */
.avantiy-templates-hero {
    background:
        radial-gradient(140% 160% at 0% 0%, rgba(178, 122, 255, 0.32) 0%, rgba(178, 122, 255, 0) 55%),
        linear-gradient(135deg, #2a0f57 0%, #4a1bb0 45%, #1a0833 100%);
    color: #f4ecff;
    border-radius: 0.75rem;
    padding: 1.5rem 1.75rem;
}

.avantiy-templates-hero-title {
    margin: 0 0 0.35rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.75rem;
}

.avantiy-templates-hero-text {
    margin: 0;
    color: #f4ecff;
    font-size: 0.92rem;
    opacity: 0.92;
    max-width: 42rem;
    line-height: 1.45;
}

/* ── Template card v2 (step1 grid only) — §2b §3e */
.avantiy-template-card-v2 {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(139, 59, 255, 0.22);
    border-radius: 0.75rem;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(20, 14, 35, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.avantiy-template-card-v2:hover {
    border-color: rgba(139, 59, 255, 0.45);
    box-shadow: 0 4px 14px rgba(139, 59, 255, 0.14);
    transform: translateY(-1px);
}

/* Fixed 16:10 box — Pete click-test: thumbs were top-left with background bleed
   bottom-right because rules targeted `.media .zoom-img img` but `zoom-img` sits
   on the same <figure> as `-media`, so object-fit never applied. */
.avantiy-template-card-v2-media {
    position: relative;
    margin: 0;
    width: 100%;
    overflow: hidden;
    border-radius: 0.75rem 0.75rem 0 0;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(74, 27, 176, 0.15) 0%, rgba(178, 122, 255, 0.2) 100%);
}

.avantiy-template-card-v2-media > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.25s ease;
}

/* Bootstrap .img-fluid sets height:auto — must lose on card thumbs or the box letterboxes */
.avantiy-template-card-v2-media > img.img-fluid {
    height: 100%;
}

.avantiy-template-card-v2:hover .avantiy-template-card-v2-media > img {
    transform: scale(1.03);
}

.avantiy-template-card-v2-name {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #3a1180;
    margin: 0.75rem 0.85rem 0.55rem;
    line-height: 1.35;
}

.avantiy-template-card-v2-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.85rem 0.85rem;
    margin-top: auto;
}

.avantiy-template-card-v2-actions .btn {
    flex: 1 1 0;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.5rem;
}

/* §2a primary CTA */
.avantiy-template-card-v2-btn-primary {
    background: linear-gradient(135deg, #4a1bb0 0%, #b27aff 100%);
    color: #ffffff;
    border: none;
    transition: filter 0.18s ease, box-shadow 0.18s ease;
}

.avantiy-template-card-v2-btn-primary:hover,
.avantiy-template-card-v2-btn-primary:focus {
    filter: brightness(1.06);
    box-shadow: 0 4px 12px rgba(139, 59, 255, 0.25);
    color: #ffffff;
}

/* §2b outline-purple secondary */
.avantiy-template-card-v2-btn-outline {
    background: transparent;
    border: 1px solid #8b3bff;
    color: #4f1aab;
    transition: background 0.18s ease, color 0.18s ease;
}

.avantiy-template-card-v2-btn-outline:hover,
.avantiy-template-card-v2-btn-outline:focus {
    background: rgba(139, 59, 255, 0.10);
    border-color: #8b3bff;
    color: #3a1180;
}

/* ── Full-viewport template preview modal — §3b */
.avantiy-template-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    background: rgba(26, 8, 51, 0.92);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.avantiy-template-preview-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.avantiy-template-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.25rem;
    background: linear-gradient(135deg, #2a0f57 0%, #4a1bb0 45%, #1a0833 100%);
    border-bottom: 1px solid rgba(178, 122, 255, 0.28);
}

.avantiy-template-preview-header-left,
.avantiy-template-preview-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.avantiy-template-preview-header-right {
    margin-left: auto;
}

.avantiy-template-preview-back {
    background: transparent;
    border: 1px solid #8b3bff;
    color: #f4ecff;
    border-radius: 0.5rem;
    padding: 0.45rem 1rem;
    font-weight: 600;
    transition: background 0.18s ease;
}

.avantiy-template-preview-back:hover,
.avantiy-template-preview-back:focus {
    background: rgba(139, 59, 255, 0.20);
    color: #ffffff;
}

.avantiy-template-preview-cta-primary {
    background: linear-gradient(135deg, #4a1bb0 0%, #b27aff 100%);
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.45rem 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: filter 0.18s ease, box-shadow 0.18s ease;
}

.avantiy-template-preview-cta-primary:hover,
.avantiy-template-preview-cta-primary:focus {
    filter: brightness(1.06);
    box-shadow: 0 4px 12px rgba(139, 59, 255, 0.25);
    color: #ffffff;
}

.avantiy-template-preview-cta-ai {
    background: transparent;
    border: 1px solid #8b3bff;
    color: #f4ecff;
    border-radius: 0.5rem;
    padding: 0.45rem 1rem;
    font-weight: 600;
    transition: background 0.18s ease;
}

.avantiy-template-preview-cta-ai:hover,
.avantiy-template-preview-cta-ai:focus {
    background: rgba(139, 59, 255, 0.20);
    color: #ffffff;
}

.avantiy-template-preview-body {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 1.25rem;
    overflow: hidden;
    min-height: 0;
}

.avantiy-template-preview-frame-wrap {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    background: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(60, 18, 130, 0.35);
}

.avantiy-template-preview-frame-wrap iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 320px;
    border: 0;
}
