/* Minecraft items: inventory slots, item icons and the tooltips drawn like the game's. */

/* Item icons: built-in pixel art, or Minecraft's textures when added (see data/textures/README.md). */
.book-icon {
    display: inline-block;
    width: var(--icon-size, 32px);
    height: var(--icon-size, 32px);
    background: url("../images/written_book.svg") center / contain no-repeat;
    image-rendering: pixelated;
}

.book-icon.writable {
    background-image: url("../images/writable_book.svg");
}

html.mc-item-textures .book-icon.written {
    background-image: url("../textures/written_book.png");
}

html.mc-item-textures .book-icon.writable {
    background-image: url("../textures/writable_book.png");
}

/* An inventory slot: grey, sunken, as in the game's GUI. */
.mc-slot {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 3px solid;
    border-color: #373737 #ffffff #ffffff #373737;
    background: #8b8b8b;
    cursor: default;
}

.mc-slot.small {
    width: 44px;
    height: 44px;
    border-width: 2px;
}

.mc-slot:focus-visible {
    outline: 3px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* The tooltip floats beside the slot while it is hovered or focused, like in game. */
.mc-item {
    position: relative;
    display: inline-block;
}

.mc-item-tooltip {
    position: absolute;
    top: -6px;
    left: calc(100% + 10px);
    z-index: 20;
    width: max-content;
    max-width: min(340px, calc(100vw - 120px));
    visibility: hidden;
    opacity: 0;
    transition: opacity .1s;
    pointer-events: none;
}

.mc-item:hover .mc-item-tooltip,
.mc-slot:focus + .mc-item-tooltip {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 599.98px) {
    .mc-item-tooltip {
        top: calc(100% + 8px);
        left: 0;
        max-width: calc(100vw - 64px);
    }
}

html.mc-font .mc-tooltip {
    letter-spacing: 0;
}

/* Item tooltip, drawn like the game's: dark purple panel with a violet border. */
.mc-tooltip {
    display: inline-block;
    max-width: 100%;
    padding: 6px 10px;
    border: 2px solid transparent;
    border-image: linear-gradient(rgba(80, 0, 255, .55), rgba(40, 0, 127, .55)) 1;
    background: #100010;
    box-shadow: 0 0 0 2px #100010, 0 6px 16px rgba(0, 0, 0, .35);
    color: #fff;
    font-family: "Minecraft Texture", "Pixelify Sans", monospace;
    font-size: 16px;
    line-height: 20px;
    letter-spacing: 2.3px;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, .55);
}

.mc-tooltip-line:first-child {
    margin-bottom: 4px;
}
