/* =========================================================
   Project pages — header + section tabs
   (ينضاف بعد style7.css بكل صفحات المشاريع)
   ========================================================= */

.page-intro {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 6px auto 0;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

.back-link:hover {
    color: #65ba9e;
    transform: translateX(-4px);
}

.back-arrow {
    display: inline-block;
}

html[dir="rtl"] .back-arrow {
    transform: scaleX(-1);
}

html[dir="rtl"] .back-link:hover {
    transform: translateX(4px);
}

/* العنوان: أيقونة القسم + الاسم + عدد الفيديوهات */
.page-title-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.page-icon {
    flex: none;
    width: 76px;
    height: 76px;
    padding: 12px;
    border: 3px solid #65ba9e;
    border-radius: 22px;
    background-color: #081c15;
    color: #65ba9e;
}

.page-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.pi-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 52;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pi-line.thin {
    stroke-width: 40;
}

.pi-fill {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 40;
    stroke-linejoin: round;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.page-eyebrow {
    color: #65ba9e;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.page-title {
    font-size: clamp(1.8rem, 4.6vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    color: #e9ffec;
}

.page-count {
    align-self: center;
    margin-inline-start: auto;
    padding: 6px 14px;
    border: 1px solid rgba(101, 186, 158, 0.45);
    border-radius: 30px;
    color: #65ba9e;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

/* شريط الأقسام: القسم الحالي يكون مضوي */
.section-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar {
    display: none;
}

.section-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding: 10px 18px 10px 14px;
    border: 1px solid rgba(101, 186, 158, 0.35);
    border-radius: 30px;
    background-color: rgba(8, 28, 21, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #e9ffec;
    font-size: 0.92rem;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

html[dir="rtl"] .section-tab {
    padding: 10px 14px 10px 18px;
}

.section-tab svg {
    width: 22px;
    height: 22px;
    flex: none;
    overflow: visible;
}

a.section-tab:hover {
    border-color: #65ba9e;
    color: #65ba9e;
    transform: translateY(-2px);
}

a.section-tab:focus-visible {
    outline: 2px solid #e9ffec;
    outline-offset: 3px;
}

.section-tab.is-active {
    background-color: #65ba9e;
    border-color: #65ba9e;
    color: #081c15;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(101, 186, 158, 0.3);
}

/* حالة فاضية (قسم بعده بدون فيديوهات) */
.empty-state {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 30px auto 60px;
    padding: 0 20px;
}

.empty-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 60px 24px;
    border: 2px dashed rgba(101, 186, 158, 0.45);
    border-radius: 24px;
    background-color: rgba(8, 28, 21, 0.7);
    text-align: center;
    color: rgba(233, 255, 236, 0.8);
}

.empty-state-box svg {
    width: 70px;
    height: 70px;
    color: #65ba9e;
    overflow: visible;
}

/* ===== زر اللغة (نفس اللي بالصفحة الرئيسية) ===== */
.lang-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 84px;
    height: 36px;
    padding: 3px;
    border: 1px solid rgba(101, 186, 158, 0.6);
    border-radius: 30px;
    background-color: rgba(8, 28, 21, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    cursor: pointer;
    direction: ltr;
    transition: border-color 0.3s ease;
}

.lang-toggle:hover {
    border-color: #65ba9e;
}

.lang-toggle:focus-visible {
    outline: 2px solid #e9ffec;
    outline-offset: 3px;
}

.lang-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 30px;
    background-color: #65ba9e;
    transition: transform 0.45s cubic-bezier(0.76, 0, 0.24, 1);
}

html[lang="ar"] .lang-toggle::before {
    transform: translateX(100%);
}

.lang-opt {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    color: #e9ffec;
    transition: color 0.35s ease;
}

.lang-ar {
    font-size: 0.95rem;
}

html:not([lang="ar"]) .lang-en,
html[lang="ar"] .lang-ar {
    color: #081c15;
}

/* العربي: الـ letter-spacing يكسر ربط الحروف */
html[lang="ar"] body * {
    letter-spacing: 0 !important;
}

html[lang="ar"] .page-title {
    line-height: 1.4;
}

html[lang="ar"] .page-eyebrow {
    font-size: 0.9rem;
}

.main-logo img {
    width: 220px;
    height: auto;
}

@media screen and (max-width: 600px) {
    .page-title-row {
        gap: 14px;
    }

    .page-icon {
        width: 58px;
        height: 58px;
        padding: 9px;
        border-radius: 16px;
    }

    .page-count {
        margin-inline-start: 0;
    }

    .section-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        overflow: visible;
        gap: 8px;
    }

    .section-tab,
    html[dir="rtl"] .section-tab {
        justify-content: center;
        gap: 8px;
        padding: 10px 10px;
        font-size: 0.8rem;
        white-space: normal;
        text-align: center;
        line-height: 1.3;
        min-width: 0;
    }

    .section-tab svg {
        width: 18px;
        height: 18px;
    }

    .main-logo img {
        width: 170px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-intro { animation: none; }
}

/* =========================================================
   Video cards + Player (lightbox)
   ========================================================= */
.reel-card {
    position: relative;
    outline: none;
}

.reel-card:focus-visible {
    box-shadow: 0 0 0 3px #e9ffec, 0 15px 30px rgba(101, 186, 158, 0.3);
}

.reel-card:nth-child(n+5) { animation-delay: 0.5s; }

.play-btn-icon svg {
    width: 22px;
    height: 22px;
    margin-inline-start: 3px;
    fill: currentColor;
}

html[dir="rtl"] .play-btn-icon svg {
    margin-inline-start: 0;
    margin-inline-end: 3px;
}

/* كروت اليوتيوب (عريضة) */
.reels-grid-container.is-wide {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.yt-card {
    display: flex;
    flex-direction: column;
    background-color: #081c15;
}

.yt-card .reel-media-wrapper {
    aspect-ratio: 16 / 9;
}

.yt-card .reel-media-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.yt-card:hover .reel-media-wrapper img {
    transform: scale(1.06);
}

.yt-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 16px;
    min-width: 0;
}

.yt-title {
    color: #e9ffec;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-channel {
    color: #65ba9e;
    font-size: 0.8rem;
}

/* ---------- Player ---------- */
html.player-lock,
html.player-lock body {
    overflow: hidden;
}

.player {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
    padding: 16px 16px 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.player.is-open {
    opacity: 1;
    visibility: visible;
}

.player-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(2, 11, 8, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.player-top,
.player-body,
.player-caption {
    position: relative;
    z-index: 1;
}

.player-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.player-count {
    padding: 6px 14px;
    border: 1px solid rgba(101, 186, 158, 0.45);
    border-radius: 30px;
    color: #65ba9e;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}

.player-btn {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 2px solid #65ba9e;
    border-radius: 50%;
    background-color: rgba(8, 28, 21, 0.8);
    color: #65ba9e;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.player-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.player-btn:hover {
    background-color: #65ba9e;
    color: #081c15;
    transform: scale(1.06);
}

.player-btn:focus-visible {
    outline: 2px solid #e9ffec;
    outline-offset: 3px;
}

html[dir="rtl"] .player-nav svg {
    transform: scaleX(-1);
}

.player-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 0;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

.player-nav {
    flex: none;
    width: 54px;
    height: 54px;
}

.player-stage {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.96);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.18s ease;
}

.player.is-open .player-stage {
    transform: scale(1);
}

.player-stage.is-swapping {
    opacity: 0;
    transform: scale(0.97);
}

.player-stage {
    container-type: size;
}

.player-stage video {
    display: block;
    width: min(100cqw, calc(100cqh * 9 / 16));
    height: auto;
    aspect-ratio: 9 / 16;
    object-fit: contain;
    background-color: #000;
    border: 3px solid #65ba9e;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.player-stage.is-wide iframe {
    display: block;
    width: min(1100px, 100cqw, calc(100cqh * 16 / 9));
    aspect-ratio: 16 / 9;
    height: auto;
    border: 3px solid #65ba9e;
    border-radius: 20px;
    background-color: #000;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.player-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.player-title {
    color: #e9ffec;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.player-yt {
    color: #65ba9e;
    font-size: 0.85rem;
    text-decoration: none;
}

.player-yt:hover {
    text-decoration: underline;
}

@media screen and (max-width: 700px) {
    .player {
        padding: 12px 10px 16px;
        gap: 10px;
    }

    .player-body {
        position: relative;
        gap: 0;
    }

    /* على الموبايل الأسهم فوق الفيديو بالجوانب */
    .player-nav {
        position: absolute;
        top: 50%;
        z-index: 2;
        width: 40px;
        height: 40px;
        margin-top: -20px;
        background-color: rgba(8, 28, 21, 0.6);
    }

    .player-prev { inset-inline-start: 4px; }
    .player-next { inset-inline-end: 4px; }

    .player-stage video {
        border-radius: 16px;
    }

    .player-stage.is-wide iframe {
        border-radius: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .player,
    .player-stage {
        transition: none;
    }
}
