/* ============================================================================
   CDARS HOUSING
   BROWN JURISDICTION (#7B4A1E) · INFRASTRUCTURE & HABITAT ARCHITECTURE
   GROUNDED · STABLE · WEIGHT-BEARING · SOLID
   ============================================================================ */

:root {
    /* Housing Identity - Brown */
    --housing-brown: #7B4A1E;
    --housing-brown-dim: rgba(123, 74, 30, 0.15);
    --housing-brown-glow: rgba(123, 74, 30, 0.25);
    --housing-brown-soft: rgba(123, 74, 30, 0.05);
    --housing-gold: #FFD700;
    --housing-steel: #2A2F38;
    
    /* GATE FOUNDATION */
    --void: #05070c;
    --void-deep: #03040a;
    --abyss: #020308;
    
    /* Surface Layers */
    --panel: rgba(12, 16, 24, 0.85);
    --panel-deep: rgba(8, 12, 20, 0.95);
    --panel-edge: rgba(255, 255, 255, 0.08);
    --panel-edge-housing: rgba(123, 74, 30, 0.15);
    
    /* Typography */
    --text-primary: rgba(255, 255, 255, 0.98);
    --text-secondary: rgba(255, 255, 255, 0.82);
    --text-tertiary: rgba(255, 255, 255, 0.62);
    
    /* Spacing - Solid, grounded */
    --radius-large: 28px;
    --radius-medium: 18px;
    --radius-small: 10px;
    --radius-pill: 999px;
    
    /* Shadows */
    --shadow-cosmic: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    --shadow-housing: 0 0 40px rgba(123, 74, 30, 0.2);
    
    /* Transitions - Slower, grounded */
    --curve-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --curve-breathe: cubic-bezier(0.87, 0, 0.13, 1);
    --curve-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --curve-grounded: cubic-bezier(0.25, 0.1, 0.25, 1);
    
    /* Mouse position */
    --mouse-x: 50%;
    --mouse-y: 50%;
    
    /* Card index */
    --card-index: 0;
    
    /* Grounded rhythm - slower than other domains */
    --grounded-beat: 4s;
}

/* ============================================================================
   REALM BASE
   ============================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    background: var(--void-deep);
    color: var(--text-primary);
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background: var(--void-deep);
    opacity: 0;
    animation: reality-manifest 1.2s var(--curve-smooth) forwards;
    line-height: 1.6;
    padding-bottom: 50px;
    position: relative;
    overflow-x: hidden;
    font-weight: 400;
}

@keyframes reality-manifest {
    0% { opacity: 0; filter: blur(10px); }
    100% { opacity: 1; filter: blur(0); }
}

/* ============================================================================
   QUANTUM REALITY LAYER - EARTH VERSION
   ============================================================================ */
.quantum-reality-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.reality-thread {
    position: fixed;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
    will-change: transform, opacity;
    opacity: 0.3;
    filter: blur(1.2px) brightness(1.1);
    box-shadow: 0 0 20px currentColor;
}

.quantum-particle {
    position: fixed;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--housing-brown);
    filter: blur(2.5px);
    animation: particle-drift linear infinite;
    pointer-events: none;
    z-index: 4;
    opacity: 0.25;
    mix-blend-mode: screen;
}

@keyframes particle-drift {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(100vw, 100vh) rotate(360deg); }
}

/* ============================================================================
   MAIN CONTAINER
   ============================================================================ */
.wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* ============================================================================
   TOPBAR NAVIGATION
   ============================================================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 0.8rem 1.5rem;
    background: rgba(10, 14, 22, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-pill);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 100;
    position: relative;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.sigil {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.sigil::after {
    content: '';
    position: absolute;
    inset: -40%;
    background: 
        radial-gradient(6px 6px at 18% 30%, rgba(255,255,255,0.45), transparent 55%),
        radial-gradient(3px 3px at 65% 65%, rgba(255,255,255,0.30), transparent 55%);
    opacity: 0.8;
    animation: sigilSpin 18s linear infinite;
}

@keyframes sigilSpin {
    to { transform: rotate(360deg); }
}

.brand h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #fff, var(--housing-brown), var(--housing-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.sub {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.presence-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-pill);
    border: 1px solid var(--housing-brown);
    flex-shrink: 0;
}

