/* --- SYSTEM CONSTANTS --- */
:root {
    --neon-pink: #ff00ff;
    --neon-cyan: #00ffff;
    --dark-bg: #05000a;
    --glass-bg: rgba(5, 0, 10, 0.85);
}

@property --flare-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* --- GLOBAL VIEWPORT & UI --- */
body { 
    margin: 0; 
    width: 100vw;
    height: 100vh; /* Fallback */
    height: 100dvh; /* The Fix: Accounts for mobile browser bars */
    overflow: hidden; 
    background: var(--dark-bg); 
    font-family: 'Courier New', monospace; 
    color: #fff;
    touch-action: none; /* Prevents unwanted bounce/scroll */
}

/* Scrollbar Hardware */
#ui-history::-webkit-scrollbar {
    width: 4px; 
}

#ui-history::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#ui-history::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--neon-cyan), var(--neon-pink));
    border-radius: 2px;
}

#ui-history::-webkit-scrollbar-thumb:hover {
    background: var(--neon-pink);
}

/* --- ENVIRONMENTAL OVERLAYS (Scanlines & Vignette) --- */
body::before {
    content: " ";
    position: fixed; /* Fix: Keeps overlay locked to viewport, not document height */
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 255, 0, 0.06));
    z-index: 100;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
}

body::after {
    content: " ";
    position: fixed; /* Fix: Same for vignette */
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(5, 0, 10, 0.9) 100%);
    z-index: 5;
    pointer-events: none;
}

/* --- NAVIGATION SIDEBAR --- */
.nav-sidebar {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2.5rem;
    pointer-events: auto;
    z-index: 20;
}

.nav-sidebar a {
    color: #fff;
    text-decoration: none;
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.15rem;
    padding: 0.7rem 1.2rem;
    transition: all 0.3s ease;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
}

.nav-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.8rem;
}

.group-label {
    font-size: 0.6rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.3rem;
    opacity: 0.6;
    padding-right: 1.2rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    padding-bottom: 0.3rem;
}

.group-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- LINK LOGIC & STATES --- */
.primary-link { border-right: 3px solid var(--neon-pink); }
.primary-link:hover {
    background: rgba(255, 0, 255, 0.15);
    box-shadow: -5px 0 15px rgba(255, 0, 255, 0.3);
    transform: translateX(-3px);
}

.poc-link { border-right: 1px solid rgba(0, 255, 255, 0.4); opacity: 0.8; }
.poc-link:hover {
    opacity: 1;
    border-right: 3px solid var(--neon-cyan);
    color: var(--neon-cyan);
    background: rgba(0, 255, 255, 0.1);
    transform: translateX(-3px);
}

.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

/* System Heartbeat / Link Status */
#vmk-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.link-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #666;
    transition: all 0.3s ease;
}

#vmk-link:not(.disabled) .link-status-dot {
    background-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
    animation: pulse-heartbeat 1.5s infinite;
}

/* --- MAIN LANDING (HOME) --- */
#ui-home {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    width: 100%;
    max-width: 100vw;
}

#ui-home h1 { 
    font-size: clamp(2.2rem, 10vw, 5rem); 
    margin: 0; 
    letter-spacing: clamp(0.4rem, 4vw, 1.8rem); 
    font-weight: 100; 
    color: #fff;
    text-shadow: -2px -2px 0 var(--neon-cyan), 2px 2px 0 var(--neon-pink), 0 0 20px var(--neon-pink);
    animation: glitch 4s infinite linear alternate-reverse, flicker 1.5s infinite;
}

#ui-home p { 
    font-size: clamp(0.7rem, 2.5vw, 1.1rem); 
    letter-spacing: clamp(0.2rem, 2vw, 0.7rem); 
    text-transform: uppercase; 
    margin-top: 1.5rem; 
    color: var(--neon-cyan);
    font-weight: 900;
    text-shadow: 0 0 12px var(--neon-cyan), 0 0 2px #000;
}

.coming-soon {
    font-size: clamp(0.5rem, 2vw, 0.8rem); 
    margin-top: 3rem !important; 
    opacity: 0.6;
    color: #aaa; /* Dimmed grey by default */
    text-shadow: none;
    transition: all 0.4s ease;
}

/* --- HISTORY & TIMELINE VIEW --- */
#ui-history {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 80vh;
    overflow-y: auto;
    padding-bottom: 2rem;
    direction: rtl; 
}

#ui-history > * {
    direction: ltr; 
}

#ui-history h1 { 
    font-size: clamp(2.2rem, 5vw, 3.5rem); 
    margin: 0 0 1rem 0; 
    letter-spacing: 0.5rem;
    font-weight: 100; 
    color: #fff;
    text-shadow: -2px -2px 0 var(--neon-cyan), 2px 2px 0 var(--neon-pink), 0 0 20px var(--neon-pink);
}

.timeline-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4rem;
    align-items: center;
    padding: 2rem 0;
    position: relative;
    border: none;
}

/* --- DATA MODULES (EVENTS / STACKS) --- */
.event, .stack-bar {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: rgba(5, 0, 10, 0.65); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem;
    border: 1px solid rgba(0, 255, 255, 0.2);
    transition: all 0.3s ease;
}

/* Frame Corner Logic */
.event::before, .event::after, .stack-bar::before, .stack-bar::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.event::before, .event::after { border: 2px solid var(--neon-pink); }
.stack-bar::before, .stack-bar::after { border: 2px solid var(--neon-cyan); }

.event::before, .stack-bar::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.event::after, .stack-bar::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.event:hover, .stack-bar:hover {
    background: rgba(5, 0, 10, 0.85);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.15);
}

.event-meta {
    background: var(--neon-cyan);
    color: #000;
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 1rem;
}

