/* Brain #505: home page blocks added without a redesign (gallery, prices lead,
   reviews, FAQ, viewer). Uses the theme's tokens from style.min.css (:root). */

.home-section-lead {
    max-width: 760px;
    margin: -12px auto 32px;
    text-align: center;
    color: var(--text-secondary);
}

/* Horizontal rail: native scrolling with snap, so a phone swipes it for free. */
.home-rail {
    position: relative;
}

.home-rail-track {
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0 0 8px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.home-rail-track::-webkit-scrollbar {
    display: none;
}

.home-rail-track > li {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.home-rail-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(21, 21, 21, .18);
    cursor: pointer;
    transition: opacity .2s;
}

.home-rail-button:hover {
    color: var(--blue);
}

.home-rail-button:disabled {
    opacity: 0;
    pointer-events: none;
}

.home-rail-prev {
    left: -22px;
}

.home-rail-next {
    right: -22px;
}

/* Gallery */
.home-gallery-item {
    width: calc((100% - 60px) / 4);
}

.home-gallery-item a {
    display: block;
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-gray);
}

.home-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform .3s;
}

.home-gallery-item a:hover img {
    transform: scale(1.04);
}

/* Reviews: four cards in a row, a swipeable rail below the desktop width. */
.home-reviews-track {
    gap: 30px;
}

.home-review {
    display: flex;
    flex-direction: column;
    width: calc((100% - 90px) / 4);
    overflow: hidden;
    border: 1px solid var(--gray);
    border-radius: 12px;
    background: #fff;
}

.home-review-scan {
    display: block;
    height: 150px;
    overflow: hidden;
    border-bottom: 1px solid var(--gray);
}

.home-review-scan img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.home-review-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 20px;
}

.home-review-place {
    margin-top: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

.home-review-quote {
    flex: 1 1 auto;
    margin: 14px 0 16px;
    padding: 0;
    border: 0;
    font-size: 15px;
    font-style: normal;
    line-height: 1.5;
    color: var(--text-primary);
}

.home-review-link {
    align-self: flex-start;
    font-weight: 600;
    color: var(--blue);
}

.home-review-link:hover {
    text-decoration: underline;
}

.home-reviews .btn-wrap {
    margin-top: 32px;
}

/* FAQ accordion */
.home-faq-list {
    max-width: 860px;
    margin: 0 auto;
}

.home-faq-item {
    border-bottom: 1px solid var(--gray);
}

.home-faq-item summary {
    position: relative;
    padding: 18px 44px 18px 0;
    list-style: none;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    cursor: pointer;
}

.home-faq-item summary::-webkit-details-marker {
    display: none;
}

.home-faq-item summary::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 12px;
    height: 12px;
    margin-top: -9px;
    border-right: 2px solid var(--blue);
    border-bottom: 2px solid var(--blue);
    transform: rotate(45deg);
    transition: transform .2s, margin-top .2s;
}

.home-faq-item[open] summary::after {
    margin-top: -3px;
    transform: rotate(-135deg);
}

.home-faq-item summary:hover {
    color: var(--blue);
}

.home-faq-item p {
    margin: 0;
    padding: 0 44px 20px 0;
}

/* Viewer: the dialog covers the viewport, only the figure is opaque, so a click
   outside the picture lands on the dialog itself and closes it. */
.home-viewer {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    overflow: hidden;
}

.home-viewer[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-viewer::backdrop {
    background: rgba(21, 21, 21, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.home-viewer-open,
.home-viewer-open body {
    overflow: hidden;
}

.home-viewer-figure {
    margin: 0;
    text-align: center;
}

.home-viewer-image {
    display: block;
    max-width: min(84vw, 1600px);
    max-height: 78vh;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}

/* The letter scans are small (363×514), scale them up to be readable. */
.home-viewer.is-document .home-viewer-image {
    height: min(84vh, 1100px);
    max-height: none;
}

.home-viewer-caption {
    margin-top: 12px;
    font-size: 15px;
    color: #fff;
}

.home-viewer.is-document .home-viewer-caption {
    display: none;
}

.home-viewer-button {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--text-primary);
    cursor: pointer;
}

.home-viewer-button:hover {
    background: var(--yellow);
}

.home-viewer-close {
    top: 16px;
    right: 16px;
}

.home-viewer-prev {
    top: 50%;
    left: 16px;
    margin-top: -24px;
}

.home-viewer-next {
    top: 50%;
    right: 16px;
    margin-top: -24px;
}

.home-viewer-counter {
    position: absolute;
    top: 28px;
    left: 24px;
    font-size: 15px;
    color: #fff;
}

@media (max-width: 1199.98px) {
    .home-gallery-item {
        width: calc((100% - 40px) / 3);
    }

    .home-review {
        width: calc((100% - 60px) / 3);
    }
}

@media (max-width: 991.98px) {
    .home-rail-button {
        display: none;
    }

    .home-gallery-item {
        width: 70%;
    }

    .home-reviews-track {
        gap: 16px;
    }

    .home-review {
        width: 78%;
    }

    .home-faq-item summary {
        font-size: 16px;
    }
}

@media (max-width: 767.98px) {
    .home-section-lead {
        margin: -8px auto 24px;
        font-size: 15px;
    }

    .home-gallery-item {
        width: 84%;
    }

    .home-review {
        width: 86%;
    }

    .home-viewer-image {
        max-width: 100vw;
        max-height: 72vh;
        border-radius: 0;
    }

    .home-viewer.is-document .home-viewer-image {
        width: 96vw;
        height: auto;
    }

    /* On a phone the arrows move to the bottom so they do not cover the picture. */
    .home-viewer-prev,
    .home-viewer-next {
        top: auto;
        bottom: 20px;
        margin-top: 0;
    }

    .home-viewer-prev {
        left: calc(50% - 60px);
    }

    .home-viewer-next {
        right: calc(50% - 60px);
    }

    .home-viewer-close {
        top: 12px;
        right: 12px;
    }
}
