.logements-main {
    background: #faf8f6;
    padding-bottom: 56px;
}

.logements-hero {
    position: relative;
    min-height: 100vh;
    padding: 140px 0 68px;
    background-image: url('https://jassistays.ma/assests/images/home/moroccan-pattern-bg.jpeg');
    background-size: cover;
    background-position: center;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logements-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(30, 24, 20, 0.5);
}

.logements-hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.hero-kicker {
    margin: 0 0 16px;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    color: #D4AF8A;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.logements-hero h1 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    line-height: 1.2;
    color: #fff;
    font-weight: 700;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.02em;
}

.hero-estimate-btn {
    margin-top: 22px;
}

.section-shell {
    padding: 68px 0;
}

.alt-bg {
    background: #fff;
}

.section-head {
    margin-bottom: 24px;
    text-align: center;
}

.section-head h2,
.two-col h2,
.final-box h2 {
    margin: 0 0 10px;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 2.8vw, 2.4rem);
    color: #2f2a26;
}

.section-head p,
.two-col p,
.final-box p {
    margin: 0;
    color: #5b544d;
    line-height: 1.7;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.media-card {
    display: grid;
    grid-template-columns: 210px 1fr;
    align-items: stretch;
    background: #fff;
    border: 1px solid #eee6de;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(68, 45, 28, 0.05);
}

.media-card img {
    width: 100%;
    height: 100%;
    min-height: 170px;
    object-fit: cover;
}

.media-card-content {
    padding: 15px 16px;
}

.media-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #2f2a26;
}

.media-card p {
    margin: 0;
    font-size: 0.92rem;
    color: #615950;
    line-height: 1.6;
}

.two-col {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: center;
}

.city-pills {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.city-pills li {
    background: #f4ece4;
    color: #5f4a38;
    border: 1px solid #e8dccf;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
}

.city-image {
    width: 100%;
    border-radius: 14px;
    display: block;
}

.residences-showcase {
    background: linear-gradient(145deg, #fff, #f8efe7);
}

.residences-shell {
    border: 1px solid #eadccf;
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 16px 42px rgba(77, 48, 27, 0.09);
}

.residences-head {
    display: grid;
    grid-template-columns: 0.55fr 1.45fr;
    gap: 22px;
    align-items: center;
    margin-bottom: 22px;
}

.residences-count-block {
    background: #2f2a26;
    color: #fff;
    border-radius: 16px;
    padding: 18px;
    text-align: center;
}

.residences-count {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.6rem, 5vw, 3.6rem);
    line-height: 1;
    color: #d4af8a;
}

.residences-count-label {
    margin: 10px 0 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #f7eee4;
}

.residences-main-copy h2 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 2.7vw, 2.35rem);
    color: #2f2a26;
    line-height: 1.2;
}

.residences-main-copy p {
    margin: 12px 0 0;
    color: #5f5750;
    line-height: 1.8;
    max-width: 760px;
}

.residences-btn {
    margin-top: 16px;
}

.residences-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.residences-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 132px;
    gap: 12px;
}

.residence-item {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(57, 35, 19, 0.12);
    isolation: isolate;
    transition: box-shadow 280ms ease, transform 280ms ease;
}

.residence-item.is-featured {
    grid-column: span 2;
    grid-row: span 2;
    box-shadow: 0 16px 34px rgba(43, 27, 15, 0.24);
}

.residence-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.01);
    transition: transform 420ms ease, filter 420ms ease;
}

.residence-item-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 10px 11px 11px;
    background: linear-gradient(180deg, rgba(27, 21, 17, 0.04) 0%, rgba(27, 21, 17, 0.88) 74%);
}

.residence-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    pointer-events: none;
}

.residence-item:hover .residence-item-image {
    transform: scale(1.08);
}

.residences-mosaic .residence-item:not(.is-featured) .residence-item-image {
    filter: saturate(0.86) brightness(0.9);
}

.residence-item.is-featured .residence-item-overlay {
    padding: 14px 15px 15px;
}

.residence-item.is-featured h3 {
    font-size: 1.14rem;
}

.residence-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.residence-city-chip,
.residence-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.residence-city-chip {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(4px);
}

.residence-status {
    background: #d4af8a;
    color: #2f2a26;
}

