/* gamingbroject.com s148b lab: "Out this week" strip on the home and the "Calendar" menu link (cal-home.css, body token
 * gbcal-home, markup from tx-calhome.php). Looks like calendar B's "This week" row: raised day tiles lit from straight
 * above, the top pick's cover printed whole (radius 4, glass edge), a gold bookmark ribbon for our games, a plinth with
 * "Read our article", empty days as recessed sockets. Depth tokens are the twins of B's (--gbcal-b-*), same values.
 * Dark default, Day values under :root[data-gb-theme="light"]. Everything in @layer s145; colours, borders, shadows and
 * type carry !important because the live Day catch-all (gbl) sets them with !important. */

/* owner 11/11: today's tile gets a light that runs around its frame (angle animated through a registered property) */
@property --gbch-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

@layer s145 {

	.gbch {
		--gbch-card: #171020;
		--gbch-line: rgba(255, 255, 255, .1);
		--gbch-line-2: rgba(255, 255, 255, .2);
		--gbch-ink: var(--s145-ink, #f7f5fb);
		--gbch-ink-3: #9a93a5;
		--gbch-red: var(--s145-red-text, #ff5c78);
		--gbch-gold: #ffd35a;
		--gbch-gold-fill: #ffd35a;
		--gbch-focus: var(--s145-focus, #21eaff);
		--gbch-display: "GB Barlow Condensed", "Barlow Condensed", "Inter", system-ui, sans-serif;
		--gbch-text: var(--font-sans, "Inter", "Inter Fallback", system-ui, sans-serif);
		--gbch-ease: var(--s145-ease, cubic-bezier(.23, 1, .32, 1));
		/* depth: one key light overhead; 4 layer stacks so states interpolate */
		--gbch-well: #08050c;
		--gbch-e1: #171020;
		--gbch-e2: #1f1729;
		--gbch-sh-well: inset 0 1px 3px rgba(0, 0, 0, .6), inset 0 -1px 0 rgba(255, 255, 255, .04);
		--gbch-sh-flat: inset 0 0 0 0 transparent, inset 0 0 0 0 transparent, 0 0 0 0 transparent, 0 0 0 0 transparent;
		--gbch-sh-1: inset 0 0 0 0 transparent, inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 1px rgba(0, 0, 0, .55), 0 3px 8px -2px rgba(0, 0, 0, .5);
		--gbch-sh-2: inset 0 0 0 0 transparent, inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 3px rgba(0, 0, 0, .5), 0 10px 18px -6px rgba(0, 0, 0, .7);
		--gbch-sh-down: inset 0 1px 2px rgba(0, 0, 0, .5), inset 0 0 0 0 transparent, 0 0 0 0 transparent, 0 0 0 0 transparent;
		--gbch-glass: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .1);
		position: relative;
		padding: 34px 0 10px;
		font-family: var(--gbch-text);
		color: var(--gbch-ink) !important;
	}
	:root[data-gb-theme="light"] .gbch {
		--gbch-card: #ffffff;
		--gbch-line: rgba(21, 18, 27, .12);
		--gbch-line-2: rgba(21, 18, 27, .24);
		--gbch-ink: var(--s145-ink, #15121b);
		--gbch-ink-3: #5d5768;
		--gbch-red: var(--s145-red-text, #b80d32);
		--gbch-gold: #8a5a00;
		--gbch-gold-fill: #ffd35a;
		--gbch-focus: var(--s145-focus, #007385);
		--gbch-well: #eeebf3;
		--gbch-e1: #ffffff;
		--gbch-e2: #ffffff;
		--gbch-sh-well: inset 0 1px 2px rgba(21, 18, 27, .12), inset 0 -1px 0 #ffffff;
		--gbch-sh-flat: inset 0 0 0 0 transparent, 0 0 0 0 transparent, 0 0 0 0 transparent, 0 0 0 0 transparent;
		--gbch-sh-1: inset 0 0 0 0 transparent, 0 0 0 1px rgba(21, 18, 27, .08), 0 1px 2px rgba(21, 18, 27, .07), 0 3px 8px -3px rgba(21, 18, 27, .12);
		--gbch-sh-2: inset 0 0 0 0 transparent, 0 0 0 1px rgba(21, 18, 27, .08), 0 2px 4px rgba(21, 18, 27, .08), 0 12px 22px -10px rgba(21, 18, 27, .24);
		--gbch-sh-down: inset 0 1px 2px rgba(21, 18, 27, .14), 0 0 0 1px rgba(21, 18, 27, .1), 0 0 0 0 transparent, 0 0 0 0 transparent;
		--gbch-glass: inset 0 0 0 1px rgba(21, 18, 27, .08), inset 0 0 0 0 transparent;
	}
	.gbch *, .gbch *::before, .gbch *::after { box-sizing: border-box; }
	/* the phone home (body.gb-lite-home): its own page, no site wrap; the main gives the side gutter */
	.gbch.gbch-lite { padding: 26px 0 0; }
	.gbch.gbch-lite .gbch-row { margin: 0 -16px; padding: 6px 16px 16px; scroll-padding-inline: 16px; }

	/* head: title and count on the left; "Full calendar" on the right; no kicker, no hairline */
	.gbch .gbch-head {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-end;
		justify-content: space-between;
		gap: 12px 20px;
		margin: 0 0 16px;
		padding: 0;
		border-bottom: 0 !important;
	}
	.gbch .gbch-h { min-width: 0; }
	.gbch .gbch-kicker { display: none !important; }
	.gbch .gbch-title {
		margin: 0 !important;
		font: 700 clamp(28px, 4.2vw, 40px)/1 var(--gbch-display) !important;
		letter-spacing: .005em !important;
		text-transform: none !important;
		color: var(--gbch-ink) !important;
	}
	.gbch .gbch-sum {
		margin: 6px 0 0 !important;
		font: 500 14px/1.35 var(--gbch-text) !important;
		font-variant-numeric: tabular-nums !important;
		color: var(--gbch-ink-3) !important;
	}
	.gbch .gbch-sum-gold { display: inline-flex; align-items: center; gap: 4px; font-weight: 700 !important; color: var(--gbch-gold) !important; }
	.gbch .gbch-sum-gold .gbch-star { width: 14px; height: 14px; }
	/* the Day theme repaints svg colour past this layer, so the stars take their gold as a fill */
	.gbch :is(.gbch-sum-gold, .gbch-read) .gbch-star path { fill: var(--gbch-gold) !important; }
	.gbch .gbch-flag .gbch-star path { fill: #1a1100 !important; }

	/* "Full calendar": a raised key */
	.gbch .gbch-all {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 44px;
		padding: 0 14px;
		border: 1px solid transparent !important;
		border-radius: 6px !important;
		background: var(--gbch-e1) !important;
		box-shadow: var(--gbch-sh-1) !important;
		font: 600 14px/1 var(--gbch-text) !important;
		color: var(--gbch-ink) !important;
		text-decoration: none !important;
		-webkit-tap-highlight-color: transparent;
		touch-action: manipulation;
		transition: box-shadow .16s var(--gbch-ease), translate .16s var(--gbch-ease), background-color .16s ease;
	}
	.gbch .gbch-all svg { width: 16px; height: 16px; color: var(--gbch-ink-3) !important; }
	.gbch .gbch-all svg path { stroke: var(--gbch-ink-3) !important; }
	@media (pointer: fine) {
		.gbch .gbch-all { min-height: 40px; }
	}

	/* the row: 7 tiles, swipe on a phone, all visible on a wide screen; padding is shadow room */
	.gbch .gbch-row {
		display: grid;
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 10px;
		margin: 0;
		padding: 6px 0 16px;
		list-style: none;
	}
	@media (max-width: 1080px) {
		.gbch .gbch-row {
			grid-template-columns: none;
			grid-auto-flow: column;
			grid-auto-columns: clamp(150px, 40vw, 200px);
			overflow-x: auto;
			overscroll-behavior-x: contain;
			scroll-snap-type: x mandatory;
			scrollbar-width: none;
		}
		.gbch .gbch-row::-webkit-scrollbar { display: none; }
	}

	/* day tile: resting level */
	.gbch .gbch-day {
		position: relative;
		display: flex;
		flex-direction: column;
		min-width: 0;
		margin: 0;
		border: 1px solid transparent !important;
		border-radius: 12px !important;
		background: var(--gbch-e1) !important;
		box-shadow: var(--gbch-sh-1) !important;
		scroll-snap-align: start;
		overflow: hidden;
		transition: box-shadow .16s var(--gbch-ease), translate .16s var(--gbch-ease), background-color .16s ease;
	}
	.gbch .gbch-go {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		gap: 8px;
		padding: 8px 8px 12px;
		color: var(--gbch-ink) !important;
		text-decoration: none !important;
		-webkit-tap-highlight-color: transparent;
		touch-action: manipulation;
	}
	.gbch .gbch-d { font: 500 12px/1.2 var(--gbch-text) !important; color: var(--gbch-ink-3) !important; }
	.gbch .gbch-d b { font-weight: 700 !important; color: var(--gbch-ink) !important; }
	.gbch .gbch-day.is-today .gbch-d b { color: var(--gbch-red) !important; }
	.gbch .gbch-day.is-today {
		border-color: rgba(255, 92, 120, .45) !important;
		box-shadow: 0 0 0 1px rgba(255, 92, 120, .25), 0 0 22px rgba(255, 59, 92, .30), var(--gbch-sh-1) !important;
	}
	.gbch .gbch-day.is-today::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 3;
		padding: 3px;
		border-radius: inherit;
		pointer-events: none;
		background: conic-gradient(from var(--gbch-spin), transparent 0deg 170deg, rgba(255, 59, 92, .95) 270deg, #ffd35a 335deg, #fff 350deg, transparent 360deg);
		-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
		-webkit-mask-composite: xor;
		mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
		animation: gbch-spin 2.2s linear infinite;
	}
	@keyframes gbch-spin { to { --gbch-spin: 360deg; } }

	/* empty day: a recessed socket */
	.gbch .gbch-day.is-empty {
		background: var(--gbch-well) !important;
		box-shadow: var(--gbch-sh-well) !important;
	}
	.gbch .gbch-day.is-empty .gbch-go { padding-bottom: 12px; }
	.gbch .gbch-day.is-empty .gbch-cv.is-blank, .gbch .gbch-day.is-empty .gbch-m { display: none; }
	/* the date stays at the top; "No releases" sits in the middle of the socket, not under the date */
	.gbch .gbch-day.is-empty .gbch-t { margin-block: auto !important; align-self: center; font-size: 18px !important; }

	/* cover: the whole picture printed on a flat field; no picture: the game's hue and its initials */
	.gbch .gbch-cv {
		position: relative;
		display: block;
		aspect-ratio: 16 / 9;
		overflow: hidden;
		border-radius: 4px !important;
		background: hsl(var(--h, 330) 22% 15%) !important;
	}
	/* behind a real picture: a neutral dark mat, like a printed letterbox (no per game hue) */
	.gbch .gbch-cv.has-img { background: #050308 !important; }
	:root[data-gb-theme="light"] .gbch .gbch-cv { background: hsl(var(--h, 330) 24% 90%) !important; }
	:root[data-gb-theme="light"] .gbch .gbch-cv.has-img { background: #15121b !important; }
	.gbch .gbch-cv::before {
		content: attr(data-i);
		position: absolute;
		inset: 0;
		display: grid;
		place-items: center;
		font: 700 34px/1 var(--gbch-display) !important;
		color: rgba(255, 255, 255, .16) !important;
		-webkit-text-stroke: 0;
	}
	:root[data-gb-theme="light"] .gbch .gbch-cv::before { color: hsl(var(--h, 330) 30% 30% / .22) !important; }
	.gbch .gbch-cv.has-img::before { content: none; }
	.gbch .gbch-cv::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 1;
		border-radius: inherit;
		box-shadow: var(--gbch-glass) !important;
		pointer-events: none;
	}
	/* !important: the theme's unlayered img rule (height: auto) would otherwise pin the picture to the top */
	.gbch .gbch-cv img { position: absolute; inset: 0; width: 100% !important; max-width: none !important; height: 100% !important; display: block; }
	.gbch .gbch-cv .gbch-bl { display: none; }
	.gbch .gbch-cv .gbch-im { object-fit: contain; object-position: 50% 50% !important; }

	/* ours: a gold bookmark ribbon hanging from the cover's top edge */
	.gbch .gbch-flag {
		position: absolute;
		top: 0;
		left: 8px;
		right: auto;
		z-index: 2;
		display: block;
		width: 18px;
		height: 26px;
		padding: 4px 4px 12px;
		box-sizing: border-box;
		border-radius: 0 !important;
		background: var(--gbch-gold-fill) !important;
		color: #1a1100 !important;
		clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
		box-shadow: inset 0 2px 0 rgba(122, 82, 0, .45), inset 1px 0 0 rgba(255, 255, 255, .45), inset -1px 0 0 rgba(122, 82, 0, .3) !important;
	}
	.gbch .gbch-flag .gbch-star { display: block; width: 10px; height: 10px; margin: 0 auto; }

	.gbch .gbch-t {
		display: -webkit-box;
		overflow: hidden;
		font: 700 18px/1.08 var(--gbch-display) !important;
		color: var(--gbch-ink) !important;
		overflow-wrap: anywhere;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.gbch .gbch-day.is-empty .gbch-t { color: var(--gbch-ink-3) !important; }
	.gbch .gbch-m { margin-top: auto; font: 500 12px/1.2 var(--gbch-text) !important; color: var(--gbch-ink-3) !important; }

	/* "Read our article": the tile's plinth */
	.gbch .gbch-read {
		display: flex;
		align-items: center;
		gap: 6px;
		min-height: 44px;
		padding: 0 10px;
		border-top: 1px solid transparent !important;
		background: rgba(0, 0, 0, .22) !important;
		font: 600 14px/1.1 var(--gbch-text) !important;
		color: var(--gbch-gold) !important;
		text-decoration: none !important;
		-webkit-tap-highlight-color: transparent;
		touch-action: manipulation;
	}
	:root[data-gb-theme="light"] .gbch .gbch-read { background: #f6f4f9 !important; }
	.gbch .gbch-read .gbch-star { flex: none; width: 14px; height: 14px; }

	/* hover (fine pointer only): one level up; only the "Full calendar" key lifts 1px. :not(:active) lets the press win. */
	@media (hover: hover) and (pointer: fine) {
		.gbch .gbch-all:hover:not(:active) { background: var(--gbch-e2) !important; box-shadow: var(--gbch-sh-2) !important; }
		.gbch .gbch-day:not(.is-empty):hover:not(:active) { background: var(--gbch-e2) !important; box-shadow: var(--gbch-sh-2) !important; }
		.gbch .gbch-go:hover .gbch-t { text-decoration: underline !important; text-underline-offset: 3px; }
		.gbch .gbch-read:hover { text-decoration: underline !important; text-underline-offset: 3px; }
		@media (prefers-reduced-motion: no-preference) {
			.gbch .gbch-all:hover:not(:active) { translate: 0 -1px; }
		}
	}

	/* press: down 1px onto its contact shadow (after hover, so it wins) */
	.gbch .gbch-all:active { box-shadow: var(--gbch-sh-down) !important; transition-duration: .1s; }
	.gbch .gbch-day:active { box-shadow: var(--gbch-sh-down) !important; transition-duration: .1s; }
	@media (prefers-reduced-motion: no-preference) {
		.gbch .gbch-all:active, .gbch .gbch-day:active { translate: 0 1px; }
	}

	.gbch a:focus-visible { outline: 2px solid var(--gbch-focus) !important; outline-offset: -2px; }
	@media (prefers-reduced-motion: reduce) {
		.gbch .gbch-all, .gbch .gbch-day { transition: none; translate: none !important; }
		.gbch .gbch-day.is-today::before { animation: none; background: rgba(255, 59, 92, .85); }
	}
}
