@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:opsz,wdth,wght@6..12,75..125,600..900&family=Open+Sans:wght@400..800&display=swap");

:root {
	--pc-font-body: "Open Sans", Arial, sans-serif;
	--pc-font-display: "Nunito Sans", "Open Sans", Arial, sans-serif;
	--pc-page-padding: 0.45in;
	--pc-gap: 8px;
	--pc-border: #d5dde6;
	--pc-preview-bg: #d9dce3;
	--pc-team-logo-size: clamp(40px, 5vw, 56px);
	--pc-brand-logo-height: clamp(40px, 5vw, 56px);
	--pc-brand-logo-max-width: 34%;
	--pc-muted-day-bg: rgba(243, 245, 248, 0.72);
	--pc-empty-day-bg: rgba(233, 237, 242, 0.72);
	--pc-event-logo-height: clamp(28px, 100%, 74px);
	--pc-qr-size: 50px;
	--pc-qr-offset: calc(var(--pc-qr-size) + var(--pc-gap));
}

body {
	margin: 0;
	padding: 20px;
	font-family: var(--pc-font-body);
	color: #111;
	background: #fff;
}

.print-shell {
	margin: 0;
	background: #fff;
}

.print-page {
	padding: var(--pc-page-padding);
}

@media screen {
	body.print-preview {
		min-height: 100vh;
		display: flex;
		justify-content: center;
		align-items: flex-start;
		padding: 24px;
		background: var(--pc-preview-bg);
	}

	body.print-preview .print-shell {
		flex: 0 0 auto;
		box-shadow: 0 10px 30px rgba(17, 24, 39, 0.2);
		transform-origin: top left;
		transform: scale(var(--sheet-scale));
	}

	body.print-preview .print-shell.letter {
		width: 8.5in;
		min-height: 11in;
	}

	body.print-preview .print-shell.ledger {
		width: 11in;
		min-height: 17in;
	}

	body.print-preview.month-pages {
		display: block;
		overflow-x: auto;
	}

	body.print-preview.month-pages .print-shell,
	body.print-preview.month-pages .print-shell.letter,
	body.print-preview.month-pages .print-shell.ledger {
		width: auto;
		min-height: auto;
		background: transparent;
		box-shadow: none;
		transform: none;
	}

	body.print-preview.month-pages .print-page {
		padding: 0;
	}

	body.print-preview.month-pages .month-page {
		box-sizing: border-box;
		width: 8.5in;
		min-height: 11in;
		margin-right: auto;
		margin-left: auto;
		padding: var(--pc-page-padding);
		background: #fff;
		box-shadow: 0 10px 30px rgba(17, 24, 39, 0.2);
	}

	body.print-preview.month-pages.ledger .month-page {
		width: 11in;
		min-height: 17in;
	}

	body.print-preview.month-pages .month-page + .month-page {
		margin-top: 24px;
	}

	body.print-preview.month-pages .month-page .header {
		margin-bottom: 24px;
	}

	body.print-preview.month-pages .month-page .footer-meta {
		margin-top: 24px;
	}

	body.print-preview.month-pages .sheet-grid {
		display: block;
	}

body.print-preview.month-pages .month {
	width: 100%;
}

body.month-pages .month-title {
	font-size: calc(26px * var(--month-font-scale));
	padding: 4px;
}

body.month-pages .dow span {
	font-size: calc(12px * var(--month-font-scale));
	padding: 4px 2px;
}

body.month-pages .day-num {
	font-size: calc(14px * var(--month-font-scale));
}

body.month-pages .event-name {
	font-size: calc(13px * var(--month-font-scale));
	line-height: 0.98;
}

body.month-pages .matchup-name {
	font-size: calc(13px * var(--month-font-scale));
	line-height: 0.92;
}

body.month-pages .event-time {
	font-size: calc(14px * var(--month-font-scale));
}

body.month-pages .event.matchup .event-time {
	font-size: calc(11px * var(--month-font-scale));
}

body.month-pages .event.matchup .event-venue {
	font-size: calc(10px * var(--month-font-scale));
}
}

@media screen and (max-width: 900px) {
	body.print-preview {
		justify-content: flex-start;
		overflow-x: auto;
	}
}

.header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--team-accent, #b61f0f);
}

.header-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.team-logo,
.league-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.team-logo {
	width: var(--pc-team-logo-size);
	height: var(--pc-team-logo-size);
}

