/* ===========================================================================
   CONTENT BLOCKS

   Collapsible dropdowns, video/screenshot grids and inline thumbnails
   used inside a page's main column.
   Loaded by: TSBM.html
   =========================================================================== */

.dropdown {
	margin: 24px;
	margin-left: 0;
	width: 99%;
	border: 2px solid transparent;
	border-radius: 16px;
}

#main_area .dropdown ul {
	margin-left: clamp(16px, 6vw, 48px);
	padding-right: clamp(12px, 2vw, 24px);
}

#main_area .dropdown h4 {
	margin-left: clamp(8px, 3.5vw, 28px);
}

.dropdown-title {
	color: var(--color-text-1);
	font-family: "Circular Spotify", sans-serif;
	padding: 16px;
	border-radius: 16px;
	background-color: var(--color-primary-a20);
	cursor: pointer;
	display: flex;
	align-items: center;
	transition:
		border-radius var(--dur-panel) var(--ease-soft),
		border-color var(--dur-hover) var(--ease-soft),
		background-color var(--dur-hover) var(--ease-soft);
	border: 2px solid transparent;
	font-weight: 600;
	font-size: 18px;
	user-select: none;
}

@media (hover: hover) {
	.dropdown-title:hover {
		border-color: var(--color-selected-2);
	}
}

/* The header takes the press rather than moving: it is the lid of a box that
   is about to change height underneath it, and a lift would fight the opening. */
.dropdown-title:active {
	border-color: var(--color-selected-2);
	background-color: var(--color-primary-a10);
	transition-duration: var(--dur-press);
}

.dropdown-title::after {
	content: "▼";
	font-size: 12px;
	transition: transform var(--dur-panel) var(--ease-out);
	margin-left: auto;
}

/* ---------------------------------------------------------------------------
   Opening.

   This used to transition max-height from 0 to 3200px. Two things were wrong
   with that, and they are the same two the patch notes hit (see the note at
   the top of CSS/patch-notes.css). Anything taller than the cap was silently
   clipped, and because the transition always covers the full 3200px whatever
   is inside, a two-line block crawled open while a long one snapped — the
   apparent speed was set by how much content there was, which is exactly
   backwards.

   grid-template-rows from 0fr to 1fr animates to the content's real height, so
   every block opens at the same rate and nothing can be cut off. The inner
   wrapper needs min-height: 0 or the grid refuses to size it below its
   content and the whole thing stays open.
   --------------------------------------------------------------------------- */

.dropdown-content {
	border-radius: 0px 0px 16px 16px;
	display: grid;
	grid-template-rows: 0fr;
	overflow: hidden;
	transition: grid-template-rows var(--dur-panel) var(--ease-soft);
	background-color: var(--color-primary-a10);
}

.dropdown-content-inner {
	min-height: 0;
	overflow: hidden;
}

.dropdown-content-inner p {
	font-weight: 400;
	font-size: 14px;
}

.dropdown input {
	display: none;
}

.dropdown-toggle {
	display: none;
}

.dropdown input:checked ~ .dropdown-content {
	grid-template-rows: 1fr;
}

.dropdown input:checked ~ .dropdown-title::after {
	transform: rotate(180deg);
}

.dropdown input:checked ~ .dropdown-title {
	border-radius: 16px 16px 0px 0px;
}

/* ---------------------------------------------------------------------------
   The contents, arriving behind the box.

   The staggered fade-in was a JS loop that added a class to each descendant
   and then awaited a 25ms sleep — one timer per element, on the main thread,
   with nothing to stop two runs overlapping if the block was opened and closed
   quickly. --i is set once per child by js_main.js and the delay is derived
   from it here, so the sequence is the renderer's problem and re-opening
   simply restarts it.
   --------------------------------------------------------------------------- */

.dropdown-item {
	opacity: 0;
	transform: translateY(6px);
	transition:
		opacity var(--dur-hover) var(--ease-out),
		transform var(--dur-hover) var(--ease-out);
}

.dropdown input:checked ~ .dropdown-content .dropdown-item {
	opacity: 1;
	transform: none;
	/* Starts after the box has begun opening, so the text is not sliding
	   upward through an edge that is still moving down past it. */
	transition-delay: calc(0.12s + var(--i, 0) * 45ms);
}

.video_grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 256px), 1fr));
	gap: 16px;
	padding: 24px;
	padding-top: 0px;
	max-width: 528px;
	justify-content: left;
}

.video_grid img {
	margin: 0;
}

#main_area .video_grid img {
	margin: 0;
}

.video_grid video,
.video_grid img,
.video_grid iframe {
	border-radius: 16px;
	width: 100%;
	max-width: 256px;
	aspect-ratio: 4/3;
	transition:
		transform var(--dur-hover) var(--ease-out),
		box-shadow var(--dur-hover) var(--ease-out);
	object-fit: contain;
	cursor: pointer;
}

@media (hover: hover) {
	.video_grid video:hover,
	.video_grid img:hover {
		transform: scale(1.05);
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	}
}

.video_grid img:active {
	transform: scale(0.98);
	transition-duration: var(--dur-press);
}

.video_grid2 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
	gap: 16px;
	padding: 24px;
	max-width: 824px;
	justify-content: left;
}

.video_grid2 video,
.video_grid2 iframe,
.video_grid2 img {
	border-radius: 16px;
	width: 100%;
	max-width: 400px;
	aspect-ratio: 16/9;
	transition:
		transform var(--dur-hover) var(--ease-out),
		box-shadow var(--dur-hover) var(--ease-out);
	object-fit: contain;
}

@media (hover: hover) {
	.video_grid2 video:hover,
	.video_grid2 iframe:hover,
	.video_grid2 img:hover {
		transform: scale(1.05);
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
	}
}

.game-thumbnail,
.game-thumbnail-1080p {
	border-radius: 16px;
	max-width: 256px;
	height: auto;
	cursor: zoom-in;
	transition:
		transform var(--dur-hover) var(--ease-out),
		box-shadow var(--dur-hover) var(--ease-out);
	margin-bottom: 0;
}

.game-thumbnail {
	width: 100%;
}

@media (hover: hover) {
	.game-thumbnail:hover,
	.game-thumbnail-1080p:hover {
		transform: scale(1.05);
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	}
}

.game-thumbnail:active,
.game-thumbnail-1080p:active {
	transform: scale(0.98);
	transition-duration: var(--dur-press);
}

#changelog_ul {
	margin-top: 8px;
	padding-left: 10px;
}
