/* Fenêtre de présentation détaillée d'un bien (page Immobilier) – identité Martin Patrimoine :
   vert pétrole #118D99, or #C5A059, Playfair Display pour les titres, Inter pour le texte. */

html.imd-lock,
body.imd-lock {
    overflow: hidden !important;
}

.imd {
    --imd-teal: var(--primary-color, #118D99);
    --imd-teal-dark: var(--primary-dark, #0e7580);
    --imd-gold: var(--accent-color, #C5A059);
    --imd-ink: var(--text-dark, #1A1A1A);
    --imd-soft: var(--text-light, #4A4A4A);
    --imd-line: #E6EAEC;
    --imd-bg: #F6F8F8;
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--font-main, 'Inter', sans-serif);
    color: var(--imd-ink);
}

.imd[hidden] {
    display: none;
}

/* Le site définit des styles globaux sur p, h2, h3… : la fenêtre les neutralise */
.imd p {
    margin: 0 !important;
    line-height: 1.6 !important;
}

.imd__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 31, 29, 0.74);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
}

.imd.is-open .imd__backdrop {
    opacity: 1;
}

.imd__dialog {
    position: relative;
    width: 100%;
    max-width: 1120px;
    max-height: min(94vh, 980px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    outline: none;
    opacity: 0;
    transform: translateY(26px) scale(0.985);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.imd.is-open .imd__dialog {
    opacity: 1;
    transform: none;
}

.imd__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 6;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--imd-ink);
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.imd__close:hover {
    background: var(--imd-teal);
    color: #fff;
    transform: rotate(90deg);
}

.imd__close:focus-visible,
.imd-nav:focus-visible,
.imd-thumb:focus-visible {
    outline: 3px solid var(--imd-gold);
    outline-offset: 2px;
}

.imd__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c9d2d4 transparent;
}

.imd-content {
    display: flex;
    flex-direction: column;
}

/* --- En-tête ------------------------------------------------------------ */
.imd-head {
    order: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding: 28px 40px 22px;
}

.imd-head__main {
    min-width: 0;
}

.imd-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 12px;
}

.imd-badge {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}

.imd-badge--sale {
    background: var(--imd-gold);
}

.imd-badge--rent {
    background: var(--imd-teal);
}

.imd-head__kind {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--imd-teal);
}

.imd-head__ref {
    font-size: 0.78rem;
    color: #7a8588;
}

.imd-title {
    font-family: var(--font-serif, 'Playfair Display', serif) !important;
    font-size: clamp(1.4rem, 2.3vw, 2rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--imd-ink);
    margin: 0 0 10px;
    overflow-wrap: anywhere;
    padding-right: 44px;
}

.imd-head__loc {
    margin: 0 !important;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    color: var(--imd-soft);
    font-size: 1rem;
}

.imd-head__loc i {
    color: var(--imd-gold);
    margin-right: -2px;
}

.imd-head__street {
    color: var(--imd-ink);
    font-weight: 600;
}

.imd-head__city::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 10px 3px 0;
    border-radius: 50%;
    background: var(--imd-gold);
    vertical-align: middle;
}

.imd-price {
    flex-shrink: 0;
    text-align: right;
}

.imd-price:empty {
    display: none;
}

.imd-price__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7a8588;
    margin-bottom: 2px;
}

.imd-price__value {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--imd-gold);
    white-space: nowrap;
}

.imd-price__cur {
    font-size: 0.5em;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--imd-soft);
}

.imd-price__value--text {
    font-size: 1.3rem;
    white-space: normal;
}

/* --- Galerie ------------------------------------------------------------ */
.imd-gallery {
    order: 1;
    background: #0d1c1e;
}

.imd-viewer {
    position: relative;
    height: clamp(260px, 50vh, 540px);
    overflow: hidden;
    background: #0d1c1e;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.imd-viewer__bg {
    position: absolute;
    inset: -30px;
    background-size: cover;
    background-position: center;
    filter: blur(26px) brightness(0.55);
    transform: scale(1.1);
}

.imd-viewer__img {
    cursor: zoom-in;
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;      /* proportions d'origine, jamais déformée ni rognée */
    -webkit-user-drag: none;
    transition: opacity 0.25s ease;
}

