/* political-ancestors.css
   Styles for the Political Ancestors gallery page
   Extends core.css design system
*/

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */

.ancestors-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.helix-strand {
    position: absolute;
    width: 300%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 48%,
        rgba(6, 255, 165, 0.03) 50%,
        transparent 52%,
        transparent 100%
    );
    animation: helixFloat 30s ease-in-out infinite;
}

.strand-1 {
    top: -50%;
    left: -100%;
    transform: rotate(-15deg);
}

.strand-2 {
    bottom: -50%;
    right: -100%;
    transform: rotate(15deg);
    animation-delay: -15s;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 48%,
        rgba(230, 57, 70, 0.02) 50%,
        transparent 52%,
        transparent 100%
    );
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

@keyframes helixFloat {
    0%, 100% { transform: rotate(-15deg) translateX(0); }
    50% { transform: rotate(-15deg) translateX(5%); }
}

/* ============================================
   HERO SECTION
   ============================================ */

.ancestors-hero {
    padding: var(--space-20) 0 var(--space-12);
    text-align: center;
    position: relative;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-6);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-4);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--gray-400);
    max-width: 600px;
    margin: 0 auto var(--space-8);
    line-height: 1.6;
}

/* ============================================
   SEARCH BAR
   ============================================ */

.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    width: 20px;
    height: 20px;
    color: var(--gray-500);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--space-4) var(--space-12);
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--white);
    transition: all var(--transition-base);
}

.search-input::placeholder {
    color: var(--gray-600);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(6, 255, 165, 0.1);
}

.search-clear {
    position: absolute;
    right: var(--space-4);
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-clear:hover {
    background: var(--surface-2);
    color: var(--white);
}

.search-clear svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.ancestors-main {
    padding-bottom: var(--space-20);
}

/* ============================================
   FILTER BAR
   ============================================ */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.filter-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-weight: 600;
}

.filter-group {
    position: relative;
}

.filter-dropdown-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-glass);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--gray-300);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 36px;
}

.filter-dropdown-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-accent);
}

.filter-dropdown-btn.active {
    border-color: var(--accent-green);
    color: var(--white);
}

.filter-dropdown-btn .chevron {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.filter-dropdown-btn[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.filter-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: 0;
    min-width: 180px;
    background: var(--gray-900);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xl);
}

.filter-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--gray-300);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-option:hover {
    background: var(--surface-1);
}

.filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-green);
}

/* View Options */
.view-options {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sort-select {
    padding: var(--space-2) var(--space-4);
    background: var(--surface-glass);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--gray-300);
    cursor: pointer;
    min-height: 36px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-green);
}

.view-toggle {
    display: flex;
    background: var(--surface-glass);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--gray-300);
}

.view-btn.active {
    background: var(--surface-2);
    color: var(--accent-green);
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   ACTIVE FILTERS & RESULTS INFO
   ============================================ */

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    min-height: 32px;
}

.active-filters:empty {
    display: none;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: rgba(6, 255, 165, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    color: var(--accent-green);
}

.filter-tag button {
    width: 16px;
    height: 16px;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.7;
}

.filter-tag button:hover {
    opacity: 1;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.user-match-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-match-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
}

/* ============================================
   FIGURES GRID
   ============================================ */

.figures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

.figures-grid.list-view {
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

/* Figure Card */
.figure-card {
    position: relative;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
}

.figure-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--dna-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.figure-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.figure-card:hover::before {
    opacity: 1;
}

.figure-card:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* Portrait */
.card-portrait {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-4);
    position: relative;
}

.portrait-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-default);
    overflow: hidden;
    transition: border-color var(--transition-base);
}

.figure-card:hover .portrait-circle {
    border-color: var(--accent-green);
}

.portrait-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait-initials {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-500);
}

/* Card Content */
.card-content {
    text-align: center;
}

.card-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-1);
}

.card-years {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-bottom: var(--space-3);
}