.event-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    letter-spacing: 0.1rem;
    color: #fff;
}

.event-description {
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin: 1rem 0 2rem 0;
    padding-left: 1rem;
    border-left: 1px solid var(--neon-pink);
}

/* --- MEDIA HANDLING --- */
.screenshot {
    position: relative;
    z-index: 101; 
    width: 100%;
    background: #000;
    border: 1px solid rgba(255, 0, 255, 0.2);
}

.screenshot img {
    width: 100%;
    height: auto;
    object-fit: contain;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    display: block;
    cursor: zoom-in;
}

.event:hover .screenshot img { opacity: 1; }

/* Lightbox / Zoom Overlay */
#image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 200; 
    display: none;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

#image-overlay.active { display: flex; }

#image-overlay img {
    max-width: 90%;
    max-height: 90%;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.3);
}

/* --- ACTIVE TECH STACK --- */
.stack-bar {
    margin: 1rem 0 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
    box-sizing: border-box;
}

.stack-label {
    font-size: 0.6rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.3rem;
    opacity: 0.6;
    margin-bottom: 0.8rem;
}

.stack-logos { 
    display: flex; 
    gap: 1.5rem; 
    align-items: center; 
    justify-content: center;
    flex-wrap: wrap;
}

.stack-logo-item { font-size: 0.8rem; opacity: 0.7; text-transform: uppercase; }

/* --- SYSTEM FOOTER & COMM-LINKS --- */
.system-footer {
    position: fixed; /* Fixed to keep pinned above browser UI */
    bottom: 2rem;
    left: 2rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    z-index: 20;
}

.system-footer a {
    position: relative;
    color: var(--neon-cyan);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 15px;
    display: inline-block;
    background: var(--glass-bg);
}

/* Orbiting Flare Effect */
.system-footer a::after {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px; 
    background: conic-gradient(from var(--flare-angle), 
                var(--neon-cyan) 0%, 
                transparent 10%, 
                transparent 90%, 
                var(--neon-cyan) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: flare-orbit 4s linear infinite;
    pointer-events: none;
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.system-footer a:hover {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.system-footer a:hover::after {
    background: conic-gradient(from var(--flare-angle), 
                var(--neon-pink) 0%, 
                transparent 10%, 
                transparent 90%, 
                var(--neon-pink) 100%);
    filter: drop-shadow(0 0 5px var(--neon-pink));
}

/* Logic Suppression */
.status-indicator { display: none; }
#ui-history ~ .system-footer { display: none; }

/* --- ANIMATION DEFINITIONS --- */
@keyframes flare-orbit {
    from { --flare-angle: 0deg; }
    to { --flare-angle: 360deg; }
}

@keyframes pulse-heartbeat {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes flicker {
    0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% { opacity: 0.99; }
    20%, 21.999%, 63%, 63.999%, 65%, 69.999% { opacity: 0.4; }
}

@keyframes glitch {
    0% { transform: skew(0deg); }
    2% { transform: skew(3deg); }
    4% { transform: skew(-3deg); }
    100% { transform: skew(0deg); }
}

/* --- MOBILE NAVIGATION (FIXED LIFT) --- */
@media (max-width: 1100px) {
	.nav-toggle-container {
		position: fixed;
		bottom: 4rem; 
		right: 2rem;
		z-index: 1100;
	}

	.nav-toggle {
		background: var(--glass-bg);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		color: #fff;
		border: none;
		border-right: 3px solid var(--neon-pink);
		padding: 0.8rem 1.4rem;
		font-family: 'Courier New', monospace;
		text-transform: uppercase;
		letter-spacing: 0.15rem;
		cursor: pointer;
		font-size: 0.8rem;
		transition: all 0.3s ease;
		box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	}

	/* Sidebar Wrapper */
	.nav-sidebar {
		position: fixed;
		top: 0; 
		left: 0;
		right: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		justify-content: flex-end; 
		padding: 0 2rem 9rem 0; 
		gap: 1.5rem;
		z-index: 1000;
		pointer-events: none;
		transition: opacity 0.4s ease;
		opacity: 0;
	}

	/* The "Darkglass/Blue" Overlay Layer */
	.nav-sidebar::before {
		content: "";
		position: absolute;
		inset: 0;
		background: radial-gradient(circle at bottom right, rgba(5, 10, 30, 0.85) 0%, rgba(5, 0, 10, 0.6) 100%);
		backdrop-filter: blur(8px);
		-webkit-backdrop-filter: blur(8px);
		z-index: -1;
		opacity: 0;
		transition: opacity 0.4s ease;
	}

	.nav-sidebar.active {
		opacity: 1;
		pointer-events: auto;
	}

	.nav-sidebar.active::before {
		opacity: 1;
	}

	/* Tight Link Spacing */
	.nav-sidebar a {
		background: rgba(5, 0, 10, 0.4); 
		border-right: 3px solid var(--neon-pink);
		padding: 0.6rem 1rem;
		font-size: 0.75rem;
		transform: translateX(10px);
		transition: transform 0.3s ease;
	}

	.nav-sidebar.active a {
		transform: translateX(0);
	}

	.nav-group {
		align-items: flex-end;
		width: auto;
		margin-bottom: 0;
	}

	.group-label {
		padding-right: 1rem;
		margin: 0 0 0.5rem 0;
		border-bottom: 1px solid rgba(0, 255, 255, 0.2);
		width: fit-content;
		text-shadow: 0 0 5px var(--neon-cyan);
	}

	body.nav-open {
		overflow: hidden;
	}
}

/* Desktop Visibility */
@media (min-width: 1101px) {
	.nav-toggle-container { display: none; }
}