.imd-viewer.is-loading .imd-viewer__img {
    opacity: 0.25;
}

.imd-viewer.is-loading::after {
    content: '';
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: imd-spin 0.8s linear infinite;
}

@keyframes imd-spin {
    to {
        transform: rotate(360deg);
    }
}

.imd-viewer__empty {
    display: none;
}

.imd-gallery--empty .imd-viewer__img,
.imd-gallery--empty .imd-viewer__bg,
.imd-gallery--empty .imd-nav,
.imd-gallery--empty .imd-count {
    display: none;
}

.imd-gallery--empty .imd-viewer__empty {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.imd-gallery--empty .imd-viewer {
    height: 180px;
}

.imd-viewer__empty i {
    font-size: 2.4rem;
}

.imd-nav {
    position: absolute;
    z-index: 3;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--imd-ink);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.imd-nav:hover {
    background: var(--imd-teal);
    color: #fff;
}

.imd-nav--prev {
    left: 16px;
}

.imd-nav--next {
    right: 16px;
}

.imd-gallery--single .imd-nav {
    display: none;
}

.imd-expand {
    position: absolute;
    z-index: 3;
    right: 16px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.imd-expand:hover {
    background: var(--imd-teal);
}

.imd-expand:focus-visible,
.imd-lb button:focus-visible {
    outline: 3px solid var(--imd-gold);
    outline-offset: 2px;
}

.imd-gallery--empty .imd-expand {
    display: none;
}

.imd-count {
    position: absolute;
    z-index: 3;
    left: 16px;
    bottom: 14px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.imd-count:empty {
    display: none;
}

.imd-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #4b6366 transparent;
    background: #0d1c1e;
}

.imd-thumbs[hidden] {
    display: none;
}

.imd-thumb {
    flex: 0 0 auto;
    width: 88px;
    height: 62px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #1a2f31;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.imd-thumb:hover {
    opacity: 1;
}

.imd-thumb.is-active {
    opacity: 1;
    border-color: var(--imd-gold);
}

.imd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.imd-thumb.is-broken img {
    visibility: hidden;
}

.imd-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- Caractéristiques principales -------------------------------------- */
.imd-keys {
    order: 2;
    list-style: none;
    margin: 26px 40px 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.imd-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    padding: 16px 10px;
    background: var(--imd-bg);
    border: 1px solid var(--imd-line);
    border-radius: 12px;
}

.imd-key i {
    font-size: 1.25rem;
    color: var(--imd-gold);
    margin-bottom: 6px;
}

.imd-key__value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}

.imd-key__label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #6b777a;
}

/* --- Description et détails -------------------------------------------- */
.imd-cols {
    order: 3;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 36px;
    padding: 32px 40px 8px;
    align-items: start;
}

.imd-cols--single {
    grid-template-columns: minmax(0, 1fr);
}

.imd-section-title {
    font-family: var(--font-serif, 'Playfair Display', serif);
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 14px;
    padding-bottom: 10px;
    color: var(--imd-ink);
    border-bottom: 2px solid var(--imd-gold);
    display: inline-block;
}

.imd-desc__body {
    color: #333;
    font-size: 0.98rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.imd-desc__body p {
    margin: 0 0 14px !important;
    line-height: 1.75 !important;
}

.imd-desc__list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.imd-desc__list li {
    position: relative;
    padding: 3px 0 3px 22px;
}

.imd-desc__list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0.85em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--imd-gold);
}

.imd-cols__side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.imd-cols__side.is-sticky {
    position: sticky;
    top: 20px;
}

.imd-card {
    background: var(--imd-bg);
    border: 1px solid var(--imd-line);
    border-radius: 14px;
    padding: 18px 20px;
}

.imd-card__title {
    font-family: var(--font-main, 'Inter', sans-serif) !important;
    font-size: 0.82rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--imd-teal);
    margin: 0 0 12px;
}

.imd-card__title i {
    color: var(--imd-gold);
    margin-right: 4px;
}

.imd-rows {
    margin: 0;
}

.imd-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px dashed #d8dfe1;
    font-size: 0.92rem;
}

.imd-row:last-child {
    border-bottom: 0;
}

.imd-row dt {
    color: #667376;
}

.imd-row dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.imd-chipgroup {
    margin-top: 12px;
}

