/*
    ========================================================
    ArmorPlus Recipe Gallery
    ========================================================
*/

#recipes {
    display: flex;
    flex-direction: column;
    gap: 18px;
}


/*
    ========================================================
    Categories
    ========================================================
*/

.recipe-category {
    border: 1px solid rgba(120, 150, 255, 0.35);
    border-radius: 10px;

    background:
        rgba(10, 15, 35, 0.65);

    overflow: visible;
}

.recipe-category > summary {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 16px 18px;

    cursor: pointer;

    list-style: none;

    font-family: var(--font-accent);

    font-size: 14px;
    font-weight: 600;

    letter-spacing: 0.03em;

    color: var(--accent);

    user-select: none;
}

.recipe-category > summary::-webkit-details-marker {
    display: none;
}

.recipe-category .category-arrow {
    display: inline-block;

    transition:
        transform 0.2s ease;
}

.recipe-category[open] .category-arrow {
    transform:
        rotate(90deg);
}

.recipe-category-content {
    padding:
        5px 18px 20px;
}


/*
    ========================================================
    Recipe sets
    ========================================================
*/

.recipe-set {
    padding: 20px 0;

    border-top:
        1px solid
        rgba(255, 255, 255, 0.08);
}

.recipe-set:first-child {
    border-top: 0;
}

.recipe-set-heading {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 18px;
}

.recipe-set-heading h3 {
    margin: 0;

    font-family: var(--font-accent);

    font-size: 14px;
    font-weight: 600;

    letter-spacing: 0.025em;

    color: var(--accent);
}


/*
    ========================================================
    Recipe cards
    ========================================================
*/

.armor-recipe-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 16px;
}

.armor-recipe {
    min-width: 0;

    padding: 16px;

    border:
        1px solid
        rgba(100, 130, 230, 0.3);

    border-radius: 8px;

    background:
        rgba(5, 8, 20, 0.55);
}

.armor-recipe h4 {
    margin:
        0 0 15px;

    font-family: var(--font-accent);

    font-size: 12px;
    font-weight: 600;

    line-height: 1.5;

    letter-spacing: 0.025em;

    color: var(--text-color);
}


/*
    ========================================================
    Crafting recipe
    ========================================================
*/

.crafting-recipe {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 15px;
}

.crafting-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 48px);

    grid-template-rows:
        repeat(3, 48px);

    padding: 7px;

    background:
        #c6c6c6;

    border-top:
        3px solid #ffffff;

    border-left:
        3px solid #ffffff;

    border-right:
        3px solid #555555;

    border-bottom:
        3px solid #555555;

    image-rendering: pixelated;
}


/*
    ========================================================
    Minecraft crafting slot
    ========================================================
*/

.crafting-slot {
    position: relative;

    width: 48px;
    height: 48px;

    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        #8b8b8b;

    border-top:
        3px solid #373737;

    border-left:
        3px solid #373737;

    border-right:
        3px solid #ffffff;

    border-bottom:
        3px solid #ffffff;

    image-rendering: pixelated;

    isolation: isolate;
}

.crafting-slot img {
    object-fit: contain;

    image-rendering: pixelated;

    pointer-events: none;
}

.crafting-slot-empty {
    cursor: default;
}


/*
    ========================================================
    Item rendering
    ========================================================
*/

.recipe-item-visual {
    position: relative;

    width: 32px;
    height: 32px;

    min-width: 32px;
    min-height: 32px;

    max-width: 32px;
    max-height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    image-rendering: pixelated;

    z-index: 1;
}

.recipe-item-image {
    position: relative;

    display: block;

    width: 32px;
    height: 32px;

    min-width: 32px;
    min-height: 32px;

    max-width: 32px;
    max-height: 32px;

    object-fit: contain;

    image-rendering: pixelated;

    z-index: 1;
}

.animated-item {
    display: block;

    width: 32px;
    height: 32px;

    min-width: 32px;
    min-height: 32px;

    max-width: 32px;
    max-height: 32px;

    flex: 0 0 32px;

    background-repeat: no-repeat;
    background-position: center top;

    image-rendering: pixelated;

    z-index: 1;
}


/*
    ========================================================
    Item count
    ========================================================
*/

.recipe-item-count {
    position: absolute;

    right: 3px;
    bottom: 1px;

    z-index: 5;

    color: #ffffff;

    font-family: var(--font-heading);

    font-size: 8px;

    text-shadow:
        1px 1px 0 #000000,
        -1px 1px 0 #000000,
        1px -1px 0 #000000,
        -1px -1px 0 #000000;

    pointer-events: none;
}


