/* =============================================
   PROJECT DETAIL PAGE STYLES
   ============================================= */

/* RTL scrollbar fix: keep scrollbar on the right, prevent horizontal overflow */
html[dir="rtl"] {
    direction: ltr;
    overflow-y: scroll;
    overflow-x: hidden;
}
html[dir="rtl"] body {
    direction: rtl;
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
}

/* LTR: also prevent any horizontal overflow */
html[dir="ltr"] body {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
}

/* Ensure no child escapes the viewport horizontally */
html[dir="rtl"] main,
html[dir="ltr"] main {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Global box-sizing for all page elements */
.pd-hero, .pd-overview, .pd-gallery, .pd-feature-img-section,
.pd-details, .pd-strip, .pd-contact-cta, .pd-next {
    box-sizing: border-box;
    max-width: 100%;
}

/* ---- Hero ---- */
.pd-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    background: #250000;
}

.pd-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.pd-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pd-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(37,0,0,0.15) 0%,
        rgba(37,0,0,0.00) 40%,
        rgba(37,0,0,0.72) 100%
    );
}

/* ---- Back button ---- */
.pd-back-btn {
    position: absolute;
    top: 100px;
    left: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #F2EAE2;
    text-decoration: none;
    font-family: var(--heading-font);
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 10;
}

.pd-back-btn:hover { opacity: 1; }
.pd-back-btn svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform 0.3s ease; }
.pd-back-btn:hover svg { transform: translateX(-5px); }

/* RTL back button — anchor right, arrow flipped */
[dir="rtl"] .pd-back-btn {
    left: auto;
    right: 40px;
}
[dir="rtl"] .pd-back-btn svg { transform: scaleX(-1); }
[dir="rtl"] .pd-back-btn:hover svg { transform: scaleX(-1) translateX(-5px); }

/* ---- Hero bottom content ---- */
.pd-hero-content {
    position: relative;
    z-index: 5;
    width: 100%;
    padding: clamp(30px,5vw,60px) clamp(20px,5vw,80px);
}

.pd-hero-label {
    font-family: var(--heading-font);
    font-size: 0.7rem;
    letter-spacing: 4px;
    color: #F2EAE2;
    opacity: 0.6;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.pd-hero-title {
    font-family: var(--heading-font);
    font-size: clamp(3rem,8vw,7rem);
    font-weight: 400;
    color: #F2EAE2;
    line-height: 1;
    margin: 0 0 20px;
    letter-spacing: 0.02em;
}
[dir="ltr"] .pd-hero-title { text-transform: uppercase; }

.pd-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #F2EAE2;
    opacity: 0.75;
    font-family: var(--main-font);
    font-size: 0.9rem;
    letter-spacing: 1px;
}
[dir="ltr"] .pd-hero-meta { text-transform: uppercase; }
.pd-hero-sep { opacity: 0.4; }

/* ---- Scroll cue ---- */
.pd-scroll-cue {
    position: absolute;
    bottom: 40px;
    right: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 5;
}
[dir="rtl"] .pd-scroll-cue { right: auto; left: 50px; }

.pd-scroll-cue span {
    font-family: var(--heading-font);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: #F2EAE2;
    writing-mode: vertical-rl;
}
.pd-scroll-line {
    width: 1px; height: 50px;
    background: #F2EAE2;
    transform-origin: top;
    animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
    0%,100% { opacity:0.3; transform:scaleY(0.4); }
    50%      { opacity:1;   transform:scaleY(1); }
}

@media (max-width: 768px) {
    .pd-back-btn              { left: 20px; top: 80px; }
    [dir="rtl"] .pd-back-btn  { left: auto; right: 20px; }
    .pd-scroll-cue             { right: 20px; }
    [dir="rtl"] .pd-scroll-cue { right: auto; left: 20px; }
}

/* ---- Overview ---- */
.pd-overview {
    background: #F2EAE2;
    padding: clamp(60px,10vw,120px) clamp(20px,5vw,80px);
    overflow: hidden;
    width: 100%;
}
.pd-overview-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: clamp(40px,6vw,100px);
    align-items: start;
}
@media (max-width: 900px) {
    .pd-overview-inner { grid-template-columns: 1fr; gap: 50px; }
}

.pd-overview-label {
    font-family: var(--heading-font);
    font-size: 0.7rem;
    letter-spacing: 4px;
    color: #250000;
    opacity: 0.45;
    text-transform: uppercase;
    margin-bottom: 20px;
}
[dir="rtl"] .pd-overview-label { letter-spacing: 1px; }

