/* ══════════════════════════════════════════════════════════════
   PIN BOARD OVERLAY — Image-driven corkboard
   Board view: rendered corkboard + chalk labels + papers + badges
   Browse view: CSS-driven article browser (from clicking papers)
   ══════════════════════════════════════════════════════════════ */

.pinboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 250;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
}

.pinboard-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Back button (shared across views) */
.pinboard-back-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 260;
    background: rgba(255, 250, 240, 0.9);
    border: 2px solid #4a3728;
    border-radius: 8px;
    color: #4a3728;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.pinboard-back-btn:active {
    transform: scale(0.95);
}

/* ══════════════════════════════════════════════════════════════
   BOARD VIEW — Rendered corkboard with images
   ══════════════════════════════════════════════════════════════ */

/* Board fills the entire overlay viewport */
.pinboard-board {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.pinboard-board.hidden {
    display: none;
}

/* Corkboard background image — stretches to fill full screen */
.pinboard-board-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    z-index: 0;
}

/* Content sits on top of the board */
.pinboard-board-content {
    position: relative;
    z-index: 1;
    height: 100%;
    box-sizing: border-box;
    padding: 40px 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1vh;
}

/* Pinned paper note title — top left, rotated like casually pinned */
.pinboard-title-img {
    width: 50%;
    max-width: 192px;
    height: auto;
    transform: rotate(-3deg);
    filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.35));
    margin-left: 8%;
}

/* Articles row — label left, sheaf right, side by side */
.pinboard-articles-row {
    display: flex;
    align-items: center;
    gap: 4%;
    width: 100%;
    padding: 0 4%;
}

/* Pinned paper label images — small, angled */
.pinboard-label-img {
    width: 28%;
    max-width: 110px;
    height: auto;
    transform: rotate(2deg);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    flex-shrink: 0;
}

.pinboard-label-badges {
    transform: rotate(-2deg);
    margin-left: 4%;
}

/* Sheaf of papers (clickable) — right of articles label */
.pinboard-papers-img {
    width: 48%;
    max-width: 195px;
    height: auto;
    cursor: pointer;
    transition: transform 0.15s ease;
    transform: rotate(-2deg);
    filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.4));
    -webkit-tap-highlight-color: transparent;
    animation: sheafShimmer 2.8s ease-in-out infinite;
}

.pinboard-papers-img:active {
    animation: none;
    transform: rotate(-2deg) scale(0.97);
}

@keyframes sheafShimmer {
    0%, 100% {
        filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.4));
    }
    50% {
        filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.4))
               drop-shadow(0 0 10px rgba(255, 248, 220, 0.5));
    }
}

/* Badge grid — full width, bigger badges since headings are smaller */
.pinboard-badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 90%;
    margin: 0 auto;
}

.pinboard-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.pinboard-badge-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    transition: transform 0.15s ease;
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

.pinboard-badge.earned .pinboard-badge-img {
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

.pinboard-badge.locked .pinboard-badge-img {
    filter: grayscale(1) brightness(0.7) drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.25));
}

.pinboard-badge-name {
    font-size: 13px;
    color: rgba(255, 250, 235, 0.85);
    text-align: center;
    font-family: 'Nunito', sans-serif;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.pinboard-badge.locked .pinboard-badge-name {
    color: rgba(255, 250, 235, 0.4);
}

/* Disclaimer */
.pinboard-disclaimer {
    font-size: 13px;
    color: rgba(255, 250, 235, 0.45);
    text-align: center;
    margin-top: auto;
    font-style: italic;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

/* ══════════════════════════════════════════════════════════════
   BROWSE VIEW — Category/article list (CSS screen)
   ══════════════════════════════════════════════════════════════ */

.pinboard-browse-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #f8f0e0 0%, #ece0c8 100%);
    z-index: 255;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 50px 16px 30px;
}

.pinboard-browse-view.hidden {
    display: none;
}

.pinboard-browse-back {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 260;
    background: rgba(255, 250, 240, 0.9);
    border: 2px solid #4a3728;
    border-radius: 8px;
    color: #4a3728;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.pinboard-browse-back:active {
    transform: scale(0.95);
}

.pinboard-browse-title {
    font-size: 20px;
    font-weight: 700;
    color: #4a3728;
    text-align: center;
    margin-bottom: 16px;
    font-family: 'Nunito', sans-serif;
}

.pinboard-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.pinboard-category-card {
    background: rgba(255, 250, 240, 0.95);
    border: none;
    border-radius: 4px;
    padding: 14px 14px 10px;
    cursor: pointer;
    transition: box-shadow 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.12);
    position: relative;
}

