/* ==========================================================
   قسم المسعفين — Team page
   Same structure & colours, refined and modernised
========================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* ================================
   Design tokens
================================ */
:root {
    /* brand (unchanged maroon family) */
    --maroon-900: #480707;
    --maroon-800: #5e0b0e;
    --maroon-700: #7a1014;   /* page background */
    --maroon-600: #951418;   /* accent */
    --maroon-tint: rgba(149, 20, 24, 0.07);

    /* neutrals */
    --surface: #faf8f8;
    --card: #ffffff;
    --line: #ece6e6;
    --text: #7a1014;
    --muted: #6b6464;

    --whatsapp: #25d366;
    --whatsapp-dark: #128c4a;

    --radius-lg: 28px;
    --radius-md: 18px;
    --shadow-card: 0 1px 2px rgba(72, 7, 7, 0.06), 0 8px 24px rgba(72, 7, 7, 0.07);
    --shadow-card-hover: 0 2px 4px rgba(72, 7, 7, 0.08), 0 18px 40px rgba(72, 7, 7, 0.16);

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ================================
   Reset
================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================================
   Page & background
================================ */
body {
    direction: rtl;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(900px 500px at 0% 110%, rgba(0, 0, 0, 0.25), transparent 60%),
        var(--maroon-700);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
a {
    font: inherit;
}

.team-page {
    display: flex;
    flex-direction: column;
    gap: 36px;
    width: 94%;
    max-width: 1440px;
    margin: 48px auto;
    padding: 56px 48px 48px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 30px 60px rgba(0, 0, 0, 0.28);
}

/* ================================
   Logo & title
================================ */
.team-page > img {
    display: block;
    width: 150px;
    height: auto;
    margin: 0 auto -12px;
    object-fit: contain;
}

.page-title {
    text-align: center;
    font-size: clamp(26px, 3.4vw, 36px);
    font-weight: 700;
    line-height: 1.3;
    color: var(--maroon-900);
    letter-spacing: -0.01em;
}

/* hide the title block while the h1 is empty */
.page-title:empty {
    display: none;
}

.page-title:not(:empty)::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    margin: 14px auto 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--maroon-600), var(--maroon-800));
}

/* ================================
   Rows
================================ */
.team-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}

/* ================================
   Horizontal scroll rows
   (auto margins = centred when it fits, scrolls when it doesn't)
================================ */
.team-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    /* room so card shadows & hover lift are not clipped */
    padding: 14px 6px 22px;
    margin: -14px 0 -10px;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* old Edge / IE */
}

.team-scroll .team-row {
    flex-wrap: nowrap;
    width: max-content;
    margin-inline: auto;
}

.team-scroll .member-card {
    scroll-snap-align: start;
}

.team-scroll::-webkit-scrollbar,
.row-3::-webkit-scrollbar {
    display: none;                  /* Chrome, Edge, Safari */
}

/* ================================
   Card
================================ */
.member-card {
    position: relative;
    flex: 0 0 220px;
    width: 220px;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    white-space: normal;
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

.member-card:hover {
    transform: translateY(-6px);
    border-color: rgba(149, 20, 24, 0.25);
    box-shadow: var(--shadow-card-hover);
}

/* ================================
   Member photo
================================ */
.member-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(145deg, #f3e9e9, #e8dada);
}

/* soft fade into the info area */
.member-image::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 30%;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.35), transparent);
    pointer-events: none;
}

.member-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.member-card:hover .member-image img {
    transform: scale(1.05);
}

/* ================================
   Card content
================================ */
.member-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 6px 16px 22px;
    text-align: center;
}

/* name */
.member-info h2 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--maroon-900);
    margin-bottom: 10px;
}

/* cards that only have a name (no role / description) */
.member-info h2:last-child {
    margin-bottom: 0;
    padding-bottom: 2px;
}

/* role badge */
.job-title {
    display: inline-block;
    padding: 4px 14px;
    margin-bottom: 12px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--maroon-600);
    background: var(--maroon-tint);
    border: 1px solid rgba(149, 20, 24, 0.12);
    border-radius: 999px;
}

/* description */
.member-info p {
    flex: 1;
    min-height: 42px;
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--muted);
}

/* ================================
   WhatsApp button
================================ */
.whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-top: auto;
    border-radius: 50%;
    font-size: 20px;
    color: var(--whatsapp-dark);
    text-decoration: none;
    background: rgba(37, 211, 102, 0.12);
    border: 1px solid rgba(37, 211, 102, 0.3);
    transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.whatsapp:hover {
    color: #fff;
    background: var(--whatsapp);
    transform: scale(1.08);
    box-shadow: 0 8px 18px rgba(37, 211, 102, 0.35);
}

.whatsapp:focus-visible,
.team-scroll:focus-visible {
    outline: 3px solid var(--maroon-600);
    outline-offset: 3px;
}

/* ================================
   First row (leadership) — larger cards
================================ */
.row-3 .member-card {
    flex: 0 0 280px;
    width: 280px;
}

/* accent bar across the top of leadership cards */
.row-3 .member-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    z-index: 2;
    background: linear-gradient(90deg, var(--maroon-800), var(--maroon-600));
}

.row-3 .member-info h2 {
    font-size: 19px;
}

.row-3 .job-title {
    font-size: 13px;
}

/* ================================
   Tablet
================================ */
@media (max-width: 1000px) {
    .team-page {
        padding: 44px 28px 36px;
    }
}

/* ================================
   Mobile
================================ */
@media (max-width: 700px) {
    .team-page {
        width: 94%;
        margin: 16px auto;
        padding: 32px 14px 26px;
        gap: 26px;
        border-radius: 22px;
    }

    .team-page > img {
        width: 96px;
    }

    .team-row {
        gap: 14px;
    }

    .member-card,
    .row-3 .member-card {
        flex: 0 0 200px;
        width: 200px;
    }

    .member-info h2,
    .row-3 .member-info h2 {
        font-size: 16px;
    }

    /* leadership row becomes a swipeable strip on phones */
    .row-3 {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: -14px -14px -10px;
        padding: 14px 14px 22px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .row-3 .member-card {
        scroll-snap-align: start;
    }

    .team-scroll {
        width: calc(100% + 28px);
        margin: -14px -14px -10px;
        padding: 14px 14px 22px;
    }
}

/* ================================
   Reduced motion
================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .member-card:hover,
    .member-card:hover .member-image img,
    .whatsapp:hover {
        transform: none;
    }
}