@import "normalize.css";
@import "theme.css";

hr {
	width: 100%;
}

#logo {
	z-index: 20;
	align-self: flex-start;
	padding: 0.4rem 1rem;
	color: inherit;
	font-weight: bold;
	/* Override sakura's link styling: normal (white) text, and no underline —
	   which it draws as a border-bottom on hover, not text-decoration. */
	border-bottom: none;

	&:hover {
		color: inherit;
		border-bottom: none;
	}
}

body {
	box-sizing: border-box;
	width: 100%;
	height: 100vh;
	max-width: 100%;
	max-height: 100vh;

	display: flex;
	flex-direction: column;
}

#main {
	display: flex;
	flex-direction: row;
	flex-grow: 1;
	min-height: 0;
	width: 100%;

	#content {
		box-sizing: border-box;
		flex-grow: 1;
		height: 100%;
		overflow: auto;
		border: 1px solid var(--app-border);
		border-right: unset;
		display: flex;
		flex-direction: column;

		#filename {
			padding-left: 1rem;
		}

		pre {
			box-sizing: border-box;
			margin: 0;
			flex-grow: 1;
			overflow: auto;
			max-width: 100%;
			max-height: 100%;
		}

		#mediabox {
			flex-grow: 1;
			display: flex;
			justify-content: center;
			overflow: hidden;
		}
	}

	#sidebar {
		box-sizing: border-box;
		flex-shrink: 0;
		padding: 1rem;
		width: 30rem;
		height: 100%;
		border: 1px solid var(--app-border);
		display: flex;
		flex-direction: column;

		h3 {
			margin-top: 0;
			text-align: center;
		}

		form {
			align-self: center;
		}
	}
}

/* Portrait (taller than wide): stack the sidebar below the content instead of
   beside it. */
@media (orientation: portrait) {
	#main {
		flex-direction: column;

		#content {
			/* The shared divider is now the bottom edge; restore the right border
			   the row layout dropped and drop the bottom one. */
			border-right: 1px solid var(--app-border);
			border-bottom: unset;
		}

		#sidebar {
			width: 100%;
			height: auto;
		}
	}
}

audio {
	max-width: 40rem;
	min-width: 0;
	flex-grow: 1;
	align-self: center;
}

img,
video {
	object-fit: scale-down;
}

#decrypt-overlay {
	position: fixed;
	inset: 0;
	z-index: 10;
	box-sizing: border-box;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background-color: var(--app-bg);
	color: var(--app-fg);
	text-align: center;

	h1 {
		max-width: 100%;
		margin-top: 0;
		/* Shrink the heading on narrow screens and let a long filename wrap
		   instead of overflowing. */
		font-size: clamp(1.5rem, 6vw, 2.5rem);
		overflow-wrap: anywhere;
	}

	/* biome-ignore lint/style/noDescendingSpecificity: targets the overlay form only, disjoint from the #sidebar form rule */
	form {
		display: flex;
		flex-direction: column;
		align-items: center;

		/* The radio group: left-align so the two buttons line up vertically
		   instead of inheriting the overlay's centering. */
		div {
			text-align: left;

			label {
				display: block;
			}
		}
	}
}