.pinboard-category-card:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pinboard-category-name {
    font-size: 14px;
    font-weight: 700;
    color: #3a2a1a;
    font-family: 'Nunito', sans-serif;
}

.pinboard-category-count {
    font-size: 13px;
    color: #7a6a5a;
    margin-top: 2px;
}

/* ── Article list items ── */

.pinboard-article-item {
    background: rgba(255, 250, 240, 0.92);
    border: none;
    border-radius: 4px;
    padding: 12px 12px 8px;
    cursor: pointer;
    transition: box-shadow 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.pinboard-article-item:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.pinboard-article-title {
    font-size: 13px;
    font-weight: 600;
    color: #3a2a1a;
    font-family: 'Nunito', sans-serif;
}

.pinboard-article-excerpt {
    font-size: 13px;
    color: #7a6a5a;
    margin-top: 2px;
    line-height: 1.3;
}

/* ══════════════════════════════════════════════════════════════
   ARTICLE DETAIL VIEW
   ══════════════════════════════════════════════════════════════ */

.pinboard-article-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #f8f0e0 0%, #ece0c8 100%);
    z-index: 255;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 50px 16px 30px;
}

.pinboard-article-content {
    max-width: 400px;
    margin: 0 auto;
    background: rgba(255, 250, 240, 0.95);
    border-radius: 4px;
    padding: 24px 18px 20px;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.12);
}

.pinboard-article-view.hidden {
    display: none;
}

.pinboard-article-back {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 260;
    background: rgba(255, 250, 240, 0.9);
    border: 2px solid #4a3728;
    border-radius: 8px;
    color: #4a3728;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.pinboard-article-back:active {
    transform: scale(0.95);
}

.pinboard-article-content h2 {
    font-size: 18px;
    font-weight: 700;
    color: #4a3728;
    margin: 0 0 12px;
    font-family: 'Nunito', sans-serif;
}

.pinboard-article-content h3 {
    font-size: 15px;
    font-weight: 700;
    color: #5a4a3a;
    margin: 14px 0 8px;
    font-family: 'Nunito', sans-serif;
}

.pinboard-article-content p {
    font-size: 13px;
    color: #4a3a2a;
    line-height: 1.6;
    margin: 0 0 10px;
    font-family: 'Nunito', sans-serif;
}

.pinboard-article-content ul {
    padding-left: 20px;
    margin: 0 0 10px;
}

.pinboard-article-content li {
    font-size: 13px;
    color: #4a3a2a;
    line-height: 1.5;
    margin-bottom: 4px;
    font-family: 'Nunito', sans-serif;
}

.pinboard-article-content strong {
    color: #3a2a1a;
}

/* ══════════════════════════════════════════════════════════════
   SEARCH VIEW
   ══════════════════════════════════════════════════════════════ */

.pinboard-search-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #f8f0e0 0%, #ece0c8 100%);
    z-index: 255;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 50px 16px 30px;
}

.pinboard-search-view.hidden {
    display: none;
}

.pinboard-search-back {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 260;
    background: rgba(255, 250, 240, 0.9);
    border: 2px solid #4a3728;
    border-radius: 8px;
    color: #4a3728;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.pinboard-search-back:active {
    transform: scale(0.95);
}

