/* ==========================================================================
   1. GLOBAL VARIABLES & BASE STYLES
   ========================================================================== */
:root {
    --bg-color: #0a0908;
    --text-primary: #e5e5e0;
    --accent-gold: #d4af37;
    --accent-pink: #f9a8d4;
    --accent-blue: #38bdf8;
    --accent-indigo: #6366f1;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image: radial-gradient(circle at 60% 0%, #1c1917 0%, #0a0908 60%);
    background-attachment: fixed;
}

.font-serif { font-family: 'Playfair Display', serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ==========================================================================
   2. UTILITIES & HELPER CLASSES
   ========================================================================== */

/* Glassmorphism */
.glass-panel {
    background: rgba(20, 18, 15, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Horizontal Scroll Utilities (Hide Scrollbars) */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Soft Fade Mask for Horizontal Menus */
.mask-right-fade {
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

/* ==========================================================================
   3. MOBILE MENU COMPONENTS (Compact Update V2)
   ========================================================================== */

.mobile-menu-link {
    display: inline-block;
    flex-shrink: 0; /* Prevents text from squishing */
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; /* Compact size */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0; /* Removed tracking to save horizontal space */
    color: #9ca3af; /* gray-400 */
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 10px 0; /* Vertical tap target */
}

.mobile-menu-link:hover {
    color: white;
}

.mobile-menu-link.highlight {
    color: #d97706; /* amber-600 */
}
.mobile-menu-link.highlight:hover {
    color: #f59e0b; /* amber-500 */
}

/* ==========================================================================
   4. HOME PAGE COMPONENTS
   ========================================================================== */

/* Work Cards */
.work-card {
    position: relative; overflow: hidden; background-color: #0a0908;
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); z-index: 1;
}
.work-card::before {
    content: ''; position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: 0.3; filter: grayscale(100%) brightness(0.7) contrast(1.1);
    transform: scale(1.0); transition: all 0.8s ease; z-index: -2;
}
.work-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, rgba(0,0,0,0.4) 100%);
    opacity: 1; z-index: -1;
}
.work-card:hover, .work-card.active-state {
    border-color: rgba(212, 175, 55, 0.6); transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}
.work-card:hover::before, .work-card.active-state::before {
    opacity: 0.8; filter: grayscale(0%) brightness(1); transform: scale(1.1);
}

/* Background Images for Work Cards */
.bg-strategy::before { background-image: url('../img/work-strategy.jpg'); }
.bg-policy::before { background-image: url('../img/work-policy.jpg'); }
.bg-rabbit::before { background-image: url('../img/work-rabbit.jpg'); }
.bg-intuition::before { background-image: url('../img/work-intuition.jpg'); }
.bg-library::before { background-image: url('../img/work-library.jpg'); }

/* Generic Hover Card Utility */
.hover-card { transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.hover-card:hover {
    transform: translateY(-4px); border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 20px 40px -15px rgba(0,0,0,0.8);
}

/* Profile Avatar Frame */
.profile-frame {
    position: relative; overflow: hidden; border-radius: 50%;
    transition: all 0.5s ease; box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}
.profile-frame img { filter: contrast(1.1); transition: all 0.7s ease; }
.profile-frame:hover img { transform: scale(1.05); }
.profile-frame:hover { box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.5); }

/* Hero Large Portrait */
.hero-portrait {
    position: relative; overflow: hidden; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.hero-portrait img { filter: grayscale(20%) contrast(1.1); transition: all 0.7s ease; }
.hero-portrait:hover img { filter: grayscale(0%); transform: scale(1.02); }

/* Gallery & Overlays */
.gallery-container { position: relative; overflow: hidden; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.1); }
.gallery-img {
    width: 100%; height: 100%; object-fit: cover; object-position: center 25%;
    filter: contrast(1.1) brightness(0.9); transition: all 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 10;
}
.gallery-container:hover .gallery-img { filter: contrast(1.1) brightness(1.1); transform: scale(1.03); }
.gallery-container:hover { border-color: rgba(212, 175, 55, 0.4); }
.gallery-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    z-index: 30;
    display: flex; flex-direction: column; justify-content: flex-end; padding: 1.5rem; opacity: 1;
}

/* ==========================================================================
   5. ANIMATIONS (GLOBAL)
   ========================================================================== */

/* Fade In Up */
.fade-in-up { opacity: 0; transform: translateY(20px); animation: fadeInUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }

/* Canvas/Heart Diagram Animations */
#canvas-container { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 4px; cursor: grab; }
#canvas-container:active { cursor: grabbing; }

.flow-down { stroke-dasharray: 8; animation: flowDown 3s linear infinite; }
.flow-up { stroke-dasharray: 8; animation: flowUp 3s linear infinite; }
.flow-out { stroke-dasharray: 12; animation: flowOut 4s linear infinite; }
.heart-pulse { animation: heartbeat 3s ease-in-out infinite; }

