/* =============================================
   Shared MC Item Rendering Styles
   Used by both main site (style.css) and portal (portal.css)
   ============================================= */

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/minecraft.woff2?v=3') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.mc-tooltip-title,
.mc-tooltip-lore,
.mc-tooltip-material,
.mc-slot-amount {
    font-family: 'Minecraft', monospace;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
}

/* Animated sprite strip icons */
.mc-item-animated {
    display: inline-block;
    overflow: hidden;
    image-rendering: pixelated;
    vertical-align: middle;
}
.mc-item-animated img {
    display: block;
    width: 100%;
    image-rendering: pixelated;
}

/* Enchant glint overlay */
.mc-item-glint {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

.mc-item-glint img {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.mc-item-glint::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 30%,
        rgba(160, 100, 255, 0.15) 45%,
        rgba(160, 100, 255, 0.25) 50%,
        rgba(160, 100, 255, 0.15) 55%,
        transparent 70%
    );
    background-size: 200% 200%;
    animation: mcGlint 3s ease-in-out infinite;
    pointer-events: none;
    -webkit-mask-image: var(--glint-mask);
    mask-image: var(--glint-mask);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

@keyframes mcGlint {
    0%, 100% { background-position: 200% 200%; }
    50% { background-position: -100% -100%; }
}

/* =============================================
   MC Tooltip
   ============================================= */

.mc-tooltip {
    display: block;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-tooltip, 100);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    white-space: nowrap;
}

@media (hover: hover) {
    .mc-tooltip {
        transition: opacity 0.12s ease, visibility 0.12s ease;
    }
    .mc-item:hover .mc-tooltip,
    .mc-item-slot:hover .mc-tooltip,
    .mc-crate-slot:hover .mc-tooltip,
    .mc-craft-filled:hover .mc-tooltip {
        opacity: 1;
        visibility: visible;
    }
}
.mc-tooltip.pinned {
    opacity: 1;
    visibility: visible;
}

.mc-tooltip-sprite {
    display: block;
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    flex-shrink: 0;
    background: #8b8b8b;
    border: 2px solid;
    border-color: #373737 #fff #fff #373737;
    padding: 2px;
}

.mc-tooltip-sprite img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    display: block;
}

.mc-tooltip-inner {
    display: block;
    text-align: left;
    background: rgba(16, 0, 16, 0.94);
    padding: 6px 6px;
    position: relative;
}

.mc-tooltip-inner::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: rgba(16, 0, 16, 0.94);
    clip-path: polygon(
        1px 0, calc(100% - 1px) 0,
        calc(100% - 1px) 1px, 100% 1px,
        100% calc(100% - 1px),
        calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) 100%,
        1px 100%, 1px calc(100% - 1px),
        0 calc(100% - 1px),
        0 1px, 1px 1px
    );
    z-index: -1;
    pointer-events: none;
}

.mc-tooltip-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-image: linear-gradient(
        180deg,
        rgba(80, 0, 255, 0.5) 0%,
        rgba(40, 0, 127, 0.5) 100%
    ) 1;
    pointer-events: none;
}

.mc-tooltip-layout {
    display: block;
}

.mc-tooltip-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.mc-tooltip-title {
    display: block;
    font-size: 16px;
    line-height: 20px;
}

.mc-tooltip-lore {
    display: block;
    font-size: 16px;
    line-height: 20px;
    color: #aa00aa;
}

.mc-tooltip-lore-line {
    display: block;
}

.mc-tooltip-sep {
    display: block;
    height: 4px;
}

.mc-tooltip-material {
    font-size: 16px;
    color: #555555;
    text-shadow: 2px 2px 0 #151515;
}

/* =============================================
   MC Item Grid & Slots
   ============================================= */

.mc-item-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: #c6c6c6;
    border: 3px solid;
    border-color: #555 #fff #fff #555;
    width: fit-content;
}

.mc-item-slot {
    width: 48px;
    height: 48px;
    background: #8b8b8b;
    border: 2px solid;
    border-color: #373737 #fff #fff #373737;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    image-rendering: pixelated;
}

.mc-item-slot:hover {
    background: #aaaaaa;
    z-index: var(--z-hover, 10);
}

.mc-item-slot img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.mc-slot-amount {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.6);
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.mc-item-slot .mc-tooltip {
    bottom: calc(100% + 6px);
}
