/* Panda's Room (room.html): scene with hotspots, a command bar, and Panda talking in the dialog box */

#room-frame {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

#room-stage {
    position: relative;
    flex: none;
    margin: 0 auto;
}

/* the art is a nearest-neighbour 4x copy scaled down smoothly ("sharp bilinear"): at the window's
   non-integer 1.65x, plain nearest-neighbour gives uneven 1px/2px columns that break the dithers */
#room-art {
    display: block;
    width: 100%;
    height: 100%;
}

/* lit sprites and the city twinkle sit over the art at native-pixel rects (set in % by room.js) */
.room-lit,
#room-twinkle {
    position: absolute;
    display: block;
    pointer-events: none;
}

.room-lit {
    visibility: hidden;
}

/* hover and keyboard focus light the object up, instantly, PC-98 style */
.room-lit.on {
    visibility: visible;
}

#room-twinkle {
    background-repeat: no-repeat;
    background-position: 0% 0%;
    animation-name: room-twinkle;
    animation-iteration-count: infinite;
}

/* duration and steps() come from room-data.js (frames / fps) */
@keyframes room-twinkle {
    from { background-position: 0% 0%; }
    to { background-position: 100% 0%; }
}

#room-hotspots {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* night lighting: everything but the hotspots sits a little darker */
.room-shade {
    fill: #000;
    opacity: 0.38;
    pointer-events: none;
}

.room-hotspot {
    fill: transparent;
    stroke: transparent;
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    shape-rendering: crispEdges;
    cursor: url("/img/cursors/magnifier.png") 12 12, pointer;
    outline: none;
}

/* exact object outlines: invisible except while LOOK flashes them */
.room-outline {
    fill: none;
    stroke: transparent;
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    shape-rendering: crispEdges;
    pointer-events: none;
}

/* LOOK: flash every object's outline, pink if you haven't looked at it yet, blue if you have */
#room-hotspots.reveal .room-outline {
    stroke: #ffaaba;
    animation: room-reveal 1.6s steps(1) forwards;
}

#room-hotspots.reveal .room-outline.seen {
    stroke: #8799ff;
    animation-name: room-reveal-seen;
}

@keyframes room-reveal {
    0%, 25%, 50%, 75% { stroke: #ffaaba; }
    12%, 37%, 62% { stroke: #ef0060; }
    100% { stroke: transparent; }
}

@keyframes room-reveal-seen {
    0%, 75% { stroke: #8799ff; }
    100% { stroke: transparent; }
}

.room-glint {
    fill: #fff;
    pointer-events: none;
    transform-box: fill-box;
    transform-origin: center;
    animation: room-glint 1.2s steps(6) forwards;
}

@keyframes room-glint {
    0% { transform: scale(0); opacity: 1; }
    40% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.2); opacity: 0; }
}

/* LOOK sits in the dialog box's top-right corner, like a PC-98 command button */
#room-look {
    position: absolute;
    top: 8px;
    right: 14px;
    z-index: 1;
    font-family: 'pc-98';
    font-size: 22px;
    color: #fff;
    background-color: #2a2a66;
    border: 3px outset #8799ff;
    padding: 2px 12px;
    cursor: pointer;
}

#room-look:hover,
#room-look:focus-visible {
    background-color: #ffaaba;
    color: #000;
    outline: none;
}

/* dialog box */
#room-text {
    font-size: 26px;
    min-height: 1.3em;
    margin-top: 0;
    margin-bottom: 10px;
}

#room-choices {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-left: 18px;
}

#room-choices.room-choices-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    column-gap: 30px;
    row-gap: 2px;
}

/* #room-choices for specificity: style.css's `.subwindow a` would stretch link choices to 80% */
#room-choices .room-choice {
    font-family: 'pc-98';
    font-size: 26px;
    line-height: 1.25;
    color: #fff;
    background: none;
    border: none;
    padding: 0 8px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    width: auto; /* .subwindow a sets 80% */
    margin: 0;
}

#room-choices.room-choices-grid .room-choice {
    font-size: 22px;
}

#room-choices .room-choice.dim {
    color: #8799ff;
}

/* the selected choice is an inverted bar, PC-98 menu style */
#room-choices .room-choice:hover,
#room-choices .room-choice:focus-visible,
#room-choices .room-choice:focus {
    background-color: #ffaaba;
    color: #000;
    outline: none;
}

#text-arrow {
    position: absolute;
    right: 18px;
    bottom: 10px;
    width: 25px;
    height: 25px;
    image-rendering: pixelated;
}

#text-arrow.bounce {
    animation: room-bounce 1.5s steps(15) infinite;
}

@keyframes room-bounce {
    0%, 100% { transform: translateY(0%); }
    50% { transform: translateY(-30%); }
}

@media (prefers-reduced-motion: reduce) {
    #text-arrow.bounce,
    #room-hotspots.reveal .room-outline {
        animation: none;
    }
    #room-hotspots.reveal .room-outline {
        stroke: #ffaaba;
    }
    #room-hotspots.reveal .room-outline.seen {
        stroke: #8799ff;
    }
    #room-twinkle {
        display: none;
    }
}

/* phones: the scene and the dialog box stack, full width */
@media (max-width: 768px) {
    #main-image,
    #text-box {
        position: relative;
        left: 0;
        top: 0;
        width: 100%;
    }

    #main-image {
        height: auto;
    }

    #room-look {
        font-size: 18px;
        top: 6px;
        right: 8px;
    }

    #text-box {
        height: auto;
        min-height: 230px;
        background-color: #000;
        border-top: 2px solid #8799ff;
    }

    #text-box .text-container {
        position: relative;
        padding: 8px 6px 40px 6px;
    }

    #room-text,
    #room-choices .room-choice {
        font-size: 19px;
    }

    #room-choices.room-choices-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 8px;
    }

    #room-choices.room-choices-grid .room-choice {
        font-size: 17px;
    }
}
