/* ==========================================================================
   Main home page of the institute (/ar), used by client/home.blade.php
   Loaded after custom.css (through the CSScripts section of the layout).
   Shared site styles stay in style.css and custom.css; this file has only what is specific to the home page.

   TABLE OF CONTENTS, in page order (search for the number and title in the section comments below)
    1. Headings and spacing
    2. Hadith
    3. News carousel
    4. Events and prayer times
    5. Imam section (icons)
    6. Questions and opinions
    7. Selected lessons
    8. Photo album
    9. App download banner
   10. Taqi and Majid banners
   11. Related sites (Dar al-Ilm)
   ========================================================================== */


/* ==========================================================================
   1. Headings and spacing
   The section titles are <h2>. They keep the spacing the old <h1> had (normalize.css gave <h1> its margin).
   ========================================================================== */
h2.H1 {
    margin: 0.67em 0;
}

.row.mb-2.VCenter > h2.H1 {
    margin-top: 0;
}

/* Title row of a section (icon + title) */
.HomeTitleRow {
    padding: 0 15px;
}

.HomeTitleRowBetween {
    justify-content: space-between;
}

/* Rows that fill the full width without Bootstrap's negative margin */
.CoverFirst.row,
.CoverSecond.row,
.ShahidRow.row {
    margin: 0;
}

/* The questions column comes in from the right (data-aos side-right): what travels outside the row is cut, so the page does not get wider
   while it moves. (The opinions on the other side have the zoom-in of AOS on each card.) */
.CoverSecond.row {
    overflow-x: clip;
}

.RtlBox {
    direction: rtl;
}

.InlineBlock {
    display: inline-block;
}

.HomeBtnLeft {
    float: left;
}

/* Desktop: the archive button starts on the same left edge as the news cards */
@media (min-width: 992px) {
    .HomeBtnLeft {
        margin-left: 15px;
    }
}


/* ==========================================================================
   2. Hadith
   ========================================================================== */
.HadisWrap {
    background-color: white;
    position: sticky;
}

/* Phone (below 744px and in landscape): a 5px light gray strip between the banner and the hadith (the same one as under the blue bar) */
@media (max-width: 743.98px), (max-width: 991.98px) and (max-height: 500px) {
    .HadisWrap::before {
        content: "";
        display: block;
        height: 5px;
        background: var(--LightGray);
    }

    /* the hadith ornaments start 1px under the strip (the strip covers their top row), no gap */
    .Hadis {
        margin-top: -3px;
    }
}

/* Phone and tablet (below 992px): the hadith text is justified, the last line starts from the right */
@media (max-width: 991.98px) {
    .Hadis .ImgContainer > p:not(:first-of-type) {
        text-align: justify;
    }
}

/* Phone (below 744px and in landscape): the space of the banner follows the picture (1600 x 420: its height is 26.25% of
   the width); 3px less, so the strip covers the last 3px of the picture, as before */
@media (max-width: 743.98px), (max-width: 991.98px) and (max-height: 500px) {
    .hepost {
        height: calc(26.25vw - 3px);
    }
}

/* The desktop header (blue bar, banner, menu), from 744px up to 1409px: the space of the banner is exactly its picture
   (1600 x 420: 26.25% of the width, the percent of the padding follows the page width, without the scrollbar), so the
   menu touches the picture. It was 370px for all desktops, which left a white band between the picture and the menu
   (34px at 1280px, up to 100px at 1024px). From 1410px the picture is 370px or more, so 370px stays. A phone in landscape
   has the phone header (above). */
@media (min-width: 744px) and (max-width: 991.98px) and (min-height: 501px), (min-width: 992px) and (max-width: 1409.98px) {
    .hepost {
        height: 0;
        padding-top: 26.25%;
    }
}

/* The desktop header from 1410px: the space of the banner is 370px (the menu starts there), so the picture is shown whole at
   its own size: 1410 x 370 (1600 x 420), in the middle, and it does not grow with the page any more. (It grew to the page width
   and was cut at 370px, so the bottom of it, the green shape and the emblem, went under the menu; from 1730px a strip of it
   came out under the menu.) The two sides are filled with the sky (the colors of the left and right edges of the picture, top to
   bottom) and the edges of the picture fade into it. */
