/* Recreación Histórica 3D — popup viewer for the public map.
   Same chrome as the WECOLAB Configurador viewer, prefixed mrec-. */

.mrec-veil {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    background: rgba(0, 0, 0, 0.82);
    opacity: 0;
    transition: opacity 220ms ease-out;
    font-family: inherit;
}

.mrec-veil.is-open {
    opacity: 1;
}

.mrec-box {
    position: relative;
    width: min(85vw, calc(88vh * 16 / 9));
    aspect-ratio: 16 / 9;
    max-height: 88vh;
    overflow: hidden;
    border-radius: 12px;
    background: #0a0605;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
    transform: scale(0.96);
    transition: transform 220ms ease-out;
}

.mrec-veil.is-open .mrec-box {
    transform: scale(1);
}

.mrec-box:fullscreen {
    width: 100vw;
    height: 100vh;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

.mrec-stage {
    position: absolute;
    inset: 0;
}

.mrec-photo,
.mrec-3d {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.mrec-photo {
    object-fit: cover;
    object-position: center;
    background: #0a0605;
}

.mrec-3d canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.mrec-topbar {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mrec-tabs {
    display: flex;
    gap: 0.15rem;
    padding: 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(10, 6, 5, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mrec-tab {
    border: 0;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.mrec-tab.active {
    color: #fff;
    background: rgba(214, 41, 41, 0.9);
}

.mrec-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(10, 6, 5, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.mrec-icon-btn:hover {
    background: rgba(214, 41, 41, 0.45);
}

.mrec-origin svg {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
}

.mrec-corner-left {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 3;
}

.mrec-corner-right {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
}

/* 3D-only chrome: spans the stage so panels can anchor, click-through
   except for its actual controls. */
.mrec-chrome {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.mrec-chrome > * {
    pointer-events: auto;
}

.mrec-icon-stack {
    position: absolute;
    top: 3.4rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}

.mrec-icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* three.js VRButton ships inline fixed/absolute styles — force the same
   round icon look as the rest of the stack. */
.mrec-icon-slot button,
.mrec-icon-slot a {
    position: static !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.3rem !important;
    height: 2.3rem !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 999px !important;
    background: rgba(10, 6, 5, 0.62) !important;
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.85) !important;
    font: inherit;
    font-size: 0.66rem !important;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.mrec-panel {
    position: absolute;
    top: 3.4rem;
    right: 4.5rem;
    z-index: 4;
    width: min(17rem, calc(100% - 5.6rem));
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(10, 6, 5, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f1e6df;
    text-align: left;
}

.mrec-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mrec-panel-head h3 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

.mrec-panel-close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.mrec-panel-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 0.4rem;
    column-gap: 0.5rem;
    font-size: 0.76rem;
}

.mrec-panel-grid > div {
    display: contents;
}

.mrec-panel-grid span {
    color: rgba(241, 230, 223, 0.72);
    align-self: center;
}

.mrec-panel-grid .mrec-kbd-group {
    display: flex;
    align-items: stretch;
    gap: 0.3rem;
    color: inherit;
}

.mrec-panel-grid kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    padding: 0.1rem 0.4rem;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: #f1e6df;
    font: inherit;
    font-size: 0.7rem;
}

.mrec-panel-grid .mrec-kbd-group kbd {
    flex: 1 1 0;
    min-width: 0;
}

.mrec-panel-body p {
    margin: 0 0 0.5rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: #e9dfd8;
}

.mrec-info-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.mrec-info-rows div {
    font-size: 0.72rem;
}

.mrec-info-rows span {
    display: block;
    color: rgba(241, 230, 223, 0.72);
}

.mrec-credit {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: calc(100% - 12rem);
}

.mrec-brand {
    flex: 0 0 auto;
    display: flex;
    width: 3.8rem;
    height: 3.8rem;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.mrec-brand img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mrec-credit span {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.66rem;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.6);
}

.mrec-status {
    /* Pedro 2026-09-03: next to the close (✕) button, top-left, instead of
       bottom-centre. Same row height as .mrec-icon-btn (2.3rem) so the text
       is vertically centred on the X; width capped so it never reaches the
       centred tabs pill. */
    position: absolute;
    top: 0.75rem;
    left: 3.65rem; /* 0.75rem edge + 2.3rem button + 0.6rem gap */
    height: 2.3rem;
    display: flex;
    align-items: center;
    z-index: 2;
    max-width: calc(50% - 11rem);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.66rem;
    line-height: 1.25;
    text-align: left;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    pointer-events: none;
}

.mrec-status:empty {
    display: none;
}

/* Button injected into the InfoBox thumbnail (.poiInfo_img is position:relative
   in the map bundle). Brand-red pill just above the caption band. */
.poiInfo_img .mrec-open-btn {
    position: absolute;
    right: 5px;
    bottom: calc(1.5rem + 5px);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 4px;
    border: 0;
    border-radius: 999px;
    background-color: #d62929;
    color: #fff;
    font: inherit;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    user-select: none;
}

.poiInfo_img .mrec-open-btn:hover {
    filter: brightness(1.1);
}

.poiInfo_img .mrec-open-btn_icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.22);
}

.poiInfo_img .mrec-open-btn_icon > svg {
    display: block;
    width: 14px;
    height: 14px;
}

@media (max-width: 767px) {
    .mrec-veil {
        padding: 1.5vh 2vw;
    }

    .mrec-box {
        width: 96vw;
    }

    .mrec-credit span,
    .mrec-status {
        display: none;
    }

    .mrec-tab {
        font-size: 0.68rem;
        padding: 0.35rem 0.6rem;
    }

    .mrec-icon-btn,
    .mrec-icon-slot button,
    .mrec-icon-slot a {
        width: 2.1rem !important;
        height: 2.1rem !important;
    }

    .mrec-brand {
        width: 3rem;
        height: 3rem;
    }

    .mrec-panel {
        right: 3.6rem;
        width: min(17rem, calc(100% - 4.6rem));
    }
}

/* Phones held upright: a 16:9 strip is unusable, so the box becomes a tall
   portrait card (the canvas re-renders to the new aspect, the photo tab
   keeps object-fit: cover). Landscape phones keep the 16:9 box above. */
@media (max-width: 767px) and (orientation: portrait) {
    .mrec-box {
        width: 96vw;
        aspect-ratio: auto;
        height: min(84vh, calc(96vw * 16 / 9));
        max-height: 84vh;
    }

    .mrec-topbar {
        top: 0.6rem;
    }

    .mrec-corner-left,
    .mrec-corner-right {
        top: 0.6rem;
    }

    .mrec-icon-stack {
        top: 3.2rem;
    }

    .mrec-panel {
        top: 3.2rem;
    }

    .mrec-credit {
        bottom: 0.6rem;
        left: 0.6rem;
    }
}
