﻿/* ============================================================================
   BeliefBoard.razor.css  —  Study Mode · Board 2 scoped styles
   Gradient-specter belief board matching the Blindside gold-on-dark language.
   ============================================================================ */

.belief-board {
    --bb-gold: #d5a642;
    --bb-cream: #f7ead0;
    --bb-light: #4a4136; /* light board square */
    --bb-dark: #241d15; /* dark board square */
    position: relative;
    width: 100%;
    max-width: 350px;
    background: linear-gradient(180deg, rgba(213, 166, 66, 0.05), rgba(0, 0, 0, 0));
    border: 1px solid rgba(213, 166, 66, 0.18);
    border-radius: 12px;
    padding: 12px;
    color: var(--bb-cream);
    box-sizing: border-box;
}

    .belief-board *, .belief-board *::before, .belief-board *::after {
        box-sizing: border-box;
    }

.belief-board__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.55);
    margin-bottom: 8px;
}

    .belief-board__title i {
        color: var(--bb-gold);
    }

/* ── Board grid ── */
.belief-board__grid-wrap {
    position: relative;
    padding-left: 16px;
    padding-bottom: 16px;
}

.belief-board__grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1;
    border: 1px solid rgba(213, 166, 66, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.bb-sq {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.bb-sq--light {
    background: var(--bb-light);
}

.bb-sq--dark {
    background: var(--bb-dark);
}

.bb-sq:focus-visible {
    box-shadow: inset 0 0 0 2px var(--bb-gold);
}

/* ── AI's own piece: small, plain, recessive (it knows where these are) ── */
.bb-own {
    width: 52%;
    height: 52%;
    border-radius: 50%;
    background: rgba(247, 234, 208, 0.14);
    border: 1px solid rgba(247, 234, 208, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bb-own__glyph {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(247, 234, 208, 0.7);
}

/* ── Belief specter: hue = type · opacity = confidence · stroke = occupancy ── */
.bb-specter {
    width: 76%;
    height: 76%;
    border-radius: 46% 46% 42% 42% / 54% 54% 46% 46%;
    background: var(--bb-hue);
    opacity: var(--bb-hue-op);
    /* black occupancy stroke — probable pieces get solid dark rings.
       Ring WIDTH scales 1px..3px by occupancy so "likely a piece" reads structurally. */
    box-shadow: 0 0 0 calc(1px + 2px * var(--bb-stroke-op)) rgba(0, 0, 0, var(--bb-stroke-op)), inset 0 -2px 5px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bb-specter__mark {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.72rem;
    color: rgba(0, 0, 0, 0.45);
}

/* ── Correctness glyph — badge on a dark disc, always legible ── */
.bb-glyph {
    position: absolute;
    bottom: 3px;
    left: 44%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 6, 3, 0.82);
    font-size: 0.6rem;
    font-weight: 900;
    line-height: 1;
}

.bb-glyph--nailed {
    color: #5fd98a;
}

.bb-glyph--wrongtype {
    color: #e0c04f;
}

.bb-glyph--phantom {
    color: #e06a5a;
}

.bb-glyph--missed {
    color: #e0902e;
}

/* ── Coordinates ── */
.belief-board__files {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 0;
    font-size: 0.5rem;
    color: rgba(247, 234, 208, 0.4);
    text-align: center;
    font-family: 'Cinzel', serif;
}

.belief-board__ranks {
    position: absolute;
    top: 0;
    bottom: 16px;
    left: 0;
    width: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    font-size: 0.5rem;
    color: rgba(247, 234, 208, 0.4);
    text-align: center;
    font-family: 'Cinzel', serif;
}

/* ── Distribution detail (hover / focus) ── */
.belief-board__detail {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(213, 166, 66, 0.25);
    border-radius: 8px;
}

.belief-board__detail-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.belief-board__detail-sq {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--bb-gold);
}

.belief-board__detail-lbl {
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.45);
}

.belief-board__bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bb-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.58rem;
}

.bb-bar__type {
    width: 52px;
    font-weight: 600;
}

.bb-bar__track {
    flex: 1;
    height: 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.bb-bar__fill {
    display: block;
    height: 100%;
    border-radius: 4px;
}

.bb-bar__pct {
    width: 30px;
    text-align: right;
    color: rgba(247, 234, 208, 0.6);
}

/* ── Legend ── */
.belief-board__legend {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(213, 166, 66, 0.15);
}

.belief-key-toggle {
    padding: 0;
    border: 0;
    margin-left: 10px;
    background: transparent;
    color: rgba(213, 166, 66, 0.72);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color 120ms ease, text-shadow 120ms ease;
}

    .belief-key-toggle:hover {
        color: #e5bd62;
        text-shadow: 0 0 6px rgba(213, 166, 66, 0.35);
    }

    .belief-key-toggle:focus-visible {
        outline: 1px solid rgba(213, 166, 66, 0.8);
        outline-offset: 3px;
        border-radius: 2px;
    }

.belief-board__legend-title {
    font-family: 'Cinzel', serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.5);
    margin-bottom: 6px;
}

.belief-board__legend-hues {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 8px;
}

.bb-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.55rem;
    color: rgba(247, 234, 208, 0.7);
}