.presence-pulse {
    width: 8px;
    height: 8px;
    background: #50ffb4;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.presence-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.nav-item {
    padding: 0.6rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s var(--curve-grounded);
    white-space: nowrap;
}

.nav-item:hover {
    border-color: var(--housing-brown);
    background: var(--housing-brown-dim);
    transform: translateY(-1px);
}

.user-badge {
    background: var(--housing-brown-dim);
    border: 1px solid var(--housing-brown);
    color: var(--housing-brown);
    padding: 0.3rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.executive-badge {
    background: var(--housing-gold);
    border: 1px solid var(--housing-gold);
    color: #000;
    padding: 0.3rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* ============================================================================
   JOURNEY PATH - FIXED POSITION
   ============================================================================ */
.journey-path {
    position: fixed;
    top: 100px;
    left: 20px;
    z-index: 9998;
    background: var(--panel-deep);
    border: 1px solid var(--housing-brown);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 20px var(--housing-brown-glow);
    animation: journey-appear 0.5s var(--curve-spring);
    pointer-events: none;
    max-width: 80%;
    overflow-x: auto;
    white-space: nowrap;
}

.journey-path::-webkit-scrollbar {
    display: none;
}

.journey-icon {
    color: var(--housing-brown);
    font-size: 1rem;
    flex-shrink: 0;
}

.journey-steps {
    display: flex;
    gap: 5px;
    color: var(--text-secondary);
}

.journey-step {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.journey-step.active {
    color: var(--housing-brown);
    font-weight: 700;
}

.journey-step::after {
    content: '→';
    margin-left: 5px;
    color: var(--text-tertiary);
}

.journey-step:last-child::after {
    display: none;
}

@keyframes journey-appear {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================================================
   TERRITORIAL MARKER - GROUNDED SYMBOL
   ============================================================================ */
.territorial-marker {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-base {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    opacity: 0.8;
    transform: rotate(45deg);
    animation: marker-grounded 4s ease-in-out infinite;
    z-index: 3;
}

.marker-grid {
    position: absolute;
    width: 100px;
    height: 100px;
    background-image: 
        linear-gradient(to right, var(--housing-brown) 1px, transparent 1px),
        linear-gradient(to bottom, var(--housing-brown) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.2;
    animation: grid-pulse 4s ease-in-out infinite;
}

@keyframes marker-grounded {
    0%, 100% { transform: rotate(45deg) scale(1); opacity: 0.8; }
    50% { transform: rotate(45deg) scale(1.03); opacity: 1; }
}

@keyframes grid-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.3; }
}

/* ============================================================================
   HERO SECTION
   ============================================================================ */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    margin-bottom: 4rem;
    align-items: center;
}

.hero-left {
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--curve-grounded);
    animation: housing-breathe 6s var(--curve-grounded) infinite;
    --card-index: 1;
}

.hero-left:hover {
    border-color: var(--housing-brown);
    box-shadow: var(--shadow-housing);
    transform: translateY(-1px) scale(1.001);
    animation-play-state: paused;
}

.hero-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/domains/housing/housing-hero.webp') center/cover no-repeat;
    opacity: 0.1;
    z-index: 0;
}

.hero-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                var(--housing-brown-glow), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hero-left:hover::after {
    opacity: 0.15;
}

.hero-left > * {
    position: relative;
    z-index: 2;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--housing-brown-dim);
    border: 1px solid rgba(123, 74, 30, 0.3);
    border-radius: var(--radius-pill);
    color: var(--housing-brown);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--housing-brown);
    box-shadow: 0 0 15px var(--housing-brown);
}

.title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--housing-brown);
}

.desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 600px;
    font-weight: 400;
}

