/*
  The items page (Pages/Front/Items.razor), rebuilt 2026-11-30: a list of one line per item on the left
  and the picked item's page on the right, which on a phone slides up over the list as a sheet. Values
  come from ravenfall-tokens.css only.
*/

.rf-items {
    --rf-items-sticky-top: var(--rf-space-4);
}

.rf-items-lead {
    margin: var(--rf-space-2) 0 0;
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-body);
}

/* ---- Controls ------------------------------------------------------------ */

.rf-items-controls {
    display: flex;
    flex-direction: column;
    gap: var(--rf-space-3);
    margin-bottom: var(--rf-space-4);
}

.rf-items-controls__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rf-space-3);
}

.rf-items-controls__row .rf-search {
    flex: 1 1 18rem;
    min-width: 0;
    font-size: var(--rf-size-body);
    padding: var(--rf-space-2) var(--rf-space-3);
}

.rf-items-controls__row--meta {
    justify-content: space-between;
    min-height: 2rem;
}

.rf-items-sort {
    display: inline-flex;
    align-items: center;
    gap: var(--rf-space-2);
    margin: 0;
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-small);
    font-weight: 600;
}

.rf-items-sort select {
    font-size: var(--rf-size-small);
    padding: var(--rf-space-2) var(--rf-space-3);
}

.rf-items-filters {
    display: flex;
    flex-direction: column;
    gap: var(--rf-space-2);
    padding: var(--rf-space-3);
    background: var(--rf-surface-1);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
}

.rf-items-filters__group {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    align-items: center;
    gap: var(--rf-space-3);
}

.rf-items-filters__label {
    color: var(--rf-ink-faint);
    font-size: var(--rf-size-tiny);
    font-weight: 700;
    letter-spacing: var(--rf-tracking-label);
    text-transform: uppercase;
}

.rf-items-filters__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rf-space-1);
}

.rf-items-filters .rf-filter {
    padding: var(--rf-space-1) var(--rf-space-2);
    font-size: var(--rf-size-small);
}

/* ---- Layout -------------------------------------------------------------- */

.rf-items-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--rf-space-4);
    align-items: start;
}

/* ---- The list ------------------------------------------------------------ */

.rf-items-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--rf-surface-1);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    overflow: hidden;
}

.rf-items-rows li + li {
    border-top: 1px solid var(--rf-line);
}

.rf-items-row {
    display: flex;
    align-items: center;
    gap: var(--rf-space-3);
    min-height: 3.75rem;
    padding: var(--rf-space-2) var(--rf-space-3);
    color: var(--rf-ink);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background var(--rf-transition), border-color var(--rf-transition);
}

.rf-items-row:hover,
.rf-items-row:focus-visible {
    background: var(--rf-surface-2);
    color: var(--rf-ink);
    text-decoration: none;
}

.rf-items-row:focus-visible {
    outline: none;
    box-shadow: inset var(--rf-focus);
}

.rf-items-row.is-selected {
    background: var(--rf-gold-wash);
    border-left-color: var(--rf-gold);
}

.rf-items-row__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.rf-items-row__name {
    font-weight: 700;
    font-size: var(--rf-size-body);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.rf-items-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rf-space-2);
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-tiny);
    font-weight: 500;
}

.rf-items-row__src {
    color: var(--rf-ink-faint);
    font-size: 0.7rem;
}

.rf-items-row__level {
    flex: 0 0 auto;
    color: var(--rf-ink);
    font-weight: 700;
    font-size: var(--rf-size-small);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rf-items-row__level small {
    color: var(--rf-ink-faint);
    font-size: var(--rf-size-tiny);
    font-weight: 700;
    letter-spacing: var(--rf-tracking-label);
    text-transform: uppercase;
}

.rf-items-more {
    display: flex;
    justify-content: center;
    padding: var(--rf-space-4) 0;
}

/* ---- Item pictures, framed in their rarity's color ----------------------- */

.rf-items-frame {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: var(--rf-surface-3);
    border: 1px solid currentColor;
    border-radius: var(--rf-radius-sm);
    box-shadow: var(--rf-bevel);
}

.rf-items-frame img {
    width: 82%;
    height: 82%;
    object-fit: contain;
}

.rf-items-frame--small { width: 2.75rem; height: 2.75rem; }
.rf-items-frame--tile { width: 3.5rem; height: 3.5rem; }
.rf-items-frame--large { width: 6rem; height: 6rem; border-width: 2px; border-radius: var(--rf-radius); }

/* ---- The item's page ----------------------------------------------------- */

.rf-items-detail {
    position: sticky;
    top: var(--rf-items-sticky-top);
    max-height: calc(100vh - var(--rf-items-sticky-top) - var(--rf-space-4));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--rf-space-5);
    background: var(--rf-surface-1);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    box-shadow: var(--rf-shadow), var(--rf-bevel);
}

