/* ============================================
   ppuzzle.org - Political Puzzle
   Palette: #1a3a52 #0f0f0f #8b7355 #d4af37 #c41e3a #f7f5f2
   Fonts: IBM Plex Serif 600, Inter 400/500, IBM Plex Mono 500
   ============================================ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #f7f5f2;
    color: #0f0f0f;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 800vh;
    position: relative;
}

/* ---- Topology Canvas (Background) ---- */
#topology-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.02;
    transition: opacity 2s ease;
}

body.phase-accumulation #topology-canvas {
    opacity: 0.06;
}

body.phase-interconnection #topology-canvas {
    opacity: 0.15;
}

body.phase-revelation #topology-canvas {
    opacity: 0.25;
}

/* ---- Progress Indicator ---- */
#progress-track {
    position: fixed;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60vh;
    background: rgba(26, 58, 82, 0.12);
    z-index: 100;
    border-radius: 1px;
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: #1a3a52;
    border-radius: 1px;
    transition: height 0.3s ease;
}

/* ---- Main Container ---- */
#container {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ---- Evidence Wall (Left Pane - 65%) ---- */
#evidence-wall {
    width: 65%;
    padding: 15vh 4vw 20vh 5vw;
    position: relative;
}

/* ---- Divider ---- */
#divider {
    width: 1px;
    position: fixed;
    top: 0;
    left: 65%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#divider-line {
    width: 1px;
    height: 80%;
    background: #1a3a52;
    opacity: 0.25;
    animation: divider-pulse 4s ease-in-out infinite;
}

@keyframes divider-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.35; }
}

/* ---- Analysis Chamber (Right Pane - 35%) ---- */
#analysis-chamber {
    width: 35%;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    padding: 12vh 3vw 8vh 2.5vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

/* Archive texture (ruled lines) */
#analysis-chamber::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 11px,
        rgba(212, 175, 55, 0.03) 11px,
        rgba(212, 175, 55, 0.03) 11.5px
    );
    pointer-events: none;
    z-index: 0;
}

#analysis-chamber > * {
    position: relative;
    z-index: 1;
}

/* ---- Default Analysis State ---- */
#analysis-default {
    transition: opacity 0.4s ease;
}

#analysis-default.hidden {
    opacity: 0;
    pointer-events: none;
}

.analysis-headline {
    font-family: 'IBM Plex Serif', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: #1a3a52;
    margin-bottom: 2rem;
}

.analysis-prompt {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    color: #8b7355;
    letter-spacing: 0.02em;
    line-height: 1.6;
}

/* ---- Analysis Panels ---- */
.analysis-panel {
    position: absolute;
    top: 50%;
    left: 2.5vw;
    right: 3vw;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.analysis-panel.active {
    opacity: 1;
    pointer-events: auto;
}

.analysis-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c41e3a;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(196, 30, 58, 0.2);
}

.analysis-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    line-height: 1.7;
    color: #0f0f0f;
    margin-bottom: 2rem;
}

.analysis-data {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-point {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.78rem;
    color: #8b7355;
    padding-left: 1rem;
    position: relative;
    line-height: 1.5;
}

.data-point::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 4px;
    height: 4px;
    background: #d4af37;
    border-radius: 50%;
}

/* ---- Evidence Cards ---- */
.evidence-card {
    background: #f7f5f2;
    border: 1px solid rgba(26, 58, 82, 0.1);
    padding: 3rem 2.5rem;
    margin-bottom: -15%;
    position: relative;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s ease,
                border-color 0.3s ease;
    opacity: 0;
    transform: translateY(40px);
    cursor: default;
}

.evidence-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.evidence-card:hover {
    z-index: 10;
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 8px 40px rgba(26, 58, 82, 0.08),
                inset 0 0 0 1px rgba(212, 175, 55, 0.15);
}

.evidence-card:nth-child(odd) {
    margin-left: 0;
}

.evidence-card:nth-child(even) {
    margin-left: 3vw;
}

.evidence-card:last-child {
    margin-bottom: 0;
}

/* Card Badges */
.card-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 1.2rem;
}

.badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    opacity: 0.2;
}

.badge-circle {
    background: #1a3a52;
    border-radius: 50%;
}

.badge-square {
    background: #c41e3a;
    border-radius: 1px;
}

.badge-pentagon {
    background: #8b7355;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

/* Card Content */
.card-title {
    font-family: 'IBM Plex Serif', serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: #1a3a52;
    margin-bottom: 1rem;
}

.card-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    line-height: 1.7;
    color: #0f0f0f;
    margin-bottom: 1.5rem;
    max-width: 52ch;
}

.card-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8b7355;
    opacity: 0.7;
}

/* Synthesis card special styling */
.card-synthesis {
    border-color: rgba(212, 175, 55, 0.3);
    background: linear-gradient(135deg, #f7f5f2 0%, rgba(212, 175, 55, 0.04) 100%);
}

.card-synthesis .card-title {
    color: #d4af37;
}

/* ---- Synthesis View ---- */
#synthesis-view {
    position: absolute;
    bottom: 8vh;
    left: 2.5vw;
    right: 3vw;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}

#synthesis-view.visible {
    opacity: 1;
}

#synthesis-diagram {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.synthesis-arc {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.2s ease;
}

#synthesis-view.visible .synthesis-arc {
    stroke-dashoffset: 0;
}

.synthesis-node {
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}

#synthesis-view.visible .synthesis-node {
    opacity: 1;
}

.synthesis-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease 0.3s;
}

#synthesis-view.visible .synthesis-line {
    stroke-dashoffset: 0;
}

/* ---- Floating Connectors (via canvas, but CSS fallback lines) ---- */
.connector-line {
    position: fixed;
    height: 1px;
    background: #1a3a52;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 1.2s ease;
    transform-origin: left center;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    #container {
        flex-direction: column;
    }

    #evidence-wall {
        width: 100%;
        padding: 10vh 5vw 10vh 5vw;
    }

    #analysis-chamber {
        width: 100%;
        position: relative;
        height: auto;
        min-height: 60vh;
        padding: 6vh 5vw;
    }

    #divider {
        display: none;
    }

    .evidence-card {
        margin-bottom: 2rem;
    }

    .evidence-card:nth-child(even) {
        margin-left: 0;
    }

    #progress-track {
        display: none;
    }

    .analysis-panel {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        display: none;
    }

    .analysis-panel.active {
        display: block;
    }
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(26, 58, 82, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 58, 82, 0.4);
}

/* ---- Selection ---- */
::selection {
    background: rgba(212, 175, 55, 0.25);
    color: #0f0f0f;
}
