/* ===== Detail Hero ===== */
.detail-hero {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 400px;
    max-height: 600px;
    margin-top: 95px;
    overflow: hidden;
}

.hero-image-wrap {
    position: absolute;
    inset: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2, #e5e7eb);
}

.hero-placeholder svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted, #9ca3af);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.3) 40%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.hero-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px clamp(20px, 5vw, 80px);
    z-index: 2;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 16px;
    transition: color 0.3s, gap 0.3s;
    width: fit-content;
}

.back-link:hover {
    color: #fff;
    gap: 12px;
}

.back-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.project-title {
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    cursor: pointer;
}

.scroll-hint-line {
    width: 2px;
    height: 32px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ===== Description ===== */
.detail-description {
    padding: clamp(40px, 8vw, 80px) clamp(20px, 5vw, 80px);
    max-width: 1200px;
    margin: 0 auto;
}

.desc-container {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.desc-container.revealed {
    opacity: 1;
    transform: translateY(0);
}

.desc-accent {
    width: 50px;
    height: 4px;
    background: var(--accent, #2dd4bf);
    border-radius: 2px;
    margin-bottom: 24px;
}

.desc-heading {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 20px 0;
}

.desc-body {
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 2;
    color: var(--text-secondary, #4b5563);
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ===== Gallery ===== */
.detail-gallery {
    padding: 0 clamp(20px, 5vw, 80px) clamp(40px, 8vw, 80px);
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-line {
    flex: 1;
    height: 1px;
    background: var(--border, #e5e7eb);
}

.gallery-title {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0;
    white-space: nowrap;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.gallery-item:hover::after {
    background: rgba(0, 0, 0, 0.15);
}

/* ویدئو/عکس داخل گالری */
.gallery-image,
.gallery-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* اگر آیتم پرتره بود (مثلاً ویدئوی عمودی موبایل) */
.gallery-item.is-portrait {
    aspect-ratio: 9 / 16;        /* شبیه استوری اینستاگرام */
}

/* برای پرتره، تصویر/ویدئو را contain کن تا کش نیاید */
.gallery-item.is-portrait .gallery-image,
.gallery-item.is-portrait .gallery-video {
    object-fit: contain;
    background: #000;            /* لبه‌ی بالا/پایین مشکی تمیز */
}


.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
    transition: transform 0.3s;
}

.lb-close:hover {
    transform: rotate(90deg);
}

.lb-close svg {
    width: 28px;
    height: 28px;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10;
}

.lb-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lb-nav svg {
    color: var(--accent);
    width: 22px;
    height: 22px;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

.lb-counter {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    z-index: 10;
}

.lb-image-wrap {
    width: 90vw;
    height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


/* ویدئو در لایت‌باکس مثل عکس رفتار کند */
.lb-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #000;
    display: block;
}

.lb-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.3s ease;
    display: block;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    text-align: center;
    padding: 20px 20px 60px;
}

.bottom-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 12px 28px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 50px;
    transition: all 0.3s ease;
}

.bottom-back-link:hover {
    color: var(--accent, #2dd4bf);
    border-color: var(--accent, #2dd4bf);
    gap: 12px;
}

.bottom-back-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] .hero-placeholder {
    background: #1f2937;
}

[data-theme="dark"] .desc-heading,
[data-theme="dark"] .gallery-title {
    color: #f3f4f6;
}

[data-theme="dark"] .desc-body {
    color: #d1d5db;
}

[data-theme="dark"] .gallery-line {
    background: #374151;
}

[data-theme="dark"] .bottom-back-link {
    color: #9ca3af;
    border-color: #374151;
}

[data-theme="dark"] .bottom-back-link:hover {
    color: var(--accent, #2dd4bf);
    border-color: var(--accent, #2dd4bf);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .detail-hero {
        height: 50vh;
        min-height: 300px;
        max-height: 450px;
        /* margin-top: ; */
    }

    .hero-content {
        padding: 24px 20px;
    }

    .back-link {
        font-size: 0.82rem;
        margin-bottom: 12px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }

    .lb-nav {
        width: 40px;
        height: 40px;
    }

    .lb-prev {
        left: 10px;
    }

    .lb-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .detail-hero {
        height: 45vh;
        min-height: 260px;
        max-height: 380px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gallery-item {
        aspect-ratio: 16 / 10;
    }

    .lb-nav {
        width: 36px;
        height: 36px;
        top: auto;
        bottom: 24px;
        transform: none;
    }

    .lb-prev {
        left: calc(50% + 30px);
        right: auto;
    }

    .lb-next {
        right: calc(50% + 30px);
        left: auto;
    }
}

/* ===== Hero Slider ===== */
.hero-slider-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease;
}

.hero-slide.active {
    opacity: 1;
    z-index: 1;
}

.hero-slide img,
.hero-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dots */
.slider-dots {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.slider-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: 0.3s;
}

.slider-dots span.active {
    background: #fff;
    transform: scale(1.2);
}

/* Gallery Overlay */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.gallery-item-overlay svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

/* ===== Enhanced Lightbox ===== */
.lb-full-toggle {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.lb-full-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox.level-2 .lb-nav {
    width: 70px;
    height: 70px;
}

.lightbox.level-2 .lb-nav svg {
    width: 30px;
    height: 30px;
}

/* ===== Project Navigation ===== */
.project-navigation {
    display: flex;
    justify-content: space-between;
    padding: 60px clamp(20px,5vw,80px);
    border-top: 1px solid var(--border,#e5e7eb);
}

.project-nav-item {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: 0.3s;
}

.project-nav-item span {
    font-size: 0.85rem;
    color: var(--text-secondary,#6b7280);
}

.project-nav-item strong {
    font-size: 1.1rem;
}

.project-nav-item:hover {
    color: var(--accent,#2dd4bf);
}


/* ===== Project Navigation - ساده و کوچک ===== */
.project-nav-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px clamp(20px, 5vw, 80px);
    border-top: 1px solid var(--border, #e5e7eb);
    margin-top: 40px;
}

.nav-simple-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-secondary, #6b7280);
    font-size: 0.9rem;
    transition: color 0.2s, gap 0.2s;
}

.nav-simple-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-simple-link:hover {
    color: var(--accent, #2dd4bf);
    gap: 12px;
}

.nav-simple-link.prev svg {
    order: 1;
}

.nav-simple-link span {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* حذف استایل‌های قبلی project-navigation و project-nav-item */
.project-navigation,
.project-nav-item {
    /* این کلاس‌ها دیگه استفاده نمیشن، میتونید حذفشون کنید */
    display: none;
}

.project-nav-simple .nav-simple-link span {
    font-size: 1rem; /* بزرگتر */
    font-weight: 600;
    max-width: 300px; /* پهنای بیشتری دارد */
    text-align: right; /* اگر نیاز به راست چین است */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* فلش ها */

.project-nav-simple .nav-simple-link.prev svg {
    order: 0; /* فلش قبل کنار متن سمت چپ */
    margin-left: 8px;
    margin-right: 0;
}

.project-nav-simple .nav-simple-link.next svg {
    order: 1;
    margin-right: 8px;
}

/* تنظیم جهت لینک قبلی بصورت ردیف معکوس (فلش سمت چپ) */
.project-nav-simple .nav-simple-link.prev {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* ===== اسکرول هینت افقی (چپ و راست) ===== */
.scroll-hint-horizontal {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.scroll-hint-line-horizontal {
    width: 32px;
    height: 2px;
    background: var(--accent, #2dd4bf);
    border-radius: 2px;
}

.scroll-hint-line-horizontal.right-to-left {
    animation: slideRightToLeft 1.2s ease-in-out infinite;
}

/* خط سمت چپ - حرکت به سمت راست */
.scroll-hint-line-horizontal.left-to-right {
    animation: slideLeftToRight 1.2s ease-in-out infinite;
}

@keyframes slideRightToLeft {
    0% {
        transform: translateX(6px);
        opacity: 0.3;
    }
    50% {
        transform: translateX(-6px);
        opacity: 1;
    }
    100% {
        transform: translateX(6px);
        opacity: 0.3;
    }
}

@keyframes slideLeftToRight {
    0% {
        transform: translateX(-6px);
        opacity: 0.3;
    }
    50% {
        transform: translateX(6px);
        opacity: 1;
    }
    100% {
        transform: translateX(-6px);
        opacity: 0.3;
    }
}

/* اختیاری: اگر میخواهید متن "گالری تصاویر" حذف بشه و فقط خط باشه، میتونید span رو مخفی کنید */
.scroll-hint-horizontal span {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 500;
    color: var(--text-primary, #1f2937);
    letter-spacing: 1px;
}

/* در هدر گالری، ترتیب المانها رو تنظیم کنید تا خط اسکرول هینت کنار عنوان بیاد */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

/* اگر h2.gallery-title اضافی است و میخواهید فقط اسکرول هینت باشه، اون رو مخفی کنید */
/* .gallery-title { display: none; } */

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lightbox:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 1);
}

.lightbox:-webkit-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 1);
}
