/* ==========================================================================
   TopSite - Horizontal Portfolio Card (Cosmic Glassmorphism)
   File: public/assets/css/components/portfolio.css
   ========================================================================== */

:root {
    --ts-cosmic-bg: rgba(10, 15, 44, 0.72);
    --ts-cosmic-border: rgba(138, 43, 226, 0.35);
    --ts-cosmic-glow: rgba(0, 255, 255, 0.22);
    --ts-neon-cyan: #00ffff;
    --ts-neon-purple: #8a2be2;
    --ts-neon-pink: #d946ef;
    --ts-gold: #ffd700;
    --ts-text-main: #f8fafc;
    --ts-text-muted: #94a3b8;

    /* سیستم تایپوگرافی اختصاصی */
    --ts-font-base: 'Dana', system-ui, -apple-system, sans-serif;
    --ts-font-display: 'Kalameh', 'Dana', sans-serif;
    --ts-lh-tight: 1.35;
    --ts-lh-normal: 1.6;
    --ts-lh-loose: 1.85;
}

/* ۱. بدنه و چارچوب اصلی کارت */
.ts-portfolio-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--ts-cosmic-bg);
    border: 1px solid var(--ts-cosmic-border);
    border-radius: 24px;
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s ease;
    overflow: hidden;
    direction: rtl;
    font-family: var(--ts-font-base);
}

.ts-portfolio-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 0 0 35px var(--ts-cosmic-glow);
}

/* افکت لایه نوری پس‌زمینه (Ambient Glow) */
.ts-portfolio-card__glow-border {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(138, 43, 226, 0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ۲. ساختار افقی درونی (جزئیات در کنار تصویر) */
.ts-portfolio-card__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column-reverse;
    gap: 1.75rem;
}

@media (min-width: 992px) {
    .ts-portfolio-card__inner {
        flex-direction: row-reverse;
        align-items: stretch;
    }
}

/* ۳. ستون محتوا و مشخصات فنی */
.ts-portfolio-card__details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

/* نشان دسته‌بندی */
.ts-portfolio-card__badge {
    font-family: var(--ts-font-base);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    color: var(--ts-neon-cyan);
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 50px;
    width: fit-content;
}

/* پشته فناوری‌ها (Tech Pills) */
.ts-portfolio-card__tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0;
    padding: 0;
    list-style: none;
}

.ts-portfolio-card__tech-pill {
    font-family: var(--ts-font-base);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #e2e8f0;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    transition: all 0.25s ease;
}

.ts-portfolio-card__tech-pill:hover {
    background: rgba(138, 43, 226, 0.25);
    border-color: var(--ts-neon-purple);
    color: #fff;
    transform: translateY(-2px);
}

/* نشانگر متریک و امتیاز عملکرد */
.ts-portfolio-card__metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.ts-portfolio-card__metric-label {
    font-family: var(--ts-font-base);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--ts-text-muted);
}

.ts-portfolio-card__metric-val {
    font-family: var(--ts-font-base);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--ts-gold);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* دکمه‌های اکشن */
