:root {
    --bg:           #141414;
    --bg-elevated:  #1c1c1c;
    --text:         #ececec;
    --text-dim:     #9a9a9a;
    --accent:       #b8965a;
    --border:       #333333;
    --link:         var(--accent);
    --error:        #c84b4b;
}

/* Light fallback — applies only on an OS light preference (no toggle exists). */
@media (prefers-color-scheme: light) {
    :root {
        --bg:           #f5f3ee;
        --bg-elevated:  #ffffff;
        --text:         #1a1a1a;
        --text-dim:     #5a5a55;
        --accent:       #b8965a;
        --border:       #ddd8cc;
        --link:         var(--accent);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Georgia, serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header --- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.site-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-brand {
    color: var(--accent);
    font-size: 1.5rem;
    letter-spacing: 0.18em;
    font-weight: bold;
    text-decoration: none;
}

.site-brand:hover { text-decoration: none; }

.site-nav a {
    color: var(--text-dim);
    margin-left: 1.5rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
}

.site-nav a:hover { color: var(--text); text-decoration: none; }

/* --- Main container --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    width: 100%;
    flex: 1;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

h1 {
    color: var(--accent);
    font-size: 2.4rem;
    margin: 0 0 0.75rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.section-heading {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.85rem;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.page-eyebrow {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    margin: 0 0 0.5rem;
}

.page-intro {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin: 0 0 2rem;
    font-style: italic;
}

.muted { color: var(--text-dim); font-style: italic; }

.breadcrumb { margin-bottom: 1rem; font-size: 0.9rem; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--text); }

/* --- Browse block on index --- */
.browse-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.browse-row { margin: 0.4rem 0; line-height: 1.8; }

.browse-label {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

/* --- Taxonomy overview article ---
   Pairs with .entry-body (shared typography); this only separates the article
   from the weapon list below it. */
.tax-overview {
    margin: 0 0 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tax-overview-edit {
    margin: 1.5rem 0 0;
    font-size: 0.85rem;
}

.tax-overview-edit a {
    color: var(--text-dim);
}

/* --- Entry list (cards) --- */
.entry-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 720px) {
    .entry-list { grid-template-columns: 1fr; }
}

.entry-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    transition: border-color 0.15s;
}

.entry-card:hover { border-color: var(--accent); }

.entry-card a {
    display: block;
    padding: 1.1rem 1.25rem;
    color: inherit;
    text-decoration: none;
}

.entry-card a:hover { text-decoration: none; }

.entry-card h3 {
    color: var(--accent);
    margin: 0 0 0.4rem;
    font-size: 1.15rem;
}

.entry-card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* --- Single wiki entry --- */
.wiki-entry .entry-summary {
    color: var(--text-dim);
    font-style: italic;
    font-size: 1.15rem;
    margin: 0 0 1.5rem;
}

.entry-tags {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.tag-row {
    margin: 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.tag-row:first-child { margin-top: 0; }
.tag-row:last-child  { margin-bottom: 0; }

.tag-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-width: 4.5rem;
    display: inline-block;
}

.tag-chip {
    display: inline-block;
    background: rgba(200, 168, 75, 0.1);
    border: 1px solid rgba(200, 168, 75, 0.4);
    color: var(--text);
    padding: 0.15rem 0.7rem;
    border-radius: 12px;
    font-size: 0.85rem;
    text-decoration: none;
}

.tag-chip:hover {
    background: rgba(200, 168, 75, 0.2);
    text-decoration: none;
    color: var(--text);
}

.tag-chip-static {
    cursor: default;
    color: var(--text-dim);
    border-color: var(--border);
    background: transparent;
}

/* --- Image gallery on entry pages --- */
.entry-gallery {
    margin: 1.5rem 0 2rem;
}

.entry-image {
    margin: 0 0 1.5rem;
}

.entry-image:last-child { margin-bottom: 0; }

.entry-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    background: var(--bg-elevated);
}

.entry-image figcaption {
    margin-top: 0.5rem;
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
}

/* Multi-photo gallery: the main figure keeps an (empty-able) caption slot
   so thumbnail clicks can swap it; hide it when there's nothing to say. */
.gallery-main figcaption:empty { display: none; }

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gallery-thumb {
    padding: 0;
    width: 72px;
    height: 72px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    cursor: pointer;
    overflow: hidden;
    flex: 0 0 auto;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-thumb:hover { border-color: var(--text-dim); }
.gallery-thumb.on    { border-color: var(--accent); }

/* Full-size lightbox: opened by clicking the main photo. Fixed light-on-dark
   colors (not theme vars) — the backdrop is dark in BOTH themes, and the
   light theme's --text would vanish against it. */
.gallery-main img { cursor: zoom-in; }

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(10, 10, 10, 0.92);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    cursor: zoom-out;
}

.gallery-lightbox img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: #c8c8c8;
    font-style: italic;
    font-size: 0.95rem;
    text-align: center;
    max-width: 70ch;
}

.lightbox-caption:empty { display: none; }

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #ececec;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover { color: var(--accent); }

/* Alternate names + sources (migration 024) */
.entry-alt-names {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: -0.75rem 0 1.5rem;
}

.entry-sources {
    margin-top: 2rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.entry-sources p { margin: 0.3rem 0; }

/* --- Rendered markdown body --- */
.entry-body { font-size: 1.05rem; }

.entry-body h2 {
    color: var(--accent);
    font-size: 1.55rem;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.entry-body h3 {
    color: var(--text);
    font-size: 1.2rem;
    margin: 1.5rem 0 0.5rem;
}

.entry-body h4 {
    color: var(--text);
    font-size: 1.05rem;
    margin: 1.25rem 0 0.4rem;
}

.entry-body p { margin: 0 0 1rem; }
.entry-body a { color: var(--link); text-decoration: underline; }

.entry-body ul, .entry-body ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0 1rem;
}

.entry-body li { margin: 0.25rem 0; }

.entry-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    color: var(--text-dim);
    background: rgba(200, 168, 75, 0.04);
    font-style: italic;
}

.entry-body code {
    background: var(--bg-elevated);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    font-size: 0.9em;
    color: var(--accent);
    font-family: Consolas, Monaco, monospace;
}

.entry-body pre {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
}

.entry-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text);
}

