@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Inter:wght@300;400;600&display=swap');

:root {
    --bg-color: #030305;
    --bg-gradient: radial-gradient(circle at 50% 0%, #1a1a2e, #030305 70%);
    --text-primary: #ffffff;
    --text-muted: #8a8d98;
    --accent-glow: rgba(255, 51, 51, 0.4);
    --accent-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(15, 15, 20, 0.6);
    --glass-blur: blur(24px);
    --gradient-text: linear-gradient(135deg, #ffffff 0%, #888888 100%);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'/%3E%3C/svg%3E") 2 22, auto !important;
}

body {
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100vw;
    min-height: 100vh;
}

a {
    /* Ensure links also get the pen cursor */
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3E%3Cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'/%3E%3C/svg%3E") 2 22, pointer !important;
}

#ambient-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0; 
    pointer-events: none; /* Let cursor pass through to HTML elements */
}

/* Editorial Floating Corners - Now Fixed for Scrolling */
.corner-top-left {
    position: fixed;
    top: 3rem; left: 3rem;
    z-index: 100;
}

.corner-top-right {
    position: fixed;
    top: 3rem; right: 3rem;
    z-index: 100;
    text-align: right;
}

.corner-bottom-left {
    position: fixed;
    bottom: 3rem; left: 3rem;
    z-index: 100;
    max-width: 320px;
}

.corner-bottom-right {
    position: fixed;
    bottom: 3rem; right: 3rem;
    z-index: 100;
    text-align: right;
}

/* Micro-Typography System */
.mono-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #fff;
    text-transform: uppercase;
}



.tagline {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.editorial-body {
    font-size: 0.80rem;
    font-weight: 300;
    line-height: 2;
    color: #a3a3a3;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.editorial-italic {
    font-style: italic;
    color: var(--text-primary);
}

p {
    margin-bottom: 1rem;
}

/* Centerpiece Action */
.center-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
}

.btn-editorial-massive {
    display: inline-block;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--accent-glow);
    padding-bottom: 10px;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.btn-editorial-massive:hover {
    color: #fff;
    border-bottom: 2px solid #fff;
    padding-bottom: 15px;
    letter-spacing: 0.5em;
    text-shadow: 0 0 15px var(--accent-glow);
}

.archive-link {
    display: block;
    margin-top: 40px;
    font-size: 0.70rem;
    color: #555;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.archive-link:hover {
    color: #fff;
    letter-spacing: 0.45em;
    text-shadow: 0 0 10px rgba(255,255,255,0.4);
}

/* New Navigation Elements - Relocated to Corner */
.secondary-nav-header {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.nav-link-subtle {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: #fff; /* High Contrast */
    text-decoration: none;
    transition: all 0.4s ease;
    opacity: 0.6;
}

.nav-link-subtle:hover {
    opacity: 1;
    letter-spacing: 0.4em;
    text-shadow: 0 0 10px var(--accent-glow);
}

.redacted-text {
    animation: flicker 4s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 0.8; }
    45% { opacity: 0.8; }
    50% { opacity: 0.2; }
    55% { opacity: 0.8; }
    80% { opacity: 0.8; }
    82% { opacity: 0.4; }
    85% { opacity: 0.8; }
}

/* Roadmap (The Blueprint) Section */
.blueprint-section {
    position: relative;
    width: 100%;
    padding: 100px 3rem;
    margin-top: 100vh; /* Push below initial view */
    z-index: 5;
    /* Removed solid background to allow ambient lines to flow through */
}

.blueprint-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.phase-item {
    margin-bottom: 30px;
    position: relative;
    padding: 3rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--accent-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.5s ease;
}

.phase-item:hover {
    background: rgba(25, 25, 35, 0.8);
    border-color: rgba(143, 166, 189, 0.5);
    box-shadow: 0 15px 50px rgba(143, 166, 189, 0.2);
    transform: translateY(-5px);
}

.phase-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    color: #cccccc;
    letter-spacing: 0.4em;
    margin-bottom: 10px;
}

.phase-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    margin-bottom: 15px;
}

.phase-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.8;
    text-align: justify;
}

.blueprint-header {
    margin-bottom: 100px;
    text-align: center;
}

