/* Home page questions and answers (layouts/home_faq.php) */

.home-faq {
    --faq-green: var(--corporate-color, rgb(0, 163, 115));
    --faq-green-dark: #047857; /* readable as text on white and behind white text */
    margin-top: 60px;
    padding: 64px 15px;
    background: #f4f8f7;
    font-family: IRANSans, sans-serif;
}

.home-faq__inner {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    align-items: start;
    gap: 48px;
    max-width: 1170px;
    margin: 0 auto;
}

/* the title stays in view while the questions scroll */
.home-faq__head {
    position: sticky;
    top: 100px;
    text-align: start;
}

.home-faq__label {
    display: inline-block;
    margin-bottom: 16px;
    padding: 4px 14px;
    border-radius: 20px;
    background: rgba(0, 163, 115, .12);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.9;
    color: var(--faq-green-dark);
}

.home-faq__title {
    text-wrap: balance;
    margin: 0 0 14px;
    font-family: inherit;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.75;
    color: #1f2937;
}

.home-faq__title::after {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    margin-top: 14px;
    border-radius: 4px;
    background: var(--faq-green);
}

.home-faq__intro {
    margin: 0;
    font-size: .95rem;
    line-height: 2.1;
    color: #5b6472;
}

.home-faq__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    counter-reset: home-faq;
}

.home-faq__item {
    counter-increment: home-faq;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.home-faq__item:hover { border-color: rgba(0, 163, 115, .45); }

.home-faq__item.is-open {
    border-color: var(--faq-green);
    box-shadow: 0 8px 24px rgba(4, 120, 87, .1);
}

.home-faq__heading {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
}

.home-faq__question {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.9;
    text-align: start;
    color: #1f2937;
    cursor: pointer;
    transition: color .2s ease;
}

.home-faq__question:hover { color: var(--faq-green-dark); }

.home-faq__question:focus-visible {
    outline: 2px solid var(--faq-green);
    outline-offset: -4px;
}

.home-faq__number {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: .85rem;
    color: #4b5563;
    transition: background .2s ease, color .2s ease;
}

.home-faq__number::before { content: counter(home-faq); }

.home-faq__item.is-open .home-faq__number {
    background: var(--faq-green-dark);
    color: #fff;
}

.home-faq__text {
    flex: 1;
    min-width: 0;
}

/* a chevron that turns over when the answer is open */
.home-faq__icon {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #6b7280;
    transition: transform .3s ease, background .2s ease, color .2s ease;
}

.home-faq__icon::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 10px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.home-faq__item.is-open .home-faq__icon {
    background: rgba(0, 163, 115, .12);
    color: var(--faq-green-dark);
    transform: rotate(180deg);
}

/* the answer slides open to its own height, however long it is */
.home-faq__answer {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows .3s ease, visibility .3s;
}

.home-faq__item.is-open .home-faq__answer {
    grid-template-rows: 1fr;
    visibility: visible;
}

.home-faq__clip {
    min-height: 0;
    overflow: hidden;
}

/* the answer starts under the question's text, past the number */
.home-faq__body {
    margin-inline: 66px 18px;
    padding: 12px 0 18px;
    border-top: 1px dashed #e5e7eb;
    font-size: .9rem;
    line-height: 2.2;
    text-align: start;
    color: #4b5563;
}

.home-faq__body p { margin: 0 0 8px; }

.home-faq__body ul {
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

.home-faq__body li {
    position: relative;
    padding-inline-start: 18px;
}

.home-faq__body li::before {
    content: "";
    position: absolute;
    top: calc(1.1em - 3px);
    inset-inline-start: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--faq-green);
}

.home-faq__body > :last-child { margin-bottom: 0; }

@media (max-width: 991px) {
    .home-faq__inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        max-width: 760px;
    }

    .home-faq__head {
        position: static;
        text-align: center;
    }

    .home-faq__title::after { margin-inline: auto; }
}

@media (max-width: 575px) {
    .home-faq { margin-top: 40px; padding: 40px 12px; }
    .home-faq__title { font-size: 1.3rem; }
    .home-faq__question { gap: 10px; padding: 14px 12px; font-size: .9rem; }
    .home-faq__number { width: 28px; height: 28px; font-size: .8rem; }
    .home-faq__icon { width: 24px; height: 24px; }
    .home-faq__icon::before { top: 7px; left: 8px; }
    .home-faq__body { margin-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .home-faq__item,
    .home-faq__number,
    .home-faq__icon,
    .home-faq__answer { transition: none; }
}
