/* ============================================================
   Reviews Page
   ============================================================ */

.rv-page {
    /* Same horizontal gutter as the header (logo and mobile menu) */
    --rv-gutter: clamp(24px, 4vw, 60px);

    padding-top: 140px;
    padding-bottom: 120px;
    padding-left: var(--rv-gutter);
    padding-right: var(--rv-gutter);

    /* Reference width for the grid card sizing and the text scaling below */
    container-type: inline-size;
    container-name: rv-page;
}

/* ── Header row ── */
.rv-header {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 0;
    align-items: start;
    margin-bottom: 0;
}

.rv-header-text {
    padding: 48px 40px 48px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 300px;
}

.rv-header-title {
    /* Fallback for browsers without container queries */
    font-size: clamp(100px, 10vw, 160px);
    /* Scales with the text cell (= 2 cards wide) instead of the viewport */
    font-size: clamp(56px, 30cqw, 160px);
    line-height: 0.85;
    /* Same centered column as the description, but the text stays left aligned */
    width: 100%;
    max-width: min(420px, 100%);
    margin: 0 auto 4px;
    text-align: left;
    color: #222;
    font-weight: 400;
}

.rv-header-subtitle {
    font-size: clamp(44px, 3.5vw, 52px);
    font-size: clamp(24px, 11cqw, 52px);
    display: block;
    line-height: 1;
    margin-bottom: clamp(8px, 4cqw, 21px);
}

.rv-heart {
    font-size: 0.5em;
    font-family: 'Segoe UI', sans-serif;
    vertical-align: super;
    font-weight: 400;
}

.rv-header-desc {
    font-size: clamp(12px, 1vw, 14px);
    font-size: clamp(11px, 2.8cqw, 14px);
    line-height: 1.67;
    color: #222;
    /* Centered block, never wider than the text cell (2 cards) */
    width: 100%;
    max-width: min(420px, 100%);
    margin: 0 auto;
    padding-left: clamp(12px, 2vw, 30px);
}

/* 3 photos beside the header text */
.rv-header-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.rv-card--header {
    aspect-ratio: 3 / 4;
}

/* ── Main grid ── */
.rv-grid {
    --rv-cols: 5;
    --rv-gap: 5px;
    --rv-card-ratio: 1.5; /* 2 / 3 */
    --rv-card-width: calc(
        (100cqw - (var(--rv-cols) - 1) * var(--rv-gap)) / var(--rv-cols)
    );

    display: grid;
    grid-template-columns: repeat(var(--rv-cols), minmax(0, 1fr));
    gap: var(--rv-gap);

    /* Every row is exactly one card tall, so the text cell and the cards
       always share the same height and the 5px gap never changes. */
    grid-auto-rows: auto;
    grid-auto-rows: calc(var(--rv-card-width) * var(--rv-card-ratio));
}

.rv-text-cell {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: clamp(10px, 4vw, 18px) clamp(10px, 4vw, 18px) clamp(10px, 4vw, 18px) clamp(10px, 4vw, 18px);

    /* Typography inside the cell scales with the cell width (= 2 cards) */
    container-type: inline-size;
}

/* ── Card flip ── */
.rv-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 2 / 3;
}

.rv-card--header {
    aspect-ratio: 3 / 4;
}

.rv-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1s cubic-bezier(0.4, 0, 0.5, 1);
    transform-style: preserve-3d;
}

.rv-card.is-flipped .rv-card-inner {
    transform: rotateY(180deg);
}

.rv-card-front,
.rv-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rv-card-front {
    background: #e8e4de;
}

.rv-card-back {
    transform: rotateY(180deg);
    background: #eae8e4;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 24px;
    overflow-y: auto;
}

.rv-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.rv-card-placeholder {
    width: 100%;
    height: 100%;
    background: #d8d3cb;
}

/* Back face content */
.rv-card-back-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.rv-quote-mark {
    font-size: 36px;
    line-height: 0;
    color: #222;
    display: block;
}

.rv-card-text {
    font-size: 14px;
    line-height: 1.67;
    color: #222;
    margin: 0;
}

.rv-card-name {
    font-size: 14px;
    color: #222;
    margin: 0;
}

.rv-card-btn {
    display: inline-block;
    text-align: center;
    margin-top: 16px;
    padding: 10px 16px;
    border: 1px solid #222;
    font-size: 14px;
    color: #222;
    text-decoration: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .rv-header {
        grid-template-columns: 1fr;
    }

    .rv-header-text {
        padding: 48px 32px 32px;
        min-height: auto;
    }

    .rv-header-desc {
        font-size: clamp(14px, 2.8cqw, 14px);
    }

    .rv-header-photos {
        grid-template-columns: repeat(3, 1fr);
    }

    .rv-card--header {
        aspect-ratio: 1 / 1;
    }

    .rv-grid {
        --rv-cols: 3;
    }
}

@media (max-width: 780px) {
    .rv-card-text {
        font-size: 12px;
    }
}

@media (max-width: 640px) {
    .rv-page {
        padding-top: 80px;
    }

    .rv-header-photos {
        grid-template-columns: repeat(2, 1fr);
    }

    .rv-grid {
        --rv-cols: 2;
        /* The text cell sits alone on its row, so let 120px titles grow
           naturally without clipping; card rows still keep their 2:3 ratio. */
        grid-auto-rows: auto;
    }

    .rv-text-cell {
        height: auto;
        margin-bottom: 18px;
    }

    .rv-header-title {
        font-size: 120px;
        text-align: center;
    }

    .rv-header-subtitle {
        font-size: 42px;
        text-align: center;
    }

    .rv-header-desc {
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .rv-grid {
        --rv-cols: 1;
        /* Slightly larger vertical gap for the single-column layout */
        --rv-gap: 10px;
    }

    .rv-text-cell {
        /* Prevent the 2-column span from creating an implicit second column */
        grid-column: span 1;
    }

    .rv-card-back {
        padding: 30px;
    }

    .rv-quote-mark {
        font-size: 42px;
    }

    .rv-card-text {
        font-size: 14px;
    }

    .rv-card-name {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .rv-quote-mark {
        font-size: 42px;
    }

    .rv-card-back {
        padding: 24px;
    }

    .rv-card-text {
        font-size: 14px;
    }

    .rv-card-name {
        font-size: 14px;
    }
}