@media (min-width: 1410px) {
    header .HeaderImg {
        background: linear-gradient(to bottom, #75d0fe 0%, #b1e3fe 55%, #d6f0fe 100%);
    }

    header .HeaderImg h1 > img {
        display: block;
        width: 1410px;
        height: 370px;
        margin: 0 auto;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
    }
}

/* The desktop header (from 744px wide, not a phone in landscape: the same condition as in main.js).
   1. The banner stays where it is while the page scrolls: the menu and the content slide up over it. The content has its own
      white background, so the banner does not show through the gaps between its blocks.
   2. The logo in the middle of the blue bar and the logo in the menu show when the menu sticks to the bar (the class
      MenuStuck of the <body>, set by setMenuLogoAnimation in main.js): the first one fades in, the second one fades in while the
      menu items glide to their new places (main.js). */
@media (min-width: 744px) and (max-width: 991.98px) and (min-height: 501px), (min-width: 992px) {
    header .HeaderImg {
        position: fixed;
    }

    main {
        background: #fff;
    }

    .header-center:not(.HeaderCenterStatic) {
        display: block;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease-out, visibility 0s linear 0.35s;
    }

    body.MenuStuck .header-center:not(.HeaderCenterStatic) {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.35s ease-out;
    }

    /* (the logo of the menu is hidden by the rule li:first-child of style.css until the menu sticks) */
    body.MenuStuck .MenuBar > ul > li.LogoMenu:not(.LogoStatic) {
        display: block;
        animation-duration: 0.35s;
        animation-timing-function: ease-out;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-center:not(.HeaderCenterStatic),
    body.MenuStuck .header-center:not(.HeaderCenterStatic) {
        transition: none;
    }

    body.MenuStuck .MenuBar > ul > li.LogoMenu:not(.LogoStatic) {
        animation: none;
    }
}

/* more space between the speaker ("قال الرسول...") and the hadith text */
.Hadis .ImgContainer > p:first-of-type {
    margin-bottom: 8px;
    line-height: 18px;
}

/* whole-pixel line height: the box height is a whole number, so the ornaments and the line sit on the same pixel row */
.Hadis .ImgContainer > p:not(:first-of-type) {
    line-height: 23px;
}

/* Bottom line of the hadith: it must look like the line of the two end ornaments (the svg files): the same blue (#13568b) and the
   same thickness. The ornaments are scaled to the height of the box (height: 100%), so their line gets thicker when the box is
   taller (2px at 69px, 2.7px at 92px: 2.9% of the height). The line here is the same 2.9% of the height of the box. It is shorter on
   both sides (it starts where the ornaments' own line stops). */
.Hadis .ImgContainer {
    border-bottom: none;
    margin-bottom: 2px;
}

.Hadis .ImgContainer::after {
    content: "";
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: -2px;
    height: 2.9%;
    background: #13568b;
}


/* ==========================================================================
   3. News carousel
   Phone: one slide, swipe. Desktop (>= 992px): three columns.
   ========================================================================== */
.news-carousel-container {
    position: relative;
    overflow: hidden;
    padding: 0 15px;
}

.news-carousel {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    scroll-padding: 15px;
    padding-bottom: 1.5rem;
}

/* News title: more space between its lines */
.news-slide h2 {
    line-height: 1.5;
}

/* The cards of one row end at the same line: the link fills the slide (the slides of a row have the same height) and the card
   (.containerNews, height 100%) fills the link. Before, the link was as high as its content, so the card with the shortest text ended higher. */
.news-slide > a {
    display: block;
    height: 100%;
}

/* The title grows with its lines (it was cut at 75px: the last line of a long title went over the text under it, and the blue bar
   beside the title, which is as high as the title, was shorter than the text) */
.news-slide .contentCard > h2 {
    max-height: none;
}

.news-slide {
    flex: 0 0 95%;
    max-width: 360px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Phone and tablet (up to 991px): one card at a time, no part of the next card (the dots show that it slides);
   the card is as wide as the carousel (at most 480px, in the middle) */
@media (max-width: 991.98px) {
    .news-slide {
        flex: 0 0 100%;
        max-width: none;
    }

    /* The carousel is 12px wider than the cards on each side (and has room above), so the card shadow is not cut
       at the edges; scroll-padding keeps every card 12px inside, exactly where the first one is */
    .news-carousel {
        margin-left: -12px;
        margin-right: -12px;
        padding: 8px 12px 24px;
        scroll-padding: 0 12px;
        scrollbar-width: none;
        gap: 24px;   /* more than the 12px extra width + the 10px shadow: the next card's shadow is never seen */
    }

    .news-carousel::-webkit-scrollbar {
        display: none;
    }

    /* Safari does not count the padding at the end of a scroll box, so the last card stopped 12px short of its place:
       this invisible block at the end gives it the room */
    .news-carousel::after {
        content: "x";
        display: block;
        flex: 0 0 12px;
        width: 12px;
        font-size: 0;
        visibility: hidden;
    }

    .news-slide > a {
        display: block;
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Archive button of the news: closer to the cards */
.News .row.mt-4 {
    margin-top: 8px !important;
}

/* Dots: centered under the cards, in the site blue (the active one full, the others light) */
.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 4px 0 6px;   /* room around the dots: the active dot (bigger) is not cut by the box */
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(42, 86, 135, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active,
.dot-input:checked + .dot {
    background: var(--Blue);
    transform: scale(1.3);
}

.dot-input {
    display: none;
}

/* Desktop: three columns, no dots */
/* Tablet and desktop >= 992px */
@media (min-width: 992px) {
    .news-carousel {
        flex-wrap: wrap;
        overflow-x: visible;
        scroll-snap-type: none;
        gap: 1.5rem;
        scroll-padding: 0;
    }

    .news-slide {
        flex: 0 0 calc((100% - 3rem) / 3); /* 3 columns fill the whole width (2 gaps of 1.5rem) */
        max-width: none;
        scroll-snap-align: none;
        scroll-snap-stop: none;
    }

    .carousel-dots {
        display: none;
    }
}


/* ==========================================================================
   4. Events and prayer times
   ========================================================================== */
.Monasebat p.EventItem {
    color: #FFFFFF;
    margin-right: 15px;
}

/* Events, phone and tablet (below 992px, one under the other): the list box is as high as its events (at most 250px, then it
   scrolls). The 250px box left 50 to 70px of empty space under the last event. */
@media (max-width: 991.98px) {
    .Monasebat-scrollable-div {
        height: auto;
        max-height: 250px;
    }
}

.PrayBox {
    padding-top: 10px;
}

.PrayLocation {
    margin-top: 30px;
}

.PrayNext {
    margin-top: 34px; /* the yellow line sits in the middle between the date and the times (same space above and below) */
}

/* The times: two columns (Fajr + Dhuhr under it on the right, Sunrise + Maghrib on its left), Midnight alone in the third row (it is the longest).
   Every row starts on the same right edge as the title. Close to the yellow line, with more height between the rows. */
.OghateShareeeeTime {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    justify-items: start;
    column-gap: 64px;
    row-gap: 10px;
    margin-bottom: 0;
    padding-top: 34px;
}

.OghateShareeeeTime .PrayItem {
    margin: 0;
}

.OghateShareeeeTime .PrayItem:last-child {
    grid-column: 1 / -1;
}


/* ==========================================================================
   5. Imam section (icons)
   ========================================================================== */
.imam-section-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
    height: 100%;
}

.imam-section-item:hover {
    transform: translateY(-5px);
    text-decoration: none;
}

/* the icons have width and height in the page (143 x 150: the browser keeps their place while they load); a height set by the page must not stretch them */
.imam-icon {
    height: auto;
}

.imam-icon-container {
    width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Desktop: smaller circles, so there is a gap between the icons */
@media (min-width: 992px) {
    .imam-icon-container {
        width: min(190px, 90%);
    }

    .imam-icon {
        width: 100%;
        height: auto;
    }
}

.imam-section-item h5 {
    color: #2c5aa0;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imam-section-item:hover h5 {
    color: #1e4080;
}


/* ==========================================================================
   6. Questions and opinions
   ========================================================================== */
/* Questions and opinions boxes: less space above the titles (both titles stay on one row) */
.esteftat,
.ra-khoei {
    padding-top: 40px;
}

/* Opinion cards (the cards after the sixth are shown only from 1280px).
   992-1279px (iPads in landscape): the two longest titles do not fit on one line in a half-width card,
   so the cards come one under the other (6 cards) and every title is on one line.
   From 1280px: two cards in a row, the box has less space on its left so the cards are wider. */
.OpinionExtra {
    display: none;
}

@media (min-width: 992px) and (max-width: 1279.98px) {
    .OpinionsRow > .ra-khoeiItem {
        flex: 0 0 100%;
        width: 100%;
    }
}

@media (min-width: 1280px) {
    .OpinionExtra {
        display: block;
    }

    .ra-khoei {
        padding-left: 20px;
    }

    /* The questions box: its title and text are 32px from the right edge, the same as the left opinion cards are 32px from the left edge */
    .esteftat {
        padding-right: 32px;
    }
}

/* 1280-1399px: still a little narrow for the longest title at 15px */
@media (min-width: 1280px) and (max-width: 1399.98px) {
    .ra-khoeiItem > div {
        padding-left: 10px;
        padding-right: 10px;
    }

    .ra-khoeiItem > div > p,
    .ra-khoeiItem > div > p > a {
        font-size: 14px;
    }
}

.Questions-scrollable-div.QuestionsList {
    margin: 15px 0;
    max-height: 255px;
    overflow-y: auto;
}

.AnswerLabel {
    margin-top: 10px;
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

.AnswerText {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

.button-container {
    position: absolute !important;
    bottom: 30px !important;
    left: 123px !important;
}

.esteftatBtn.BtnLightGray {
    background-color: var(--LightGray);
    border-color: var(--DarkGray);
}

.esteftatBtn.BtnWhite {
    background-color: var(--White);
    border-color: var(--DarkGray);
}

.esteftatBtn.BtnBlue {
    background-color: var(--Blue);
    border-color: var(--Blue);
    color: white;
}

.OpinionsRow {
    margin: 15px 0;
}

.FirstOpinion {
    background-color: #539ba5;
}

.OpinionsFooter {
    justify-content: end;
    align-items: center;
}

.btn_home_archive {
    position: absolute;
    bottom: 30px;
}


/* ==========================================================================
   7. Selected lessons
   ========================================================================== */
.SoundBtn > div.downloadIcon > i.PlayIcon {
    margin-top: 1px;
    margin-left: 7px;
}


/* ==========================================================================
   8. Photo album
   ========================================================================== */
.AlbumLink {
    margin: 0 1px;
}

.AlbumImg {
    height: 188px !important;
    width: 300px !important;
}


/* ==========================================================================
   9. App download banner
   ========================================================================== */
.downloadApp {
    height: 100%;
    width: 100%;
}

/* The banner is the containing block of the two buttons (before, only the page animation made it one) */
#AppDownload1 {
    position: relative;
}

.DwAndroid {
    position: absolute;
    bottom: 20px;
    right: 50px;
}

.DwIOS {
    position: absolute;
    bottom: 20px;
    right: 260px;
}

/* Phone and tablet (576px to 991px): the wide picture, and the two buttons grow with the screen, in the same places as on
   the desktop (3.9vw = 50px at 1280px): the first one 3.9vw from the right edge, the second one next to it */
@media (min-width: 576px) and (max-width: 991.98px) {
    .DwAndroid,
    .DwIOS {
        height: clamp(30px, 3.9vw, 50px);
        bottom: 1.56vw;
    }

    .DwAndroid {
        right: 3.9vw;
    }

    .DwIOS {
        right: calc(8.4vw + clamp(30px, 3.9vw, 50px) * 3.05);   /* 3.9vw + the first button (width = 3.05 x height) + 4.5vw */
    }
}

/* Phone in portrait (below 576px): the tall picture, the buttons at the bottom left */
@media (max-width: 575.98px) {
    .downloadApp {
        display: block;
    }

    .DwAndroid,
    .DwIOS {
        height: 40px;
        right: auto;
    }

    .DwAndroid {
        left: 210px;
    }

    .DwIOS {
        left: 45px;
    }
}

@media (max-width: 500px) {
    .DwAndroid,
    .DwIOS {
        height: 30px;
    }

    .DwAndroid {
        left: 150px;
    }

    .DwIOS {
        left: 25px;
    }
}


/* ==========================================================================
   10. Taqi and Majid banners
   ========================================================================== */
.ShahidCol {
    position: relative;
    padding: 0;
    /* the labels slide in from the edges of the banner (below): what is outside the banner is cut */
    overflow: hidden;
}

.ShahidRight {
    position: absolute;
    right: 20px;
    bottom: 20px;
    opacity: .7;
}

.ShahidLeft {
    position: absolute;
    left: 20px;
    bottom: 20px;
    opacity: .7;
}

/* the pictures of the banners have width and height in the page (the place is kept while they load, so the animations below do not start too early):
   the height follows the width */
.ShahidCol img.d-block {
    height: auto;
}

/* the labels have width and height in the page: a height set by a rule must not stretch them */
.ShahidRight,
.ShahidLeft {
    width: auto;
}

/* Phone portrait banners (one under the other): Taqi's label on the right, Majid's on the left; the first one is 10px higher */
.ShahidRow .ShahidRight {
    right: 20px;
    left: auto;
    bottom: 50px;
}

.ShahidRow .ShahidLeft {
    left: 20px;
    right: auto;
}

/* The single wide banner (576px and up): the labels follow the picture. They are 74px high on a 1280px picture (5.78% of its width) and shrink with it,
   never above 74px, so on a tablet they do not stay big while the picture gets small */
.ShahidSingle .ShahidRight,
.ShahidSingle .ShahidLeft {
    height: min(74px, 5.78vw);
    width: auto;
}

/* The motion of the banner: the banner rises (data-aos="section-in" on .ShahidCol), then 0.35s later the two labels slide in from the two edges
   toward their place, Taqi's from the right and Majid's from the left (0.6s, ease-out; the opacity ends at the .7 of the label).
   A CSS animation with "backwards" (not a transition), so the hover of the label (opacity 1) and its own transition keep working.
   The labels are hidden only after AOS has started (.aos-init), and only if the visitor did not ask for less motion. */
@keyframes ShahidFromRight {
    from {
        opacity: 0;
        transform: translate3d(90px, 0, 0);
    }
    to {
        opacity: 0.7;
        transform: none;
    }
}

@keyframes ShahidFromLeft {
    from {
        opacity: 0;
        transform: translate3d(-90px, 0, 0);
    }
    to {
        opacity: 0.7;
        transform: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .ShahidCol.aos-init:not(.aos-animate) .ShahidRight,
    .ShahidCol.aos-init:not(.aos-animate) .ShahidLeft {
        opacity: 0;
    }

    .ShahidCol.aos-animate .ShahidRight {
        animation: ShahidFromRight 0.6s ease-out 0.35s backwards;
    }

    .ShahidCol.aos-animate .ShahidLeft {
        animation: ShahidFromLeft 0.6s ease-out 0.35s backwards;
    }
}

/* Below 768px the labels are 48px high, the width follows so the proportions stay (the labels are 288 x 74; phone and desktop use the same file) */
@media (max-width: 767.98px) {
    .ShahidRight,
    .ShahidLeft {
        height: 48px;
    }

    /* Landscape phone, one picture: the labels sit 10px from the bottom, under the chins */
    .ShahidSingle .ShahidRight,
    .ShahidSingle .ShahidLeft {
        bottom: 10px;
    }
}


/* ==========================================================================
   11. Related sites (Dar al-Ilm)
   ========================================================================== */
.SitesSection {
    margin: 0 !important;
}

.SitesRow {
    background-image: url('/assets/imgs/daralilm-background.jpg');
    background-size: cover;
    background-position: center;
    min-height: 300px;
    align-items: center;
    justify-content: space-between;
}

h2.SitesTitle {
    margin-top: 20px;
    font-size: 30px;
    margin-bottom: 0.67em;
}

.SitesLogo {
    width: 220px;
    margin-top: 10px;
}

.SitesGray {
    height: 240px;
}

/* The three buttons: 50px high (the height in the page), smaller as the screen gets narrower */
@media (max-width: 1228.98px) {
    .SitesSection .SitesButton {
        height: 40px;
    }
}

@media (max-width: 767.98px) {
    .SitesSection .SitesButton {
        height: 40px;
    }
}

@media (max-width: 575.98px) {
    .SitesSection .SitesButton {
        height: 34px;
    }
}

/* Desktop (992px and up) */
@media (min-width: 992px) {
    /* the title is centered in the white box (the h2 margins pushed it down); -4px moves the letters 2px up, because
       the Arabic letters sit low in their line box */
    h2.SitesTitle {
        margin: -4px 0 0;
    }

    .SitesSection .SitesContent {
        padding-right: 102px;
    }

    .SitesSection .SitesLogoCol {
        margin-left: -40px;
    }

    /* the gray element: 2px to the right */
    .SitesSection .SitesGray {
        position: relative;
        left: 2px;
    }

    /* the three buttons: the top of the first and the bottom of the last are level with the top and bottom of the
       gray element (its drawing is 3px inside its 240px box: 233.5px high) */
    .SitesSection .SitesButtonsCol > .d-flex {
        height: 233.5px;
        justify-content: space-between;
    }

    .SitesSection .SitesButtonsCol > .d-flex > a {
        display: flex;
    }

    .SitesSection .SitesButton {
        margin: 0;
    }
}

/* Phone in landscape and tablet (576px to 991px): from the right: the logo (149px from the screen edge), the gray line (10px after
   the logo), then the three buttons (24px after the gray line). The gray line is as high as the three buttons (3 x 40px
   and 2 gaps of 31px), and everything is 24px under the title. */
@media (min-width: 576px) and (max-width: 991.98px) {
    h2.SitesTitle {
        margin-bottom: 0;
    }

    .SitesSection .SitesRow {
        align-content: flex-start;
    }

    .SitesSection .SitesContent {
        padding-right: 137px;        /* the logo is 149px from the screen edge (12px of the row + 137px): the gray line is at 360px from the left of a 667px screen */
    }

    .SitesSection .SitesContent > .row {
        flex-wrap: nowrap;
        column-gap: 10px;
    }

    .SitesSection .SitesContent > .row > * {
        flex: 0 0 auto;
        width: auto;
        margin: 0;
        padding: 0;
    }

    /* 24px between the gray line and the buttons (the 10px of the row + 14px) */
    .SitesSection .SitesContent > .row > .SitesButtonsCol {
        margin-right: 14px;
    }

    .SitesSection .SitesLogo {
        width: 123px;
        margin-top: 0;
    }

    .SitesSection .SitesGray {
        height: 182px;
    }

    .SitesSection .SitesButtonsCol > .d-flex {
        height: 182px;
        justify-content: space-between;
    }

    .SitesSection .SitesButtonsCol > .d-flex > a {
        display: flex;
    }

    .SitesSection .SitesButton {
        margin: 0;
    }
}

/* Tablet (768px to 991px): the gray line is at 450px from the left of an 852px screen (the logo 12px of the row +
   232px from the right edge) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .SitesSection .SitesContent {
        padding-right: 232px;
    }
}

/* iPad mini in portrait (744px to 819px): the gray line is at 54% of the width from the left (400px at 744px, 415px at 768px,
   442px at 819px); the logo is on its right and the buttons on its left, 70px from the line on both sides. The space on the
   right of the logo follows (46vw - 230px: 123px at 768px) so that the line stays where it is. */
@media (min-width: 744px) and (max-width: 819.98px) {
    .SitesSection .SitesContent {
        padding-right: calc(46vw - 230px);
    }

    .SitesSection .SitesContent > .row {
        column-gap: 70px;
    }

    .SitesSection .SitesContent > .row > .SitesButtonsCol {
        margin-right: 0;
    }
}

/* iPad Air in portrait and tablets higher than 500px (820px to 991px): the gray line stays where it was (the width minus 402px:
   418px at 820px), the logo and the buttons are 70px from it on both sides (they were 10px and 24px). A phone in landscape
   (852 x 393) keeps the closer one. */
@media (min-width: 820px) and (max-width: 991.98px) and (min-height: 501px) {
    .SitesSection .SitesContent {
        padding-right: 172px;
    }

    .SitesSection .SitesContent > .row {
        column-gap: 70px;
    }

    .SitesSection .SitesContent > .row > .SitesButtonsCol {
        margin-right: 0;
    }
}

/* iPad mini and iPad in landscape (992px to 1199px): the three parts are 72px more to the right (the space to the title
   was 114px at 1133px, now 42px); the gray line and the three buttons are lower: 182px (3 x 40px and 2 gaps of 31px)
   instead of 240px and 234px */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .SitesSection .SitesContent {
        padding-right: 30px;
    }

    .SitesSection .SitesGray {
        height: 182px;
    }

    .SitesSection .SitesButtonsCol > .d-flex {
        height: 182px;
    }
}

/* iPad Air in landscape (1150px to 1199px, 1180px wide): the logo, the gray line and the buttons together are 27px more to
   the left (they move as one block, so the distances between them stay the same) */
@media (min-width: 1150px) and (max-width: 1199.98px) {
    .SitesSection .SitesContent > .row {
        position: relative;
        left: -27px;
    }
}

/* Phone in portrait (below 576px): from the right: the logo (30px from the screen edge, 95px wide), then the gray
   element, then the three buttons (as high as the gray element, top and bottom level with it). The positions are
   set for the narrow columns of this width. */
@media (max-width: 575.98px) {
    .SitesSection .SitesContent {
        position: relative;
        top: -20px;
    }

    .SitesSection .SitesLogo {
        position: relative;
        left: 48.5px;
        width: 95px;
        max-width: none;
    }

    .SitesSection .SitesGray {
        position: relative;
        left: 46px;
        height: 140px;
    }

    .SitesSection .SitesButtonsCol {
        margin-top: 0;
        margin-right: -73px;
    }

    .SitesSection .SitesButtonsCol > .d-flex {
        position: relative;
        left: 46px;                  /* moves with the gray element */
        height: 140px;               /* = the height of the gray element */
        justify-content: space-between;
    }

    .SitesSection .SitesButtonsCol > .d-flex > a {
        display: flex;
    }

    .SitesSection .SitesButton {
        margin: 0;
    }
}


/* ==========================================================================
   Phone and tablet (below 992px): rules that change the sections above
   ========================================================================== */
@media (max-width: 991.98px) {
    .imam-icon-container {
        width: 200px;
    }

    .imam-icon {
        width: 170px !important;
    }

    .title_ImamKhoei_Opinions_About {
        margin-top: 50px !important;
    }

    .btn_home_archive {
        bottom: 10px !important;
    }

    .button-container {
        position: unset !important;
        text-align: center !important;
        margin-bottom: 10px !important;
    }

    .ra-khoei,
    .esteftat {
        padding-top: 20px !important;
        padding-bottom: 60px !important;
    }
}


/* ==========================================================================
   Phone (up to 767px, also in landscape): home page boxes, buttons and icons
   ========================================================================== */
@media (max-width: 767.98px) {
    /* Imam icons: a little smaller (170px -> 150px), centered in their columns */
    .imam-icon-container {
        width: 150px;
    }

    .imam-icon {
        width: 150px !important;
    }

    .SoundBtn {
        margin-left: 3px;
        margin-right: 3px;
    }

    /* Lesson icons (share, download, play): size 21, a bit more space, all in the middle of the box height */
    .SoundBtn > div.downloadIcon {
        align-items: center;
        gap: 12px;
    }

    .SoundBtn > div.downloadIcon > i,
    .SoundBtn > div.downloadIcon > a > i {
        font-size: 21px;
        line-height: 1;
        margin: 0;
    }

    .SoundBtn > div.downloadIcon > i.PlayIcon {
        margin: 0;
    }

    .SoundBtn > div.downloadIcon > a {
        display: flex;
        align-items: center;
    }

    /* Archive buttons (news, opinions, lessons): 30px from the left edge */
    .HomeBtnLeft {
        margin-left: 3px;
    }

    .Sounds .row > .d-flex.justify-content-end > a {
        margin-left: 6px;
    }

    .btn_home_archive {
        left: 30px;
    }

    /* News card: the title and the text under it are closer to the picture */
    .news-slide .contentCard {
        padding-top: 0;
        margin-top: 0;
    }

    .news-slide .contentCard > h2 {
        padding-top: 5px;
    }

    /* Imam icons: the name is close to its icon (it was about 13px below the image) */
    .imam-section-item h5 {
        min-height: 0;
        margin-top: 6px;
    }

}

/* Phone and tablet (below 992px): the boxes of the questions and the opinions are 30px from the left and the right edge */
@media (max-width: 991.98px) {
    /* Opinion boxes and lesson boxes: the same width, centered, 30px from the left and the right edge */
    .ra-khoei {
        padding-left: 15px;      /* was 5% (changes with the screen): the boxes inside start 30px from the edge */
        padding-right: 15px;
    }

    /* Question and answer text: one shared rule (they stay the same until you ask to separate them): 15px, justified,
       the last line starts from the right (the list box is ltr for its scrollbar, so the question needs its own rtl,
       like the answer) */
    .question-card p.AlmaraiRegular.DarkGray,
    .question-card p.AnswerText {
        direction: rtl;
        unicode-bidi: embed;
        text-align: justify;
        font-size: 15px;
        line-height: 22.5px;
    }

    /* Questions list: the text starts 30px from the left and the right edge of the screen, in the middle (the section
       has 5% of padding that changes with the screen: the list gets the opposite margin, plus the 15px of the card).
       The scrollbar is blue (on the phones that ignore ::-webkit-scrollbar it was the system color, white). */
    .Questions-scrollable-div.QuestionsList {
        padding-left: 0;
        padding-right: 0;
        margin-left: calc(15px - 5vw);
        margin-right: calc(15px - 5vw);
        scrollbar-gutter: stable both-edges;
    }

    /* The line under each question: as wide as the text (30px from the left and the right edge) */
    .esteftatImg {
        width: calc(100vw - 60px);
        height: auto !important;
    }
}

/* Imam section, phone in landscape and small tablet (576px to 991px): the four circles in one row */
@media (min-width: 576px) and (max-width: 991.98px) {
    .imam-col {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .imam-icon-container {
        width: min(170px, 90%);
    }

    .imam-icon {
        width: 100% !important;
        height: auto;
    }
}

/* Questions list, everything below the desktop (the scrollbar was white on the phones that ignore ::-webkit-scrollbar):
   a blue scrollbar */
@media (max-width: 991.98px) {
    .Questions-scrollable-div.QuestionsList {
        scrollbar-color: var(--Blue) transparent;
        scrollbar-width: thin;
    }
}

/* Selected lessons: on a phone in landscape only the first 3 (the 4th to 6th have the class lesson-extra) */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 991.98px) {
    .lesson-extra {
        display: none !important;
    }
}

/* News, phone in landscape and tablet (576px to 991px): two cards in view, each about half of the width */
@media (min-width: 576px) and (max-width: 991.98px) {
    .news-slide {
        flex: 0 0 calc((100% - 24px) / 2);
    }

    .news-slide > a {
        max-width: none;
    }
}

/* News, tablet in portrait (768px to 991px): the title and the text under it are as close to the picture as on a phone
   (the same two rules as in the phone block above; there the block ends at 767px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .news-slide .contentCard {
        padding-top: 0;
        margin-top: 0;
    }

    .news-slide .contentCard > h2 {
        padding-top: 5px;
    }
}


/* Selected lessons, phone and tablet (below 992px): the title is as far from the section above as the first title of the
   page (the news): the margin of the section 50px -> 16px (+ the margin of the title), so 36px on a phone */
@media (max-width: 991.98px) {
    .LessonsSection {
        margin-top: 16px;
    }
}
