﻿    *, *::before, *::after

{
    box-sizing: border-box;
}

html {
    /* Stops iOS Safari from inflating text once a column becomes narrow. */
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: #ebe7e0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #333;
    overflow-x: hidden;
}

.details-container {
    max-width: 1050px;
    margin: 40px auto;
    background: #FBF8F3;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    position: relative;
}

.details-header {
    margin-bottom: 20px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #DDD;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: .25s;
}

    .back-btn:hover {
        background: #214523;
        color: #fff;
        border-color: #214523;
    }

.breadcrumb-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    /* Keeps the trail clear of the absolutely positioned close button. */
    padding-right: 56px;
    margin-bottom: 25px;
    font-size: 13px;
    color: #777;
    overflow-wrap: anywhere;
}

    .breadcrumb-row a {
        color: #777;
        text-decoration: none;
    }

    .breadcrumb-row strong {
        color: #214523;
        font-style: italic;
        font-family: Georgia,serif;
    }

.details-grid {
    display: grid;
    grid-template-columns: minmax(0, 59fr) minmax(0, 38fr);
    gap: 30px;
    align-items: start;
}

.gallery-card,
.description-card,
.info-card,
.map-card {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #E5DED3;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

.gallery-card {
    padding: 20px;
}

.main-image {
    height: clamp(240px, 45vh, 470px);
    background: #F8F8F6;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

    .main-image img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

.thumb-container {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.thumb-img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 2px solid transparent;
    object-fit: contain;
    background: white;
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px;
}

    .thumb-img:hover {
        border-color: #b28c38;
    }

.active-thumb {
    border-color: #b28c38;
}

.description-card {
    margin-top: 22px;
    padding: 28px;
}

    .description-card h3 {
        margin-bottom: 18px;
        font-family: Georgia,serif;
        color: #214523;
        font-weight: 700;
    }

    .description-card p {
        line-height: 1.8;
        color: #555;
        margin: 0;
    }

.info-card {
    padding: 22px;
}

.family-title {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 2px;
    color: #8E8476;
    font-weight: 700;
}

.info-card h1 {
    margin: 8px 0 20px;
    font-family: Georgia,serif;
    color: #214523;
    font-size: clamp(22px, 4.5vw, 28px);
    line-height: 1.2;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.info-table {
    border: 1px solid #e6ded0;
    border-radius: 14px;
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 15px 18px;
    border-bottom: 1px solid #ece6dc;
}

    .info-row:last-child {
        border-bottom: none;
    }

    .info-row span {
        color: #7E7466;
        font-size: 14px;
        flex: 0 0 auto;
    }

    .info-row strong {
        color: #222;
        font-size: 14px;
        /* Long localities wrap instead of pushing the row wider than the card. */
        min-width: 0;
        text-align: right;
        overflow-wrap: anywhere;
    }

.map-card {
    --details-map-height: 140px;
    margin-top: 22px;
    background: #fff;
    border: 1px solid #E5DED3;
    border-radius: 18px;
    overflow: hidden;
}

.details-map {
    width: 100%;
    height: var(--details-map-height);
    overflow: hidden;
    background: #E8F0E6;
}

/* _BeetleMap.cshtml sets an inline height on the map div, so this has to win. */
#detailsMap {
    height: var(--details-map-height) !important;
    width: 100% !important;
}

.details-map > div,
.details-map > div > div,
.details-map .leaflet-container {
    width: 100%;
    height: 100%;
}

.map-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    font-size: 14px;
}

    .map-footer span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .map-footer a {
        color: #214523;
        font-weight: 700;
        text-decoration: none;
    }

        .map-footer a:hover {
            text-decoration: underline;
        }

.close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ECE8E1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #555;
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
    transition: .25s;
    z-index: 1000;
}

    .close-btn:hover {
        background: #214523;
        color: #fff;
    }

/* ---- Tablet: single column, gallery above the info panel ---- */
@media(max-width:992px) {

    .details-container {
        margin: 20px auto;
        padding: 24px;
        border-radius: 20px;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }
    /* The map is the only element that gains from the extra width here. */
    .map-card {
        --details-map-height: 220px;
    }
}

/* ---- Large phones / small tablets ---- */
@media(max-width:768px) {

    .details-container {
        margin: 12px auto;
        padding: 16px;
        border-radius: 16px;
    }

    .breadcrumb-row {
        margin-bottom: 18px;
        padding-right: 48px;
    }

    .gallery-card {
        padding: 14px;
    }

    .description-card {
        margin-top: 16px;
        padding: 20px;
    }

    .info-card {
        padding: 18px;
    }

    .map-card {
        --details-map-height: 200px;
        margin-top: 16px;
    }

    .thumb-img {
        width: 64px;
        height: 64px;
    }

    .info-row {
        padding: 12px 14px;
    }

    .close-btn {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 24px;
    }
}

/* ---- Small phones: stack each info row so values keep full width ---- */
@media(max-width:480px) {

    .details-container {
        margin: 8px;
        padding: 14px;
    }

    .breadcrumb-row {
        font-size: 12px;
        gap: 6px;
    }

    .main-image {
        height: clamp(200px, 40vh, 300px);
    }

    .thumb-container {
        gap: 8px;
        margin-top: 14px;
    }

    .thumb-img {
        width: 56px;
        height: 56px;
    }

    .description-card {
        padding: 16px;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

        .info-row strong {
            text-align: left;
        }

    .map-footer {
        justify-content: flex-start;
    }
}
