/* ========================================
   SITE DETAIL SECTION
======================================== */

.site-detail-section {
    width: 100%;
    padding: 40px 20px;
    box-sizing: border-box;
}

.site-detail-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}


/* ========================================
   SITE DETAIL GRID
======================================== */

.site-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
    gap: 25px;

    /*
       Do not stretch the map card to
       the height of the sidebar.
    */
    align-items: start;
}


/* ========================================
   SITE MAP CARD
======================================== */

.site-map-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}


/* ========================================
   SITE MAP FIGURE
======================================== */

.site-map-figure {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;

    background: #ffffff;

    /*
       No fixed line-height/aspect-ratio hacks here anymore.
       The figure just wraps whatever size the image / canvas
       actually renders at, so there is never blank space
       around the content.
    */
    line-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    box-sizing: border-box;
}


/* ========================================
   SITE MAP IMAGE
======================================== */

.site-map-img {
    display: block;

    width: 100%;
    max-width: 100%;

    height: auto;

    margin: 0;
    padding: 0;

    background: #ffffff;

    object-fit: contain;
    object-position: center center;

    cursor: zoom-in;

    box-sizing: border-box;
}


/* ========================================
   SITE MAP PDF (rendered via PDF.js canvas)

   No aspect-ratio is forced here. The canvas element is
   given an explicit width/height in pixels by JS, matching
   the PDF page's real proportions, so it never gets padded
   with blank/black space. max-width just stops it overflowing
   its card on narrow screens; the JS already accounts for the
   container width when it renders.
======================================== */

.site-map-pdf {
    display: block;

    max-width: 100%;
    height: auto;

    margin: 0 auto;

    background: #ffffff;

    cursor: zoom-in;

    box-sizing: border-box;
}

.site-map-pdf-fallback {
    display: block;

    padding: 40px 16px;

    text-align: center;

    color: #666666;

    font-size: 13px;
}

.site-map-pdf-fallback a {
    color: #f5820a;
    font-weight: 600;
    text-decoration: none;
}

.site-map-pdf-fallback a:hover {
    text-decoration: underline;
}


/* ========================================
   ZOOM BUTTON
======================================== */

.site-map-zoom {
    position: absolute;

    top: 12px;
    right: 12px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 8px 12px;

    color: #333333;
    background: rgba(255, 255, 255, 0.94);

    border: 1px solid #e2e2e2;
    border-radius: 8px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;

    cursor: pointer;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.site-map-zoom:hover {
    background: #ffffff;

    transform: translateY(-1px);

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.site-map-zoom i {
    font-size: 13px;
}


/* ========================================
   MAP CAPTION
======================================== */

.site-map-caption {
    padding: 15px 10px;

    text-align: center;

    color: #3a2a1a;

    font-family: Georgia, "Times New Roman", serif;

    font-size: 15px;
    font-weight: bold;

    letter-spacing: 1px;
    line-height: 1.4;

    border-top: 1px solid #f0f0f0;

    box-sizing: border-box;

    flex: 0 0 auto;
}


/* ========================================
   LIGHTBOX
======================================== */

.site-map-lightbox {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: none;

    padding: 20px;

    background: rgba(0, 0, 0, 0.88);

    overflow: auto;

    -webkit-overflow-scrolling: touch;

    box-sizing: border-box;
}

.site-map-lightbox.is-open {
    display: block;
}


/* ========================================
   LIGHTBOX INNER
======================================== */

.site-map-lightbox-inner {
    width: 100%;
    min-height: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    box-sizing: border-box;
}


/* ========================================
   LIGHTBOX IMAGE
======================================== */

.site-map-lightbox-inner img {
    display: block;

    width: auto;
    max-width: 100%;

    height: auto;

    background: #ffffff;

    border-radius: 8px;

    box-sizing: border-box;
}


/* ========================================
   LIGHTBOX PDF (canvas)

   Sized entirely by JS (page.getViewport) to match the PDF's
   real aspect ratio within the available viewport space, so
   there is no letterboxing here either.
======================================== */

.site-map-lightbox-pdf {
    display: block;

    max-width: 100%;
    max-height: 90vh;

    border: 0;
    border-radius: 8px;

    background: #ffffff;

    box-sizing: border-box;
}


/* ========================================
   LIGHTBOX CLOSE
======================================== */

.site-map-lightbox-close {
    position: fixed;

    top: 14px;
    right: 18px;

    z-index: 10000;

    width: 40px;
    height: 40px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    color: #333333;
    background: #ffffff;

    border: none;
    border-radius: 50%;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.site-map-lightbox-close:hover {
    color: #ffffff;

    background: #222222;

    transform: rotate(90deg);
}


/* ========================================
   SITE DETAILS SIDEBAR
======================================== */

.site-details-sidebar {
    min-width: 0;

    /*
       Don't force sidebar height
       to control map height.
    */
    height: auto;

    display: flex;
    flex-direction: column;

    gap: 16px;
}


/* ========================================
   DETAIL CARD
======================================== */

.site-detail-card {
    padding: 16px 18px;

    background: #fafafa;

    border: 1px solid #eeeeee;
    border-radius: 12px;

    box-sizing: border-box;
}

.site-detail-card h3 {
    margin: 0 0 12px;

    color: #222222;

    font-size: 15px;
    font-weight: 600;

    line-height: 1.3;
}


/* ========================================
   LOCATION ROW
======================================== */

.location-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 7px 0;

    border-bottom: 1px dashed #e2e2e2;

    font-size: 13px;
    line-height: 1.4;
}

.location-row:last-child {
    border-bottom: none;
}

.location-row span {
    flex-shrink: 0;
    color: #888888;
}

.location-row strong {
    min-width: 0;

    color: #222222;

    font-weight: 600;
    text-align: right;

    overflow-wrap: anywhere;
}


/* ========================================
   DETAIL VALUES
======================================== */

.detail-label {
    display: block;

    margin-bottom: 6px;
    color: #888888;

    font-size: 12px;
    line-height: 1.3;
}

.detail-value {
    display: block;

    margin-bottom: 4px;

    color: #1a1a1a;

    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;

    word-break: break-word;
}

.detail-value-sm {
    font-size: 18px;
}

.detail-note {
    display: block;
    color: #aaaaaa;
    font-size: 11px;
    line-height: 1.4;
}

.detail-richtext {
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    word-break: break-word;
}

.detail-richtext p {
    margin: 0 0 6px;
}

.detail-richtext p:last-child {
    margin-bottom: 0;
}

.detail-richtext h1,
.detail-richtext h2,
.detail-richtext h3,
.detail-richtext h4 {
    margin: 0 0 6px;
    color: #1a1a1a;
    font-weight: 700;
    line-height: 1.25;
}

.detail-richtext h1 {
    font-size: 22px;
}

.detail-richtext h2 {
    font-size: 18px;
}

.detail-richtext h3 {
    font-size: 16px;
}

.detail-richtext h4 {
    font-size: 15px;
}

.detail-richtext .loc-h1 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.detail-richtext .loc-h2 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}

.detail-richtext .loc-h3 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.detail-richtext p + p {
    color: #aaaaaa;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
}

.detail-richtext .detail-note {
    margin-top: 2px;
}


/* ========================================
   LEGEND
======================================== */

.legend-card h3 {
    margin-bottom: 14px;
}

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333333;
    font-size: 12.5px;
    line-height: 1.4;
}