/*
    ========================================================
    Result
    ========================================================
*/

.recipe-result {
    display: flex;
    align-items: center;

    gap: 12px;
}

.recipe-arrow {
    font-family: var(--font-accent);

    font-size: 32px;

    color:
        #c7c7c7;

    text-shadow:
        2px 2px #222222;
}

.result-slot {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.result-slot .recipe-item-visual {
    width: 48px;
    height: 48px;

    min-width: 48px;
    min-height: 48px;

    max-width: 48px;
    max-height: 48px;

    flex: 0 0 48px;
}

.result-slot .recipe-item-image,
.result-slot .animated-item {
    width: 48px;
    height: 48px;

    min-width: 48px;
    min-height: 48px;

    max-width: 48px;
    max-height: 48px;

    flex: 0 0 48px;
}

.result-slot .recipe-item-glint {
    width: 48px;
    height: 48px;
}


/*
    ========================================================
    Enchantment glint
    ========================================================
*/

.recipe-item-glint {
    position: absolute;

    inset: 0;

    width: 32px;
    height: 32px;

    overflow: hidden;

    pointer-events: none;

    mix-blend-mode: screen;

    opacity: 0.65;

    z-index: 2;
}

.recipe-item-glint::before {
    content: "";

    position: absolute;

    width: 220%;
    height: 220%;

    left: -60%;
    top: -60%;

    background:
        linear-gradient(
            115deg,
            transparent 20%,
            rgba(120, 70, 255, 0.15) 35%,
            rgba(180, 120, 255, 0.65) 47%,
            rgba(90, 170, 255, 0.45) 55%,
            transparent 70%
        );

    animation:
        recipe-glint
        2.4s
        linear
        infinite;
}

@keyframes recipe-glint {
    from {
        transform:
            translate(-25%, 25%);
    }

    to {
        transform:
            translate(25%, -25%);
    }
}


/*
    ========================================================
    Ingredient tooltip
    ========================================================
*/

.recipe-tooltip {
    position: absolute;

    left: 50%;
    bottom: calc(100% + 8px);

    transform:
        translateX(-50%);

    z-index: 1000;

    min-width: max-content;
    max-width: 220px;

    padding:
        7px 9px;

    pointer-events: none;

    opacity: 0;

    visibility: hidden;

    background:
        rgba(16, 0, 16, 0.96);

    border:
        2px solid #2a0a3f;

    box-shadow:
        inset 0 0 0 1px #5000a0;

    color:
        #ffffff;

    font-family: var(--font-body);

    font-size: 12px;
    font-weight: 500;

    line-height: 1.3;

    white-space: nowrap;
}

.crafting-slot:hover .recipe-tooltip {
    opacity: 1;

    visibility: visible;
}


/*
    ========================================================
    Recipe heading icons
    ========================================================
*/

.recipe-heading-slot {
    width: 40px;
    height: 40px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;

    background:
        transparent;
}


/*
    ========================================================
    Legend
    ========================================================
*/

.recipe-legend {
    display: flex;
    flex-wrap: wrap;

    gap: 20px;

    margin-top: 20px;
}

.recipe-legend-item {
    display: flex;
    align-items: center;

    gap: 10px;

    font-family: var(--font-body);
}

.recipe-legend-item .crafting-slot {
    width: 32px;
    height: 32px;
}

.example-filled::after {
    content: "";

    width: 18px;
    height: 18px;

    background:
        #8d63c7;

    border-radius:
        2px;
}


/*
    ========================================================
    Major recipe sections
    ========================================================
*/

.recipe-major-heading {
    margin-top: 34px;
    margin-bottom: 10px;
}

.recipe-major-heading:first-child {
    margin-top: 0;
}

.recipe-major-heading h2 {
    margin-bottom: 8px;
}


/*
    ========================================================
    Multi-step recipes
    ========================================================
*/

.recipe-step + .recipe-step {
    margin-top: 20px;

    padding-top: 18px;

    border-top:
        1px dashed
        rgba(255, 255, 255, 0.15);
}

.recipe-step-label {
    margin-bottom: 12px;

    font-family: var(--font-accent);

    font-size: 11px;
    font-weight: 500;

    line-height: 1.5;

    letter-spacing: 0.04em;

    color:
        #a9bfff;
}


/*
    ========================================================
    Smithing
    ========================================================
*/

.smithing-recipe {
    display: flex;

    align-items: flex-end;
    justify-content: center;

    gap: 10px;

    padding:
        14px 10px;

    border-radius: 6px;

    background:
        rgba(0, 0, 0, 0.2);
}

.smithing-input {
    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 6px;
}

.smithing-input > span {
    font-family: var(--font-body);

    font-size: 9px;
    font-weight: 600;

    letter-spacing: 0.08em;

    color:
        rgba(255, 255, 255, 0.55);

    text-transform: uppercase;
}

.smithing-symbol {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding-bottom: 1px;

    font-family: var(--font-accent);

    font-size: 18px;
    font-weight: 600;

    color:
        rgba(255, 255, 255, 0.7);
}

.weapon-recipe,
.smithing-step {
    min-width: 0;
}


/*
    ========================================================
    Responsive
    ========================================================
*/

@media (max-width: 900px) {

    .armor-recipe-grid {
        grid-template-columns:
            1fr;
    }

}


@media (max-width: 600px) {

    .smithing-recipe {
        gap: 5px;

        padding:
            12px 4px;
    }

    .smithing-recipe .crafting-slot {
        width: 38px;
        height: 38px;
    }

    .smithing-symbol {
        min-height: 38px;

        font-size: 14px;
    }

    .smithing-input > span {
        font-size: 8px;
    }

}


@media (max-width: 520px) {

    .recipe-category > summary {
        padding:
            14px 12px;

        font-size: 12px;
    }

    .recipe-category-content {
        padding:
            4px 10px 14px;
    }

    .recipe-set-heading h3 {
        font-size: 13px;
    }

    .armor-recipe {
        padding:
            12px 8px;
    }

    .armor-recipe h4 {
        font-size: 11px;
    }

    .crafting-recipe {
        gap: 8px;
    }

    .crafting-grid {
        grid-template-columns:
            repeat(3, 40px);

        grid-template-rows:
            repeat(3, 40px);
    }

    .crafting-slot {
        width: 40px;
        height: 40px;
    }

    .result-slot {
        width: 48px;
        height: 48px;
    }

    .result-slot .recipe-item-visual,
    .result-slot .recipe-item-image,
    .result-slot .animated-item {
        width: 32px;
        height: 32px;

        min-width: 32px;
        min-height: 32px;

        max-width: 32px;
        max-height: 32px;

        flex: 0 0 32px;
    }

    .result-slot .recipe-item-glint {
        width: 32px;
        height: 32px;
    }

    .recipe-arrow {
        font-size: 23px;
    }

    .recipe-step-label {
        font-size: 10px;
    }

}

.recipe-set:target,
.material-recipe:target {
    scroll-margin-top: 24px;
}
.recipe-set:target,
.material-recipe:target {
    scroll-margin-top: 24px;
    outline: 1px solid currentColor;
    outline-offset: 8px;
}

/*
    ========================================================
    Recipe Search
    ========================================================
*/

.recipe-search {
    display: flex;
    flex-direction: column;

    gap: 10px;

    margin-bottom: 8px;
}


/*
    Search label
*/
.recipe-search label {
    font-family: var(--font-accent);

    font-size: 12px;
    font-weight: 600;

    line-height: 1.5;
    letter-spacing: 0.03em;

    color: var(--accent);
}


/*
    Search field
*/
.recipe-search input {
    width: 100%;

    box-sizing: border-box;

    padding: 13px 15px;

    border:
        1px solid
        rgba(120, 150, 255, 0.45);

    border-radius: 8px;

    outline: none;

    background:
        rgba(5, 8, 20, 0.7);

    color:
        var(--text-color);

    font-family:
        var(--font-body);

    font-size: 14px;
    font-weight: 500;

    line-height: 1.4;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


/*
    Placeholder
*/
.recipe-search input::placeholder {
    color:
        rgba(255, 255, 255, 0.4);

    opacity: 1;
}


/*
    Hover
*/
.recipe-search input:hover {
    border-color:
        rgba(120, 150, 255, 0.7);

    background:
        rgba(8, 12, 30, 0.8);
}


/*
    Keyboard / click focus
*/
.recipe-search input:focus {
    border-color:
        var(--accent);

    background:
        rgba(8, 12, 30, 0.95);

    box-shadow:
        0 0 0 2px
            rgba(100, 130, 255, 0.12),
        0 0 12px
            rgba(80, 110, 255, 0.2);
}


/*
    Remove browser-specific search styling.
*/
.recipe-search input[type="search"] {
    appearance: none;
    -webkit-appearance: none;
}


/*
    Chrome / Edge search clear button.
*/
.recipe-search input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;

    opacity: 0.65;
}


/*
    ========================================================
    Responsive Search
    ========================================================
*/

@media (max-width: 520px) {

    .recipe-search label {
        font-size: 11px;
    }

    .recipe-search input {
        padding: 12px;

        font-size: 13px;
    }

}
