@font-face {
    font-family: 'HYWenHei';
    src: url('HYWenHei-85W.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
	font-family: Helvetica;
	font-weight: normal;
	font-style: normal;
	src: local("Helvetica");
}

html {
	font-family: 'HYWenHei', Arial;
	font-size: 18px;
	color: #ffffff;
	background-color: #1b1d24;
}

body {
	margin: 0;
}

body > * {
	padding-left: 20px;
	padding-right: 20px;
}

audio {
	max-width: 300px;
	min-width: 260px;
}

nav {
	position: fixed;
	top: 20px;
    right: 20px;
	display: flex;
    padding: 10px;
    border-radius: 5px;
	background-color: #000000B3;
	transition: top 0.3s;
	z-index: 999;
}

nav a {
	font-weight: bold;
	color: #deb76c;
    text-decoration: none;
    margin: 0 5px;
}

nav a:hover {
	text-decoration: underline;
}

nav > span {
	margin: 0 10px;
}

.section-text {
	width: 100%;
	font-weight: bold;
	overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

header {
	display: flex;
	justify-content: center;
	padding-top: 20px;
	margin-bottom: 20px;
	font-size: 32px;
	font-weight: bold;
}

.image-container {
	display: flex;
	justify-content: center;
	align-items: center;
	max-height: 600px;
	overflow: hidden;
}

.image-container img {
    max-width: 100%;
    max-height: 600px;
    height: auto;
	margin: 0 10px;
	opacity: 1;
	transition: opacity 500ms ease-in-out;
}

section > span {
	display: inline-block;
	margin-top: 40px;
	margin-bottom: 20px;
	font-size: 24px;
	font-weight: bold;
}

section > div {
	font-family: Arial;
	display: grid;
	grid-template-columns: 16rem 319px 1fr;
	border-bottom: 1px solid #dddddd;
	border-right: 1px solid #dddddd;
}

section > div > div {
	padding: 8px;
	border-top: 1px solid #dddddd;
	border-left: 1px solid #dddddd;
}

section > div > div img{
	width: fit-content;
	max-height: fit-content;
	margin-right: 2.5px;
}

.head {
	font-weight: bold;
	color: #ffffff;
	background-color: #deb76c;
}

.title {
	color: #ffffff;
}

.audio {
	min-height: 56px;
	flex-wrap: wrap;
	gap: 4px;
}

.title,
.audio {
	display: flex;
	align-items: center;
}

.details {
	align-content: center;
}

.odd {
	background-color: #1b1d24;
}

.even {
	background-color: #2c2f38;
}

.title.odd {
	background-color: #404356;
}

.title.even {
	background-color: #51556a;
}

hr {
	width: 100%;
	height: 1px;
	border: 0;
	background-color: #ffffff;
	margin: 4.5px 0;
}

.title:has(hr) {
	display: flex;
	flex-direction: column;
	align-items: unset;
	justify-content: center;
}

.title:has(hr) span {
	display: flex;
	align-items: center;
}

div:has(.chibi) {
	position: relative;
}

.chibi {
	position: absolute;
	height: 100px;
	right: 0;
	top: -71.27px;
}

.title .chibi {
	display: none;
}

.story-chibi {
	top: -62.39px;
}
.combat-chibi {
	top: -63.83px;
}

#combat {
	margin-bottom: 20px;
}

footer {
	padding-top: 26px;
	margin: 32px 0 16px;
	text-align: center;
}

.info {
	font-style: italic;
	color:#d3d3d3;
}

.title:has(.info) {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
}

/*
header span {
	padding: 0 18.5px;
	background: red;
}
*/

.grid-r-2 {
	grid-row: span 2;
}

.grid-r-3 {
	grid-row: span 3;
}

.grid-c-2 {
	grid-column: span 2;
}

.grid-c-3 {
	grid-column: span 3;
}

@media (pointer: coarse) {
	body {
		-webkit-tap-highlight-color: transparent;
	}
	nav a:hover {
		text-decoration: unset;
	}
	nav a:active {
		text-decoration: underline;
	}
}

@media (pointer: fine) and (max-width: 1268px) {
	.audio-3 audio:last-of-type,
	.audio-5 audio:last-of-type,
	.audio-7 audio:last-of-type {
		width: 604px;
		max-width: 604px;
	}
}

@media (pointer: coarse) and (max-width: 1253px) {
	.audio-3 audio:last-of-type,
	.audio-5 audio:last-of-type,
	.audio-7 audio:last-of-type {
		width: 604px;
		max-width: 604px;
	}
}

@media (max-width: 965px) {
	nav {
		position: sticky;
		top: 18px;
		justify-content: space-evenly;
        transform: translateY(-18px);
		padding: 10px 0;
		border-radius: unset;
		background-color: #000000;
		border-bottom: 1px solid #dddddd;
	}
	nav a {
		margin: 0px;
	}
    nav > div {
        display: grid;
        grid-template-columns: fit-content(100%) 1fr fit-content(100%);
        justify-items: center;
    }
	nav > span {
		margin: unset;
		align-content: center;
	}
	.image-container img {
		max-height: calc(600px - 45px);
	}
	section > div {
		grid-template-columns: 1fr;
	}
	.head {
		display: none;
	}
	.audio {
		background-color: #1b1d24;
	}
	.details {
		background-color: #2c2f38;
	}
	.title {
		align-items: unset;
		font-weight: bold;
	}
	.title.odd,
	.title.even {
		background-color: #deb76c;
	}
	.title .chibi {
		display: unset;
	}
	.title br {
		display: none;
	}
	.grid-r-2,
	.grid-r-3 {
		grid-row: unset;
	}
	.grid-c-2,
	.grid-c-3 {
		grid-column: unset;
	}
}

@media (pointer: coarse) and (max-width: 965px) {
	body {
		-webkit-tap-highlight-color: transparent;
	}
	nav {
		display: grid;
		grid-template-columns: 1fr fit-content(100%) 1fr fit-content(100%) 1fr fit-content(100%) 1fr;
		height: 41px;
		padding: 0;
	}
	nav a {
		width: 100%;
		margin: 0;
		text-align: center;
		align-content: center;
		transition: background-color 0.3s;
	}
	nav a:active {
		text-decoration: unset;
		background-color: #dddddd;
	}
    nav > div {
        grid-template-columns: 1fr 1fr 1fr;
    }
	.section-text,
	nav > a > span {
		margin: 0 5px;
		text-align: center;
		align-content: center;
	}
}

@media (max-width: 768px) {
	body > *:not(nav) {
		padding-left: 10px;
		padding-right: 10px;
	}
}

@media (max-width: 656px) {
	.audio-3 audio:last-of-type,
	.audio-5 audio:last-of-type,
	.audio-7 audio:last-of-type {
		width: 300px;
		max-width: 300px;
	}
}

@media (max-width: 480px) {  
	body > section {
		padding-left: 0;
		padding-right: 0;
	}
	section > span {
		padding-left: 10px;
	}
	#to-top span {
		display: none;
	}
	#to-top::before {
		content: "↑";
	}
	#to-bottom span {
		display: none;
	}
	#to-bottom::before {
		content: "↓";
	}
	.story span {
		display: none;
	}
	.story::before {
		content: "<";
	}
	.combat span {
		display: none;
	}
	.combat::before {
		content: ">";
	}
}

/*

example:

/*
Equation for audio width and transform offset:

A = Total top row width / Bottom row item count
    = 1212 / 3 = 404

B = Total visible gaps in bottom row
    = 4 + 4 = 8

C = B / Bottom row item count
    = 8 / 3 = 2.66

D = 300 (a constant. width of audio elements)

Width/max-width of audio elements = A - C
                                = 404 - 2.66
                                = 401.34px

Transform offset for first item = A - C - D
                                = 404 - 2.66 - 300
                                = 101.33px

Transform offset for nth item = (A - C) * n
                              = 101.33px * n
                              where n is the position (1, 2, etc.)
*/

/*
@media (max-width: 2484px) {
	.audio-7 {
		display: grid;
		grid-template-columns: 300px 300px 300px 300px;
		grid-template-rows: fit-content(100%) fit-content(100%);
	}
	.audio-7 audio:nth-of-type(5),
	.audio-7 audio:nth-of-type(6),
	.audio-7 audio:nth-of-type(7) {
		width: 401.33px;
		max-width: 401.33px;
	}
	.audio-7 audio:nth-of-type(6) {
		transform: translateX(101.33px);
	}
	.audio-7 audio:nth-of-type(7) {
		transform: translateX(202.66px);
	}
}
*/