.pd-overview-title {
    font-family: var(--heading-font);
    font-size: clamp(1.8rem,4vw,3.2rem);
    font-weight: 400;
    color: #250000;
    line-height: 1.15;
    margin: 0 0 24px;
}
[dir="ltr"] .pd-overview-title { text-transform: uppercase; }

.pd-overview-desc {
    font-family: var(--main-font);
    font-size: clamp(0.95rem,1.5vw,1.1rem);
    line-height: 1.9;
    color: #250000;
    text-align: justify;
}

/* ---- Stats ---- */
.pd-overview-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: rgba(37,0,0,0.12);
    border: 1px solid rgba(37,0,0,0.12);
    align-self: start;
}
.pd-stat {
    background: #F2EAE2;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pd-stat-value {
    font-family: var(--heading-font);
    font-size: clamp(1.4rem,2.5vw,2rem);
    color: #250000;
    font-weight: 400;
    line-height: 1;
}
.pd-stat-label {
    font-family: var(--heading-font);
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: #250000;
    opacity: 0.4;
    text-transform: uppercase;
}
[dir="rtl"] .pd-stat-label { letter-spacing: 1px; }

/* ---- Gallery Grid ---- */
.pd-gallery {
    background: #fff;
    padding: 0;
    position: relative;
    z-index: 1;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}
.pd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 280px;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}
.pd-gallery-grid .pd-gal-item:nth-child(1) { grid-column: span 7; grid-row: span 2; }
.pd-gallery-grid .pd-gal-item:nth-child(2) { grid-column: span 5; }
.pd-gallery-grid .pd-gal-item:nth-child(3) { grid-column: span 5; }
.pd-gallery-grid .pd-gal-item:nth-child(4) { grid-column: span 4; }
.pd-gallery-grid .pd-gal-item:nth-child(5) { grid-column: span 4; }
.pd-gallery-grid .pd-gal-item:nth-child(6) { grid-column: span 4; }

/* Tablet */
@media (max-width: 900px) {
    .pd-gallery-grid {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 220px;
    }
    .pd-gallery-grid .pd-gal-item {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
    .pd-gallery-grid .pd-gal-item:nth-child(1) {
        grid-column: span 2 !important;
    }
}

/* Mobile — completely flat single column, no complex spans */
@media (max-width: 768px) {
    .pd-gallery-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
    }
    .pd-gallery-grid .pd-gal-item {
        width: 100% !important;
        height: 260px !important;
        grid-column: unset !important;
        grid-row: unset !important;
        flex: none !important;
    }
}

.pd-gal-item {
    overflow: hidden;
    cursor: zoom-in;
    transform-origin: center center;
    will-change: transform, opacity;
    box-sizing: border-box;
}
.pd-gal-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.pd-gal-item:hover img { transform: scale(1.06); }

/* ---- Feature Image ---- */
.pd-feature-img-section {
    width: 100%; position: relative; z-index: 1; line-height: 0; overflow: hidden;
}
.pd-feature-img-wrap { width:100%; }
.pd-feature-img {
    width:100%; height:auto; display:block;
}

/* ---- Details / Scope ---- */
.pd-details {
    background: #250000;
    color: #F2EAE2;
    padding: clamp(60px,10vw,120px) clamp(20px,5vw,80px);
    position: relative; z-index: 1;
    overflow: hidden;
    width: 100%;
}
.pd-details-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: clamp(40px,6vw,100px);
}
/* RTL: swap column widths */
[dir="rtl"] .pd-details-inner { grid-template-columns: 1.6fr 1fr; }

@media (max-width: 768px) {
    .pd-details-inner,
    [dir="rtl"] .pd-details-inner { grid-template-columns: 1fr; gap: 50px; }
    [dir="rtl"] .pd-details-left  { order: 2; }
    [dir="rtl"] .pd-details-right { order: 1; }
}

.pd-details-label {
    font-family: var(--heading-font);
    font-size: 0.65rem;
    letter-spacing: 4px;
    color: #F2EAE2;
    opacity: 0.4;
    text-transform: uppercase;
    margin-bottom: 28px;
}
[dir="rtl"] .pd-details-label { letter-spacing: 1px; }