.card-bio {
    font-size: var(--text-sm);
    color: var(--gray-400);
    line-height: 1.5;
    margin-bottom: var(--space-4);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Archetype Badge */
.card-archetype {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    background: var(--surface-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-300);
    margin-bottom: var(--space-3);
}

/* Family color coding */
.card-archetype.family-libertarian { 
    border-color: rgba(6, 255, 165, 0.3); 
    color: #06ffa5; 
}
.card-archetype.family-conservative { 
    border-color: rgba(59, 130, 246, 0.3); 
    color: #3b82f6; 
}
.card-archetype.family-progressive { 
    border-color: rgba(168, 85, 247, 0.3); 
    color: #a855f7; 
}
.card-archetype.family-socialist { 
    border-color: rgba(239, 68, 68, 0.3); 
    color: #ef4444; 
}
.card-archetype.family-authoritarian { 
    border-color: rgba(107, 114, 128, 0.3); 
    color: #9ca3af; 
}
.card-archetype.family-centrist { 
    border-color: rgba(251, 191, 36, 0.3); 
    color: #fbbf24; 
}
.card-archetype.family-nationalist { 
    border-color: rgba(249, 115, 22, 0.3); 
    color: #f97316; 
}

/* Family-colored portrait circles */
.portrait-circle.family-libertarian {
    background: linear-gradient(135deg, rgba(6, 255, 165, 0.15) 0%, rgba(6, 255, 165, 0.05) 100%);
    border-color: rgba(6, 255, 165, 0.4);
}
.portrait-circle.family-libertarian .portrait-initials { color: #06ffa5; }

.portrait-circle.family-conservative {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.4);
}
.portrait-circle.family-conservative .portrait-initials { color: #3b82f6; }

.portrait-circle.family-progressive {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-color: rgba(168, 85, 247, 0.4);
}
.portrait-circle.family-progressive .portrait-initials { color: #a855f7; }

.portrait-circle.family-socialist {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.4);
}
.portrait-circle.family-socialist .portrait-initials { color: #ef4444; }

.portrait-circle.family-authoritarian {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(107, 114, 128, 0.05) 100%);
    border-color: rgba(107, 114, 128, 0.4);
}
.portrait-circle.family-authoritarian .portrait-initials { color: #9ca3af; }

.portrait-circle.family-centrist {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.05) 100%);
    border-color: rgba(251, 191, 36, 0.4);
}
.portrait-circle.family-centrist .portrait-initials { color: #fbbf24; }

.portrait-circle.family-nationalist {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
    border-color: rgba(249, 115, 22, 0.4);
}
.portrait-circle.family-nationalist .portrait-initials { color: #f97316; }

.portrait-circle.family-communitarian {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0.05) 100%);
    border-color: rgba(234, 179, 8, 0.4);
}
.portrait-circle.family-communitarian .portrait-initials { color: #eab308; }

/* Modal portrait with family colors */
.modal-portrait-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    border: 3px solid var(--border-default);
    transition: all var(--transition-base);
}

.modal-portrait-circle .portrait-initials {
    font-size: var(--text-4xl);
    font-weight: 800;
}

.modal-portrait-circle.family-libertarian {
    background: linear-gradient(135deg, rgba(6, 255, 165, 0.2) 0%, rgba(6, 255, 165, 0.05) 100%);
    border-color: #06ffa5;
}
.modal-portrait-circle.family-libertarian .portrait-initials { color: #06ffa5; }

.modal-portrait-circle.family-conservative {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: #3b82f6;
}
.modal-portrait-circle.family-conservative .portrait-initials { color: #3b82f6; }

.modal-portrait-circle.family-progressive {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-color: #a855f7;
}
.modal-portrait-circle.family-progressive .portrait-initials { color: #a855f7; }

.modal-portrait-circle.family-socialist {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: #ef4444;
}
.modal-portrait-circle.family-socialist .portrait-initials { color: #ef4444; }

.modal-portrait-circle.family-authoritarian {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.2) 0%, rgba(107, 114, 128, 0.05) 100%);
    border-color: #6b7280;
}
.modal-portrait-circle.family-authoritarian .portrait-initials { color: #9ca3af; }

.modal-portrait-circle.family-centrist {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.05) 100%);
    border-color: #fbbf24;
}
.modal-portrait-circle.family-centrist .portrait-initials { color: #fbbf24; }

.modal-portrait-circle.family-nationalist {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.05) 100%);
    border-color: #f97316;
}
.modal-portrait-circle.family-nationalist .portrait-initials { color: #f97316; }

.modal-portrait-circle.family-communitarian {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2) 0%, rgba(234, 179, 8, 0.05) 100%);
    border-color: #eab308;
}
.modal-portrait-circle.family-communitarian .portrait-initials { color: #eab308; }

/* Match Score (if user has results) */
.card-match {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-3);
}