/* --- MOBILE RESPONSIVENESS (PWA) --- */
@media screen and (max-width: 800px) {
    body {
        padding-top: 2rem;
        overflow-x: hidden;
    }

    /* Un-fix the corners and stack them for touch-friendly scroll */
    .corner-top-left, .corner-top-right, .corner-bottom-left, .corner-bottom-right {
        position: relative;
        top: auto; left: auto; right: auto; bottom: auto;
        text-align: center;
        margin: 2rem auto;
        max-width: 90%;
        z-index: 10;
    }

    .secondary-nav-header {
        align-items: center;
    }

    /* Move center-action into normal flow instead of absolute centering */
    .center-action {
        position: relative;
        top: auto; left: auto; transform: none;
        margin: 5rem auto;
        padding-bottom: 2rem;
    }

    .blueprint-section {
        margin-top: 2rem;
        padding: 50px 1.5rem;
    }

    .phase-item {
        padding: 1.5rem;
    }

    .logo { font-size: 1.2rem; }
    .btn-editorial-massive { font-size: 0.75rem; letter-spacing: 0.4em; }
}

/* Generative 3D Carousel */
.carousel-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    perspective: 1200px;
    z-index: 10;
    pointer-events: none;
}

.carousel-scene {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.carousel {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

.carousel-item {
    position: absolute;
    top: 0; left: 0;
    width: 300px;
    height: 300px;
    backface-visibility: hidden;
    background: var(--glass-bg);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.1);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    pointer-events: auto;
    cursor: crosshair;
    overflow: hidden;
}

.carousel-item canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: screen;
}

.trait-hud {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur) saturate(150%);
    -webkit-backdrop-filter: var(--glass-blur) saturate(150%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 1.5rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    min-width: 280px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.trait-hud.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.trait-hud-label {
    text-transform: uppercase;
    color: var(--text-muted);
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    margin-bottom: 6px;
}

.trait-hud-value {
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.trait-hud-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-bottom: 15px;
}

.trait-hud-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 12px 0;
}

.trait-hud-statement {
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.65rem;
}

/* --- MOBILE RESPONSIVENESS (OVERRIDE CASCADE) --- */
@media screen and (max-width: 800px) {
    /* Fix Trait HUD for Mobile */
    .trait-hud {
        min-width: 0 !important;
        width: 90vw !important;
        left: 5vw !important;
        top: 50% !important;
        transform: translateY(100px) scale(0.95) !important;
        padding: 1rem !important;
    }
    .trait-hud.active {
        transform: translateY(-50%) scale(1) !important;
    }
    .trait-hud-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Shrink the Generative Carousel and bring into document flow */
    .carousel-wrapper {
        position: relative !important;
        top: auto !important; 
        left: auto !important; 
        transform: none !important;
        margin: 4rem auto !important;
        width: 180px !important;
        height: 180px !important;
    }
    .carousel-item {
        width: 180px !important;
        height: 180px !important;
    }
    }
}

/* Codex Book Layout */
.book-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 10vh 20px;
    position: relative;
    z-index: 10;
}

.book-spread {
    display: flex;
    background: rgba(3, 3, 5, 0.6);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,0.5);
    width: 100%;
    max-width: min(1200px, 130vh);
    aspect-ratio: 1.5;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    container-type: inline-size;
}

.book-spine {
    width: 60px;
    background: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 20%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.8) 100%);
    box-shadow: inset 0 0 20px rgba(0,0,0,1);
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

.book-page {
    flex: 1;
    padding: 4cqi 5.5cqi;
    position: relative;
    display: flex;
    flex-direction: column;
}

.page-left {
    box-shadow: inset -20px 0 30px rgba(0,0,0,0.5);
}

.page-right {
    box-shadow: inset 20px 0 30px rgba(0,0,0,0.5);
}

.chapter-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9cqi;
    font-weight: 800;
    letter-spacing: 0.4em;
    color: #8fa6bd;
    margin-bottom: 1.5cqi;
    text-transform: uppercase;
    text-align: center;
}

.book-heading {
    font-family: 'Outfit', sans-serif;
    font-size: 2.8cqi;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 2cqi;
    text-align: center;
}

.book-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.15cqi;
    line-height: 1.9;
    color: var(--text-muted);
    margin-bottom: 1.5cqi;
    text-align: justify;
}

