/* Shared headers, forms, buttons, stats, sections, and cards. */

.page-head,
.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.page-head h1,
.detail-head h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    line-height: 1;
}

.page-head p,
.detail-head p {
    max-width: 650px;
    margin: 0;
    font-size: 0.9rem;
}

.eyebrow {
    display: inline-flex;
}

.search-autocomplete {
    position: relative;
    display: block;
}

.search-autocomplete-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 80;
    display: grid;
    width: 100%;
    max-width: calc(100vw - 32px);
    max-height: 640px;
    overflow: auto;
}

.search-autocomplete-menu[hidden] {
    display: none;
}

.search-autocomplete-option {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 7px 9px;
    border-bottom: 1px solid rgba(143, 106, 71, 0.35);
    color: var(--ink);
}

.search-autocomplete-option > span {
    min-width: 0;
}

.search-autocomplete-option:last-child {
    border-bottom: 0;
}

.search-autocomplete-option:hover,
.search-autocomplete-option.is-active {
    text-decoration: none;
}

.search-autocomplete-option img[src*="/mob_icon.php"] {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.search-autocomplete-option strong,
.search-autocomplete-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-autocomplete-option strong {
    color: #2f1809;
    font-size: 0.85rem;
    line-height: 1.2;
}

.search-autocomplete-option small {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.2;
}

.search-autocomplete-option em {
    justify-self: end;
    max-width: 100%;
    overflow: hidden;
    min-width: 44px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #5d3210;
    color: #fff;
    font-size: 0.62rem;
    font-style: normal;
    font-weight: 900;
    line-height: 1.35;
    text-align: center;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.search-autocomplete-empty {
    padding: 11px 12px;
    color: var(--muted);
    font-weight: 800;
}

.wiki-item-grid {
    --wiki-item-cell-size: 32px;

    grid-auto-flow: row;
    grid-auto-rows: var(--wiki-item-cell-size);
    gap: 2px;
}

.wiki-item-grid > .wiki-item-cell {
    position: relative;
    align-self: stretch;
    border-radius: 3px;
}

.wiki-item-grid > .wiki-item-cell::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    border: 1px solid rgba(94, 54, 29, 0.42);
    border-radius: inherit;
    box-shadow: inset 0 0 5px rgba(112, 68, 27, 0.12);
    content: "";
    pointer-events: none;
}

.wiki-item-grid > .wiki-item-cell--size-2 {
    grid-row: span 2;
}

.wiki-item-grid > .wiki-item-cell--size-3 {
    grid-row: span 3;
}

img[src$="/item_icon.php?size=1"] {
    width: 32px !important;
    height: 32px !important;
    max-width: none !important;
    max-height: none !important;
}

img[src$="/item_icon.php?size=2"] {
    width: 32px !important;
    height: 64px !important;
    max-width: none !important;
    max-height: none !important;
}

img[src$="/item_icon.php?size=3"] {
    width: 32px !important;
    height: 96px !important;
    max-width: none !important;
    max-height: none !important;
}

input,
select,
button {
    min-height: 34px;
    border-radius: 3px;
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid #8f6a47;
    background: #fff8df;
    color: var(--ink);
    padding: 0 12px;
    outline: none;
}

input:focus,
select:focus {
    border-color: #88283a;
    box-shadow: 0 0 0 2px rgba(136, 40, 58, 0.22);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
}

.entity-card small,
.compact-row small {
    color: var(--muted);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.section-title h2,
.detail-panel h2 {
    margin: 0;
    width: fit-content;
    padding: 4px 10px;
    line-height: 1.3;
    text-transform: none;
}

.section-title a,
.list-meta a,
.back-link {
    color: var(--accent-strong);
    font-weight: 800;
}

.catalog-separator {
    width: 100%;
    border-top: 1px solid #b49663;
}

/* Shared controls and portal components. */

.page-head,
.detail-head {
    gap: 14px;
    margin-bottom: 18px;
}

.page-head h1,
.detail-head h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 900;
}

.page-head p,
.detail-head p,
.empty-state p {
    color: var(--muted);
}

.eyebrow {
    color: var(--accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.section-title h2,
.detail-panel h2 {
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 2px 3px 6px rgba(31, 15, 4, 0.42);
}

.search-autocomplete {
    min-width: 0;
}

.search-autocomplete-menu {
    border: 1px solid #6f241b;
    border-radius: 2px 2px 12px 2px;
    background: #fff9df;
    box-shadow: 5px 7px 13px rgba(21, 9, 2, 0.42);
}

.search-autocomplete-option:hover,
.search-autocomplete-option.is-active {
    background:
        linear-gradient(90deg, rgba(205, 163, 65, 0.32), transparent 80%),
        #f8edbf;
}

.pagination a:hover {
    background: #f5df98;
    color: var(--accent);
}

.list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    margin-bottom: 16px;
    color: #5f4b3d;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
}

.pagination a {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #8f6a47;
    border-radius: 8px;
    background: #fff8df;
    color: #5d3210;
    font-weight: 800;
}

.pagination a.is-active {
    border-color: #5d3210;
    background: #5d3210;
    color: #fff;
}

.pagination a.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.empty-state {
    display: grid;
    place-items: start;
    gap: 10px;
    min-height: 240px;
    padding: 36px;
}

.empty-state h1,
.empty-state h2,
.empty-state p {
    margin: 0;
}

.map-wiki-card {
    overflow: hidden;
    border: 2px solid #7a1a13;
    border-radius: 18px 18px 0 0;
    background: #fbfade;
    box-shadow: 7px 9px 15px rgba(19, 13, 6, 0.36);
}

.map-wiki-titlebar {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 18px;
    background: #2f1d1f;
    color: #f2e4b5;
}

.map-wiki-titlebar h1 {
    margin: 0;
    color: inherit;
    font-size: clamp(1.18rem, 1.55vw, 1.55rem);
    line-height: 1.1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.crafting-item-icon span {
    border-color: #3a1209;
}

.compact-row {
    color: var(--ink);
}

.compact-row img,
.crafting-item-icon,
.wiki-entity-link img,
.rich-entity-result img {
    border-color: #8b6040;
    background: #fff9df;
    box-shadow: inset 0 0 8px rgba(112, 68, 27, 0.16);
}
