/* =========================================================================
   BASIC-256 Gallery page (template-gallery.php)
   Builds on landing.css + release-notes.css (shared tokens, hero, buttons,
   CTA). This file only adds the section jump links and the program cards.
   ========================================================================= */

/* ---- Per-section tint ------------------------------------------------- */
/* One accent per type, from the landing palette. It colours the jump pill,
   the type label on each card and the placeholder for a missing screenshot. */
.gal-fractals    { --gal-tint: var(--purple); }
.gal-simulations { --gal-tint: var(--green); }
.gal-physics     { --gal-tint: var(--orange); }
.gal-games       { --gal-tint: var(--pink); }
.gal-gui         { --gal-tint: var(--blue-2); }
.gal-demos       { --gal-tint: var(--teal); }
.gal-console     { --gal-tint: var(--text-muted); }

/* ---- Jump links ------------------------------------------------------- */
.gal-jump {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	/* .b256 .wrap zeroes the body's top padding, which leaves these shadowed
	   pills touching the hero band without a gap of their own. */
	margin: 32px 0 44px;
}
.gal-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 7px 16px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text);
	box-shadow: var(--shadow);
	transition: border-color .15s ease, transform .15s ease;
}
.gal-pill::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 999px;
	background: var(--gal-tint);
}
.gal-pill:hover {
	border-color: var(--gal-tint);
	transform: translateY(-1px);
}

/* ---- Sections --------------------------------------------------------- */
/* Clear the sticky header when a jump link lands on a section. */
.gal-section { scroll-margin-top: 90px; }
.gal-section > h2 { margin-bottom: 6px; }
.rn-block p.gal-blurb {
	color: var(--text-muted);
	margin: 0 0 22px;
}

/* ---- Card grid -------------------------------------------------------- */
.gal-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 22px;
}
.gal-card {
	display: flex;
	flex-direction: column;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: border-color .15s ease, transform .15s ease;
}
.gal-card:hover {
	border-color: var(--gal-tint);
	transform: translateY(-2px);
}

/* Screenshot: a fixed 16:10 frame, so cards line up whatever the program's
   graphsize was. The full image is one click away in the lightbox. */
.gal-media {
	margin: 0;
	aspect-ratio: 16 / 10;
	/* Without this a tall screenshot's own height wins over aspect-ratio. */
	overflow: hidden;
	background: var(--bg-dark);
	border-bottom: 1px solid var(--border);
}
.gal-media .b256-zoom,
.gal-media picture { height: 100%; }
.gal-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .18s ease;
}
.gal-media .b256-zoom:hover img { transform: scale(1.03); }
.gal-media .b256-zoom { overflow: hidden; }
.gal-media .b256-zoom:focus-visible { outline-offset: -3px; border-radius: 0; }

.gal-placeholder {
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 16px;
	text-align: center;
	background:
		radial-gradient(420px 200px at 80% 0%, color-mix(in srgb, var(--gal-tint) 35%, transparent), transparent 70%),
		linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-dark-2) 100%);
}
.gal-ph-title {
	font-family: "SFMono-Regular", Consolas, Menlo, monospace;
	font-size: 17px;
	font-weight: 700;
	color: #fff;
}
.gal-ph-note {
	font-size: 12.5px;
	color: var(--text-invert-muted);
}

/* ---- Card body -------------------------------------------------------- */
.gal-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 18px 20px 20px;
}
.gal-type {
	align-self: flex-start;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--gal-tint);
	background: color-mix(in srgb, var(--gal-tint) 12%, transparent);
	padding: 3px 10px;
	border-radius: 999px;
	margin-bottom: 10px;
}
.gal-body h3 {
	margin: 0 0 2px;
	font-size: 18px;
	font-weight: 800;
	color: var(--text);
}
.rn-block .gal-credit {
	font-size: 13px;
	color: var(--text-muted);
	margin: 0 0 8px;
}
.rn-block .gal-text {
	font-size: 14.5px;
	line-height: 1.55;
	margin: 6px 0 16px;
}

/* Actions sit at the bottom of every card, however long its text. */
.gal-actions {
	margin-top: auto;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 16px;
}
.b256 .gal-run {
	padding: 9px 16px;
	font-size: 14px;
}
.b256 .gal-source {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--blue);
	font-size: 14px;
	font-weight: 600;
}
.b256 .gal-source:hover { text-decoration: underline; }
.gal-soon {
	font-size: 13px;
	font-weight: 700;
	color: #b45309;
	background: rgba(245, 158, 11, 0.16);
	padding: 5px 12px;
	border-radius: 999px;
}
.rn-block .gal-file {
	margin: 12px 0 0;
	font-size: 12px;
}
.rn-block .gal-file code { font-size: 12px; }

/* A section with nothing in it yet. */
.gal-empty {
	background: var(--card);
	border: 1px dashed var(--border);
	border-radius: var(--radius);
	padding: 22px 24px;
}
.rn-block .gal-empty p { margin: 0; color: var(--text-muted); }
.gal-empty a { color: var(--blue-2); }
.gal-empty a:hover { text-decoration: underline; }

.b256-gallery .rn-note { margin-bottom: 40px; }

/* ---- Program overlay (gallery-player.js) ------------------------------- */
/* Appended to <body>, outside the .b256 wrapper, so like the lightbox it
   cannot use the scoped variables and spells its colours out. */
dialog.b256-player {
	width: min(1100px, 96vw);
	height: min(800px, 92vh);
	max-width: 96vw;
	max-height: 92vh;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: #0f172a;
	overflow: hidden;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
dialog.b256-player[open] {
	display: flex;
	flex-direction: column;
}
dialog.b256-player::backdrop {
	background: rgba(2, 6, 23, 0.88);
	backdrop-filter: blur(3px);
}
.b256-player-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 8px 8px 8px 18px;
	color: #e2e8f0;
	font-size: 15px;
}
.b256-player-title {
	flex: 1;
	min-width: 0;
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
a.b256-player-newtab {
	color: #93c5fd;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}
a.b256-player-newtab:hover { text-decoration: underline; }
button.b256-player-close {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #e2e8f0;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}
button.b256-player-close:hover,
button.b256-player-close:focus-visible { background: rgba(255, 255, 255, 0.12); }
.b256-player-frame {
	flex: 1;
	width: 100%;
	border: 0;
	background: #fff;
}
@media (max-width: 640px) {
	a.b256-player-newtab { display: none; }
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 960px) {
	.gal-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
	.gal-grid { grid-template-columns: 1fr; }
}