.pd-scope-list { list-style:none; padding:0; margin:0; }
.pd-scope-list li {
    font-family: var(--heading-font);
    font-size: clamp(1rem,2vw,1.25rem);
    color: #F2EAE2;
    letter-spacing: 0.5px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(242,234,226,0.1);
}
[dir="ltr"] .pd-scope-list li { text-transform: uppercase; }

.pd-details-body {
    font-family: var(--main-font);
    font-size: clamp(0.95rem,1.5vw,1.1rem);
    line-height: 1.95;
    color: #F2EAE2;
    text-align: justify;
}

/* ---- Strip ---- */
.pd-strip { background:#fff; overflow:hidden; padding:6px 0; position:relative; z-index:1; width:100%; }

.pd-strip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 100%;
}

/* Arrow buttons */
.pd-strip-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(37, 0, 0, 0.75);
    border: 1px solid rgba(242, 234, 226, 0.3);
    color: #F2EAE2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.pd-strip-btn:hover {
    background: rgba(37, 0, 0, 0.95);
    border-color: #F2EAE2;
    transform: translateY(-50%) scale(1.08);
}
.pd-strip-btn svg { width: 18px; height: 18px; pointer-events: none; }
.pd-strip-prev { left: 16px; }
.pd-strip-next { right: 16px; }

.pd-strip-track {
    display: flex;
    gap: 6px;
    height: 320px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 6px;
    direction: ltr;
    width: 100%;
}

.pd-strip-item {
    flex: 0 0 auto;
    width: clamp(240px,30vw,420px);
    height: 100%;
    overflow: hidden;
    scroll-snap-align: start;
    cursor: zoom-in;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
}
.pd-strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.pd-strip-item:hover img { transform: scale(1.06); }

/* ---- Lightbox ---- */
.pd-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.93);
    z-index: 9900;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.pd-lightbox.open { opacity:1; pointer-events:auto; }
.pd-lightbox-img {
    max-width:90vw; max-height:86vh;
    object-fit:contain; border-radius:2px;
    transform:scale(0.95);
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
    display:block; user-select:none;
}
.pd-lightbox.open .pd-lightbox-img { transform:scale(1); }

.pd-lightbox-close {
    position:absolute; top:24px; right:32px;
    background:none;
    border:1px solid rgba(242,234,226,0.4);
    border-radius:50px;
    color:#F2EAE2;
    font-family:var(--heading-font);
    font-size:0.7rem; letter-spacing:2px;
    padding:10px 22px;
    cursor:pointer; text-transform:uppercase;
    transition:background 0.3s ease, border-color 0.3s ease;
    z-index:2;
}
[dir="rtl"] .pd-lightbox-close { right:auto; left:32px; }
.pd-lightbox-close:hover { background:rgba(242,234,226,0.12); border-color:#F2EAE2; }

.pd-lightbox-prev,
.pd-lightbox-next {
    position:absolute; top:50%; transform:translateY(-50%);
    background:rgba(242,234,226,0.07);
    border:1px solid rgba(242,234,226,0.2);
    border-radius:50%;
    width:48px; height:48px;
    cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    color:#F2EAE2;
    opacity:0.65;
    transition:opacity 0.3s ease, background 0.3s ease;
    z-index:2;
}
.pd-lightbox-prev { left:24px; }
.pd-lightbox-next { right:24px; }
[dir="rtl"] .pd-lightbox-prev { left:auto; right:24px; }
[dir="rtl"] .pd-lightbox-next { right:auto; left:24px; }
.pd-lightbox-prev:hover,
.pd-lightbox-next:hover { opacity:1; background:rgba(242,234,226,0.15); }
.pd-lightbox-prev svg,
.pd-lightbox-next svg { width:22px; height:22px; }

/* ---- Contact CTA ---- */
.pd-contact-cta {
    position: relative;
    height: 60vh;
    min-height: 400px;
    overflow: hidden;
    z-index: 1;
}

.pd-contact-cta-bg {
    position: absolute;
    inset: 0;
}

.pd-contact-cta-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.pd-contact-cta-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(37, 0, 0, 0.55) 0%,
        rgba(37, 0, 0, 0.65) 100%
    );
}

.pd-contact-cta-content {
    position: absolute;
    bottom: clamp(30px, 6vw, 60px);
    right: clamp(20px, 5vw, 80px);
    z-index: 5;
}

/* RTL: position on left */
[dir="rtl"] .pd-contact-cta-content {
    right: auto;
    left: clamp(20px, 5vw, 80px);
}