.imd-chipgroup:first-child {
    margin-top: 0;
}

.imd-chipgroup__label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #6b777a;
    margin-bottom: 8px;
}

.imd-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.imd-chips li {
    padding: 5px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--imd-line);
    font-size: 0.84rem;
    font-weight: 500;
}

.imd-card .imd-rows + .imd-chipgroup,
.imd-card .imd-chipgroup + .imd-rows {
    margin-top: 14px;
}

/* --- Cartes de la page d'accueil ---------------------------------------- */
.property-card[role="button"] {
    cursor: pointer;
}

.property-card[role="button"]:focus-visible {
    outline: 3px solid var(--accent-color, #C5A059);
    outline-offset: 3px;
}

.property-card .property-cta {
    width: 100%;
    margin-top: 20px;
    text-align: center;
    display: block;
    padding: 12px;
    font-weight: 600;
}

/* --- Tablette ----------------------------------------------------------- */
@media (max-width: 900px) {
    .imd {
        padding: 12px;
    }

    .imd-cols {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 28px 24px 4px;
    }

    .imd-head {
        padding: 24px 24px 18px;
    }

    .imd-keys {
        margin: 0 24px;
    }

}

/* --- Smartphone : feuille plein écran, photo en premier ------------------ */
@media (max-width: 640px) {
    .imd {
        padding: 0;
        align-items: flex-end;
    }

    .imd__dialog {
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        transform: translateY(40px);
    }

    .imd-viewer {
        height: clamp(220px, 42vh, 380px);
    }

    .imd-nav {
        width: 40px;
        height: 40px;
        margin-top: -20px;
    }

    .imd-nav--prev {
        left: 8px;
    }

    .imd-nav--next {
        right: 8px;
    }

    .imd-thumbs {
        padding: 10px 12px;
    }

    .imd-thumb {
        width: 72px;
        height: 52px;
    }

    .imd-gallery {
        order: 0;
    }

    .imd-head {
        order: 1;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 20px 18px 16px;
    }

    .imd-title {
        padding-right: 0;
        font-size: 1.35rem;
    }

    .imd-price {
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 10px;
        padding-top: 14px;
        border-top: 1px solid var(--imd-line);
    }

    .imd-price__label {
        margin: 0;
    }

    .imd-keys {
        margin: 0 18px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .imd-key {
        padding: 14px 8px;
    }

    .imd-cols {
        padding: 26px 18px 0;
    }

    .imd-row {
        font-size: 0.9rem;
    }



    .imd__close {
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .imd__backdrop,
    .imd__dialog,
    .imd__close,
    .imd-viewer__img,
    .imd-thumb {
        transition: none;
    }

    .imd-viewer.is-loading::after {
        animation: none;
    }
}

/* --- Photo en plein écran ------------------------------------------------ */
.imd-lb {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: #050d0e;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.imd-lb[hidden] {
    display: none;
}

.imd-lb.is-open {
    opacity: 1;
}

.imd-lb__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 72px;
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

.imd-lb__img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;       /* proportions d'origine, jamais déformée */
    -webkit-user-drag: none;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.imd-lb__close,
.imd-lb__nav {
    position: absolute;
    z-index: 2;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.imd-lb__close:hover,
.imd-lb__nav:hover {
    background: var(--imd-teal);
}

.imd-lb__close {
    top: 14px;
    right: 14px;
}

.imd-lb__nav {
    top: 50%;
    margin-top: -24px;
}

.imd-lb__nav--prev {
    left: 14px;
}

.imd-lb__nav--next {
    right: 14px;
}

.imd-lb--single .imd-lb__nav {
    display: none;
}

.imd-lb__count {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

@media (max-width: 640px) {
    .imd-lb__stage {
        padding: 64px 0 56px;
    }

    .imd-lb__nav {
        top: auto;
        bottom: 8px;
        margin-top: 0;
        width: 44px;
        height: 44px;
    }

    .imd-lb__nav--prev {
        left: 16px;
    }

    .imd-lb__nav--next {
        right: 16px;
    }

    .imd-lb__close {
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
        width: 44px;
        height: 44px;
    }

    .imd-expand {
        right: 10px;
        bottom: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .imd-lb {
        transition: none;
    }
}