.residence-item h3 {
    margin: 0;
    font-size: 0.98rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.residence-item p {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.84rem;
    line-height: 1.5;
    max-width: 42ch;
}

.residence-link {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #f4ddc6;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
}

.residence-item .residence-status,
.residence-item p,
.residence-item .residence-link {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(7px);
    transition: opacity 220ms ease, transform 220ms ease, max-height 220ms ease;
}

.residence-item.is-featured .residence-status,
.residence-item.is-featured p,
.residence-item.is-featured .residence-link {
    opacity: 1;
    max-height: 120px;
    transform: translateY(0);
    transition-delay: 160ms;
}

.residence-item.is-featured h3 {
    font-size: 1.14rem;
    white-space: normal;
}

.residence-link i {
    font-size: 0.72rem;
    transition: transform 220ms ease;
}

.residence-item:hover .residence-link i {
    transform: translateX(4px);
}

.residences-simple {
    background: #faf8f6;
    padding-top: 80px;
    padding-bottom: 80px;
}

/* Header Grid Layout */
.residences-header-grid {
    display: grid;
    grid-template-columns: auto 1.5fr 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 60px;
}

.header-col-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.big-number {
    font-size: 5rem;
    font-weight: 700;
    color: #c17956; /* Brand Orange */
    line-height: 1;
    font-family: 'Playfair Display', serif;
}

.small-label {
    font-size: 0.85rem;
    line-height: 1.3;
    color: #5b544d;
    font-weight: 500;
    max-width: 100px;
}

.header-col-center {
    display: flex;
    justify-content: center;
}

.header-stat-group {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.header-col-center h2 {
    margin: 0;
    font-size: 2.8rem;
    line-height: 1.1;
    color: #2f2a26;
    font-family: 'Playfair Display', serif;
    text-align: center;
}

.header-col-right p {
    margin: 0 0 20px;
    color: #5b544d;
    line-height: 1.6;
    font-size: 0.95rem;
}

.wide-label {
    max-width: 220px; /* Wider label for the center stat */
}

.dark-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #4a4642; /* Dark Grey/Brown */
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.dark-btn:hover {
    background: #2f2a26;
}

/* Slider Section */
.residence-carousel {
    overflow: hidden;
    margin-bottom: 30px;
}

.residence-track {
    display: flex;
    gap: 20px;
    transition: transform 480ms cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.residence-card {
    flex: 0 0 calc((100% - 60px) / 4); /* Display 4 items */
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 3/4;
    background: #ccc;
}

.residence-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.residence-card:hover img {
    transform: scale(1.05);
}

.residence-caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 20px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.residence-caption strong {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.residence-caption span {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
}

/* Navigation Dots */
.residence-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 70px;
}

.residence-dot {
    width: 8px;
    height: 8px;
    background: #dcdcdc;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s;
}

.residence-dot.active {
    background: #c17956;
    transform: scale(1.2);
}

/* Bottom CTA Section */
.residences-bottom-cta {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.centered-stat {
    justify-content: center;
    margin-bottom: 30px;
}

.large-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    color: #2f2a26;
}

.residences-bottom-cta h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    color: #2f2a26;
    margin: 0 0 30px;
    line-height: 1.2;
}

.orange-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #c17956;
    color: #fff;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.3s;
}

.orange-btn:hover {
    background: #a06243;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .residences-header-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .header-col-left, 
    .header-col-center,
    .header-col-right {
        justify-content: center; /* Center content on mobile */
    }

    .header-col-right {
        max-width: 600px;
        margin: 0 auto;
    }

    .header-col-left {
        margin-bottom: 10px;
    }

    .residence-card {
        flex: 0 0 calc((100% - 20px) / 2); /* 2 items on tablet */
    }
}

@media (max-width: 640px) {
    .residence-card {
        flex: 0 0 100%; /* 1 item on mobile */
    }

    .header-col-center h2,
    .residences-bottom-cta h2 {
        font-size: 2rem;
    }

    .big-number {
        font-size: 4rem;
    }
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.check-item {
    background: #fff;
    border: 1px solid #eee6de;
    border-radius: 12px;
    padding: 13px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    color: #4f4740;
    font-size: 0.92rem;
}

.check-item i {
    color: #c17956;
}

.final-cta {
    padding-top: 20px;
}

.final-box {
    background: linear-gradient(135deg, #fff, #f7f0ea);
    border: 1px solid #eadfce;
    border-radius: 18px;
    padding: 26px;
    text-align: center;
}

.cta-row {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.owner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    background: #c17956;
    font-weight: 600;
}

.owner-btn-secondary {
    background: #7b6757;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .media-card {
        grid-template-columns: 185px 1fr;
    }

    .check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .residences-head {
        grid-template-columns: 1fr;
    }

    .residences-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .residences-mosaic {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: 125px;
    }

    .residence-item.is-featured {
        grid-column: span 2;
        grid-row: span 2;
    }

    .residence-card {
        flex: 0 0 calc((100% - 14px) / 2);
    }

    .residence-card img {
        height: 330px;
    }
}

@media (max-width: 768px) {
    .logements-hero {
        min-height: 38vh;
        padding: 104px 0 42px;
    }

    .logements-hero h1 {
        font-size: clamp(1.45rem, 6.2vw, 2rem);
        line-height: 1.2;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .section-shell {
        padding: 54px 0;
    }
}

@media (max-width: 640px) {
    .logements-hero {
        min-height: 34vh;
        padding: 96px 0 34px;
    }

    .card-grid,
    .check-grid {
        grid-template-columns: 1fr;
    }

    .media-card {
        grid-template-columns: 130px 1fr;
    }

    .media-card img {
        min-height: 100%;
    }

    .media-card:nth-child(even) {
        grid-template-columns: 1fr 130px;
    }

    .media-card:nth-child(even) img {
        order: 2;
    }

    .media-card:nth-child(even) .media-card-content {
        order: 1;
    }

    .final-box {
        padding: 20px;
    }

    .residences-shell {
        padding: 20px;
    }

    .residences-grid {
        grid-template-columns: 1fr;
    }

    .residences-mosaic {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 118px;
    }

    .residence-item.is-featured {
        grid-column: span 2;
        grid-row: span 2;
    }

    .residence-card {
        flex: 0 0 100%;
    }

    .residence-card img {
        height: 300px;
    }
}