.book-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.book-text em {
    color: #8fa6bd;
    font-style: italic;
}

.book-quote {
    margin-top: 3rem;
    padding: 2rem;
    border-left: 2px solid #8fa6bd;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-primary);
    background: rgba(165,180,252,0.05);
}

.book-equation {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15cqi;
    color: #8fa6bd;
    text-align: center;
    padding: 1.5cqi;
    margin: 2cqi 0;
    background: rgba(165,180,252,0.05);
    border-left: 2px solid #3730a3;
    border-right: 2px solid #3730a3;
    letter-spacing: 0.1em;
    font-weight: bold;
}

.page-number {
    position: absolute;
    bottom: 3cqi;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9cqi;
    font-weight: 600;
    color: var(--text-muted);
}

.page-left .page-number { left: 4.5cqi; }
.page-right .page-number { right: 4.5cqi; }

@media screen and (max-width: 900px) {
    .book-spread {
        flex-direction: column;
        border-radius: 12px;
        aspect-ratio: auto;
    }
    .book-spine {
        display: none;
    }
    .page-left, .page-right {
        box-shadow: none;
        padding: 3rem 2rem;
    }
    .chapter-title { font-size: 0.8rem; margin-bottom: 1rem; }
    .book-heading { font-size: 2rem; margin-bottom: 1.5rem; }
    .book-text { font-size: 1rem; margin-bottom: 1.2rem; }
    .page-left .page-number, .page-right .page-number {
        position: relative;
        left: 0; right: 0;
        bottom: 0;
        margin-top: 2rem;
        font-size: 0.8rem;
        text-align: center;
    }

    /* Force override inline CQI sizing for mobile readability */
    .page-content h1[style] { font-size: 2.2rem !important; margin-bottom: 2rem !important; }
    .page-content h2[style] { font-size: 1.5rem !important; margin-bottom: 1.5rem !important; }
    .page-content p[style] { font-size: 1rem !important; margin-bottom: 1.2rem !important; line-height: 1.6 !important; }
    .page-content div[style*="font-size"] { font-size: 0.95rem !important; margin-bottom: 0.8rem !important; line-height: 1.4 !important; }
    
    /* Fix Table of Contents Layout on Mobile */
    .page-content ul[style] { font-size: 1rem !important; }
    .page-content li[style] { 
        flex-direction: column !important; 
        align-items: flex-start !important; 
        padding: 0.8rem 0 !important;
        margin-bottom: 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .page-content li[style] span { 
        width: 100% !important; 
        text-align: left !important; 
        font-size: 0.95rem !important; 
        margin-bottom: 0.2rem !important;
    }
    .page-content li[style] span:nth-child(2) {
        font-size: 1.1rem !important;
        color: #fff !important;
    }

    /* Fix #matrix-traits overlay getting cut off on mobile */
    #matrix-traits[style] {
        position: fixed !important;
        top: 50% !important;
        left: 5vw !important;
        width: 90vw !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 10000 !important;
        padding: 1.5rem !important;
    }
    #matrix-traits div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* General Pages Container Fixes */
    .manifest-content, .curators-container, .ascend-container {
        width: 95% !important;
        padding: 1.5rem !important;
        margin-top: 5rem !important;
        box-sizing: border-box !important;
    }
    .manifest-content h2 { font-size: 1.8rem !important; margin-top: 2rem !important; }
    .ascend-header h1 { font-size: 1.5rem !important; }
    .curators-header h1 { font-size: 1.2rem !important; }
}

/* Dynamic Book Engine Styles */
.book-spread {
    transition: opacity 0.3s ease-in-out;
}
.book-spread.fading .page-content {
    opacity: 0;
}
.page-content {
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
}

.book-nav-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}
.zone-left {
    left: 0;
}
.zone-right {
    right: 0;
}
.book-nav-zone:hover {
    background: rgba(165,180,252,0.05);
}
.nav-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    white-space: nowrap;
    position: absolute;
    top: 50%;
    left: 50%;
}
.zone-left .nav-hint {
    transform: translate(-50%, -50%) rotate(-90deg);
}
.zone-right .nav-hint {
    transform: translate(-50%, -50%) rotate(90deg);
}
.book-nav-zone:hover .nav-hint {
    opacity: 1;
    color: #8fa6bd;
}
