Halacha

הלכה א
מִי שֶׁבָּאָה לוֹ שְׁמוּעָה שֶׁמֵּת לוֹ קָרוֹב. אִם בְּתוֹךְ שְׁלֹשִׁים יוֹם הִגִּיעָה הַשְּׁמוּעָה אֲפִלּוּ יוֹם שְׁלֹשִׁים עַצְמוֹ הֲרֵי זוֹ שְׁמוּעָה קְרוֹבָה. וְחַיָּב לִנְהֹג שִׁבְעָה יְמֵי אֲבֵלוּת מִיּוֹם שֶׁהִגִּיעָה הַשְּׁמוּעָה. וְקוֹרֵעַ וּמוֹנֶה שְׁלֹשִׁים לְאִסּוּר הַתִּסְפֹּרֶת עִם שְׁאָר הַדְּבָרִים. כְּלָלוֹ שֶׁל דָּבָר יוֹם שְׁמוּעָתוֹ הַקְּרוֹבָה כְּיוֹם הַקְּבוּרָה. אֲבָל אִם הִגִּיעָה לוֹ הַשְּׁמוּעָה אַחַר הַשְּׁלֹשִׁים יוֹם הֲרֵי זוֹ שְׁמוּעָה רְחוֹקָה וְאֵינָהּ נוֹהֶגֶת אֶלָּא יוֹם אֶחָד וְאֵינוֹ קוֹרֵעַ. וּכְאִלּוּ יוֹם הַשְּׁמוּעָה הוּא יוֹם שְׁבִיעִי וְיוֹם שְׁלֹשִׁים וּמִקְצָת הַיּוֹם כְּכֻלּוֹ:
כסף משנה
1.
The following rules apply when a person receives a report that a close relative of his died. If he received the report within 30 days of the person's death - even on the thirtieth day itself - it is considered a proximate report. He must observe the seven days of mourning from the time he receives the report. He must rend his garments and count 30 days for the prohibition against cutting one's hair and the other factors from that date. The general principle is: The day on which he hears the report is like the day of the person's burial.
If, however, a person receives a report after 30 days, it is considered as a distant report. He observes mourning rites for only one day and is not required to rend his garments. It is as if the day of the report is both the seventh day and the thirtieth day. And we follow the principle: A portion of the day is considered as the entire day.

הלכה ב
כֵּיצַד מִקְצָת הַיּוֹם כְּכֻלּוֹ. כֵּיוָן שֶׁנָּהַג אֲבֵלוּת שָׁעָה אַחַת כְּאִלּוּ נָהַג כָּל הַיּוֹם כֻּלּוֹ. וּמֻתָּר לִנְעל וְלִרְחֹץ וְלָסוּךְ וּלְגַלֵּחַ בִּשְׁאָר הַיּוֹם. וְכֵן הוּא מֻתָּר בְּכָל הַדְּבָרִים:
כסף משנה
2.
What is implied by the statement: A portion of the day is considered as the entire day? Once one observed the mourning rites for a certain time He is permitted to wear shoes, wash, anoint himself, and cut his hair during the remainder of the day. Similarly, he has license not to observe any of the mourning rites.

הלכה ג
מִי שֶׁבָּאָה לוֹ שְׁמוּעָה קְרוֹבָה בְּתוֹךְ הָרֶגֶל אוֹ בְּיוֹם שַׁבָּת וּלְאַחַר שַׁבָּת אוֹ אַחַר הָרֶגֶל נַעֲשֵׂית רְחוֹקָה. עוֹלֶה לוֹ וְאֵינוֹ נוֹהֵג לְאַחַר הָרֶגֶל אוֹ לְאַחַר הַשַּׁבָּת אֶלָּא יוֹם אֶחָד בִּלְבַד. וּמִקְצָת הַיּוֹם כְּכֻלּוֹ כְּמוֹ שֶׁבֵּאַרְנוּ:
כסף משנה
3.
When a person hears a proximate report in the midst of a festival or on the Sabbath and after the Sabbath or after the festival, the report will become distant, the Sabbath or the festival are counted for him. Thus he observes only one day of mourning after the festival or after the Sabbath. And a portion of the day is considered as the entire day as explained.

הלכה ד
מִי שֶׁמֵּת לוֹ קָרוֹב וְלֹא יָדַע עַד שֶׁבָּא. אִם הָיָה בְּמָקוֹם קָרוֹב שֶׁהוּא מַהֲלַךְ עֲשָׂרָה פַּרְסָאוֹת שֶׁאֶפְשָׁר שֶׁיָּבוֹא בְּיוֹם אֶחָד. אֲפִלּוּ בָּא בַּיּוֹם הַשְּׁבִיעִי. אִם מָצָא מְנַחֲמִים אֵצֶל גְּדוֹל הַבַּיִת אַף עַל פִּי שֶׁנִּנְעֲרוּ לַעֲמֹד הוֹאִיל וּמָצָא מְנַחֲמִים עוֹלֶה לוֹ וּמוֹנֶה עִמָּהֶן תַּשְׁלוּם שְׁלֹשִׁים יוֹם. וְאִם לֹא מָצָא מְנַחֲמִים מוֹנֶה לְעַצְמוֹ. וְכֵן אִם הָיָה בְּמָקוֹם רָחוֹק אֲפִלּוּ בָּא בְּיוֹם שֵׁנִי מוֹנֶה לְעַצְמוֹ שִׁבְעָה וּשְׁלֹשִׁים מִיּוֹם שֶׁבָּא:
כסף משנה
4.
The following rules apply when a close relative of a person dies and that person does not know until he comes to that place. If he was in a close place, e.g., within ten parseot away, and thus he could come in one day, even if he came on the seventh day, if he finds people offering comfort to the person of greatest stature in the family, it is considered as if he was together with them and he counts with them the remainder of the 30 days. This applies even if they had already begun to rise, as long as he finds comforters, he counts with the other mourners.
If he did not find comforters, he counts for himself. Similarly, if he comes from a distant place, even if he comes on the second day, he counts seven and thirty days for himself from the day he comes.

