/* Locations Page */

.clinic-locations-section {
    /* padding: 70px 0; */
    background: #f8fafc;
}

.locations-heading {
    text-align: center;
    margin-bottom: 35px;
}

.locations-heading h1 {
    font-size: clamp(28px, 4vw, 42px);
    color: #17365d;
    margin-bottom: 12px;
}

.locations-heading p {
    color: #526176;
    line-height: 1.6;
}

/* Google Map */

#md-locations-map {
    width: 100%;
    height: 500px;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 35px;
}

/* Map Popup */

.clinic-map-popup {
    min-width: 220px;
    max-width: 290px;
    padding: 10px;
    font-family: Arial, sans-serif;
}

.clinic-map-popup h3 {
    font-size: 17px;
    color: #17365d;
    margin: 0 0 12px;
}

.clinic-map-popup p {
    font-size: 13px;
    line-height: 1.5;
    margin: 5px 0;
}

.map-location-button {
    display: inline-block;
    background: #75aaff;
    color: #10243d;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    padding: 10px 15px;
    margin-top: 12px;
}

/* Location Cards */

.locations-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.location-card {
    background: #ffffff;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
    padding: 22px;
}

.location-card h3 {
    color: #17365d;
    font-size: 17px;
    margin-bottom: 12px;
}

.location-card p {
    color: #526176;
    font-size: 14px;
    line-height: 1.6;
}

.location-card a {
    display: inline-block;
    color: #2863a5;
    font-weight: 600;
    margin-top: 12px;
    text-decoration: none;
}

/* all location map */
.clinic-map {
    position: relative;
    width: 100%;
    max-width: 850px;
    /* Reduce overall map size */
    margin: 0 auto 45px;
    overflow: hidden;
    border-radius: 12px;
}

.clinic-map-image {
    display: block;
    width: 80%;
    margin: auto;
    height: auto;
}

.locations-hero {
    /* padding: 55px 20px; */
    text-align: center;
    background: #f3f7fb;
}

.locations-hero h1 {
    margin-bottom: 12px;
    color: #183b56;
}

.locations-hero p {
    max-width: 650px;
    margin: 0 auto;
    color: #526577;
    line-height: 1.7;
}

.clinic-locations-section {
    padding: 5px 20px 70px;
}

.clinic-map {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 45px;
    overflow: hidden;
    border-radius: 14px;
    background: #f2f5f7;
}

.clinic-map-image {
    display: block;
    width: 80%;
    margin: auto;
    height: auto;
}

/* Clickable clinic pins */
.clinic-map-pin {
    --pin-width: 28px;

    position: absolute;
    z-index: 2;
    display: block;
    width: var(--pin-width);
    height: calc(var(--pin-width) * 24 / 17);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='3.5 0 17 24'%3E%3Cpath fill='%23EA4335' d='M12 0C7.31 0 3.5 3.81 3.5 8.5c0 6.375 8.5 15.5 8.5 15.5s8.5-9.125 8.5-15.5C20.5 3.81 16.69 0 12 0z'/%3E%3Ccircle cx='12' cy='8.5' r='3.4' fill='%23B31412'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 2px 2px rgb(0 0 0 / 35%));
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;

    /* Tip of the pin = bottom center */
    transform-origin: 50% 100%;
    transform: translate(-50%, -100%);
    transition: transform 0.2s ease;
}

/* The inner dot is drawn by the SVG, so the span is hidden */
.clinic-map-pin-dot {
    display: none;
}

.clinic-map-pin:hover,
.clinic-map-pin:focus-visible {
    transform: translate(-50%, -100%) scale(1.15);
}

.clinic-map-pin:focus-visible,
.clinic-location-button:focus-visible {
    outline: 3px solid #e4a62a;
    outline-offset: 4px;
}


/* Clinic cards */

.clinic-location-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

.clinic-location-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid #e0e7ed;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(20 45 65 / 5%);
}

.clinic-location-card h2 {
    margin: 0 0 14px;
    color: #183b56;
    font-size: 19px;
    line-height: 1.4;
}

.clinic-location-card p {
    color: #526577;
    line-height: 1.7;
}

.clinic-location-card a:not(.clinic-location-button) {
    color: #1769aa;
    text-decoration: none;
}

.clinic-location-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding: 11px 16px;
    border-radius: 6px;
    background: #1769aa;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.clinic-location-button:hover {
    background: #0e456e;
    color: #fff;
}

/* Map container */
.clinic-map-container {
    position: relative;
    z-index: 5;
    /* sits above the cards below the map */
    width: 100%;
    max-width: 1200px;
    /* margin: 0 auto 40px; */
    overflow: hidden;
    /* was hidden: this is what cuts the card off */
}

/* =========================================================
   Pin marker + hover popup
   ========================================================= */

/* Zero-size anchor point placed at the top/left coordinates */
.clinic-map-marker {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 2;
}

.clinic-map-marker:hover,
.clinic-map-marker:focus-within {
    z-index: 20;
    /* above neighbouring pins */
}

/* Popup sits just below the pin tip.
   The padding-top acts as an invisible bridge so the popup
   doesn't close while the mouse moves from the pin to the card. */
.clinic-map-tooltip {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    max-width: 70vw;
    padding-top: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Pins near the left / right edge: align the popup so it stays on the map */
.clinic-map-tooltip.is-left {
    left: -12px;
    transform: none;
}

.clinic-map-tooltip.is-right {
    left: auto;
    right: -12px;
    transform: none;
}

.clinic-map-marker:hover .clinic-map-tooltip,
.clinic-map-marker:focus-within .clinic-map-tooltip {
    opacity: 1;
    visibility: visible;
}

.clinic-map-tooltip-card {
    padding: 12px;
    border: 1px solid #e0e7ed;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgb(20 45 65 / 20%);
    position: relative;
    z-index: 1;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.clinic-map-tooltip-card h3 {
    flex: 0 0 100%;
    margin: 0 0 4px;
    color: #183b56;
    font-size: 16px;
    line-height: 1.3;

}

.clinic-map-tooltip-card p {
    /* margin: 0 0 12px; */
    color: #526577;
    font-size: 13px;
    line-height: 1.5;
}

.clinic-map-tooltip-card .clinic-map-tooltip-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 13px;
}

.clinic-map-tooltip-link {
    display: inline-block;
    color: #1769aa;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.clinic-map-tooltip-link:hover {
    text-decoration: underline;
}

.clinic-map-tooltip-link:focus-visible {
    outline: 3px solid #e4a62a;
    outline-offset: 3px;
}

/* Map image scales proportionally */
.clinic-map-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    /* round the image itself instead of the container */
}


/* Map pins */


/* Laptop screens */
@media (min-width: 769px) and (max-width: 1200px) {
    .clinic-map-container {
        position: relative;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto 40px;
        overflow: hidden;
    }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .clinic-map-pin {
        width: 28px;
        height: 28px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {

    .clinic-map-pin {
        width: 28px;
        height: 28px;
    }
}


/* Responsive layout */

@media (max-width: 1000px) {
    .clinic-location-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .clinic-locations-section {
        padding: 5px 15px 45px;
    }

    .clinic-location-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .clinic-map {
        margin-bottom: 30px;
        border-radius: 8px;
    }

    .clinic-map-pin {
        width: 26px;
        height: 26px;
    }
}


/* Responsive */

@media (max-width: 900px) {
    .locations-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    #md-locations-map {
        height: 380px;
    }

    .locations-list {
        grid-template-columns: 1fr;
    }
}