.match-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.match-value {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--accent-green);
}

.match-value.high { color: #06ffa5; }
.match-value.medium { color: #fbbf24; }
.match-value.low { color: #ef4444; }

/* Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1);
    margin-top: var(--space-3);
}

.tag {
    padding: 2px var(--space-2);
    background: var(--surface-glass);
    border-radius: var(--radius-sm);
    font-size: 10px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   LIST VIEW STYLES
   ============================================ */

.figures-grid.list-view .figure-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
}

.figures-grid.list-view .card-portrait {
    width: 60px;
    height: 60px;
    margin: 0;
    flex-shrink: 0;
}

.figures-grid.list-view .portrait-initials {
    font-size: var(--text-lg);
}

.figures-grid.list-view .card-content {
    text-align: left;
    flex: 1;
}

.figures-grid.list-view .card-bio {
    -webkit-line-clamp: 1;
    margin-bottom: 0;
}

.figures-grid.list-view .card-archetype {
    margin-bottom: 0;
}

.figures-grid.list-view .card-match {
    border-top: none;
    border-left: 1px solid var(--border-subtle);
    margin-top: 0;
    padding-top: 0;
    padding-left: var(--space-4);
    margin-left: var(--space-4);
    flex-direction: column;
}

.figures-grid.list-view .card-tags {
    display: none;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-4);
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
    color: var(--gray-600);
}

.empty-state h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: var(--space-6);
}

/* ============================================
   LOAD MORE
   ============================================ */

.load-more-container {
    text-align: center;
    margin-top: var(--space-8);
}

#load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

#load-more-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: var(--gray-900);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-overlay.open .modal-container {
    transform: scale(1) translateY(0);
}

.modal-close {
    width: 40px;
    height: 40px;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--white);
    border-color: var(--border-accent);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-content {
    padding: var(--space-6);
    padding-top: 0;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.figure-portrait {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.portrait-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border-default);
    overflow: hidden;
}

.portrait-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#modal-initials {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--gray-500);
}

/* Modal portrait family colors */
.portrait-placeholder.family-libertarian {
    background: linear-gradient(135deg, rgba(6, 255, 165, 0.2) 0%, rgba(6, 255, 165, 0.05) 100%);
    border-color: #06ffa5;
}
.portrait-placeholder.family-libertarian #modal-initials { color: #06ffa5; }

.portrait-placeholder.family-conservative {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: #3b82f6;
}
.portrait-placeholder.family-conservative #modal-initials { color: #3b82f6; }

.portrait-placeholder.family-progressive {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-color: #a855f7;
}
.portrait-placeholder.family-progressive #modal-initials { color: #a855f7; }

.portrait-placeholder.family-socialist {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: #ef4444;
}
.portrait-placeholder.family-socialist #modal-initials { color: #ef4444; }

.portrait-placeholder.family-authoritarian {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.2) 0%, rgba(107, 114, 128, 0.05) 100%);
    border-color: #6b7280;
}
.portrait-placeholder.family-authoritarian #modal-initials { color: #9ca3af; }

.portrait-placeholder.family-centrist {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.05) 100%);
    border-color: #fbbf24;
}
.portrait-placeholder.family-centrist #modal-initials { color: #fbbf24; }

.portrait-placeholder.family-nationalist {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.05) 100%);
    border-color: #f97316;
}
.portrait-placeholder.family-nationalist #modal-initials { color: #f97316; }

.portrait-placeholder.family-communitarian {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2) 0%, rgba(234, 179, 8, 0.05) 100%);
    border-color: #eab308;
}
.portrait-placeholder.family-communitarian #modal-initials { color: #eab308; }

.portrait-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-red)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.figure-identity {
    flex: 1;
}

.figure-name {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-1);
}

.figure-years {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: var(--space-3);
}

.figure-archetype-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    background: var(--surface-1);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-green);
}

/* Modal Match Score */
.modal-match-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6);
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.match-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.match-ring svg {
    transform: rotate(-90deg);
}

