body {
    background-color: orange;
    margin: 0;
    padding: 0.4em;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;   /* mobile: ignores the collapsing URL bar; older browsers keep the vh line */
    display: flex;
    flex-direction: column;
}

div.header {
    border-radius: 10px;
    border:1px solid #262018;
    margin:0.4em;
    padding:1em;
    background: #fffdfa;
	 text-align: center;
	 flex: 0 0 auto; /* stays it's natural height */
}

div.content {
    border-radius: 10px;
    border:1px solid #262018;
    margin:0.4em;
    padding:2em;
    background: #fffdfa;
	 flex: 1 0 auto; /* grows to fill the rest, never srinks below its content */
	 min-width: 0; /* keeps wide <pre>/code blocks from stretching the page sideways */
}

div.footer {
    flex: 0 0 auto;       /* natural height, like the header */
    border-radius: 10px;
    border: 1px solid #262018;
    margin: 0.4em;
    padding: 1em;
    background: #fffdfa;
	 text-align: right;
}

.file-item:hover {
    transform: scale(1.15);
}

.directory-grid {
    list-style: none;
}

@supports (display: grid) and (display: flex) {

	.directory-grid {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 20px;
		padding: 20px;
		margin: 0;
	}

	.file-item {
		display: flex;
		justify-content: center;
		margin-bottom: 1.5em;
	}

	.file-item a {
		display: flex;
		flex-direction: column;
		align-items: center;
		text-decoration: none;
		color:inherit;
		width: 100%;
		display: flex;
	}

	.file-icon {
		width: 64px;
		height: 104px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #eee;
		border: 1px solid #ccc;
		border-radius: 4px;
		margin-bottom: 8px;
		font-size: 0.8rem;
		font-weight: bold;
		border-radius: 4px;
		visibility: visible;
	}

	.icon-img {
		/*width: 64px;
		#height: 104px;*/
		width: 100%;
		height: 100%;
		object-fit: contain;
		border: 1px solid #ccc;
		margin-bottom: 8px;
		border-radius: 4px;
	}

 	.file-name {
		font-size: 0.9rem;
		overflow-wrap: anywhere;
		max-width: 100%;
		text-align: center;
	}

}

@media screen and (max-width: 600px) {
    .directory-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
	margin: 0;
    }

    .file-name {
        font-size: 14px;
        overflow-wrap: anywhere;
    }
    
}