.team-logo img,
.team-logo-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
}

.league-logo {
	height: var(--pc-brand-logo-height);
	max-width: var(--pc-brand-logo-max-width);
}

.league-logo a,
.league-logo .custom-logo-link,
.league-logo .wp-block-site-logo__link {
	height: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.league-logo img,
.league-logo-img,
.league-logo .custom-logo,
.league-logo .wp-block-site-logo__image {
	width: auto;
	height: 100%;
	max-width: 100%;
	display: block;
	object-fit: contain;
}

.header-copy {
	min-width: 0;
}

.title {
	margin: 0;
	font-family: var(--pc-font-display);
	font-size: 28px;
	font-weight: 800;
	font-variation-settings: "wdth" 92, "wght" 800;
	line-height: 1.1;
	color: var(--team-ink, #111);
}

.meta {
	margin: 0;
	font-size: 13px;
	color: var(--team-muted-ink, #333);
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--pc-gap);
	margin: 0;
}

.legend-item {
	display: inline-flex;
	align-items: center;
	font-family: var(--pc-font-display);
	font-variation-settings: "wdth" 70, "wght" 700;
	background: #fff;
}

.sheet-grid {
	display: grid;
	grid-template-columns: repeat(var(--month-columns), minmax(0, 1fr));
	gap: var(--pc-gap);
	align-items: start;
}

.sheet-grid > .month:nth-child(3):last-child {
	grid-column: 1 / -1;
	width: calc((100% - var(--pc-gap)) / 2);
	max-width: calc((100% - var(--pc-gap)) / 2);
	justify-self: center;
}

.month {
	margin: 0;
	break-inside: avoid;
	page-break-inside: avoid;
}

.month-title {
	margin: 0;
	padding: 2px;
	font-family: var(--pc-font-display);
	font-size: calc(20px * var(--month-font-scale));
	font-weight: 800;
	font-variation-settings: "wdth" 80, "wght" 800;
	line-height: 1.1;
	letter-spacing: 0.01em;
	text-align: center;
	text-transform: uppercase;
	background: var(--team-primary);
	color: var(--team-on-primary);
}

.dow,
.grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dow span {
	display: block;
	padding: 2px 1px;
	font-size: calc(10px * var(--month-font-scale));
	font-weight: 700;
	text-align: center;
	text-transform: uppercase;
	border-bottom: 1px solid var(--pc-border);
	background: var(--team-link-color);
	color: var(--team-on-link-color);
}

.day {
	--corner-badge-size: calc(15px * var(--month-font-scale));
	--corner-badge-offset: 0px;
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--day-aspect);
	background: #fff;
}

.day.muted {
	background: var(--pc-muted-day-bg);
	color: #9aa5b1;
}

.day.no-events {
	background: var(--pc-empty-day-bg);
}

.day-num {
	position: absolute;
	top: var(--corner-badge-offset);
	left: var(--corner-badge-offset);
	z-index: 20;
	width: var(--corner-badge-size);
	height: var(--corner-badge-size);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--pc-font-display);
	font-size: calc(12px * var(--month-font-scale));
	font-weight: 800;
	font-variation-settings: "wdth" 86, "wght" 800;
	line-height: 1;
}