.rf-items-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--rf-space-3);
    padding: var(--rf-space-7) var(--rf-space-4);
    color: var(--rf-ink-muted);
    text-align: center;
}

.rf-items-empty i {
    color: var(--rf-gold-dim);
    font-size: 2rem;
}

.rf-items-empty p {
    margin: 0;
    max-width: 26rem;
}

.rf-items-detail__bar {
    display: flex;
    justify-content: flex-end;
    gap: var(--rf-space-2);
    margin-bottom: var(--rf-space-3);
}

/* only on a phone, where the page is a sheet over the list */
.rf-items-detail__back {
    display: none;
    margin-right: auto;
}

.rf-items-head {
    display: flex;
    align-items: center;
    gap: var(--rf-space-4);
}

.rf-items-head__text {
    display: flex;
    flex-direction: column;
    gap: var(--rf-space-1);
    min-width: 0;
}

.rf-items-head__name {
    margin: 0;
    font-size: var(--rf-size-title);
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.rf-items-head__kind {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rf-space-2);
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-small);
    font-weight: 600;
}

.rf-items-head__kind span + span::before {
    content: "\00b7";
    margin-right: var(--rf-space-2);
    color: var(--rf-ink-faint);
}

.rf-items-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rf-space-2);
    margin-top: var(--rf-space-1);
}

.rf-items-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--rf-space-1);
    padding: 2px var(--rf-space-2);
    background: var(--rf-surface-3);
    border: 1px solid var(--rf-line-strong);
    border-radius: var(--rf-radius-sm);
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-tiny);
    font-weight: 700;
}

.rf-items-desc {
    margin: var(--rf-space-4) 0 0;
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-body);
    line-height: 1.5;
}

.rf-items-block {
    margin-top: var(--rf-space-5);
    padding-top: var(--rf-space-4);
    border-top: 1px solid var(--rf-line);
}

.rf-items-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--rf-space-2);
    margin-bottom: var(--rf-space-3);
}

.rf-items-block__head .rf-items-block__title {
    margin: 0;
}

.rf-items-block__title {
    display: flex;
    align-items: center;
    gap: var(--rf-space-2);
    margin: 0 0 var(--rf-space-3);
    color: var(--rf-gold);
    font-size: var(--rf-size-tiny);
    font-weight: 800;
    letter-spacing: var(--rf-tracking-label);
    text-transform: uppercase;
}

.rf-items-count {
    padding: 0 var(--rf-space-2);
    background: var(--rf-gold-wash);
    border-radius: 999px;
    color: var(--rf-gold-bright);
    letter-spacing: 0;
}

.rf-items-block__more {
    margin-top: var(--rf-space-3);
}

.rf-items-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--rf-space-4) var(--rf-space-5);
}

.rf-items-facts .rf-items-block__title {
    margin-bottom: var(--rf-space-2);
}

.rf-items-list-stats {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.rf-items-list-stats > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rf-space-3);
    padding: var(--rf-space-1) 0;
    border-bottom: 1px dashed var(--rf-line);
}

.rf-items-list-stats > div:last-child {
    border-bottom: none;
}

.rf-items-list-stats dt {
    color: var(--rf-ink-muted);
    font-weight: 500;
    font-size: var(--rf-size-small);
}

.rf-items-list-stats dt i {
    width: 1.1rem;
    margin-right: var(--rf-space-1);
    color: var(--rf-ink-faint);
    text-align: center;
}

.rf-items-list-stats dd {
    margin: 0;
    color: var(--rf-ink);
    font-weight: 700;
    font-size: var(--rf-size-small);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rf-items-list-stats--wide {
    max-width: 30rem;
}

/* ---- How to get it ------------------------------------------------------- */

.rf-items-sources {
    display: flex;
    flex-direction: column;
    gap: var(--rf-space-2);
}

.rf-items-source {
    display: flex;
    gap: var(--rf-space-3);
    padding: var(--rf-space-3);
    background: var(--rf-surface-2);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius-sm);
}

