/* ==========================================================================
   actor.css — تصميم صفحة الممثل (يُحمَّل فقط في صفحات /actor/)
   --------------------------------------------------------------------------
   • كل الأصناف بالبادئة .ax- لمنع أي تعارض مع ستايل الموقع.
   • الألوان أدناه مأخوذة من ألوان الثيم المستخدمة فعلياً (#1a1a1a / #222 / #333 / #e50914).
     لمطابقة متغيرات الموقع أكثر، عدّل قيم المتغيرات في أول كتلة .ax فقط.
   • بطاقات الأعمال نفسها تأتي من cf_section / cf_card_* (ستايل الموقع الأصلي).
   ========================================================================== */

.ax {
    /* ---- Design tokens ---- */
    --ax-surface: #1a1a1a;
    --ax-surface-2: #222222;
    --ax-border: #333333;
    --ax-text: #ffffff;
    --ax-text-soft: #dcdcdc;
    --ax-muted: #a8a8a8;
    --ax-accent: #e50914;
    --ax-accent-soft: rgba(229, 9, 20, .14);
    --ax-radius: 12px;
    --ax-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    --ax-sticky-top: 16px;           /* ارفعها (مثلاً 72px) إن كان هيدر الموقع ثابتاً */
    --ax-side-width: 280px;

    position: relative;
    isolation: isolate;
    direction: rtl;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 0 32px;
    color: var(--ax-text);
    font-family: inherit;
}

.ax *,
.ax *::before,
.ax *::after { box-sizing: border-box; }

/* ---------- خلفية سينمائية ضبابية من صورة الممثل (زخرفية فقط) ---------- */
.ax-backdrop {
    position: absolute;
    inset: 0 0 auto 0;
    height: 380px;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    border-radius: var(--ax-radius) var(--ax-radius) 0 0;
    -webkit-mask-image: linear-gradient(#000 35%, transparent);
            mask-image: linear-gradient(#000 35%, transparent);
}
.ax-backdrop::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: var(--ax-photo) center 20% / cover no-repeat;
    filter: blur(36px) saturate(1.3);
    opacity: .30;
    transform: translateZ(0);
}

/* ---------- الشبكة الرئيسية: الشريط الجانبي | المحتوى ---------- */
.ax-layout {
    display: grid;
    grid-template-columns: var(--ax-side-width) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    padding-top: 28px;
}

.ax-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: start;
}
/* التثبيت فقط إن كانت الشاشة طويلة بما يكفي لعرض الشريط كاملاً */
@media (min-width: 992px) and (min-height: 820px) {
    .ax-side { position: sticky; top: var(--ax-sticky-top); }
}

.ax-main { min-width: 0; }

/* ---------- صورة الممثل (لا تسبب CLS: النسبة محجوزة مسبقاً) ---------- */
.ax-photo {
    margin: 0;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--ax-surface-2);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
    box-shadow: var(--ax-shadow);
}
.ax-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
}

/* ---------- بطاقة المعلومات الشخصية ---------- */
.ax-facts {
    background: var(--ax-surface);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
    padding: 14px 16px 6px;
    box-shadow: var(--ax-shadow);
}
.ax-facts__title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ax-text);
}
.ax-facts dl { margin: 0; }
.ax-fact {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--ax-border);
}
.ax-fact:last-child { border-bottom: 0; }
.ax-fact__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ax-accent-soft);
    color: var(--ax-accent);
    font-size: .95rem;
}
.ax-fact dt {
    margin: 0;
    font-size: .78rem;
    color: var(--ax-muted);
}
.ax-fact dd {
    margin: 2px 0 0;
    font-weight: 700;
    color: var(--ax-text);
    overflow-wrap: anywhere;
}

/* ---------- ترويسة الاسم والمهن والإحصائيات ---------- */
.ax-head { min-width: 0; }

.ax-name {
    margin: 0 0 12px;
    font-size: clamp(1.7rem, 3.2vw, 2.6rem);
    line-height: 1.25;
    font-weight: 800;
    color: var(--ax-text);
    text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
    overflow-wrap: anywhere;
}

.ax-jobs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}
.ax-jobs li {
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--ax-accent-soft);
    border: 1px solid rgba(229, 9, 20, .45);
    color: var(--ax-text);
    font-size: .85rem;
}