.desc strong {
    color: var(--housing-brown);
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--housing-brown);
    text-shadow: 0 0 20px var(--housing-brown-glow);
    animation: stat-grounded 3s ease-in-out infinite;
}

@keyframes stat-grounded {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.01); }
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-right {
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    transition: all 0.3s var(--curve-grounded);
    animation: housing-breathe 6s var(--curve-grounded) infinite;
    animation-delay: 0.3s;
    --card-index: 2;
}

.hero-right:hover {
    border-color: var(--housing-brown);
    box-shadow: var(--shadow-housing);
    transform: translateY(-1px) scale(1.001);
    animation-play-state: paused;
}

.seal {
    aspect-ratio: 1/1;
    background: url('/assets/domains/housing/housing-seal.webp') center/contain no-repeat;
    opacity: 0.9;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.seal:hover {
    opacity: 1;
    transform: scale(1.01);
    filter: drop-shadow(0 0 20px var(--housing-brown));
}

.seal-meta {
    display: grid;
    gap: 0.8rem;
}

.meta-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-tertiary);
    font-weight: 400;
}

.meta-line span:last-child {
    color: var(--housing-brown);
    font-weight: 600;
}

/* ============================================================================
   LEGENDARY CROWN
   ============================================================================ */
.legendary-crown {
    margin: 2rem 0 3rem;
    padding: 2rem 0 1.5rem;
    background: var(--panel-deep);
    border-top: 2px solid var(--panel-edge-housing);
    border-bottom: 2px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    position: relative;
    overflow: visible;
    z-index: 50;
}

.crown-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 50% 50%, var(--housing-brown-dim), transparent 70%);
    opacity: 0.3;
    pointer-events: none;
    animation: crown-pulse 8s ease-in-out infinite;
}

@keyframes crown-pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

.crown-header {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--housing-brown);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 1.2rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.2em;
    white-space: nowrap;
    box-shadow: 0 0 20px var(--housing-brown);
    z-index: 55;
}

.crown-track-container {
    position: relative;
    overflow: visible;
    padding: 0 2rem;
}

.crown-gradient-left,
.crown-gradient-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    pointer-events: none;
    z-index: 52;
}

.crown-gradient-left {
    left: 0;
    background: linear-gradient(90deg, var(--panel-deep), transparent);
}

.crown-gradient-right {
    right: 0;
    background: linear-gradient(-90deg, var(--panel-deep), transparent);
}

.crown-track {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0.5rem 2rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--housing-brown) var(--panel-edge);
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 51;
}

.crown-track::-webkit-scrollbar {
    height: 4px;
}

.crown-track::-webkit-scrollbar-track {
    background: var(--panel-edge);
    border-radius: 10px;
}

.crown-track::-webkit-scrollbar-thumb {
    background: var(--housing-brown);
    border-radius: 10px;
}

/* Crown Jewel Styles */
.crown-jewel {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.5s var(--curve-grounded);
    filter: drop-shadow(0 0 10px var(--jewel-color));
    z-index: 53;
}

.crown-jewel::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: var(--jewel-color);
    opacity: 0;
    transition: opacity 0.4s ease;
    filter: blur(15px);
    z-index: -1;
}

.crown-jewel:hover::before {
    opacity: 0.5;
}

.crown-jewel:hover {
    transform: scale(1.15) translateY(-8px);
    z-index: 200;
}

.crown-jewel.active {
    transform: scale(1.1);
    filter: drop-shadow(0 0 25px var(--jewel-color));
    animation: housing-crown-pulse 4s var(--curve-grounded) infinite;
}

@keyframes housing-crown-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 20px var(--jewel-color));
    }
    50% {
        filter: drop-shadow(0 0 30px var(--jewel-color));
    }
}

.crown-jewel.active::after {
    content: '✦';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--jewel-color);
    font-size: 1.2rem;
    animation: housing-star 3s ease-in-out infinite;
    text-shadow: 0 0 15px currentColor;
}