/* ========================================
   LEGEND SYMBOLS
======================================== */

.legend-symbol {
    width: 22px;
    height: 4px;

    flex-shrink: 0;

    border-radius: 2px;
}

.legend-symbol.boundary {
    height: 3px;
    background: #111111;
}

.legend-symbol.subdivision {
    height: 2px;
    background: #999999;
}

.legend-symbol.road {
    height: 3px;
    background: #e53935;
}

.legend-symbol.approach {
    height: 3px;
    background: #ec407a;
}

.legend-symbol.electricity {
    height: 3px;
    background: #1976d2;
}

.legend-symbol.water,
.legend-symbol.proposed,
.legend-symbol.proposed-road,
.legend-symbol.custom {
    width: 18px;
    height: 14px;
    border-radius: 3px;
}

.legend-symbol.water {
    background: #00bcd4;
}

.legend-symbol.proposed {
    background: #a5d6a7;
}

.legend-symbol.proposed-road {
    background: #fff176;
}

.legend-symbol.custom {
    background: #78909c;
}


/* ========================================
   SURVEY STONE
======================================== */

.legend-symbol.survey {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    border: none;
}

.legend-symbol.survey i {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4f46e5;
    font-size: 14px;
    line-height: 1;
}


/* ========================================
   ENQUIRY BUTTON
======================================== */

.site-detail-action {
    margin-top: 30px;

    text-align: center;
}

.site-enquiry-btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 12px 28px;

    color: #ffffff;

    background: #f5820a;

    border-radius: 8px;

    text-decoration: none;

    font-size: 14px;

    font-weight: 600;

    line-height: 1;

    transition:
        background 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.site-enquiry-btn:hover {
    color: #ffffff;

    background: #d76e05;

    transform: translateY(-2px);

    box-shadow: 0 5px 15px rgba(245, 130, 10, 0.18);
}


/* ========================================
   TABLET
======================================== */

@media (max-width: 1024px) {

    .site-detail-grid {
        grid-template-columns:
            minmax(0, 1.8fr)
            minmax(260px, 1fr);

        gap: 20px;
    }
}


/* ========================================
   SMALL TABLET
======================================== */

@media (max-width: 900px) {

    .site-detail-grid {
        grid-template-columns: 1fr;
    }

    .site-map-figure {
        min-height: 0;
    }

    .site-details-sidebar {
        height: auto;
    }

    .site-detail-container {
        padding: 22px;
    }
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 600px) {

    .site-detail-section {
        padding: 24px 12px;
    }

    .site-detail-container {
        padding: 16px;

        border-radius: 10px;
    }

    .site-detail-grid {
        gap: 18px;
    }

    .site-detail-card {
        padding: 14px;
    }

    .detail-value {
        font-size: 17px;
    }

    .location-row {
        font-size: 12px;
    }

    .site-map-caption {
        padding: 12px 8px;

        font-size: 13px;
    }

    .site-map-zoom {
        top: 8px;
        right: 8px;

        padding: 8px 10px;
    }

    .site-map-zoom span {
        display: none;
    }

    .site-map-lightbox {
        padding: 10px;
    }

    .site-map-lightbox-close {
        top: 10px;
        right: 10px;

        width: 36px;
        height: 36px;

        font-size: 24px;
    }

    .site-enquiry-btn {
        width: 100%;
    }

    .site-map-figure {
        width: 100%;

        min-height: 0;

        overflow: hidden;
    }

    .site-map-img {
        width: 100%;
        max-width: 100%;

        height: auto;
    }
}


/* ========================================
   SMALL MOBILE
======================================== */

@media (max-width: 380px) {

    .site-detail-section {
        padding: 20px 8px;
    }

    .site-detail-container {
        padding: 12px;
    }

    .site-detail-card {
        padding: 12px;
    }

    .detail-value {
        font-size: 16px;
    }

    .site-map-caption {
        font-size: 12px;
    }

    .site-enquiry-btn {
        padding: 11px 20px;

        font-size: 13px;
    }
}