* {
    box-sizing: border-box;
    font-family: sans-serif;
    --sb-offset: -20px;
    --bubble-color: rgb(0, 0, 0);
    --bubble-color-second: rgb(255, 255, 255);
}

body {
    margin: 0 auto 100px auto;
    max-width: 800px;
    background-image: url("imgs/bg.png");
}

.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr 1fr;
    position: relative;
    z-index: 1;
}

.item {
    min-width: 100px;
    width: 390px;
    min-height: 100px;
    height: 390px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-container {
    width: 100%;
    height: 100%;
}

img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

/* Speech bubble configuration stuff */
.sb {
    background-color: var(--bubble-color);
    width: fit-content;
    padding: 20px;
    border-radius: 10px;
    visibility: hidden;
    z-index: 1;
    color: var(--bubble-color-second);
    font-size: 13px;
    position: absolute;
    z-index: 9999;
}

.sb:after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 80px solid var(--bubble-color);
    z-index: -1;
}

.sb-top-left {
    position: absolute;
    top: var(--sb-offset);
    left: var(--sb-offset);
}

.sb-top-left::after {
    bottom: -40px;
    left: 69%;
    transform: rotate(-35deg);
}

.sb-top-right {
    position: absolute;
    top: var(--sb-offset);
    right: var(--sb-offset);
}

.sb-top-right::after {
    bottom: -40px;
    left: 20%;
    transform: rotate(35deg);
}

.sb-bottom-left {
    position: absolute;
    bottom: var(--sb-offset);
    left: var(--sb-offset);
}

.sb-bottom-right::after {
    top: -40px;
    left: 20%;
    transform: rotate(145deg);
}

.sb-bottom-right {
    position: absolute;
    bottom: var(--sb-offset);
    right: var(--sb-offset);
}

.sb-bottom-left::after {
    top: -40px;
    left: 69%;
    transform: rotate(-145deg);
}

/* Cursor and link stuff */
.active a,
.active img {
    cursor: pointer;
    text-decoration: underline;
}

.active a:hover {
    color: yellow;
}

.inactive a:hover {
    color: white;
}

.inactive a,
.inactive img {
    cursor: default;
    text-decoration: none;
}

/* Speech bubble visibility stuff */
.sb.active {
    visibility: visible;
}

.sb.inactive {
    visibility: visible;
    opacity: 0.5;
}


/* ending animation */

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes toBlack {
    from {
        background-color: white;
    }
    to {
        background-color: black;
    }
}

.fade-out {
    animation: fadeOut 1s forwards;
}

.to-black {
    animation: toBlack 1s forwards;
}

#sb-final {
    background-color: white;
    color: black;
    position: absolute;
    top: 4000px;
    left: 300px;
}

#sb-final::after {
    border-top: 80px solid white;
}