@keyframes housing-star {
    0%, 100% { 
        opacity: 0.7; 
        transform: translateX(-50%) scale(1);
    }
    50% { 
        opacity: 1; 
        transform: translateX(-50%) scale(1.2);
    }
}

.jewel-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--jewel-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    box-shadow: 0 0 30px var(--jewel-color), 
                inset 0 0 20px rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.jewel-face::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, 
                rgba(255, 255, 255, 0.9), 
                transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.crown-jewel:hover .jewel-face::after {
    opacity: 0.6;
}

.jewel-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s var(--curve-grounded);
    line-height: 1;
}

.crown-jewel:hover .jewel-icon {
    transform: scale(1.1);
}

.jewel-name {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #000;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1.2;
    max-width: 70px;
}

/* Jewel index delays */
.crown-jewel:nth-child(1) { --jewel-index: 1; }
.crown-jewel:nth-child(2) { --jewel-index: 2; }
.crown-jewel:nth-child(3) { --jewel-index: 3; }
.crown-jewel:nth-child(4) { --jewel-index: 4; }
.crown-jewel:nth-child(5) { --jewel-index: 5; }
.crown-jewel:nth-child(6) { --jewel-index: 6; }
.crown-jewel:nth-child(7) { --jewel-index: 7; }
.crown-jewel:nth-child(8) { --jewel-index: 8; }
.crown-jewel:nth-child(9) { --jewel-index: 9; }
.crown-jewel:nth-child(10) { --jewel-index: 10; }
.crown-jewel:nth-child(11) { --jewel-index: 11; }
.crown-jewel:nth-child(12) { --jewel-index: 12; }

.crown-jewel {
    animation: housing-jewel-enter 0.6s var(--curve-grounded) backwards;
    animation-delay: calc(0.1s * var(--jewel-index));
}

@keyframes housing-jewel-enter {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   CROWN HOVER PORTAL
   ============================================================================ */
.crown-hover-portal {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crown-hover-portal.visible {
    opacity: 1;
}

.hover-card {
    background: var(--panel-deep);
    border: 2px solid var(--hover-color);
    border-radius: var(--radius-large);
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 
                0 0 40px var(--hover-color);
    backdrop-filter: blur(12px);
    width: 280px;
    transform-origin: center;
    animation: housing-hover-appear 0.4s var(--curve-grounded);
    position: relative;
}

@keyframes housing-hover-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hover-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--panel-deep);
    border-right: 2px solid var(--hover-color);
    border-bottom: 2px solid var(--hover-color);
}

.hover-arrow.above {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.hover-arrow.below {
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(225deg);
}

.hover-title {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--hover-color);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Cinzel', serif;
}

.hover-domain {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hover-meaning {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-style: italic;
}

.hover-preview {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.8rem;
}

.hover-preview span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.hover-preview i {
    color: var(--hover-color);
    font-size: 1rem;
}

/* ============================================================================
   EXECUTIVE CHAMBERS SECTION
   ============================================================================ */
.executive-chambers {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--panel-deep);
    border: 2px solid var(--housing-gold);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
}

.executive-chambers::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, var(--housing-gold)10, transparent 70%);
    pointer-events: none;
}

.chambers-header {
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.chambers-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.chambers-desc {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chambers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.chamber-card {
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--housing-gold);
    border-radius: var(--radius-medium);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--curve-grounded);
    position: relative;
    overflow: hidden;
}

.chamber-card:hover {
    transform: translateY(-2px);
    border-color: var(--housing-brown);
    box-shadow: 0 0 30px var(--housing-gold);
}

.chamber-number {
    font-size: 1rem;
    color: var(--housing-gold);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.chamber-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.chamber-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* ============================================================================
   SEARCH SYSTEM
   ============================================================================ */
.search-section {
    margin: 2rem 0 3rem;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--housing-brown);
    font-size: 1.2rem;
    opacity: 0.7;
    pointer-events: none;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    background: var(--panel-deep);
    border: 2px solid var(--panel-edge-housing);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: all 0.3s var(--curve-grounded);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
    font-weight: 500;
}

