/* ============================================================
 * Digital Presence Engine (DPE)
 * themes/_shared/showcase.css — Showcase Public Styles (Shared)
 * ============================================================
 * نسخه: 1.4 — 2026-09-27 (Phase Post Title — Fix Padding)
 *      بر پایه 1.3 (Phase Post Title — PX Units Only)
 *      ⚠️ همه چیز با px — نه rem
 */

/* ============================================================
 * Defaults (Fallback اگه تم Variables نداد)
 * ============================================================ */

:root {
    --sc-accent:          #f97316;
    --sc-accent-hover:    #ea580c;
    --sc-hero-gradient-1: #1e40af;
    --sc-hero-gradient-2: #7c3aed;
    --sc-text:            #23234a;
    --sc-text-muted:      #7a7a90;
    --sc-bg:              #ffffff;
    --sc-border:          #e5e7eb;
    --sc-radius:          14px;

    --sc-type-product:    #3b82f6;
    --sc-type-service:    #8b5cf6;
    --sc-type-portfolio:  #ec4899;
}

/* ============================================================
 * Showcase Page Wrapper
 * ============================================================ */

.showcase-page {
    width: 100%;
}

/* ============================================================
 * Showcase Hero (بالای ویترین) — اختیاری
 * ============================================================ */

.showcase-hero {
    position: relative;
    padding: 60px 0;
    margin-bottom: 40px;
    border-radius: var(--sc-radius);
    overflow: hidden;
    text-align: center;
    background-size: cover;
    background-position: center;
    color: #fff;
}

.showcase-hero.showcase-hero-gradient {
    background: linear-gradient(135deg,
        var(--sc-hero-gradient-1) 0%,
        var(--sc-hero-gradient-2) 100%);
}

.showcase-hero.showcase-hero-with-image {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.showcase-hero-with-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.65));
    z-index: 1;
}

.showcase-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 720px;
    margin: 0 auto;
}

.showcase-hero-intro {
    font-size: 17px;
    color: #f0f0f8;
    line-height: 1.9;
    opacity: 0.95;
    text-shadow: 0 1px 8px rgba(0,0,0,0.3);
    margin: 0;
}

/* ============================================================
 * Showcase Grid
 * ============================================================ */

.showcase-items-section {
    padding: 0;
}

.showcase-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 40px;
}

.showcase-grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.showcase-grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.showcase-grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.showcase-list {
    grid-template-columns: 1fr;
}

.showcase-list .showcase-item-card {
    display: flex;
    flex-direction: row;
    text-align: right;
}

.showcase-list .showcase-item-thumb {
    width: 200px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    margin: 0;
    border-radius: 0;
}

.showcase-list .showcase-item-body {
    flex: 1;
    text-align: right;
    padding: 20px 24px;
}

/* ============================================================
 * Showcase Item Card
 * ============================================================ */

.showcase-item-card {
    background: var(--sc-bg);
    border-radius: var(--sc-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.showcase-item-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    transform: translateY(-4px);
}

/* Thumb */
.showcase-item-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.showcase-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.showcase-item-card:hover .showcase-item-thumb img {
    transform: scale(1.05);
}

.showcase-item-thumb-placeholder {
    font-size: 64px;
    color: #cbd5e1;
    opacity: 0.7;
}

/* Type Badge */
.showcase-item-type {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.showcase-item-type.type-product   { background: var(--sc-type-product); }
.showcase-item-type.type-service   { background: var(--sc-type-service); }
.showcase-item-type.type-portfolio { background: var(--sc-type-portfolio); }

/* Body */
.showcase-item-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.showcase-item-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--sc-text);
    line-height: 1.4;
    margin: 0;
}

.showcase-item-subtitle {
    font-size: 14px;
    color: var(--sc-text-muted);
    margin: 0;
    line-height: 1.5;
}