.day.has-events .day-num {
	color: var(--day-num-color, #fff);
}

.day.has-matchups {
	background: #fff;
	border: 1px solid var(--pc-border);
}

.day.has-matchups .day-num {
	position: absolute;
	z-index: 20;
	background: #fff;
	color: var(--team-ink, #111) !important;
	text-shadow: none !important;
	box-shadow: 0 0 0 1px var(--pc-border);
}

body.month-pages .day .day-num {
	top: 1px;
	left: 1px;
	width: var(--corner-badge-size);
	height: var(--corner-badge-size);
	border-radius: 0;
	background: #fff;
	color: var(--team-ink, #111);
	text-shadow: none;
}

.events-stack {
	position: relative;
	z-index: 1;
	height: 100%;
	display: grid;
	grid-template-rows: repeat(var(--event-count), minmax(0, 1fr));
}

.day.has-matchups .events-stack {
	box-sizing: border-box;
	grid-template-rows: repeat(var(--event-count), minmax(0, 1fr));
	gap: 2px;
	padding: 2px;
}

.event {
	--event-top-band: calc(var(--corner-badge-size, 11px) + var(--corner-badge-offset, 2px));
	--event-bottom-band: 26px;
	--event-logo-height: var(--pc-event-logo-height);
	position: relative;
	background: var(--event-bg, var(--team-primary, #1b76d1));
	color: var(--event-fg, #fff);
}

.event.h {
	--event-bg: var(--team-primary, #1b76d1);
}

.event.a {
	--event-bg: var(--team-link-color, var(--team-secondary, #8b3f1f));
}

.event.matchup {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) auto;
	gap: 1px;
	min-height: 0;
	padding: 2px 3px;
	border-radius: 2px;
	overflow: hidden;
}

.event-center {
	position: absolute;
	top: var(--event-top-band);
	left: 0;
	right: 0;
	bottom: var(--event-bottom-band);
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	width: 100%;
	font-size: calc(10px * var(--month-font-scale));
	font-weight: 700;
	line-height: 1;
	text-align: center;
}

.event.matchup .event-center {
	position: relative;
	top: auto;
	left: auto;
	right: auto;
	bottom: auto;
	min-height: 0;
	align-items: center;
	justify-content: center;
}

.event-center img {
	width: auto;
	height: var(--event-logo-height);
	max-width: 100%;
	max-height: 100%;
	display: block;
	object-fit: contain;
	object-position: center;
}

.event-name {
	width: 100%;
	max-width: 100%;
	max-height: 100%;
	overflow: hidden;
	text-overflow: clip;
	white-space: normal;
	word-break: normal;
	overflow-wrap: normal;
	hyphens: none;
	line-height: 1.05;
	font-weight: 700;
	font-stretch: condensed;
	font-variation-settings: "wdth" 42, "wght" 700;
	opacity: 0.85;
}

.event.no-logo .event-name {
	font-family: var(--pc-font-display);
	font-weight: 700;
	font-variation-settings: "wdth" 30, "wght" 700;
	text-transform: uppercase;
}

.matchup-name {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	padding: 0;
	font-size: calc(8.5px * var(--month-font-scale));
	line-height: 0.98;
	font-variation-settings: "wdth" 36, "wght" 800;
	opacity: 1;
}

.matchup-vs {
	font-size: 0.66em;
	font-weight: 900;
	opacity: 0.78;
}

.matchup-team {
	display: block;
	width: 100%;
	overflow: hidden;
	text-align: center;
	text-overflow: clip;
	white-space: nowrap;
	font-stretch: condensed;
}

.ha-flag {
	position: absolute;
	top: var(--corner-badge-offset, 2px);
	right: var(--corner-badge-offset, 2px);
	z-index: 3;
	width: var(--corner-badge-size, 11px);
	height: var(--corner-badge-size, 11px);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--pc-font-display);
	font-size: calc(10px * var(--month-font-scale));
	font-weight: 900;
	font-variation-settings: "wdth" 84, "wght" 900;
	line-height: 1;
	letter-spacing: 0;
	background: #111;
	color: #fff;
}

.event.a .ha-flag {
	background: #fff;
	color: #111;
}

.event-meta {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 2px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 1px;
	padding: 0 2px;
	overflow: hidden;
}

.event.matchup .event-meta {
	position: relative;
	left: auto;
	right: auto;
	bottom: auto;
	display: grid;
	grid-template-columns: minmax(0, auto) minmax(0, 1fr);
	align-items: center;
	justify-content: center;
	column-gap: 3px;
	padding: 0;
}

.event-time {
	order: 1;
	max-width: 100%;
	font-size: calc(12px * var(--month-font-scale));
	font-weight: 800;
	font-stretch: condensed;
	font-variation-settings: "wdth" 56, "wght" 800;
	line-height: 1;
	text-transform: uppercase;
	text-align: center;
	color: currentColor;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: clip;
	opacity: 0.95;
}

.event.matchup .event-time {
	min-width: 0;
	font-size: calc(7.5px * var(--month-font-scale));
	font-weight: 900;
}

.event-venue {
	order: 2;
	max-width: 100%;
	font-size: calc(8px * var(--month-font-scale));
	font-weight: 700;
	font-stretch: condensed;
	font-variation-settings: "wdth" 50, "wght" 700;
	line-height: 1;
	text-align: center;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: clip;
	opacity: 0.88;
}

.event.matchup .event-venue {
	min-width: 0;
	font-size: calc(7px * var(--month-font-scale));
	text-align: left;
}

.empty {
	padding: 16px;
	border: 2px dashed #c8d2de;
	background: #f8fafc;
}

.footer-meta {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--pc-gap);
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid var(--pc-border);
}

.legend-bottom {
	--month-width: calc((100% - ((var(--month-columns) - 1) * var(--pc-gap))) / var(--month-columns));
	flex: 0 0 var(--month-width);
	width: var(--month-width);
	max-width: var(--month-width);
	align-content: flex-start;
	justify-content: center;
	gap: 6px;
}

.legend-bottom .legend-item {
	padding: 3px 6px;
	font-size: 10px;
	text-align: center;
}

.footer-qr {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	gap: var(--pc-gap);
	min-height: var(--pc-qr-size);
	padding-right: var(--pc-qr-offset);
}

.footer-qr-copy {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	text-align: right;
}

.footer-qr-label {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--team-muted-ink, #333);
}

.footer-qr-link {
	font-size: 10px;
	font-weight: 700;
	text-decoration: none;
	color: var(--team-ink, #111);
}

.footer-qr-image {
	position: absolute;
	right: 0;
	bottom: 0;
	width: var(--pc-qr-size);
	height: var(--pc-qr-size);
	display: block;
	border: 1px solid var(--pc-border);
	background: #fff;
}

body.black-white .header,
body.black-white .month-title,
body.black-white .dow span,
body.black-white .day,
body.black-white .event,
body.black-white .empty,
body.black-white .footer-meta,
body.black-white .footer-qr-image {
	border-color: #2f3337 !important;
}

body.black-white .month-title,
body.black-white .ha-flag {
	background: #1f2328 !important;
	color: #fff !important;
	text-shadow: none !important;
}

body.black-white .dow span,
body.black-white .day,
body.black-white .day.muted,
body.black-white .day.no-events,
body.black-white .day.has-matchups,
body.black-white .empty,
body.black-white .legend-item,
body.black-white .event.a .ha-flag {
	background: #f7f7f7 !important;
	color: #111 !important;
	text-shadow: none !important;
}

body.black-white .dow span {
	background: #e4e7eb !important;
}

body.black-white .day,
body.black-white .day.has-matchups,
body.black-white .legend-item {
	background: #fff !important;
}

body.black-white .event,
body.black-white .event.h,
body.black-white .event.a,
body.black-white .event.matchup {
	background: #e4e7eb !important;
	color: #111 !important;
	text-shadow: none !important;
}

body.black-white .day.muted,
body.black-white .day.no-events {
	background: #f2f3f5 !important;
	color: #4b5563 !important;
}

body.black-white .month-title,
body.black-white .dow span,
body.black-white .day,
body.black-white .event {
	border: 1px solid #2f3337;
}

body.black-white .day-num,
body.black-white .day.has-events .day-num,
body.black-white .day.has-matchups .day-num,
body.black-white.month-pages .day .day-num {
	background: #fff !important;
	color: #111 !important;
	box-shadow: 0 0 0 1px #2f3337 !important;
	text-shadow: none !important;
}

body.black-white .ha-flag,
body.black-white .event.a .ha-flag {
	box-shadow: 0 0 0 1px #2f3337;
}

body.black-white .event-name,
body.black-white .event-time,
body.black-white .event-venue,
body.black-white .matchup-vs,
body.black-white .footer-qr-label,
body.black-white .footer-qr-link,
body.black-white .meta {
	color: #111 !important;
	opacity: 1 !important;
}

body.black-white .meta,
body.black-white .footer-qr-label {
	color: #374151 !important;
}

@media print {
	body,
	body.print-preview {
		padding: 0;
		display: block;
		background: #fff;
	}

	.print-shell,
	body.print-preview .print-shell,
	body.print-preview .print-shell.letter,
	body.print-preview .print-shell.ledger {
		width: auto;
		min-height: auto;
		box-shadow: none;
		transform: none;
	}

	.print-page {
		padding: 0;
	}

	.header {
		margin-bottom: 8px;
	}

	.title {
		font-size: calc(26px * var(--month-font-scale));
	}

	body.month-pages .sheet-grid {
		display: block;
	}

	body.month-pages .month-page {
		break-after: page;
		page-break-after: always;
	}

	body.month-pages .month-page:last-child {
		break-after: auto;
		page-break-after: auto;
	}

	body.month-pages .month {
		width: 100%;
	}

	body.month-pages .grid {
		break-inside: avoid;
		page-break-inside: avoid;
	}
}