.bb-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.belief-board__legend-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 6px;
    font-size: 0.52rem;
    color: rgba(247, 234, 208, 0.55);
}

    .belief-board__legend-notes span {
        display: flex;
        align-items: center;
        gap: 4px;
    }

.bb-note-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d64545;
    display: inline-block;
}

.bb-note-dot--solid {
    opacity: 1;
}

.bb-note-dot--faint {
    opacity: 0.55;
}

.bb-note-ring {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #d64545;
    box-shadow: 0 0 0 2px #000;
    display: inline-block;
}

.belief-board__legend-glyphs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 0.78rem;
    color: rgba(247, 234, 208, 0.6);
}

.bb-lg {
    display: flex;
    align-items: center;
    gap: 3px;
}

    .bb-lg b {
        font-size: 0.6rem;
    }

    .bb-lg .bb-glyph--nailed {
        color: #5fd98a;
        background: none;
        position: static;
        width: auto;
        height: auto;
    }

    .bb-lg .bb-glyph--wrongtype {
        color: #e0c04f;
        background: none;
        position: static;
        width: auto;
        height: auto;
    }

    .bb-lg .bb-glyph--phantom {
        color: #e06a5a;
        background: none;
        position: static;
        width: auto;
        height: auto;
    }

    .bb-lg .bb-glyph--missed {
        color: #e0902e;
        background: none;
        position: static;
        width: auto;
        height: auto;
    }

/* ── Census tray ── */
.belief-board__census {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(213, 166, 66, 0.15);
}

.belief-board__census-title {
    font-family: 'Cinzel', serif;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.5);
    margin-bottom: 6px;
}

.belief-board__census-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bb-census-item {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(213, 166, 66, 0.1);
    border: 1px solid rgba(213, 166, 66, 0.2);
}

.bb-census-glyph {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.6rem;
    color: var(--bb-cream);
}

.bb-census-x {
    font-size: 0.55rem;
    color: rgba(247, 234, 208, 0.6);
}

/* Reduced motion / responsive floor */
@media (prefers-reduced-motion: reduce) {
    .bb-specter, .bb-glyph {
        transition: none;
    }
}

/* ── Board callout ──
   Full-size, unmissable. Lives inside the board container, over the board itself.
   Fires on a real moment (belief change, unlock), then travels to its target
   via the calloutTravel JS. */
.board-callout {
    position: absolute;
    top: 26%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 60;
    text-align: center;
    max-width: 46ch;
    padding: 0.9rem 1.4rem;
    pointer-events: none; /* never blocks a click on the board */
    border: 1px solid rgba(213, 166, 66, 0.35);
    border-radius: 10px;
    backdrop-filter: blur(3px);
    /* Just enough ground to stay readable over pieces and fog */
    background: radial-gradient(ellipse at center, rgba(12, 10, 7, 0.88) 0%, rgba(12, 10, 7, 0.72) 55%, rgba(12, 10, 7, 0) 100%);
    animation: callout-slam 420ms cubic-bezier(0.15, 0.9, 0.2, 1.25) both;
}

.board-callout__headline {
    font-family: 'Cinzel', serif;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: #ffe8a0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 28px rgba(213, 166, 66, 0.45);
}

.board-callout__detail {
    margin-top: 0.45rem;
    font-family: 'Cinzel', serif;
    font-size: 1.36rem;
    color: #d5a642;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.03em;
    color: rgba(247, 234, 208, 0.88);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

    .board-callout__detail strong {
        color: #d5a642;
        font-weight: 700;
    }

/* Entrance only — the exit is the travel animation, applied by JS. */
@keyframes callout-slam {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.72);
    }

    62% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.board-callout--travel {
    animation: board-callout-travel 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes board-callout-travel {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    70% {
        opacity: 0.85;
    }

    100% {
        opacity: 0;
        transform: translate(var(--travel-x), var(--travel-y)) scale(0.34);
    }
}

@media (prefers-reduced-motion: reduce) {
    .board-callout {
        animation: none;
    }

    .board-callout--travel {
        animation: callout-fade 240ms ease both;
    }

    @keyframes callout-fade {
        to {
            opacity: 0;
        }
    }
}

@media (min-width: 1920px) {
    .belief-board {
        width: 377px !important;
        max-width: 377px !important;
        min-width: 377px !important;
    }
}