.showcase-item-desc {
    font-size: 14px;
    color: var(--sc-text);
    opacity: 0.75;
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.showcase-item-price {
    display: inline-block;
    align-self: flex-start;
    padding: 6px 14px;
    background: rgba(249, 115, 22, 0.1);
    color: var(--sc-accent);
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    margin-top: 4px;
}

/* CTA */
.showcase-item-cta {
    display: block;
    text-align: center;
    margin-top: auto;
    padding: 11px 20px;
    background: linear-gradient(135deg,
        var(--sc-accent) 0%,
        var(--sc-accent-hover) 100%);
    color: #fff !important;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.showcase-item-cta:hover {
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* ============================================================
 * Showcase Empty / Error States
 * ============================================================ */

.showcase-empty-public,
.showcase-error-box {
    padding: 60px 20px;
    text-align: center;
}

.showcase-empty-inner,
.showcase-error-inner {
    max-width: 480px;
    margin: 0 auto;
    background: var(--sc-bg);
    border-radius: var(--sc-radius);
    padding: 48px 32px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.showcase-empty-icon,
.showcase-error-icon {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 16px;
}

.showcase-empty-inner h2,
.showcase-error-inner h2 {
    font-size: 22px;
    color: var(--sc-text);
    margin-bottom: 8px;
}

.showcase-empty-inner p,
.showcase-error-inner p {
    color: var(--sc-text-muted);
    font-size: 15px;
    line-height: 1.8;
    margin: 0;
}

.showcase-error {
    padding: 40px 20px;
    text-align: center;
    color: #c0392b;
    background: #fce4e1;
    border-radius: var(--sc-radius);
    margin-bottom: 24px;
}

/* ============================================================
 * 🆕 Post Hero (بنر بالای صفحه پست)
 * ============================================================ */

.section-hero-post {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #23234a;
}

.section-hero-post .hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.section-hero-post.has-overlay .hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.65));
    pointer-events: none;
}

.section-hero-post .hero-inner {
    position: relative;
    z-index: 1;
    padding: 56px 32px;
    color: #fff;
    max-width: 720px;
}

.section-hero-post .hero-title {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 14px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
    line-height: 1.3;
}

.section-hero-post .hero-subtitle {
    font-size: 18px;
    color: #e6e6ee;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

/* ============================================================
 * 🆕 Post Hero — Layout Special
 * ============================================================ */

/* اگه Post Hero هست، post-single نباید پدینگ داشته باشه */
.post-single:has(> .section-hero-post) {
    padding: 0;
}

.post-single:has(> .section-hero-post) .section-hero-post {
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
}

/* 🆕 پدینگ افقی برای محتوا و پاراگراف‌های پست با بنر */
.post-single:has(> .section-hero-post) .post-content {
    padding: 0 40px;
    margin: 24px 0;
}

.post-single:has(> .section-hero-post) > p {
    padding: 0 40px;
}

/* ============================================================
 * 🆕 Post Title — px + padding درست
 * ============================================================
 * - فونت 20px (قابل پیش‌بینی)
 * - راست‌چین
 * - پدینگ افقی 40px فقط برای پست با بنر (چون post-single پدینگ نداره)
 * - برای پست‌های دیگه، پدینگ از post-single میاد
 * ============================================================ */

.post-single .post-title-post {
    /* 🎯 فونت ثابت با px */
    font-size: 20px;
    font-weight: bold;
    line-height: 1.4;

    /* 🎯 راست‌چین */
    text-align: right;

    /* 🎯 رنگ متن */
    color: var(--sc-text, #23234a);

    /* حذف margin پیش‌فرض */
    margin-left: 0;
    margin-right: 0;
}

/* وقتی بنر یا کاور هست → فاصله از بالا */
.post-single .post-title-post.post-title-below-media {
    margin-top: 32px;
    margin-bottom: 20px;
}

/* وقتی هیچی نیست → فاصله کم */
.post-single .post-title-post.post-title-standalone {
    margin-top: 8px;
    margin-bottom: 20px;
}

/* 🆕 وقتی بنر هست → عنوان باید پدینگ افقی داشته باشه
   (چون post-single پدینگ نداره) */
.post-single:has(> .section-hero-post) .post-title-post {
    padding-left: 40px;
    padding-right: 40px;
}

/* ============================================================
 * Responsive — موبایل
 * ============================================================ */

@media (max-width: 640px) {
    .showcase-hero {
        padding: 40px 0;
    }

    .showcase-hero-intro {
        font-size: 15px;
    }

    .showcase-grid-2,
    .showcase-grid-3,
    .showcase-grid-4 {
        grid-template-columns: 1fr;
    }

    .showcase-list .showcase-item-card {
        flex-direction: column;
    }

    .showcase-list .showcase-item-thumb {
        width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: var(--sc-radius) var(--sc-radius) 0 0;
    }

    /* Post Hero Responsive */
    .section-hero-post {
        min-height: 220px;
    }

    .section-hero-post .hero-inner {
        padding: 40px 20px;
    }

    .section-hero-post .hero-title {
        font-size: 24px;
    }

    .post-single:has(> .section-hero-post) .post-content {
        padding: 0 20px;
        margin: 20px 0;
    }

    .post-single:has(> .section-hero-post) > p {
        padding: 0 20px;
    }

    .post-single:has(> .section-hero-post) .post-title-post {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Post Title Responsive */
    .post-single .post-title-post {
        font-size: 18px;
    }

    .post-single .post-title-post.post-title-below-media {
        margin-top: 20px;
        margin-bottom: 14px;
    }

    .post-single .post-title-post.post-title-standalone {
        margin-top: 4px;
        margin-bottom: 14px;
    }
}