.search-input:focus {
    outline: none;
    border-color: var(--housing-brown);
    box-shadow: 0 0 0 4px var(--housing-brown-dim), 0 0 40px var(--housing-brown-glow);
    transform: scale(1.001);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-size: 1rem;
    font-style: italic;
}

.search-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.search-filter {
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--curve-grounded);
}

.search-filter:hover {
    border-color: var(--housing-brown);
    background: var(--housing-brown-dim);
    color: #fff;
}

.search-filter.active {
    background: var(--housing-brown);
    border-color: var(--housing-brown);
    color: #000;
    font-weight: 700;
}

.search-results-count {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
    border-top: 1px solid var(--panel-edge-housing);
    color: var(--housing-brown);
}

.search-results {
    margin-top: 2rem;
    max-height: 500px;
    overflow-y: auto;
    background: var(--panel);
    border-radius: var(--radius-large);
    padding: 1.5rem;
    border: 1px solid var(--panel-edge-housing);
}

.result-group {
    margin-bottom: 1.5rem;
}

.result-group h4 {
    color: var(--housing-brown);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-item:hover {
    background: var(--housing-brown-dim);
    transform: translateX(5px);
}

.result-type {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    background: var(--housing-brown);
    color: #000;
    border-radius: 4px;
    text-transform: uppercase;
}

.result-title {
    color: var(--text-primary);
    font-weight: 500;
}

.result-more {
    padding: 0.5rem;
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 3rem;
}

.no-results-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.no-results h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-tertiary);
}

/* ============================================================================
   COLOR MEANING PANEL
   ============================================================================ */
.color-meaning {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
    animation: housing-breathe 6s var(--curve-grounded) infinite;
    animation-delay: 0.4s;
    --card-index: 3;
}

.color-meaning:hover {
    animation-play-state: paused;
    border-color: var(--housing-brown);
    transform: scale(1.001);
}

@keyframes housing-breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.003);
        box-shadow: 0 8px 24px var(--housing-brown-dim);
    }
}

.meaning-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.meaning-color {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--housing-brown);
    box-shadow: 0 0 30px var(--housing-brown);
}

.meaning-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--housing-brown);
}

.meaning-text {
    position: relative;
    z-index: 2;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 800px;
    font-weight: 400;
}

.meaning-text strong {
    color: var(--housing-brown);
}

/* ============================================================================
   PORTALS GRID
   ============================================================================ */