.entry-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

.entry-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.entry-body table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}

.entry-body th, .entry-body td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.entry-body th {
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

/* --- Commerce section on entry pages --- */
.commerce-section { margin-top: 2.5rem; }

.listing-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.listing-card {
    display: flex;
    gap: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    padding: 1rem 1.25rem;
    transition: border-color 0.15s;
}

.listing-card:hover { border-color: var(--accent); }

.listing-thumb {
    flex: 0 0 120px;
    width: 120px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
}

.listing-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listing-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
}

.listing-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.listing-badge {
    align-self: flex-start;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    border: 1px solid transparent;
}

.listing-source-warpast {
    background: rgba(200, 168, 75, 0.15);
    border-color: rgba(200, 168, 75, 0.5);
    color: var(--accent);
}

.listing-source-seller {
    background: transparent;
    border-color: var(--border);
    color: var(--text-dim);
}

.listing-title {
    color: var(--text);
    font-size: 1.15rem;
    margin: 0;
}

.listing-meta {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.listing-price {
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: bold;
}

.listing-price-tbd {
    font-size: 1rem;
    font-weight: normal;
    font-style: italic;
    color: var(--text-dim);
}

.listing-condition {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.listing-source-note {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}

/* "Have one for sale?" invite */
.commerce-invite {
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: rgba(200, 168, 75, 0.04);
    padding: 1.25rem 1.5rem;
    text-align: center;
}

.commerce-invite-text {
    margin: 0 0 0.75rem;
    color: var(--text-dim);
    font-size: 1.05rem;
}

/* Live CTA on the "have one for sale?" invite (was .btn-stub before
   registration existed). */
.btn-invite {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.9rem;
    text-decoration: none;
}

.btn-invite:hover {
    background: var(--accent);
    color: #141414;
}

@media (max-width: 720px) {
    .listing-card { flex-direction: column; }
    .listing-thumb { flex-basis: auto; width: 100%; height: 180px; }
}

/* --- Shipping restrictions on listing cards (display only; no cart yet) --- */
.listing-restrictions {
    margin-top: 0.6rem;
    font-size: 0.85rem;
}

.restriction-block {
    margin: 0 0 0.35rem;
    padding: 0.4rem 0.65rem;
    border-left: 3px solid #c84b4b;
    background: rgba(200, 75, 75, 0.08);
    color: #d98f8f;
    border-radius: 0 3px 3px 0;
}

.restriction-warn summary {
    cursor: pointer;
    padding: 0.4rem 0.65rem;
    border-left: 3px solid #d4a843;
    background: rgba(212, 168, 67, 0.08);
    color: #d4b878;
    border-radius: 0 3px 3px 0;
}

.restriction-warn ul {
    margin: 0.4rem 0 0;
    padding: 0.25rem 0.5rem 0.25rem 1.5rem;
    color: var(--text-dim);
}

.restriction-warn li { margin-bottom: 0.35rem; }

/* --- Cart & checkout (Phase 1) --- */
.cart-link { position: relative; }

.cart-count {
    display: none;
    margin-left: 0.3rem;
    padding: 0.05rem 0.45rem;
    background: var(--accent);
    color: #141414;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}
.cart-count.visible { display: inline-block; }

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 20px);
    background: var(--bg-elevated, #1c1c1c);
    color: var(--text, #ececec);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0.6rem 1.2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.add-to-cart, .checkout-btn {
    margin-top: 0.6rem;
    padding: 0.45rem 1.1rem;
    background: var(--accent);
    color: #141414;
    border: none;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
}
.add-to-cart:hover, .checkout-btn:hover { filter: brightness(1.1); }
.checkout-btn { font-size: 1.05rem; padding: 0.7rem 1.8rem; }
.checkout-btn:disabled { opacity: 0.6; cursor: wait; }

.cart-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-title { display: block; font-weight: bold; }
.cart-item-price { color: var(--text-dim); font-size: 0.9rem; }

.cart-item-controls { display: flex; align-items: center; gap: 0.5rem; }

.qty-btn {
    width: 1.8rem; height: 1.8rem;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    font-size: 1rem;
}
.qty-btn:hover { border-color: var(--accent); }

.cart-item-qty { min-width: 1.5rem; text-align: center; }

.cart-remove {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.cart-remove:hover { color: #c84b4b; border-color: #c84b4b; }

.checkout-form label { display: block; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.9rem; }
.checkout-form input, .checkout-form select, .checkout-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.7rem;
    background: rgba(0,0,0,0.25);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 1rem;
    box-sizing: border-box;
}

.co-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    max-width: 640px;
}
.co-grid .co-wide { grid-column: 1 / -1; }
@media (max-width: 600px) { .co-grid { grid-template-columns: 1fr; } }

.quote-box { max-width: 320px; }
.quote-table { width: 100%; border-collapse: collapse; }
.quote-table td { padding: 0.35rem 0; }
.quote-table td:last-child { text-align: right; }
.quote-total td {
    border-top: 2px solid var(--border);
    font-weight: bold;
    font-size: 1.15rem;
    color: var(--accent);
}

.co-blocked {
    border-left: 3px solid #c84b4b;
    background: rgba(200, 75, 75, 0.08);
    border-radius: 0 3px 3px 0;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
}
.co-blocked h3 { margin: 0 0 0.5rem; color: #d98f8f; }
.co-blocked ul { margin: 0; padding-left: 1.2rem; }
.co-blocked li { margin-bottom: 0.5rem; }

.co-warnings {
    border-left: 3px solid #d4a843;
    background: rgba(212, 168, 67, 0.08);
    border-radius: 0 3px 3px 0;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
}
.co-warnings h3 { margin: 0 0 0.5rem; color: #d4b878; }

.ack-label {
    display: flex !important;
    gap: 0.6rem;
    align-items: flex-start;
    color: var(--text) !important;
    font-size: 0.9rem !important;
}
.ack-label input { width: auto !important; margin-top: 0.25rem; }
.ack-label em { display: block; color: var(--text-dim); margin-top: 0.2rem; }

.co-ffl {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    max-width: 640px;
}
.co-ffl h3 { margin-top: 0; }

.payment-stub {
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 0.8rem 1rem;
    color: var(--text-dim);
    max-width: 640px;
}

.checkout-error { color: #d98f8f; margin-top: 0.75rem; min-height: 1.2em; }

.order-confirm {
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1.5rem;
    max-width: 560px;
}
.order-confirm h2 { margin-top: 0; color: var(--accent); }

.payment-fields { max-width: 640px; }
.payment-note { font-size: 0.85rem; margin-top: 0; }

/* --- Account pages (login / register / dashboard) --- */
.auth-form { max-width: 420px; }
.auth-form label { display: block; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.9rem; }
.auth-form input, .auth-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.7rem;
    background: rgba(0,0,0,0.25);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 1rem;
    box-sizing: border-box;
}

.account-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.account-table th, .account-table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.account-table th { color: var(--text-dim); font-weight: normal; }

.account-list { list-style: none; padding: 0; }
.account-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.account-item-actions { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-end; }
.account-item-actions button {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.account-item-actions button:hover { color: var(--text); border-color: var(--accent); }
.account-item-actions .danger-link:hover { color: #c84b4b; border-color: #c84b4b; }

.default-badge {
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--accent);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.account-pre { white-space: pre-wrap; }

.account-add { margin: 0.75rem 0 2rem; }
.account-add summary { cursor: pointer; color: var(--accent); margin-bottom: 0.75rem; }

/* --- Contribute page --- */
.contrib-form { max-width: 720px; }
.contrib-form .wc { color: var(--text-dim); font-size: 0.78rem; }
.entry-contribute { margin-top: 2rem; font-size: 0.9rem; }

/* Inline [[ link picker (shared linkpicker.js — same rules as admin.css,
   using this sheet's variables). */
.link-picker {
    position: fixed;
    z-index: 1000;
    min-width: 220px;
    max-width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--accent);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
}
.link-picker-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
}
.link-picker-row.sel { background: rgba(184, 150, 90, 0.18); }
.link-picker-row .lp-title { color: var(--text); }
.link-picker-row .lp-status {
    color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.link-picker-row .lp-broken { color: var(--accent); }
.link-picker-row .lp-broken em { color: var(--text-dim); font-style: normal; font-size: 0.8rem; }
/* Off-screen caret-measuring mirror (never visible). */
.link-picker-mirror { position: absolute; visibility: hidden; top: 0; left: -9999px; }

/* Weapon vs taxonomy-subject switch (new submissions only). Borrows the
   .tax-chip look so the two pickers on this page read as one system. */
.contrib-mode { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.contrib-mode-btn {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.contrib-mode-btn:hover { border-color: var(--accent); }
.contrib-mode-btn.on {
    color: #141414;
    background: var(--accent);
    border-color: var(--accent);
}

.tax-group { margin-bottom: 1rem; }
.tax-group-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}
.tax-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tax-chip {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.tax-chip:hover { border-color: var(--accent); }
.tax-chip.on {
    color: #141414;
    background: var(--accent);
    border-color: var(--accent);
    font-weight: bold;
}

/* --- Contribute: photo uploads --- */
.cb-attest {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.cb-attest input { margin-right: 0.4rem; }
.cb-img-drop {
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 0.9rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
}
.cb-img-drop.drag-over { border-color: var(--accent); }
.cb-img-list { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.6rem; }
.cb-img-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem;
}
.cb-img-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.cb-img-fields { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.cb-img-fields label { font-size: 0.78rem; color: var(--text-dim); }
.cb-img-fields input { width: 100%; }

/* --- Store credit at checkout --- */
.credit-apply {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.credit-apply label { flex: 1; }
.credit-max-btn { width: auto; padding: 0.4rem 0.8rem; margin-bottom: 0.9rem; }

/* --- Contributor tier badges + hall of fame --- */
.tier-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.55rem;
    border-radius: 10px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}
.tier-contributor { border: 1px solid var(--accent); color: var(--accent); }
.tier-expert { border: 1px solid #7ab8c8; color: #7ab8c8; }
.tier-master { border: 1px solid #d4a843; color: #d4a843; background: rgba(212, 168, 67, 0.1); }

.entry-contributors {
    margin-top: 1.5rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.hof-row h3 { margin: 0 0 0.25rem; }
.hof-row p { margin: 0; color: var(--text-dim); }

/* --- Entry specifications section --- */
.entry-specs { margin: 1.5rem 0; }
.entry-specs h2 { font-size: 1.1rem; border-bottom: 1px solid var(--border, #ccc); padding-bottom: 0.3rem; }
.spec-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin-top: 0.6rem; }
.spec-row { display: contents; }
.spec-list dt { font-weight: 600; }
.spec-list dd { margin: 0; }

/* --- Internal wiki links (identity-based, rename-safe) --- */
.entry-body a.wiki-link { color: var(--accent); text-decoration: underline; }
.wiki-link-broken {
    color: var(--error);
    border-bottom: 1px dotted var(--error);
    cursor: help;
}

/* --- Homepage --- */
/* Full-bleed black band: the logo art has a pure-black ground, so the band
   makes it borderless. The negative top margin cancels .container's top
   padding so the band meets the header; the 50vw margins stretch it to the
   viewport edges (body hides the scrollbar-width overflow this can cause). */
body { overflow-x: hidden; }

.home-hero {
    background: #000;
    margin: -2.5rem calc(50% - 50vw) 2.75rem;
    padding: 2.75rem 1.5rem 3rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

/* NOTE: keep this pure black with no glow/gradient — the logo PNG has an
   opaque #000 ground, and anything painted behind it turns that ground into
   a visible rectangle. */
.home-hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.home-logo {
    width: 100%;
    max-width: 520px;
    height: auto;
    display: inline-block;
}

.home-lede {
    max-width: 560px;
    margin: 1.5rem auto 0.9rem;
    color: #a89e8c;
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.7;
}

.home-tagline {
    margin: 0 0 1.9rem;
    color: var(--accent);
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.home-cta {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-ghost {
    display: inline-block;
    padding: 0.7rem 1.8rem;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 2px;
}

.btn-primary {
    background: var(--accent);
    color: #141414;
}
.btn-primary:hover { background: #c9a86e; text-decoration: none; }

.btn-ghost {
    border: 1px solid var(--accent);
    color: var(--accent);
}
.btn-ghost:hover {
    background: rgba(200, 168, 75, 0.1);
    text-decoration: none;
}

/* Two-column body: main content + sidebar (featured entry, browse) */
.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 0 2.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .home-grid { grid-template-columns: 1fr; }
}

/* Featured entry card (rotates daily) — vertical, lives in the sidebar */
.featured-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    color: inherit;
    overflow: hidden;
    transition: border-color 0.15s;
}
.featured-card:hover { border-color: var(--accent); text-decoration: none; }

.featured-thumb {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.featured-thumb img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.featured-body { padding: 1rem 1.2rem 1.2rem; }

.featured-body h3 {
    color: var(--accent);
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
}

.featured-body p {
    margin: 0 0 0.75rem;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.featured-more {
    color: var(--accent);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* "Our focus" cards — stacked in the main column */
.home-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.home-feature {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    padding: 1.25rem 1.4rem;
}

.home-feature h3 {
    color: var(--accent);
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.home-feature p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* Footer nav links (About / Guides / Contact / ...) */
.footer-nav { margin-bottom: 0.5rem; }
.footer-nav a { color: var(--text-dim); }
.footer-nav a:hover { color: var(--text); }
.footer-legal { font-size: 0.8rem; }

/* --- Header search box --- */
.site-header-inner { flex-wrap: wrap; gap: 0.5rem 1rem; }

.site-search {
    flex: 1;
    max-width: 260px;
    margin: 0 auto;
}

.site-search input {
    width: 100%;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 0.9rem;
    font-family: inherit;
}
.site-search input:focus { outline: none; border-color: var(--accent); }
.site-search input::placeholder { color: var(--text-dim); }

@media (max-width: 860px) {
    .site-search { order: 3; flex-basis: 100%; max-width: none; }
}

/* --- Shop cards (homepage strip + /shop grid) --- */
.shop-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.shop-grid-home { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 860px) {
    .shop-grid, .shop-grid-home { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .shop-grid, .shop-grid-home { grid-template-columns: 1fr; }
}

.shop-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    overflow: hidden;
    transition: border-color 0.15s;
}
.shop-card:hover { border-color: var(--accent); }

.shop-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}
.shop-card a:hover { text-decoration: none; }

.shop-thumb {
    height: 150px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.shop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.shop-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}

.shop-card-body { padding: 0.9rem 1rem 1rem; }

.shop-card-body h3 {
    color: var(--text);
    font-size: 1rem;
    margin: 0.5rem 0 0.4rem;
    line-height: 1.35;
}

.shop-card-meta {
    margin: 0 0 0.4rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.shop-card-meta .listing-price { font-size: 1.15rem; }

.shop-card-entry {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-style: italic;
}

.shop-more { text-align: right; font-size: 0.95rem; }

.shop-sell-note {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* --- Search page --- */
.search-form input[type="search"] {
    width: 100%;
    padding: 0.7rem 1rem;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 1.1rem;
    font-family: inherit;
    box-sizing: border-box;
}
.search-form input[type="search"]:focus { outline: none; border-color: var(--accent); }

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.75rem;
}

.search-filters select {
    padding: 0.45rem 0.6rem;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.9rem;
    font-family: inherit;
    max-width: 200px;
}
.search-filters select:focus { outline: none; border-color: var(--accent); }

.search-forsale {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    white-space: nowrap;
}

.search-submit {
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0.5rem 1.4rem;
}

.search-reading {
    margin: 1.25rem 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.search-examples {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.search-examples li { margin: 0.4rem 0; font-size: 1.05rem; }

/* --- Wiki entry page: main column + infobox sidebar --- */
/* Named areas keep the sidebar FIRST on small screens (tags + For Sale
   above the article body) while sitting right of the body on wide ones. */
.entry-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "main side";
    gap: 0 2.5rem;
    align-items: start;
}

.entry-main { grid-area: main; min-width: 0; }
.entry-side { grid-area: side; min-width: 0; }

@media (max-width: 860px) {
    .entry-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "side" "main";
    }
}

/* Sidebar variants of existing blocks */
.entry-side .entry-tags { margin: 0 0 1.5rem; }
.entry-side .tag-label { display: block; margin-bottom: 0.2rem; }
.entry-side .tag-row { margin: 0.75rem 0; }
.entry-side .tag-row:first-child { margin-top: 0; }

.entry-side .entry-specs { margin: 0 0 1.5rem; }
.entry-side .spec-list { font-size: 0.9rem; }

.entry-side .commerce-section { margin-top: 0; }
.entry-side .commerce-section .section-heading { margin-top: 0; }

/* Listing cards go vertical in the narrow column */
.entry-side .listing-card { flex-direction: column; gap: 0.75rem; }
.entry-side .listing-thumb { flex-basis: auto; width: 100%; height: 150px; }
.entry-side .commerce-invite { padding: 1rem; }

.entry-side-links {
    margin: 1rem 0 0;
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* --- Listing detail page (/listing/<id>) --- */
.listing-page-source {
    margin: -0.25rem 0 1.5rem;
    color: var(--text-dim);
    font-style: italic;
}

.buy-box {
    border: 1px solid var(--accent);
    border-radius: 4px;
    background: var(--bg-elevated);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.5rem;
}

.buy-price {
    color: var(--accent);
    font-size: 1.9rem;
    font-weight: bold;
    margin: 0.6rem 0 0.4rem;
}
.buy-price-tbd { font-size: 1.2rem; font-weight: normal; font-style: italic; }

.buy-condition, .buy-stock {
    margin: 0 0 0.4rem;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.buy-box .add-to-cart {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    margin-top: 0.75rem;
}

.buy-ended {
    color: var(--text-dim);
    font-style: italic;
    margin: 0.75rem 0 0.25rem;
}

.listing-history {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-elevated);
    padding: 1rem 1.2rem;
}
.listing-history h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.listing-history p { margin: 0 0 0.5rem; color: var(--text-dim); font-size: 0.95rem; }
.listing-history-link { margin-bottom: 0 !important; }

.listing-desc { font-size: 1.05rem; }
.listing-desc p { margin: 0 0 1rem; }

.listing-page-noimage {
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 1.5rem;
}

/* Listing-card titles are links now (wiki sidebar cards) */
.listing-title a { color: var(--text); }
.listing-title a:hover { color: var(--accent); text-decoration: none; }

/* "For sale" badge on search result / entry cards */
.forsale-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.05rem 0.55rem;
    background: rgba(200, 168, 75, 0.15);
    border: 1px solid rgba(200, 168, 75, 0.5);
    color: var(--accent);
    border-radius: 10px;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
}