@keyframes flowDown { to { stroke-dashoffset: -16; } }
@keyframes flowUp { to { stroke-dashoffset: 16; } }
@keyframes flowOut { to { stroke-dashoffset: -24; } }
@keyframes heartbeat {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(249, 168, 212, 0)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 15px rgba(249, 168, 212, 0.5)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(249, 168, 212, 0)); }
}

/* 404 Glitch Effect */
.glitch {
    animation: glitch 1s linear infinite;
}

@keyframes glitch {
    2%, 64% { transform: translate(2px,0) skew(0deg); }
    4%, 60% { transform: translate(-2px,0) skew(0deg); }
    62% { transform: translate(0,0) skew(5deg); }
}

/* ==========================================================================
   6. ABOUT PAGE SPECIFIC STYLES
   ========================================================================== */

/* Compass Cards */
.compass-card {
    position: relative; overflow: hidden;
    background: rgba(20, 18, 15, 0.4);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); z-index: 1;
}
.compass-card::before {
    content: ''; position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: 0.3; filter: grayscale(100%) brightness(0.7) contrast(1.1);
    transform: scale(1.0); transition: all 0.8s ease; z-index: -2;
}
.compass-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, rgba(0,0,0,0.6) 100%);
    opacity: 1; z-index: -1;
}
.compass-card:hover, .compass-card.active-state {
    border-color: rgba(212, 175, 55, 0.6); transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}
.compass-card:hover::before, .compass-card.active-state::before {
    opacity: 0.8; filter: grayscale(0%) brightness(1); transform: scale(1.1);
}

/* Compass Background Images */
.bg-tribe::before { background-image: url('../img/tribe-family.jpg'); }
.bg-god::before { background-image: url('../img/god-nature.jpg'); }
.bg-frontier::before { background-image: url('../img/frontier-hike.jpg'); }
.bg-iron::before { background-image: url('../img/iron-gym.jpg'); }
.bg-archives::before { background-image: url('../img/archives-books.jpg'); }
.bg-craft::before { background-image: url('../img/craft-work.jpg'); }

.hub-card {
    background: linear-gradient(145deg, rgba(20, 18, 15, 0.9), rgba(40, 30, 10, 0.6));
    border: 1px solid rgba(212, 175, 55, 0.3);
}

/* Dossier Card */
.dossier-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 2px solid var(--accent-gold);
    transition: background 0.3s ease;
}
.dossier-card:hover { background: rgba(255, 255, 255, 0.06); }

/* Slideshow Styles */
.slide {
    position: absolute; inset: 0; opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 10s ease;
    transform: scale(1.0);
    pointer-events: none;
}
.slide.active {
    opacity: 1; transform: scale(1.05); z-index: 10;
}
.slide img {
    width: 100%; height: 100%; object-fit: cover;
    filter: contrast(1.1) brightness(0.9) grayscale(20%);
}

.slider-nav-btn {
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1); color: white;
    padding: 12px; border-radius: 50%;
    transition: all 0.3s ease; cursor: pointer;
}
.slider-nav-btn:hover {
    background: var(--accent-gold); color: black; border-color: var(--accent-gold);
}

/* ==========================================================================
   7. LIBRARY PAGE SPECIFIC STYLES
   ========================================================================== */

/* Grid Layout */
.codex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Book Cards */
.book-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    opacity: 0; /* Hidden initially for fade in */
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.book-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.book-cover {
    height: 140px;
    width: 100%;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    filter: grayscale(100%);
    transition: all 0.5s ease;
}

.book-card:hover .book-cover img {
    opacity: 1;
    filter: grayscale(0%);
}

.book-meta {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Search Input */
.search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

/* Modal (Detail View) */
#bookModal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#bookModal.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#bookModal.open .modal-content {
    transform: translateY(0);
}

/* ==========================================================================
   8. REMOTE VIEWING PAGE SPECIFIC STYLES
   ========================================================================== */

/* RV Hero Section */
.rv-hero-section {
    position: relative;
    height: 55vh;
    max-height: 700px;
    min-height: 350px;
    width: 100%;
    overflow: hidden;
}

.rv-hero-bg {
    position: absolute; inset: 0;
    /* Note: Path relative to the CSS file location */
    background-image: url('../img/mystic-perception.jpg');
    background-size: cover;
    background-position: center 25%;
    filter: grayscale(100%) contrast(1.1) brightness(0.6);
    transition: all 1s ease;
}

.rv-hero-section:hover .rv-hero-bg {
    filter: grayscale(80%) contrast(1.1) brightness(0.7);
}

.rv-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(10,9,8,0.3) 0%, rgba(10,9,8,1) 100%);
}

/* Case Cards */
.case-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}
.case-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
}

.evidence-img {
    width: 100%; height: 100%; object-fit: cover;
    transition: all 0.5s ease;
}
.case-card:hover .evidence-img {
    transform: scale(1.02);
}

/* Light Cone Background Effect */
.light-cone-bg {
    background-image:
        linear-gradient(to bottom right, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        linear-gradient(to top left, rgba(212, 175, 55, 0.05) 0%, transparent 40%);
}
