/* ============================================================
   خوارزميات — «المؤلفون»: دليل المؤلفين + الملف الشخصي
   يتبع هوية «نسيج المعرفة» (أخضر مهيمن · كحلي · برتقالي)
   ============================================================ */

/* ---------- دعوة المؤلفين داخل البانر (تسجيل / دخول) ---------- */
.khw-auth-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.khw-auth-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 15.5px;
    font-weight: 700;
    border-radius: 999px;
    padding: 14px 30px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, background 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.khw-auth-cta__btn i { font-size: 14px; }

.khw-auth-cta__btn--primary {
    color: #06231a;
    background: linear-gradient(135deg, #7fe3b0 0%, #2eb97e 65%);
    box-shadow: 0 16px 32px -14px rgba(46, 185, 126, 0.75);
}

.khw-auth-cta__btn--primary:hover {
    color: #06231a;
    transform: translateY(-3px);
    box-shadow: 0 22px 40px -14px rgba(46, 185, 126, 0.9);
}

.khw-auth-cta__btn--ghost {
    color: #eaf7f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1.6px solid rgba(127, 227, 176, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.khw-auth-cta__btn--ghost:hover {
    color: #06231a;
    background: #7fe3b0;
    border-color: transparent;
    transform: translateY(-3px);
}

.khw-auth-cta__note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Tajawal", sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(234, 247, 240, 0.82);
    line-height: 1.7;
}

