/* ==========================================================================
   Pinboard — reusable Pinterest-style board (base chrome + theme vars)
   Ported from bandsaas.com. Layout-specific grids live in
   /css/pinboard/{agora,acropolis,stoa,amphora}.css.
   Base = toolbar, search, count, empty, sentinel/spinner + CSS vars.
   Light-theme defaults; dark overrides keyed off body.hub-dark / body.fs-dark
   (never dark-only vars — that's what broke the leaderboard).
   ========================================================================== */

:root {
    --pin-gap: 18px;
    --pin-card-bg: #ffffff;
    --pin-card-radius: 14px;
    --pin-card-shadow: 2px 4px 12px rgba(0, 0, 0, 0.08);
    --pin-card-shadow-hover: 4px 8px 22px rgba(0, 0, 0, 0.16);
    --pin-text: #14171a;
    --pin-text-muted: #667;
    --pin-surface: rgba(0, 0, 0, 0.04);
    --pin-border: rgba(0, 0, 0, 0.08);
    --pin-accent: var(--hub-primary, #d2042d);
}

body.hub-dark,
body.fs-dark {
    --pin-card-bg: #16181c;
    --pin-card-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    --pin-card-shadow-hover: 0 8px 26px rgba(0, 0, 0, 0.65);
    --pin-text: #e7e9ea;
    --pin-text-muted: #8b98a5;
    --pin-surface: rgba(255, 255, 255, 0.06);
    --pin-border: rgba(255, 255, 255, 0.1);
}

/* ---- Toolbar (search + count) ------------------------------------------- */
.pinboard-toolbar {
    position: sticky;
    top: 110px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    margin-bottom: 8px;
    background: var(--body-bg, var(--pin-accent));
}

.pinboard-search {
    position: relative;
    flex: 1;
    max-width: 520px;
}

.pinboard-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pin-text-muted);
    font-size: 14px;
    pointer-events: none;
}

.pinboard-search-input {
    width: 100%;
    padding: 11px 40px 11px 38px;
    border: 1px solid var(--pin-border);
    border-radius: 999px;
    background: var(--pin-card-bg);
    color: var(--pin-text);
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.pinboard-search-input:focus {
    border-color: var(--pin-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin-accent) 22%, transparent);
}

.pinboard-search-input::placeholder { color: var(--pin-text-muted); }

.pinboard-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: var(--pin-surface);
    color: var(--pin-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pinboard-search-clear:hover { background: var(--pin-border); }

.pinboard-count {
    flex-shrink: 0;
    color: var(--pin-text);
    font-size: 14px;
    font-weight: 600;
    opacity: .85;
}

/* ---- Grid container (layout files set the actual grid) ------------------ */
.pinboard {
    display: block;
}

/* ---- Empty state -------------------------------------------------------- */
.pinboard-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--pin-text);
    opacity: .8;
    font-size: 16px;
}

/* ---- Sentinel + spinner ------------------------------------------------- */
.pinboard-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 0 40px;
    min-height: 40px;
}

.pinboard-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--pin-border);
    border-top-color: var(--pin-accent);
    border-radius: 50%;
    animation: pinSpin .7s linear infinite;
}

@keyframes pinSpin { to { transform: rotate(360deg); } }

.pinboard .d-none,
.pinboard-empty.d-none,
.pinboard-spinner.d-none,
.pinboard-search-clear.d-none { display: none !important; }

/* ---- Content pin card internals (shared across all layouts) ------------- */
.pin-card-locked,
.pin-card-video-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    background: var(--pin-surface);
    color: var(--pin-text-muted);
    font-size: 28px;
}

.pin-card-video-ph::after {
    content: "\f04b"; /* fa-play */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.pin-card-text {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--pin-text);
}

.pin-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pin-card-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.pin-card-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--pin-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pin-card-verified {
    color: var(--pin-accent);
    font-size: 12px;
    margin-left: 2px;
}

.pin-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--pin-text-muted);
}

.pin-card-price {
    font-weight: 700;
    color: var(--pin-accent);
}

.pin-card-stat i { margin-right: 3px; }

/* ---- Sort tabs (used on /content) --------------------------------------- */
.pinboard-sorttabs {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
}

.pinboard-sorttab {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--pin-text);
    background: var(--pin-surface);
    opacity: .8;
}

.pinboard-sorttab.is-active {
    background: var(--pin-accent);
    color: #fff;
    opacity: 1;
}

/* ---- Feed List/Pins view toggle (front page) ---------------------------- */
.front-viewtoggle {
    display: flex;
    gap: 6px;
    padding: 12px 0 4px;
}

.front-viewtoggle-btn {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--pin-text);
    background: var(--pin-surface);
}

.front-viewtoggle-btn.is-active {
    background: var(--pin-accent);
    color: #fff;
}

.front-viewtoggle-btn i { margin-right: 5px; }

/* ---- Mobile toolbar ----------------------------------------------------- */
@media (max-width: 640px) {
    .pinboard-toolbar {
        top: 64px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .pinboard-search { max-width: none; }
}