.pd-contact-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(242, 234, 226, 0.12);
    border: 2px solid rgba(242, 234, 226, 0.6);
    border-radius: 50px;
    color: #F2EAE2;
    text-decoration: none;
    font-family: var(--heading-font);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 16px 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
}

.pd-contact-cta-btn:hover {
    background: rgba(242, 234, 226, 0.25);
    border-color: #F2EAE2;
    transform: translateY(-2px);
}

.pd-contact-cta-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.pd-contact-cta-btn:hover svg {
    transform: translateX(4px);
}

/* RTL: arrow is already left-pointing in HTML; just slide left on hover */
[dir="rtl"] .pd-contact-cta-btn svg {
    transform: none;
}

[dir="rtl"] .pd-contact-cta-btn:hover svg {
    transform: translateX(-4px);
}

@media (max-width: 600px) {
    .pd-contact-cta { height: 50vh; min-height: 320px; }
    .pd-contact-cta-btn { font-size: 0.7rem; padding: 12px 20px; }
}

/* ---- Next Project ---- */
.pd-next {
    position:relative; height:55vh; min-height:320px;
    overflow:hidden; display:block; z-index:1;
}
.pd-next-link {
    display:block; width:100%; height:100%;
    text-decoration:none; position:relative;
}
.pd-next-bg { position:absolute; inset:0; }
.pd-next-img {
    width:100%; height:100%; object-fit:cover;
    transition: transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.pd-next-link:hover .pd-next-img { transform:scale(1.04); }
.pd-next-overlay {
    position:absolute; inset:0;
    background:linear-gradient(to bottom,rgba(37,0,0,0.15),rgba(37,0,0,0.68));
}

.pd-next-content {
    position:absolute;
    bottom: clamp(30px,6vw,60px);
    left:   clamp(20px,5vw,80px);
    display:flex; flex-direction:column; gap:10px;
}
/* RTL: anchor right */
[dir="rtl"] .pd-next-content {
    left:auto;
    right: clamp(20px,5vw,80px);
    align-items: flex-end;
}

.pd-next-label {
    font-family:var(--heading-font);
    font-size:0.65rem; letter-spacing:4px;
    color:#F2EAE2; opacity:0.6; text-transform:uppercase;
}
[dir="rtl"] .pd-next-label { letter-spacing:1px; }

.pd-next-title {
    font-family:var(--heading-font);
    font-size:clamp(2rem,5vw,4rem);
    font-weight:400; color:#F2EAE2; margin:0; line-height:1.05;
}
[dir="ltr"] .pd-next-title { text-transform:uppercase; }

.pd-next-arrow {
    margin-top:8px;
    width:42px; height:42px;
    border:1px solid rgba(242,234,226,0.5);
    border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    color:#F2EAE2;
    transition:background 0.35s ease, border-color 0.35s ease, transform 0.35s ease;
}
.pd-next-link:hover .pd-next-arrow {
    background:rgba(242,234,226,0.15);
    border-color:#F2EAE2;
    transform:translateX(6px);
}
[dir="rtl"] .pd-next-link:hover .pd-next-arrow { transform:translateX(-6px); }
.pd-next-arrow svg { width:18px; height:18px; }
/* RTL: arrow already points ← in the HTML; no flip needed */
[dir="rtl"] .pd-next-arrow svg { transform: none; }

/* ---- Social sidebar: above page sections, below lightbox ---- */
.social-sidebar {
    z-index: 500 !important;
}
/* RTL: keep on left side */
html[dir="rtl"] .social-sidebar {
    right: auto !important;
    left: 30px !important;
}
@media (max-width: 1024px) {
    html[dir="rtl"] .social-sidebar { left: 16px !important; }
}

/* ---- Responsive final tweaks ---- */
@media (max-width: 600px) {
    .pd-overview { padding: 50px 20px; }
    .pd-details  { padding: 50px 20px; }
    .pd-back-btn              { top:80px; left:20px; }
    [dir="rtl"] .pd-back-btn  { left:auto; right:20px; }

    /* Prevent GSAP scale animations from causing horizontal overflow on mobile */
    .pd-gallery,
    .pd-overview,
    .pd-details,
    .pd-feature-img-section,
    .pd-strip,
    .pd-contact-cta,
    .pd-next {
        overflow: hidden !important;
    }

    /* Strip: smaller height on mobile */
    .pd-strip-track { height: 220px; }
    .pd-strip-item  { width: clamp(180px, 75vw, 300px); }
}