.portals-section {
    margin: 4rem 0;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.portals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.portal-card {
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s var(--curve-grounded);
    position: relative;
    overflow: hidden;
    min-height: 250px;
    animation: housing-breathe 6s var(--curve-grounded) infinite;
    animation-delay: calc(var(--card-index) * 0.1s);
}

.portal-card:nth-child(1) { --card-index: 1; }
.portal-card:nth-child(2) { --card-index: 2; }
.portal-card:nth-child(3) { --card-index: 3; }
.portal-card:nth-child(4) { --card-index: 4; }
.portal-card:nth-child(5) { --card-index: 5; }
.portal-card:nth-child(6) { --card-index: 6; }
.portal-card:nth-child(7) { --card-index: 7; }
.portal-card:nth-child(8) { --card-index: 8; }
.portal-card:nth-child(9) { --card-index: 9; }
.portal-card:nth-child(10) { --card-index: 10; }
.portal-card:nth-child(11) { --card-index: 11; }
.portal-card:nth-child(12) { --card-index: 12; }

.portal-card:hover {
    transform: translateY(-2px) scale(1.003);
    border-color: var(--housing-brown);
    box-shadow: var(--shadow-housing);
    animation-play-state: paused;
}

.portal-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                var(--housing-brown-glow), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.portal-card:hover::after {
    opacity: 0.15;
}

.portal-number {
    font-size: 1rem;
    color: var(--housing-brown);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.portal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.portal-desc {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.portal-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
    font-weight: 500;
}

.portal-meta span:last-child {
    color: var(--housing-brown);
    font-weight: 700;
}

/* ============================================================================
   PORTAL DETAIL PANEL
   ============================================================================ */
.portal-detail-panel {
    display: none;
    margin-top: 2rem;
    animation: slide-up 0.5s var(--curve-smooth);
}

.portal-detail-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.back-button {
    padding: 0.6rem 1.2rem;
    background: var(--housing-brown-dim);
    border: 1px solid var(--housing-brown);
    border-radius: var(--radius-pill);
    color: var(--housing-brown);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s var(--curve-grounded);
}

.back-button:hover {
    background: var(--housing-brown);
    color: #000;
    transform: translateX(-3px);
}

.panel-title {
    font-size: 2rem;
    font-family: 'Cinzel', serif;
    color: var(--housing-brown);
}

.portal-detail-content {
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-housing);
    border-radius: var(--radius-large);
    padding: 2rem;
}

/* ============================================================================
   PRESENCE BUBBLES
   ============================================================================ */
.presence-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.presence-bubble {
    background: var(--panel-deep);
    border: 1px solid var(--housing-brown);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 20px var(--housing-brown-glow);
    animation: bubble-appear 0.3s var(--curve-spring);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s var(--curve-grounded);
    position: relative;
}

.presence-bubble:hover {
    transform: scale(1.01) translateX(-2px);
    border-color: var(--housing-gold);
    box-shadow: 0 0 30px var(--housing-gold);
}

.presence-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #000;
    box-shadow: 0 0 15px currentColor;
}

.presence-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.presence-location {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.presence-role {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--panel-deep);
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    border: 1px solid currentColor;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.presence-bubble:hover .presence-role {
    opacity: 1;
}

@keyframes bubble-appear {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================================================
   3D CARDS
   ============================================================================ */
.portal-card {
    transition: transform 0.6s var(--curve-3d);
    transform-style: preserve-3d;
    position: relative;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: inherit;
    padding: 2rem;
    background: inherit;
    border: inherit;
    box-shadow: inherit;
    top: 0;
    left: 0;
}

.card-back {
    transform: rotateY(180deg);
    background: var(--panel-deep);
    border-color: var(--housing-brown);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-back h4 {
    color: var(--housing-brown);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.card-back p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-back .btn {
    background: var(--housing-brown-dim);
    border: 1px solid var(--housing-brown);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    color: var(--housing-brown);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.card-back .btn:hover {
    background: var(--housing-brown);
    color: #000;
}

.portal-card.flipped {
    transform: rotateY(180deg);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(123, 74, 30, 0.2);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.housing-declaration {
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 400;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1000px) {
    .hero {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .brand {
        justify-content: center;
    }
    
    .presence-indicator {
        justify-content: center;
    }
    
    .nav {
        justify-content: center;
    }
    
    .chambers-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .wrap { padding: 1rem; }
    .title { font-size: 2rem; }
    .stats { flex-direction: column; gap: 1rem; }
    .meaning-header { flex-direction: column; text-align: center; }
    
    .search-filters {
        flex-direction: column;
        align-items: center;
    }
    
    .search-filter {
        width: 100%;
        max-width: 300px;
    }
    
    .crown-jewel {
        width: 70px;
        height: 70px;
    }
    
    .jewel-icon {
        font-size: 1.8rem;
    }
    
    .jewel-name {
        font-size: 0.65rem;
    }
    
    .hover-card {
        width: 240px;
        padding: 1.2rem;
    }
    
    .journey-path {
        top: auto;
        bottom: 20px;
        left: 20px;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .crown-jewel {
        width: 60px;
        height: 60px;
    }
    
    .jewel-icon {
        font-size: 1.5rem;
    }
    
    .jewel-name {
        font-size: 0.6rem;
    }
    
    .hover-card {
        width: 200px;
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    
    .quantum-reality-layer {
        display: none;
    }
}