/* Explain: Styles for the branches section, including card layouts and animations. */
/* ===== فرعانا — المقر في القاهرة ومكتب غزة ===== */
.branches-grid {
    display: grid;
    gap: 1.4rem;
    margin-top: 3rem;
}

@media (min-width: 900px) {
    .branches-grid {
        grid-template-columns: 1fr auto 1fr;
        align-items: stretch;
        gap: 1.4rem;
    }
}

.branch-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: 2.2rem;
    background: linear-gradient(155deg, #ffffff 0%, var(--surface-color) 100%);
    padding: 1.8rem;
    box-shadow: 0 22px 60px rgba(19, 19, 22, 0.08);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s ease, border-color 0.6s ease;
}

.branch-card::after {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 84% 6%, rgba(200, 16, 46, 0.14), transparent 18rem);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    content: "";
}

.branch-card.is-active,
.branch-card:hover {
    border-color: rgba(200, 16, 46, 0.45);
    box-shadow: 0 34px 80px rgba(200, 16, 46, 0.2);
    transform: translateY(-8px);
}

.branch-card.is-active::after,
.branch-card:hover::after {
    opacity: 1;
}

.branch-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.branch-icon {
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.2rem;
    background: linear-gradient(150deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    font-size: 1.3rem;
    box-shadow: 0 14px 34px rgba(200, 16, 46, 0.4);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.branch-card.is-active .branch-icon,
.branch-card:hover .branch-icon {
    transform: rotate(-6deg) scale(1.08);
}

.branch-role {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    background: var(--sage-soft);
    padding: 0.4rem 0.9rem;
    color: var(--sage-dark);
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.branch-card.is-active .branch-role {
    background: var(--primary-color);
    color: #ffffff;
}

.branch-city {
    position: relative;
    z-index: 1;
    margin-top: 1.4rem;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.2;
}

.branch-country {
    position: relative;
    z-index: 1;
    margin-top: 0.3rem;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 700;
}

.branch-text {
    position: relative;
    z-index: 1;
    margin-top: 0.9rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.9;
}

.branch-details {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.75rem;
    margin-top: 1.3rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.2rem;
}

.branch-detail {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.7;
}

.branch-detail i {
    margin-top: 0.2rem;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.branch-detail a {
    color: var(--text-color);
    font-weight: 700;
    transition: color 0.3s ease;
}

.branch-detail a:hover {
    color: var(--primary-color);
}

/* ===== المسار المتحرك بين الفرعين ===== */
.branch-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.4rem 0.5rem;
}

.branch-link-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--primary-color);
    font-size: 1.1rem;
    box-shadow: 0 12px 30px rgba(19, 19, 22, 0.12);
    animation: branchIconFloat 3.6s ease-in-out infinite;
}

@keyframes branchIconFloat {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

.branch-link-track {
    position: relative;
    display: block;
    width: 100%;
    min-width: 4.5rem;
    height: 3px;
    border-radius: 999px;
    background-image: repeating-linear-gradient(90deg, rgba(200, 16, 46, 0.4) 0 9px, transparent 9px 18px);
}

.branch-link-glow {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    background: var(--accent-color);
    box-shadow: 0 0 16px 5px rgba(225, 29, 56, 0.7);
    transform: translate(-50%, -50%);
    animation: branchTravel 3.8s cubic-bezier(0.52, 0, 0.48, 1) infinite;
}

@keyframes branchTravel {
    0% {
        left: 0%;
        opacity: 0;
    }

    9% {
        opacity: 1;
    }

    50% {
        left: 100%;
        opacity: 1;
    }

    84% {
        left: 100%;
        opacity: 1;
    }

    92%, 100% {
        left: 100%;
        opacity: 0;
    }
}

.branch-link-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
}

@media (min-width: 900px) {
    .branch-link {
        height: 100%;
        min-width: 6rem;
        padding: 1.4rem 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .branch-link-glow,
    .branch-link-icon {
        animation: none;
    }

    .branch-link-glow {
        left: 50%;
        opacity: 1;
    }

    .branch-card,
    .branch-icon {
        transition: none;
    }

    .branch-card:hover,
    .branch-card.is-active {
        transform: none;
    }
}