.khw-auth-cta__note i { color: #7fe3b0; }

@media (max-width: 575px) {
    .khw-auth-cta { gap: 10px; margin-top: 20px; }
    .khw-auth-cta__btn { padding: 12px 22px; font-size: 14.5px; }
    .khw-auth-cta__note { font-size: 12.5px; }
}

/* ---------- شريط البحث داخل الدليل ---------- */
.khw-auth-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid rgba(46, 185, 126, 0.28);
    border-radius: 999px;
    padding: 7px 7px 7px 18px;
    box-shadow: 0 10px 26px -16px rgba(22, 50, 79, 0.3);
    max-width: 460px;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.khw-auth-search:focus-within {
    border-color: var(--khw-green, #2eb97e);
    box-shadow: 0 0 0 4px rgba(46, 185, 126, 0.14);
}

.khw-auth-search i { color: #8aa0ac; font-size: 15px; }

.khw-auth-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: "Tajawal", sans-serif;
    font-size: 15px;
    color: var(--khw-ink, #22343c);
    padding: 8px 4px;
    min-width: 0;
}

.khw-auth-search button {
    flex: none;
    border: none;
    cursor: pointer;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--khw-green, #2eb97e), #22a06c);
    border-radius: 999px;
    padding: 10px 22px;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.khw-auth-search button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(46, 185, 126, 0.6);
}

.khw-auth-search__clear {
    font-family: "Tajawal", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #157f52;
    text-decoration: underline;
    text-underline-offset: 4px;
    white-space: nowrap;
}

/* ============================================================
   دليل المؤلفين
   ============================================================ */
.khw-auth {
    padding: 66px 0 100px;
    background:
        radial-gradient(ellipse 55% 50% at 90% 6%, rgba(46, 185, 126, 0.06) 0%, transparent 60%),
        linear-gradient(180deg, #f6faf7 0%, #fbfdfb 100%);
    direction: rtl;
    position: relative;
}

.khw-auth::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(46, 185, 126, 0.11) 1.2px, transparent 1.2px);
    background-size: 34px 34px;
    -webkit-mask-image: radial-gradient(ellipse 50% 55% at 88% 10%, #000 0%, transparent 70%);
    mask-image: radial-gradient(ellipse 50% 55% at 88% 10%, #000 0%, transparent 70%);
    pointer-events: none;
}

.khw-auth__inner { position: relative; z-index: 2; }

.khw-auth__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
    margin-bottom: 38px;
}

.khw-auth__head-titles { max-width: 620px; }

.khw-auth__kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: #157f52;
    margin: 0 0 10px;
}

.khw-auth__kicker::before {
    content: "";
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(270deg, #2eb97e, transparent);
}

.khw-auth__title {
    font-family: "Tajawal", sans-serif;
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 800;
    color: var(--khw-navy, #16324f);
    margin: 0 0 8px;
}

.khw-auth__title span { color: #157f52; }

.khw-auth__desc {
    font-family: "Tajawal", sans-serif;
    font-size: 16px;
    line-height: 1.85;
    color: #52666f;
    margin: 0;
}

.khw-auth__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: "Tajawal", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--khw-navy, #16324f);
    background: #fff;
    border: 1px solid rgba(46, 185, 126, 0.3);
    border-radius: 999px;
    padding: 10px 20px;
    box-shadow: 0 8px 20px -12px rgba(22, 50, 79, 0.25);
}

.khw-auth__count i { color: var(--khw-orange, #ff9f45); }

.khw-auth__toolbar { margin-bottom: 34px; }

/* ---------- الشبكة ---------- */
.khw-auth__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
    gap: 26px;
}

/* ---------- بطاقة المؤلف ---------- */
.khw-auth__card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border: 1px solid rgba(22, 50, 79, 0.09);
    border-radius: 22px;
    padding: 30px 22px 24px;
    text-decoration: none;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(22, 50, 79, 0.05), 0 18px 38px -20px rgba(22, 50, 79, 0.18);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.khw-auth__card::before {
    content: "";
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 4px;
    background: linear-gradient(270deg, #2eb97e, #ff9f45);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.khw-auth__card:hover {
    transform: translateY(-8px);
    border-color: rgba(46, 185, 126, 0.4);
    box-shadow: 0 8px 16px rgba(22, 50, 79, 0.08), 0 34px 60px -22px rgba(6, 35, 26, 0.4);
}

.khw-auth__card:hover::before { transform: scaleX(1); }

.khw-auth__avatar {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(145deg, #0a2e1f, #06231a);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 12px 26px -12px rgba(6, 35, 26, 0.6);
    border: 3px solid #fff;
    outline: 2px solid rgba(46, 185, 126, 0.28);
}

.khw-auth__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.khw-auth__card:hover .khw-auth__avatar img { transform: scale(1.07); }

.khw-auth__avatar i { color: rgba(127, 227, 176, 0.8); font-size: 38px; }

.khw-auth__name {
    font-family: "Tajawal", sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--khw-navy, #16324f);
    margin: 0 0 5px;
    transition: color 0.3s ease;
}

.khw-auth__card:hover .khw-auth__name { color: #157f52; }

.khw-auth__role {
    font-family: "Tajawal", sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: #8aa0ac;
    margin: 0 0 12px;
}

.khw-auth__bio {
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    line-height: 1.85;
    color: #52666f;
    margin: 0 0 16px;
    flex: 1;
}

.khw-auth__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: "Tajawal", sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #157f52;
    background: rgba(46, 185, 126, 0.1);
    border-radius: 999px;
    padding: 7px 15px;
    margin-bottom: 14px;
}

.khw-auth__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: #157f52;
    margin-top: auto;
}

.khw-auth__more i { font-size: 12px; transition: transform 0.3s ease; }
.khw-auth__card:hover .khw-auth__more { color: #ff9f45; }
.khw-auth__card:hover .khw-auth__more i { transform: translateX(-4px); }

.khw-auth__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 54px 20px;
    font-family: "Tajawal", sans-serif;
}

.khw-auth__empty i { font-size: 42px; color: rgba(46, 185, 126, 0.5); margin-bottom: 16px; display: block; }
.khw-auth__empty p { font-size: 18px; color: #52666f; margin: 0 0 6px; }
.khw-auth__empty span { font-size: 15px; color: #8aa0ac; }

/* ============================================================
   صفحة الملف الشخصي للمؤلف
   ============================================================ */
.khw-prof {
    position: relative;
    padding: 60px 0 46px;
    background:
        radial-gradient(ellipse 70% 90% at 18% 20%, rgba(15, 77, 51, 0.55) 0%, transparent 65%),
        linear-gradient(150deg, #0a2e1f 0%, #04180f 100%);
    direction: rtl;
    overflow: hidden;
}

.khw-prof::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(127, 227, 176, 0.14) 1.2px, transparent 1.2px);
    background-size: 30px 30px;
    -webkit-mask-image: radial-gradient(ellipse 60% 70% at 20% 30%, #000 0%, transparent 72%);
    mask-image: radial-gradient(ellipse 60% 70% at 20% 30%, #000 0%, transparent 72%);
    pointer-events: none;
}

.khw-prof__inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.khw-prof__avatar {
    flex: 0 0 auto;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    overflow: hidden;
    background: #06231a;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255, 255, 255, 0.12);
    outline: 2px solid rgba(46, 185, 126, 0.4);
    box-shadow: 0 24px 50px -18px rgba(2, 12, 8, 0.8);
}

.khw-prof__avatar img { width: 100%; height: 100%; object-fit: cover; }
.khw-prof__avatar i { font-size: 54px; color: rgba(127, 227, 176, 0.7); }

.khw-prof__info { flex: 1; min-width: 260px; }

.khw-prof__kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: "Tajawal", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #7fe3b0;
    margin: 0 0 8px;
}

.khw-prof__kicker::before {
    content: "";
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(270deg, #7fe3b0, transparent);
}

.khw-prof__name {
    font-family: "Tajawal", sans-serif;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.25;
}

.khw-prof__role {
    font-family: "Tajawal", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ff9f45;
    margin: 0 0 14px;
}

.khw-prof__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.khw-prof__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Tajawal", sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: #eaf7f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(127, 227, 176, 0.25);
    border-radius: 999px;
    padding: 8px 16px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.khw-prof__chip i { color: #7fe3b0; }

/* ---------- جسم الملف ---------- */
.khw-profbody {
    padding: 54px 0 90px;
    background: linear-gradient(180deg, #f6faf7 0%, #fbfdfb 100%);
    direction: rtl;
}

.khw-profbody__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
}

@media (min-width: 992px) {
    .khw-profbody__grid { grid-template-columns: 1fr 320px; }
}

.khw-card {
    background: #fff;
    border: 1px solid rgba(22, 50, 79, 0.09);
    border-radius: 20px;
    padding: 28px 26px;
    box-shadow: 0 2px 6px rgba(22, 50, 79, 0.05), 0 18px 38px -22px rgba(22, 50, 79, 0.18);
}

.khw-card + .khw-card { margin-top: 22px; }

.khw-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Tajawal", sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--khw-navy, #16324f);
    margin: 0 0 16px;
}

.khw-card__title i { color: var(--khw-green, #2eb97e); font-size: 17px; }

.khw-card__text {
    font-family: "Tajawal", sans-serif;
    font-size: 15.5px;
    line-height: 2;
    color: #52666f;
    margin: 0;
    white-space: pre-line;
}

.khw-card__muted {
    font-family: "Tajawal", sans-serif;
    font-size: 15px;
    color: #8aa0ac;
    margin: 0;
}

/* قائمة بيانات جانبية */
.khw-facts { list-style: none; margin: 0; padding: 0; }

.khw-facts li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-family: "Tajawal", sans-serif;
    font-size: 14.5px;
    color: #52666f;
    padding: 11px 0;
}

.khw-facts li:not(:last-child) { border-bottom: 1px solid rgba(22, 50, 79, 0.08); }
.khw-facts li i { color: var(--khw-green, #2eb97e); width: 18px; text-align: center; }
.khw-facts li b { color: var(--khw-navy, #16324f); font-weight: 800; }

/* ---------- التجاوب ---------- */
@media (max-width: 991px) {
    .khw-prof__inner { gap: 22px; }
    .khw-prof__avatar { width: 116px; height: 116px; }
}

@media (max-width: 575px) {
    .khw-auth { padding: 50px 0 72px; }
    .khw-auth__grid { grid-template-columns: 1fr; gap: 20px; }
    .khw-auth__head { margin-bottom: 28px; }
    .khw-prof { padding: 44px 0 36px; }
    .khw-prof__inner { flex-direction: column; align-items: flex-start; text-align: right; }
    .khw-profbody { padding: 38px 0 66px; }
    .khw-card { padding: 22px 18px; }
    .khw-auth-search { padding: 6px 6px 6px 14px; }
    .khw-auth-search button { padding: 9px 16px; font-size: 13.5px; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
    .khw-auth__card,
    .khw-auth__card::before,
    .khw-auth__avatar img,
    .khw-auth__more i,
    .khw-auth-search button { transition: none !important; }
    .khw-auth__card:hover { transform: none; }
    .khw-auth__card:hover .khw-auth__avatar img { transform: none; }
    .khw-auth-search button:hover { transform: none; }
}
