/* ---------------------------------------------------------------------------
   ROM hack pages — shared by every project page that offers a patch.
   Loaded after site.css, and goes with rom-patcher.js, which drives the
   "Patch your ROM" buttons styled here.

   Sections:
     hack sections · download and patch · screens · intro · feature lists
     gallery · small screens
   --------------------------------------------------------------------------- */

/* --- hack sections -------------------------------------------------------- */

.hack
{
	margin-top: 44px;
	padding-top: 34px;
	border-top: 1px solid var(--line);
	/* So the nav's #links land below the sticky header, not under it. */
	scroll-margin-top: var(--head-height);
}
/* The first section starts the page, so no rule or gap above it. */
.hack:first-child
{
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.hack-head
{
	display: flex;
	align-items: baseline;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.hack h2
{
	font-family: var(--mono);
	font-size: clamp(1.25rem, 3vw, 1.6rem);
	letter-spacing: -0.01em;
	color: #eef3fa;
	margin: 0;
}
.hack h3
{
	font-family: var(--mono);
	font-size: 0.95rem;
	color: #eef3fa;
	margin: 34px 0 12px;
}
.hack p { color: var(--text-dim); max-width: 68ch; }
.hack .tags { margin: 0; }

/* --- download and patch ----------------------------------------------------
   Each hack's big download button, the "Patch your ROM" button beside it,
   and the lines of facts and patcher status under them. */

.get { margin: 22px 0 6px; }
.download
{
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.btn-big
{
	font-size: 1rem;
	padding: 13px 20px;
	border-radius: 8px;
	gap: 10px;
}
.btn-big svg { flex: none; }
.get .meta,
.get .status
{
	margin: 10px 0 0;
	max-width: none;
	font-family: var(--mono);
	font-size: 0.8rem;
	color: var(--text-dim);
	overflow-wrap: anywhere;
}
.get .status { margin-top: 4px; }
.get .status.ok { color: var(--accent-good); }
.get .status.bad { color: #ff7b72; }

/* A ROM dragged over a hack's buttons can be dropped to patch it. */
.get.is-over .btn-patch
{
	border-style: dashed;
	border-color: var(--accent);
	color: var(--accent);
}

/* The "Patch your ROM" file inputs stay focusable for the keyboard, but
   their labels are what show. */
.visually-hidden
{
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.get input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A ROM's MD5 is one long word, so the browser would rather start a new
   line than split it. Letting it break anywhere keeps it inline after
   "MD5", and clone gives each piece its own rounded box. */
code.md5
{
	word-break: break-all;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

/* --- screens ---------------------------------------------------------------
   Game screens, saved at a whole multiple of the console's own resolution
   (4x for Game Boy, 2x for Mega Drive) so the browser scales them down
   rather than up and they stay sharp-ish at any size. Each <img> carries
   its width and height, which gives it its aspect ratio before it loads. */

.screen
{
	display: block;
	margin: 0;
	border: 1px solid var(--line);
	border-radius: 8px;
	overflow: hidden;
	background: #000;
}
.screen img
{
	display: block;
	width: 100%;
	height: auto;
}
a.screen:hover { border-color: var(--line-hi); }

/* --- intro -----------------------------------------------------------------
   A screen beside a section's intro. 322px is the 1px border either side
   of a 320px image: exactly 2x a Game Boy screen and 1x a Mega Drive one,
   so either is crisp. */

.intro
{
	display: grid;
	grid-template-columns: 322px minmax(0, 1fr);
	gap: 28px;
	align-items: start;
}
.intro p:first-child { margin-top: 0; }

/* --- feature lists -------------------------------------------------------- */

.features
{
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 0 28px;
}
.features h4
{
	font-family: var(--mono);
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent-warm);
	margin: 0 0 8px;
}
.features ul
{
	margin: 0 0 22px;
	padding-left: 1.2em;
	color: var(--text-dim);
	font-size: 0.94rem;
}
.features li { margin: 5px 0; }

/* --- gallery ---------------------------------------------------------------
   Three to a row, with a short last row centred. */

.gallery
{
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 18px 14px;
}
.gallery figure
{
	margin: 0;
	flex: 0 0 calc((100% - 28px) / 3);
}
.gallery figcaption
{
	font-family: var(--mono);
	font-size: 0.74rem;
	color: var(--text-faint);
	margin-top: 6px;
}

/* --- small screens -------------------------------------------------------- */

@media (max-width: 760px)
{
	.intro { grid-template-columns: minmax(0, 322px); }
	.gallery figure { flex-basis: calc((100% - 14px) / 2); }

	/* Keep a long "Download ... Patch" on one line on a phone. */
	.btn-big { font-size: 0.84rem; padding: 12px 16px; }
	/* The two buttons stack on a phone, so give them one width. */
	.download .btn-big { flex: 1 1 auto; justify-content: center; }

	/* Let the nav drop under the brand rather than split its links. */
	.site-nav { flex-wrap: wrap; gap: 4px 16px; }
	.site-nav a { white-space: nowrap; }
}