.ts-portfolio-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.ts-portfolio-card__btn {
    font-family: var(--ts-font-base);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ts-portfolio-card__btn--primary {
    background: linear-gradient(135deg, var(--ts-neon-cyan), var(--ts-neon-purple));
    color: #050814;
    border: none;
}

.ts-portfolio-card__btn--primary:hover {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    transform: scale(1.02);
}

.ts-portfolio-card__btn--secondary {
    background: transparent;
    color: var(--ts-text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ts-portfolio-card__btn--secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ۴. بخش پیش‌نمایش مرورگر و تصویر تامبنیل */
.ts-portfolio-card__thumbnail {
    flex: 1.15;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #050814;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    
}

.ts-portfolio-card__browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    direction: ltr;
}

.ts-portfolio-card__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.ts-portfolio-card__dot:nth-child(1) {
    background: #ff5f56;
}

.ts-portfolio-card__dot:nth-child(2) {
    background: #ffbd2e;
}

.ts-portfolio-card__dot:nth-child(3) {
    background: #27c93f;
}

.ts-portfolio-card__browser-url {
    font-size: 0.7rem;
    color: var(--ts-text-muted);
    margin-left: auto;
    font-family: monospace;
}

.ts-portfolio-card__img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    /* این خط باعث می‌شود لبه‌های عکس از کادر بیرون نزند */
    border-radius: inherit; 
}

.ts-portfolio-card__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* اجازه می‌دهیم عکس ارتفاع واقعی خودش را بگیرد */
    min-height: 100%; /* برای سایت‌های خیلی کوتاه */
    object-fit: cover;
    
    /* کلید طلایی پرفورمنس: انتقال بار پردازشی به کارت گرافیک (GPU) */
    transform: translateY(0);
    will-change: transform; 
    
    /* یک انیمیشن نرم برای زمانی که موس یا دست کاربر از روی کارت برداشته می‌شود */
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* افکت زوم (Scale) را که در کد قبلی بود حذف می‌کنیم تا با اسکرول تداخل نداشته باشد.
   بنابراین کد زیر را یا پاک کن یا مثل من کامنت کن:
.ts-portfolio-card:hover .ts-portfolio-card__img {
    transform: scale(1.05);
}
*/

/* ۵. فوتر کارت: نام نمونه‌کار در پایین */
.ts-portfolio-card__footer {
    position: relative;
    z-index: 1;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.ts-portfolio-card__title {
    font-family: var(--ts-font-display);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: var(--ts-lh-tight);
    letter-spacing: -0.02em;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 40%, var(--ts-neon-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* ۶. استایل بخش مادر و سربرگ */
.ts-portfolio-section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    direction: rtl;
    font-family: var(--ts-font-base);
}

.ts-portfolio-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.ts-portfolio-header__title {
    font-family: var(--ts-font-display);
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 700;
    line-height: var(--ts-lh-tight);
    letter-spacing: -0.03em;
    background: linear-gradient(180deg, #ffffff 30%, rgba(255, 255, 255, 0.75) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 25px rgba(0, 255, 255, 0.35));
    margin-bottom: 0.85rem;
}

.ts-portfolio-header__lead {
    font-family: var(--ts-font-base);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: var(--ts-lh-loose);
    color: var(--ts-text-muted);
    max-width: 650px;
    margin: 0 auto;
}

/* ۷. نوار فیلترها */
.ts-portfolio-filter {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.ts-portfolio-filter__list {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem;
    background: rgba(10, 15, 44, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 60px;
    list-style: none;
    backdrop-filter: blur(12px);
}

.ts-portfolio-filter__btn {
    font-family: var(--ts-font-base);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    background: transparent;
    border: none;
    color: var(--ts-text-muted);
    padding: 0.6rem 1.4rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ts-portfolio-filter__btn:hover {
    color: #fff;
}

.ts-portfolio-filter__btn.is-active {
    background: linear-gradient(135deg, var(--ts-neon-cyan), var(--ts-neon-purple));
    color: #050814;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

/* ۸. شبکه گرید کارت‌ها */
.ts-portfolio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.25rem;
}

/* ۹. استایل پنجره مودال مشخصات فنی */
.ts-portfolio-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    padding: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-family: var(--ts-font-base);
    direction: rtl;
}

.ts-portfolio-modal[open] {
    opacity: 1;
    pointer-events: auto;
}

.ts-portfolio-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 20, 0.85);
    backdrop-filter: blur(10px);
}

.ts-portfolio-modal__box {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: #0a0f2c;
    border: 1px solid var(--ts-neon-purple);
    box-shadow: 0 0 40px rgba(138, 43, 226, 0.3);
    border-radius: 20px;
    padding: 2rem;
    color: #fff;
    z-index: 1;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ts-portfolio-modal[open] .ts-portfolio-modal__box {
    transform: translateY(0);
}

.ts-portfolio-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.ts-portfolio-modal__title {
    font-family: var(--ts-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: var(--ts-lh-tight);
    color: var(--ts-neon-cyan);
    margin: 0;
}

.ts-portfolio-modal__content {
    font-family: var(--ts-font-base);
    line-height: var(--ts-lh-normal);
}

.ts-portfolio-modal__close {
    background: transparent;
    border: none;
    color: var(--ts-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
}

.ts-portfolio-modal__close:hover {
    color: #fff;
}

/* ==========================================
   باکس توضیحات: کشیده، شیشه‌ای با انعکاس نور سفید
   ========================================== */

.ts-portfolio-card__details {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
    
}

.ts-portfolio-card__desc {
    position: relative;
    font-family: var(--ts-font-base);

    /* کشیدگی برای پر کردن فضای خالی */
    flex-grow: 1;
    /* ایجاد فاصله (مارجین) از تگ‌های بالا و دکمه‌های پایین */
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: 16px;

    /* افکت شیشه‌ای واقعی با انعکاس نور سفید (Glare Effect) */
    /* یک گرادیان که از سفید نیمه‌شفاف شروع میشه و به سمت بی‌رنگ میره */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 25%, rgba(10, 15, 44, 0.3) 100%);

    /* لبه‌های شیشه: بالا و راست روشن‌تر برای القای حس سه‌بعدی و تابش نور */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.12);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* لیبل کلمه "توضیحات" */
.ts-portfolio-card__desc-title {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ts-neon-cyan);
    /* رنگ سایان برای هارمونی با کهکشان */
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.15);
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    margin-bottom: 0.85rem;
}

/* متن توضیحات */
.ts-portfolio-card__desc-text {
    font-size: 0.9rem;
    line-height: var(--ts-lh-loose);
    color: #e2e8f0;
    margin: 0;

    /* محدود کردن خطوط برای حفظ یکپارچگی کارت‌ها */
    display: -webkit-box;
    -webkit-line-clamp: 8;
    /* در دسکتاپ تا ۵ خط کش میاد */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* دکمه‌ها همیشه در پایین کارت فیکس بمانند */
.ts-portfolio-card__actions {
    margin-top: auto;
}

/* ==========================================
   ریسپانسیو (موبایل و تبلت)
   ========================================== */
@media (max-width: 991px) {
    .ts-portfolio-card__desc {
        margin: 1.25rem 0;
        /* در موبایل فاصله کمی جمع‌تر می‌شود */
        padding: 1rem 1.25rem;
    }

    .ts-portfolio-card__desc-text {
        -webkit-line-clamp: 10;
        /* در موبایل فقط ۴ خط نمایش داده شود */
    }
}

/* انیمیشن اسکرول خودکار برای ماک‌آپ سایت‌ها */
@keyframes tsAutoScrollBrowser {

    0%,
    15% {
        object-position: 50% 0%;
        /* 15 درصد از زمان در بالای صفحه توقف می‌کند */
    }

    45%,
    55% {
        object-position: 50% 100%;
        /* یواش اسکرول می‌شود پایین و 10 درصد متوقف می‌ماند */
    }

    85%,
    100% {
        object-position: 50% 0%;
        /* یواش برمی‌گردد بالا و منتظر چرخه بعدی می‌ماند */
    }
}