הלכה ה
אָבֵל בִּשְׁלֹשָׁה יָמִים הָרִאשׁוֹנִים אֵינוֹ הוֹלֵךְ אֲפִלּוּ לְבֵית אָבֵל אַחֵר. מִכָּאן וְאֵילָךְ הוֹלֵךְ וְאֵינוֹ יוֹשֵׁב בִּמְקוֹם הַמְנַחֲמִין אֶלָּא בִּמְקוֹם הַמִּתְנַחֲמִין. וְלֹא יֵצֵא לְמָקוֹם אַחֵר מִפֶּתַח בֵּיתוֹ כָּל שַׁבָּת הָרִאשׁוֹנָה. שְׁנִיָּה יוֹצֵא וְאֵינוֹ יוֹשֵׁב בִּמְקוֹמוֹ. שְׁלִישִׁית יוֹשֵׁב בִּמְקוֹמוֹ וְאֵינוֹ מְדַבֵּר כְּדַרְכּוֹ. רְבִיעִית הֲרֵי הוּא כְּכָל אָדָם:
כסף משנה
5.
During the first three days of mourning, a mourner does not even go the house of another mourner. From that time onward, he may go, but he does not sit together with those offering comfort, but with those receiving comfort. He should not leave the entrance to his house to go any place for the entire first week. During the second week, he may leave his home, but should not sit in his ordinary place. During the third week, he may sit in his ordinary place, but should not speak in his ordinary manner. During the fourth week, he is like any other person.

הלכה ו
כֹּהֵן גָּדוֹל חַיָּב בְּכָל דִּבְרֵי אֲבֵלוּת. אֶלָּא שֶׁאָסוּר לוֹ לִקְרֹעַ בְּגָדָיו לְמַעְלָה וּלְגַדֵּל פֶּרַע וְלָצֵאת אַחַר הַמִּטָּה. וְכָל הָעָם בָּאִין לְנַחֲמוֹ לְבֵיתוֹ. וּכְשֶׁמַּבְרִין אוֹתוֹ כָּל הָעָם מְסֻבִּין עַל הָאָרֶץ וְהוּא מֵסֵב עַל הַסַּפְסָל. וְאוֹמְרִין לוֹ כְּשֶׁמְּנַחֲמִין אוֹתוֹ אָנוּ כַּפָּרָתְךָ וְהוּא אוֹמֵר לָהֶם תִּתְבָּרְכוּ מִן הַשָּׁמַיִם. וְאִם רָצָה לְנַחֵם אֲחֵרִים הַמְמֻנֶּה מְמַצְּעוֹ בְּתוֹךְ הָעָם וְאוֹמֵר לָהֶם תְּנֻחֲמוּ:
כסף משנה
6.
The High Priest is obligated to observe all the mourning practices, except that he is forbidden to rend the upper portion of his garments, to let his hair grow long, or to follow the bier in the funeral procession.
The entire Jewish people come to his house to comfort him. When they bring him the meal of comfort, all of the people must sit on the ground; he, by contrast, sits on a bench. When they comfort him, they tell him: "We are atonement for you." And he tells them: "May you be blessed from heaven."
If he desires to comfort others, the deputee has him positioned among the people. And he tells the mourners: "Be comforted."

הלכה ז
וְכֵן הַמֶּלֶךְ חַיָּב בְּכָל דִּבְרֵי אֲבֵלוּת אֶלָּא שֶׁאֵינוֹ יוֹצֵא מִפֶּתַח פַּלְטֵרִין שֶׁלּוֹ אַחַר מֵתוֹ. וְאֵין צָרִיךְ לוֹמַר אַחַר מֵתִים אֲחֵרִים. וְאֵינוֹ מְנַחֵם אֲבֵלִים. וְלֹא יָצָא דָּוִד אַחַר אַבְנֵר אֶלָּא לְהוֹדִיעַ לָעָם שֶׁלֹּא נֶהֱרַג בִּרְצוֹנוֹ:
כסף משנה
7.
Similarly, a king is obligated to observe all the mourning practices, except that he does not leave his palace in the funeral procession for his dead. Needless to say, this applies with regard to other deceased. Nor does he comfort mourners. King David followed Avner's funeral procession only to show the people that he was not slain because of David's desire.

הלכה ח
אֵין אָדָם נִכְנָס לַמֶּלֶךְ לְנַחֲמוֹ אֶלָּא עֲבָדָיו וּמִי שֶׁנָּתַן לוֹ רְשׁוּת לְהִכָּנֵס. וְאֵין לָהֶן רְשׁוּת לְדַבֵּר לוֹ דִּבְרֵי תַּנְחוּמִין אֶלָּא כְּפִי מַה שֶּׁיַּרְשֶׁה אוֹתָם. וּכְשֶׁמַּבְרִין אוֹתוֹ כָּל הָעָם מְסֻבִּין עַל הָאָרֶץ וְהוּא מֵסֵב עַל הַדַּרְגָּשׁ:
כסף משנה
8.
No one enters the king's presence to comfort him except his servants and those who are given permission to enter. They do not have permission to speak words of comfort except what he allows them. When they serve him the meal of comfort, all of the others recline on the ground and he reclines on a dargesh.

שופטים הלכות אבל פרק ז
Shoftim Eivel Chapter 7