.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }

.portfolio-card { 
    position: relative;
    background: var(--bg); 
    border: 1px solid var(--glass-border); 
    border-radius: 20px; 
    overflow: hidden;
    transition: all .4s ease; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); 
    cursor: pointer; 
    height: 420px;
    display: block;
}
.portfolio-card:hover { 
    border-color: var(--primary); 
    transform: translateY(-8px); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); 
}
.portfolio-alert-badge { 
    position: absolute; 
    top: 15px; right: 15px; 
    background: #dc5050; color: #fff; 
    padding: 5px 12px; border-radius: 20px; 
    font-size: 11px; font-weight: 700; 
    z-index: 5; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); 
}

/* تصویر پس‌زمینه (قفل شده درون کادر) */
.portfolio-gallery { 
    position: absolute;
    top: 0; left: 0;
    width: 100%; 
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background: var(--bg);
}
.portfolio-gallery img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    object-position: center top; 
    display: block;
    transition: transform .5s ease; 
}
.portfolio-card:hover .portfolio-gallery img { transform: scale(1.08); }

.lib-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.lib-placeholder iconify-icon {
    font-size: 64px;
    color: rgba(255, 255, 255, 0.3);
}

/* لایه شیشه‌ای پایین کارت */
.portfolio-content { 
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    z-index: 2;
    padding: 20px; 
    background: rgba(255, 255, 255, 0.15); 
    backdrop-filter: blur(12px) saturate(180%); 
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.3); 
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1); 
    display: flex; 
    flex-direction: column;
    border-bottom-left-radius: 20px; 
    border-bottom-right-radius: 20px; 
}

.portfolio-content h3 { 
    font-size: 17px; 
    font-weight: 700; 
    color: #ffffff; 
    margin-bottom: 6px; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.4); 
}
.portfolio-content p { 
    font-size: 13px; 
    color: rgba(255, 255, 255, 0.9); 
    line-height: 1.7; 
    margin-bottom: 12px; 
    font-weight: 300; 
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.portfolio-tags { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 5px; 
    margin-bottom: 12px;
}
.portfolio-content .tag { 
    background: rgba(255, 255, 255, 0.2); 
    border: 1px solid rgba(255, 255, 255, 0.4); 
    color: #fff; 
    backdrop-filter: blur(4px);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}
.portfolio-empty { 
    text-align: center; 
    color: var(--text); 
    opacity: 0.4; 
    padding: 60px 0; 
    grid-column: 1/-1; 
}

/* دکمه مشاهده جزئیات داخل کارت */
.portfolio-content .btn-secondary { 
    width: 100%; 
    justify-content: center; 
    padding: 10px 14px;
    font-size: 13px;
    background: #ffffff; 
    color: #333333; 
    font-weight: 600; 
    border: 1px solid transparent;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 10px;
    text-decoration: none;
}
.portfolio-content .btn-secondary:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

html[data-theme="dark"] .portfolio-content {
    background: rgba(0, 0, 0, 0.6); 
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .portfolio-content .tag {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) { 
    .portfolio-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 15px; 
    } 
    .portfolio-card { height: 350px; }
    .portfolio-content { padding: 15px; }
    .portfolio-content h3 { font-size: 15px; }
    .portfolio-content p { font-size: 11px; }
    .portfolio-content .btn-secondary { padding: 9px 12px; font-size: 12px; }
}
@media (max-width: 480px) {
    .portfolio-tags .tag { font-size: 10px; padding: 3px 6px; }
}
