/* RE-DS Item Compendium page-specific styling. Keep overrides scoped. */

.nds-shell[data-re-ds-item-compendium] {
    width: min(1480px, calc(100vw - 1.5rem));
}

@media (min-width: 821px) {
    .nds-shell[data-re-ds-item-compendium] .nds-grid {
        grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    }
}

.nds-shell[data-re-ds-item-compendium] .nds-rail {
    display: none;
}

[data-re-ds-item-compendium] .re-ds-item-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

[data-re-ds-item-compendium] .re-ds-item-grid .re-ds-field--search {
    grid-column: span 2;
}

[data-re-ds-item-compendium] .re-ds-item-gallery {
    margin-top: 0.9rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 0.75rem;
}

[data-re-ds-item-compendium] .re-ds-item-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(70, 55, 28, 0.22);
    background:
        radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 45%),
        repeating-linear-gradient(
            135deg,
            rgba(24, 18, 10, 0.06) 0px,
            rgba(24, 18, 10, 0.06) 2px,
            rgba(255, 255, 255, 0) 2px,
            rgba(255, 255, 255, 0) 6px
        ),
        rgba(255, 252, 246, 0.64);
    color: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 2px rgba(70, 55, 28, 0.1),
        0 14px 26px rgba(0, 0, 0, 0.08);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

[data-re-ds-item-compendium] .re-ds-item-tile:hover,
[data-re-ds-item-compendium] .re-ds-item-tile:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(22, 34, 24, 0.34);
    outline: none;
    background-color: rgba(217, 229, 205, 0.2);
    box-shadow:
        inset 0 0 0 2px rgba(22, 34, 24, 0.12),
        0 18px 34px rgba(0, 0, 0, 0.1);
}

[data-re-ds-item-compendium] .re-ds-item-tile.is-active {
    border-color: rgba(76, 118, 50, 0.5);
    background-color: rgba(217, 229, 205, 0.34);
    box-shadow:
        inset 0 0 0 2px rgba(76, 118, 50, 0.18),
        0 18px 34px rgba(0, 0, 0, 0.1);
}

[data-re-ds-item-compendium] .re-ds-item-tile__frame {
    position: absolute;
    inset: 0.52rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: rgba(12, 16, 19, 0.92);
    display: grid;
    place-items: center;
    overflow: hidden;
}

[data-re-ds-item-compendium] .re-ds-item-tile__thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.3rem;
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.4));
}

[data-re-ds-item-compendium] .re-ds-item-tile__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(246, 241, 234, 0.7);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 1.1rem;
    letter-spacing: 0.18em;
}

[data-re-ds-item-compendium] .re-ds-item-tile__kicker {
    position: absolute;
    left: 0.55rem;
    top: 0.55rem;
    max-width: calc(100% - 3.6rem);
    padding: 0.22rem 0.45rem;
    border-radius: 999px;
    background: rgba(8, 11, 14, 0.72);
    color: rgba(246, 241, 234, 0.92);
    font-family: "Oswald", sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 12px 22px rgba(0, 0, 0, 0.18);
}

[data-re-ds-item-compendium] .re-ds-item-tile__flags {
    position: absolute;
    right: 0.55rem;
    top: 0.55rem;
    display: flex;
    gap: 0.3rem;
}

[data-re-ds-item-compendium] .re-ds-item-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 12px;
    background: rgba(8, 11, 14, 0.68);
    color: rgba(246, 241, 234, 0.92);
    font-family: "Oswald", sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 12px 22px rgba(0, 0, 0, 0.18);
}

[data-re-ds-item-compendium] .re-ds-item-tile__label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.35rem 0.55rem 0.5rem;
    color: rgba(246, 241, 234, 0.94);
    font-family: "Oswald", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.12;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    background: linear-gradient(180deg, rgba(8, 11, 14, 0), rgba(8, 11, 14, 0.88));
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

[data-re-ds-item-compendium] .re-ds-item-tile__count {
    position: absolute;
    right: 0.55rem;
    bottom: 0.55rem;
    min-width: 1.8rem;
    height: 1.5rem;
    padding: 0 0.42rem;
    border-radius: 12px;
    background: rgba(8, 11, 14, 0.84);
    color: rgba(246, 241, 234, 0.92);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 12px 22px rgba(0, 0, 0, 0.18);
}

[data-re-ds-item-compendium] .re-ds-item-toggles {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
}

[data-re-ds-item-compendium] .re-ds-item-meta {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.2rem;
}

[data-re-ds-item-compendium] .re-ds-item-count {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    letter-spacing: 0.02em;
}

[data-re-ds-item-compendium] .re-ds-item-render {
    width: 100%;
    display: block;
    border-radius: 12px;
    border: 1px solid rgba(70, 55, 28, 0.12);
    background: rgba(12, 16, 19, 0.92);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 0.35rem;
}

[data-re-ds-item-compendium] .re-ds-item-render-meta {
    margin-top: 0.65rem;
    color: rgba(24, 18, 10, 0.7);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

[data-re-ds-item-compendium] .re-ds-item-chiprow {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

[data-re-ds-item-compendium] .re-ds-item-note {
    margin-top: 0.75rem;
    color: rgba(24, 18, 10, 0.74);
    overflow-wrap: anywhere;
}

[data-re-ds-item-compendium] .re-ds-item-subnote {
    margin-top: 0.45rem;
    color: rgba(24, 18, 10, 0.66);
    overflow-wrap: anywhere;
}

[data-re-ds-item-compendium] .re-ds-item-rooms {
    margin-top: 0.75rem;
}

[data-re-ds-item-compendium] .re-ds-item-rooms h4 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.14em;
}

[data-re-ds-item-compendium] .re-ds-item-roomlist {
    margin-top: 0.65rem;
}

[data-re-ds-item-compendium] .re-ds-item-roomlist li {
    padding: 0;
    border: 0;
    background: transparent;
}

[data-re-ds-item-compendium] .re-ds-item-roomlink {
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: 1px solid rgba(70, 55, 28, 0.12);
    border-radius: 14px;
    background: rgba(255, 252, 246, 0.48);
    color: rgba(24, 18, 10, 0.86);
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

[data-re-ds-item-compendium] .re-ds-item-roomlink:hover,
[data-re-ds-item-compendium] .re-ds-item-roomlink:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(22, 34, 24, 0.32);
    outline: none;
    background: rgba(255, 252, 246, 0.72);
}

[data-re-ds-item-compendium] .re-ds-item-roomlist small {
    color: rgba(24, 18, 10, 0.62);
    font-size: 0.9rem;
}

[data-re-ds-item-compendium] .re-ds-item-notes {
    color: rgba(24, 18, 10, 0.74);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

@media (min-width: 900px) {
    [data-re-ds-item-compendium] .re-ds-item-results {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
    }
}

@media (max-width: 720px) {
    [data-re-ds-item-compendium] .re-ds-item-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    [data-re-ds-item-compendium] .re-ds-item-grid .re-ds-field--search {
        grid-column: 1 / -1;
    }

    [data-re-ds-item-compendium] .re-ds-item-gallery {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        gap: 0.65rem;
    }
}