.pinboard-search-input {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 16px;
    padding: 10px 14px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 250, 240, 0.95);
    font-size: 14px;
    color: #3a2a1a;
    font-family: 'Nunito', sans-serif;
    outline: none;
    box-sizing: border-box;
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1);
}

.pinboard-search-input:focus {
    box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.18);
}

.pinboard-search-input::placeholder {
    color: #9a8a7a;
}

.pinboard-search-results {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.pinboard-search-hint {
    font-size: 13px;
    color: rgba(60, 40, 20, 0.5);
    text-align: center;
    font-style: italic;
    padding: 20px 0;
}

/* ── Nugget-specific styles ── */

.nugget-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #5a7a4a;
    background: rgba(120, 160, 90, 0.15);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: middle;
    font-family: 'Nunito', sans-serif;
}

.nugget-claim {
    font-size: 14px;
    font-weight: 600;
    color: #3a2a1a;
    line-height: 1.5;
    margin-bottom: 14px;
}

.nugget-evidence {
    font-size: 13px;
    color: #5a7a4a;
    margin-bottom: 10px;
}

.nugget-attribution {
    font-size: 13px;
    color: #7a6a5a;
    margin-bottom: 8px;
}

.nugget-sources {
    font-size: 13px;
    color: #7a6a5a;
    line-height: 1.4;
    margin-bottom: 8px;
}

.nugget-date {
    font-size: 13px;
    color: #9a8a7a;
}

/* ── Loading spinner ── */
.pinboard-loading {
    text-align: center;
    padding: 20px 0;
    color: rgba(60, 40, 20, 0.5);
    font-size: 13px;
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    .pinboard-overlay {
        background: linear-gradient(180deg, #5a4030 0%, #4a3525 30%, #3a2a1a 100%);
    }
    .pinboard-back-btn,
    .pinboard-browse-back,
    .pinboard-article-back,
    .pinboard-search-back {
        background: rgba(40, 35, 30, 0.9);
        border-color: rgba(180, 160, 130, 0.4);
        color: #e0d5c5;
    }
    .pinboard-badge-name {
        color: rgba(220, 200, 170, 0.7);
    }
    .pinboard-badge.locked .pinboard-badge-name {
        color: rgba(220, 200, 170, 0.3);
    }
    .pinboard-browse-view,
    .pinboard-search-view {
        background: linear-gradient(180deg, #2a2520 0%, #1e1a16 100%);
    }
    .pinboard-browse-title {
        color: #e0d5c5;
    }
    .pinboard-category-card,
    .pinboard-article-item {
        background: rgba(55, 45, 35, 0.95);
        box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
    }
    .pinboard-category-name,
    .pinboard-article-title {
        color: #e0d5c5;
    }
    .pinboard-category-count,
    .pinboard-article-excerpt {
        color: #b0a090;
    }
    .pinboard-article-view {
        background: linear-gradient(180deg, #2a2520 0%, #1e1a16 100%);
    }
    .pinboard-article-content {
        background: rgba(55, 45, 35, 0.95);
        box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.35);
    }
    .pinboard-article-content h2 { color: #e0d5c5; }
    .pinboard-article-content h3 { color: #d0c5b5; }
    .pinboard-article-content p,
    .pinboard-article-content li { color: #c0b5a5; }
    .pinboard-search-input {
        background: rgba(55, 45, 35, 0.95);
        color: #e0d5c5;
        box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
    }
    .nugget-badge {
        color: #8ab070;
        background: rgba(120, 160, 90, 0.2);
    }
    .nugget-claim { color: #e0d5c5; }
    .nugget-evidence { color: #8ab070; }
    .nugget-attribution { color: #b0a090; }
    .nugget-sources { color: #b0a090; }
    .nugget-date { color: #8a7a6a; }
}
