/* ---------------------------------------------------------------
   TyreMalta Interactive Map — front-end styles
   --------------------------------------------------------------- */

#shortcode-garage-map {
    position: relative;
    width: 100%;
    max-width: 694px;
    margin: 0 auto;
    /* aspect ratio keeps the pin coordinates (which are %) accurate
       at every screen width, since the SVG scales fluidly */
    aspect-ratio: 694 / 602;
    /* stops a briefly-mispositioned tooltip from ever creating a
       horizontal scrollbar on the page while still allowing the
       tooltip to show above the map */
    overflow: visible;
}

#shortcode-garage-map > svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ----------------------------- pins ----------------------------- */
.garage-pinned-marker {
    position: absolute;
    width: 35px;
    height: 35px;
    transform: translate(-50%, -100%);
    cursor: pointer;
    z-index: 5;
}

/* Lift the active pin above its siblings. Each pin is its own stacking
   context (position + z-index), so the tooltip's z-index only ranks it
   *within its own pin*. Without raising the whole marker, sibling pins
   that come later in the DOM paint over the open tooltip. */
.garage-pinned-marker:hover,
.garage-pinned-marker.tm-active {
    z-index: 200 !important;
}

.garage-pinned-marker svg {
    width: 100%;
    height: 100%;
    display: block;
}

.garage-pinned-marker svg path {
    cursor: pointer;
}

/* --------------------------- tooltip ---------------------------- */
.garage-details-tooltip-container {
    position: absolute;
    bottom: 100%;
    left: 50%;
    /* default centred position; JS may override transform to keep
       the box inside the viewport near the map edges */
    transform: translateX(-50%);
    margin-bottom: 15px;
    width: 300px;
    /* never wider than the screen -> no sideways scroll, ever */
    max-width: calc(100vw - 24px);
    padding: 20px;
    box-sizing: border-box;
    background-color: #0D0F0B;
    border-radius: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Desktop / mouse: reveal on hover */
.garage-pinned-marker:hover .garage-details-tooltip-container {
    opacity: 1;
    visibility: visible;
}

/* Touch devices & JS-driven toggle: reveal on tap/click */
.garage-details-tooltip-container.show-marker {
    opacity: 1;
    visibility: visible;
}

.tooltip-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #0D0F0B;
}

.garage-details-tooltip-container * {
    font-family: "Inter", sans-serif;
    color: #ffffff;
    margin: 0;
}

.garage-details-tooltip-container h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.garage-details-tooltip-container .garage-address {
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.single-garage-page .garage-details-tooltip-container .garage-details-text,
.garage-details-tooltip-container .garage-details-text {
    margin-bottom: 20px;
}

.garage-details-tooltip-container .garage-details-text p,
.single-garage-page .garage-details-tooltip-container .garage-details-text p {
    text-align: left;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.5;
    color: #e0e0e0;
}

.garage-footer a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.garage-footer a:hover {
    transform: translateY(-2px);
}

.no-link-message {
    margin-top: 10px;
    font-size: 12px;
    color: #999 !important;
    font-style: italic;
    text-align: center;
}

/* --------------------------- responsive -------------------------- */
@media (max-width: 768px) {
    .garage-pinned-marker {
        width: 30px;
        height: 30px;
    }

    .garage-details-tooltip-container {
        width: 260px;
        padding: 15px;
    }

    .garage-details-tooltip-container h3 {
        font-size: 16px;
    }

    .garage-details-tooltip-container .garage-details-text p,
    .single-garage-page .garage-details-tooltip-container .garage-details-text p {
        font-size: 14px;
        margin-bottom: 14px;
    }

    .garage-footer a {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .garage-pinned-marker {
        width: 26px;
        height: 26px;
    }

    .garage-details-tooltip-container {
        width: 220px;
        padding: 12px;
    }
}