.rf-items-source > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.rf-items-source strong {
    color: var(--rf-ink);
    font-size: var(--rf-size-body);
}

.rf-items-source span {
    color: var(--rf-ink-muted);
    font-size: var(--rf-size-small);
}

.rf-items-source__icon {
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rf-gold-wash);
    border-radius: 50%;
    color: var(--rf-gold);
    font-size: 0.9rem;
}

.rf-items-source__note {
    margin-top: var(--rf-space-2);
}

/* ---- Picture tiles: ingredients and what it makes ------------------------ */

.rf-items-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    gap: var(--rf-space-2);
}

.rf-items-tiles--ingredients {
    margin-top: var(--rf-space-3);
}

.rf-items-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--rf-space-1);
    padding: var(--rf-space-2) var(--rf-space-1);
    border: 1px solid transparent;
    border-radius: var(--rf-radius-sm);
    color: var(--rf-ink);
    text-align: center;
    text-decoration: none;
    transition: background var(--rf-transition), border-color var(--rf-transition);
}

.rf-items-tile:hover,
.rf-items-tile:focus-visible {
    background: var(--rf-surface-3);
    border-color: var(--rf-line-strong);
    color: var(--rf-ink);
    text-decoration: none;
}

.rf-items-tile:focus-visible {
    outline: none;
    box-shadow: var(--rf-focus);
}

.rf-items-tile__name {
    color: var(--rf-ink);
    font-size: var(--rf-size-tiny);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.rf-items-tile__sub {
    color: var(--rf-ink-faint);
    font-size: 0.7rem;
    font-weight: 600;
}

.rf-items-tile__amount {
    position: absolute;
    right: -0.4rem;
    bottom: -0.4rem;
    padding: 0 var(--rf-space-1);
    background: var(--rf-bg);
    border: 1px solid var(--rf-line-strong);
    border-radius: var(--rf-radius-sm);
    color: var(--rf-ink);
    font-size: var(--rf-size-tiny);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rf-items-usedin-search {
    width: 12rem;
    max-width: 100%;
}

/* ---- Narrow screens: the item's page becomes a sheet over the list ------- */

@media (max-width: 960px) {
    .rf-items-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .rf-items-detail {
        position: fixed;
        inset: 0;
        top: 0;
        z-index: 1050;
        max-height: none;
        border: none;
        border-radius: 0;
        padding: var(--rf-space-4);
        background: var(--rf-bg);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform 220ms ease, visibility 0s linear 220ms;
    }

    .rf-items-detail.is-open {
        transform: none;
        visibility: visible;
        transition: transform 220ms ease;
    }

    .rf-items-detail__bar {
        position: sticky;
        top: calc(-1 * var(--rf-space-4));
        z-index: 1;
        margin: calc(-1 * var(--rf-space-4)) calc(-1 * var(--rf-space-4)) var(--rf-space-3);
        padding: var(--rf-space-3) var(--rf-space-4);
        background: var(--rf-bg);
        border-bottom: 1px solid var(--rf-line);
    }

    .rf-items-detail__back {
        display: inline-flex;
    }

    html.rf-items-sheet-open,
    html.rf-items-sheet-open body {
        overflow: hidden;
    }

    /* the page content is a layer of its own (z-index 1, ravenfall-front.css), under the site's header (20);
       with the sheet open it has to be over it, or the header covers the sheet's back button */
    .page-content:has(.rf-items-detail.is-open),
    html.rf-items-sheet-open .page-content {
        z-index: 1100;
    }
}

@media (max-width: 560px) {
    .rf-items-filters__group {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--rf-space-1);
    }

    /* one line that scrolls sideways rather than four lines of chips */
    .rf-items-filters__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: var(--rf-space-1);
        scrollbar-width: thin;
    }

    .rf-items-filters .rf-filter {
        flex: 0 0 auto;
    }

    .rf-items-head {
        align-items: flex-start;
    }

    .rf-items-frame--large { width: 4.5rem; height: 4.5rem; }

    .rf-items-tiles {
        grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .rf-items-detail,
    .rf-items-detail.is-open {
        transition: none;
    }
}