.match-bg {
    fill: none;
    stroke: var(--gray-800);
    stroke-width: 8;
}

.match-progress {
    fill: none;
    stroke: url(#matchGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease-out;
}

.match-ring .match-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--white);
}

.modal-match-score .match-label {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--gray-400);
}

/* Pre-Quiz Match CTA */
.modal-match-cta {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-5);
    background: linear-gradient(135deg, rgba(6, 255, 165, 0.08) 0%, rgba(6, 255, 165, 0.02) 100%);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.modal-match-cta.hidden {
    display: none;
}

.match-cta-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.match-cta-ring svg {
    transform: rotate(-90deg);
}

.match-cta-dashed {
    fill: none;
    stroke: var(--accent-green);
    stroke-width: 4;
    stroke-dasharray: 8 8;
    opacity: 0.5;
    transform-origin: center;
    animation: rotateDash 20s linear infinite;
}

@keyframes rotateDash {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.match-cta-ring svg {
    overflow: visible;
}

.match-cta-ring .match-cta-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--accent-green);
}

.match-cta-content {
    flex: 1;
}

.match-cta-text {
    font-size: var(--text-base);
    color: var(--gray-300);
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.match-cta-text span {
    color: var(--white);
    font-weight: 600;
}

.match-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* Modal Sections */
.modal-section {
    margin-bottom: var(--space-6);
}

.section-heading {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}

.bio-content {
    color: var(--gray-300);
    line-height: 1.7;
}

.bio-content p {
    margin-bottom: var(--space-4);
}

/* Dimensions Grid */
.dimensions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.dimension-item {
    background: var(--surface-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.dimension-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.dimension-name {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dimension-value {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--white);
}

.dimension-bar {
    height: 6px;
    background: var(--gray-800);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.dimension-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
}

.dimension-fill.liberty { background: var(--accent-green); }
.dimension-fill.markets { background: #3b82f6; }
.dimension-fill.global { background: #a855f7; }
.dimension-fill.progress { background: #f97316; }

/* Positions List */
.positions-list {
    list-style: none;
}

.positions-list li {
    position: relative;
    padding-left: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--gray-300);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.positions-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-green);
    font-weight: bold;
}

/* Quotes */
.quotes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.quote-item {
    position: relative;
    padding: var(--space-4);
    background: var(--surface-glass);
    border-left: 3px solid var(--accent-green);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.quote-text {
    font-style: italic;
    color: var(--gray-300);
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.quote-source {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

/* Related Figures */
.related-figures {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.related-figure {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--gray-300);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.related-figure:hover {
    background: var(--surface-1);
    border-color: var(--border-accent);
    color: var(--white);
}

/* ============================================
   ENHANCED MODAL SECTIONS (Bio, Rationale, Tensions, Sources)
   ============================================ */

/* Modal Navigation Arrows */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: var(--gray-900);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.open .modal-nav {
    opacity: 1;
    visibility: visible;
}

.modal-nav:hover {
    background: var(--accent-green);
}

.modal-nav:hover svg path {
    stroke: var(--gray-900);
}

.modal-nav svg {
    width: 24px;
    height: 24px;
}

.modal-nav svg path {
    stroke: var(--accent-green);
    stroke-width: 2.5;
}

.modal-nav-prev {
    left: var(--space-4);
}

.modal-nav-next {
    right: var(--space-4);
}

/* Modal Top Bar */
.modal-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-glass);
}

.modal-position {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.modal-top-bar .modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
}

.modal-top-bar .modal-close:hover {
    background: var(--surface-1);
    color: var(--white);
}

.modal-top-bar .modal-close svg {
    width: 18px;
    height: 18px;
}

/* Full Bio with Expand/Collapse */
.full-bio-container {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border-subtle);
}

.full-bio p {
    margin-bottom: var(--space-4);
    color: var(--gray-300);
    line-height: 1.7;
}

.full-bio p:last-child {
    margin-bottom: 0;
}

.bio-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-glass);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-green);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.bio-toggle:hover {
    background: var(--surface-1);
    border-color: var(--border-accent);
}

.bio-toggle .toggle-chevron {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.bio-toggle.expanded .toggle-chevron {
    transform: rotate(180deg);
}

/* Dimension Rationale */
.dimension-item.has-rationale {
    padding-bottom: var(--space-4);
}

.dimension-rationale {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-subtle);
    font-size: var(--text-xs);
    color: var(--gray-400);
    line-height: 1.6;
}

/* Section Subtitle */
.section-subtitle {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: calc(-1 * var(--space-2));
    margin-bottom: var(--space-4);
    font-style: italic;
}

/* Tensions List */
.tensions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.tensions-list li {
    position: relative;
    padding: var(--space-3) var(--space-4);
    padding-left: var(--space-5);
    background: var(--surface-glass);
    border-left: 3px solid var(--accent-orange, #f97316);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--gray-300);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.tensions-list li::before {
    content: '⚡';
    position: absolute;
    left: var(--space-3);
    top: var(--space-3);
    font-size: var(--text-xs);
    opacity: 0.7;
}

/* Sources List */
.sources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sources-list li {
    position: relative;
    padding-left: var(--space-5);
    font-size: var(--text-sm);
    color: var(--gray-400);
    font-style: italic;
    line-height: 1.5;
}

.sources-list li::before {
    content: '📄';
    position: absolute;
    left: 0;
    font-size: var(--text-xs);
    font-style: normal;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: var(--space-3);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-6);
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.modal-actions svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   FLOATING CTA
   ============================================ */

.floating-cta {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-sticky);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.floating-cta.visible {
    opacity: 1;
    visibility: visible;
}

.floating-cta .cta-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--gray-900);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl);
}

.floating-cta .cta-text {
    font-size: var(--text-sm);
    color: var(--gray-300);
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    .ancestors-hero {
        padding: var(--space-16) 0 var(--space-8);
    }
    
    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-section {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: var(--space-2);
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-section::-webkit-scrollbar {
        display: none;
    }
    
    .view-options {
        justify-content: space-between;
    }
    
    .figures-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: var(--space-4);
    }
    
    .modal-header {
        flex-direction: column;
        text-align: center;
    }
    
    .figure-identity {
        text-align: center;
    }
    
    .dimensions-grid {
        grid-template-columns: 1fr;
    }
    
    .dimension-rationale {
        font-size: var(--text-xs);
    }
    
    .tensions-list li {
        padding: var(--space-3);
        padding-left: var(--space-4);
    }
    
    .tensions-list li::before {
        display: none;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    /* Match CTA mobile styles */
    .modal-match-cta {
        flex-direction: column;
        text-align: center;
        padding: var(--space-4);
    }
    
    .match-cta-ring {
        width: 64px;
        height: 64px;
    }
    
    .match-cta-content {
        text-align: center;
    }
    
    .match-cta-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Hide side nav arrows on mobile - use swipe instead */
    .modal-nav {
        display: none;
    }
    
    .modal-top-bar {
        padding: var(--space-2) var(--space-3);
    }
    
    .floating-cta .cta-content {
        flex-direction: column;
        gap: var(--space-2);
        border-radius: var(--radius-lg);
    }
}

@media (max-width: 480px) {
    .filter-dropdown-btn span {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .figures-grid {
        grid-template-columns: 1fr;
    }
    
    .figure-card {
        padding: var(--space-4);
    }
    
    .card-portrait {
        width: 64px;
        height: 64px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.figure-card {
    animation: cardFadeIn 0.4s ease-out forwards;
    opacity: 0;
}

.figure-card:nth-child(1) { animation-delay: 0.05s; }
.figure-card:nth-child(2) { animation-delay: 0.1s; }
.figure-card:nth-child(3) { animation-delay: 0.15s; }
.figure-card:nth-child(4) { animation-delay: 0.2s; }
.figure-card:nth-child(5) { animation-delay: 0.25s; }
.figure-card:nth-child(6) { animation-delay: 0.3s; }
.figure-card:nth-child(7) { animation-delay: 0.35s; }
.figure-card:nth-child(8) { animation-delay: 0.4s; }
.figure-card:nth-child(9) { animation-delay: 0.45s; }
.figure-card:nth-child(10) { animation-delay: 0.5s; }
.figure-card:nth-child(11) { animation-delay: 0.55s; }
.figure-card:nth-child(12) { animation-delay: 0.6s; }