.ax-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}
.ax-stat {
    flex: 1 1 96px;
    max-width: 150px;
    padding: 12px 8px;
    text-align: center;
    background: var(--ax-surface);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius);
}
.ax-stat strong {
    display: block;
    font-size: 1.5rem;
    line-height: 1.1;
    color: var(--ax-text);
}
.ax-stat span {
    display: block;
    margin-top: 4px;
    font-size: .8rem;
    color: var(--ax-muted);
}

/* ---------- النبذة التعريفية (قصيرة + باقي السيرة بدون JavaScript) ---------- */
.ax-intro {
    margin: 0 0 28px;
    padding: 16px 18px;
    background: var(--ax-surface);
    border: 1px solid var(--ax-border);
    border-inline-start: 3px solid var(--ax-accent);
    border-radius: var(--ax-radius);
    color: var(--ax-text-soft);
    line-height: 1.95;
}
.ax-intro__title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ax-text);
}
.ax-intro p { margin: 0 0 .8em; }
.ax-intro p:last-child { margin-bottom: 0; }

.ax-more { margin-top: 6px; }
.ax-more summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--ax-accent);
}
.ax-more summary::-webkit-details-marker { display: none; }
.ax-more summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform .2s ease;
}
.ax-more[open] summary::after { transform: rotate(-135deg); }
.ax-more__less { display: none; }
.ax-more[open] .ax-more__more { display: none; }
.ax-more[open] .ax-more__less { display: inline; }

/* ---------- قسم الأعمال (البطاقات من ستايل الموقع نفسه) ---------- */
.ax-works { min-width: 0; }
.ax-empty {
    padding: 28px 18px;
    text-align: center;
    color: var(--ax-muted);
    background: var(--ax-surface);
    border: 1px dashed var(--ax-border);
    border-radius: var(--ax-radius);
}

/* ---------- أدوات المدير (تحديث TMDB) ---------- */
.ax-admin {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0 0;
    padding: 12px 14px;
    background: var(--ax-surface);
    border: 1px dashed var(--ax-accent);
    border-radius: var(--ax-radius);
}
.ax-admin__label { font-size: .9rem; font-weight: 700; }
.ax-admin input[type="text"] {
    flex: 1 1 180px;
    min-width: 0;
    padding: 8px 12px;
    color: var(--ax-text);
    background: var(--ax-surface-2);
    border: 1px solid var(--ax-border);
    border-radius: 8px;
}
.ax-admin button {
    padding: 8px 20px;
    color: #fff;
    background: var(--ax-accent);
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.ax a:focus-visible,
.ax summary:focus-visible,
.ax button:focus-visible,
.ax input:focus-visible {
    outline: 2px solid var(--ax-accent);
    outline-offset: 3px;
}

/* ==========================================================================
   الجوال والتابلت (≤ 991px): عمود واحد
   الترتيب: صورة دائرية ← الاسم/المهن/الإحصائيات ← النبذة ← المعلومات ← الأعمال
   (display:contents يفكّ الحاويتين ليُعاد ترتيب عناصرهما بـ order)
   ========================================================================== */
@media (max-width: 991px) {
    .ax { padding-bottom: 20px; }
    .ax-backdrop { height: 320px; }

    .ax-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;      /* عرض كامل للعناصر (يلغي align-items:start الخاص بالديسكتوب) */
        gap: 0;
        padding-top: 20px;
    }
    .ax-side,
    .ax-main { display: contents; }

    .ax-photo {
        order: 1;
        width: 170px;
        aspect-ratio: 1 / 1;
        align-self: center;
        margin-bottom: 14px;
        border-radius: 50%;
        border: 3px solid var(--ax-accent);
    }
    .ax-head   { order: 2; text-align: center; }
    .ax-intro  { order: 3; margin-bottom: 20px; }
    .ax-facts  { order: 4; margin-bottom: 24px; }
    .ax-works  { order: 5; }

    .ax-jobs,
    .ax-stats { justify-content: center; }

    .ax-facts dl {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        column-gap: 20px;
    }
    .ax-fact:last-child { border-bottom: 1px solid var(--ax-border); }
    .ax-facts dl .ax-fact:last-child { border-bottom: 0; }
}

@media (max-width: 575px) {
    .ax-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
        gap: 8px;
    }
    .ax-stat { max-width: none; padding: 10px 4px; }
    .ax-stat strong { font-size: 1.3rem; }
    .ax-intro { padding: 14px; }
    .ax-photo { width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    .ax *, .ax *::before, .ax *::after { transition: none !important; }
}
