/**
 * AZ Lions USSSA Sync — front-end styles.
 *
 * BRANDING: everything is driven by the custom properties in :root below.
 * Override them once, in your theme's stylesheet or Customizer > Additional CSS,
 * and every table follows. Don't fork this file.
 *
 *   :root {
 *     --azl-primary:   #0b2545;   your navy
 *     --azl-accent:    #f2a900;   your gold
 *     --azl-radius:    4px;
 *   }
 *
 * Falls back to the active theme's own tokens where WP/theme.json provides them,
 * so a block theme will mostly just look right out of the box.
 */

:root {
	/* Brand — override these. */
	--azl-primary: var(--wp--preset--color--primary, #0b2545);
	--azl-primary-ink: #ffffff;
	--azl-accent: var(--wp--preset--color--secondary, #f2a900);

	/* Surfaces */
	--azl-bg: transparent;
	--azl-row: transparent;
	--azl-row-alt: rgba(0, 0, 0, 0.025);
	--azl-row-hover: rgba(0, 0, 0, 0.045);
	--azl-border: rgba(0, 0, 0, 0.1);

	/* Text */
	--azl-text: inherit;
	--azl-muted: #6b7280;

	/* Semantic */
	--azl-win: #15803d;
	--azl-loss: #b91c1c;
	--azl-tie: #6b7280;

	/* Shape + rhythm */
	--azl-radius: 6px;
	--azl-gap: 1rem;
	--azl-pad: 0.85rem;
	--azl-font: inherit;

	/*
	 * TYPE SCALE — 16px floor.
	 *
	 * Nothing in this stylesheet renders below --azl-size-min. Every label,
	 * column header, date and caption uses it. That's a deliberate constraint:
	 * 11px uppercase column headers are unreadable on a phone in the sun at a
	 * ball field, which is exactly where parents read this.
	 *
	 * Because the small text got bigger, the big text has to grow too or the
	 * hierarchy collapses — hence the larger --azl-size-xl / 2xl below.
	 *
	 * Want everything a notch bigger? Change --azl-size-min and --azl-size-base
	 * to 1.0625rem (17px). The rest scales off them.
	 */
	--azl-size-min: 1rem;      /* 16px — hard floor for ALL text */
	--azl-size-base: 1rem;     /* 16px — table cells, body copy  */
	--azl-size-lg: 1.25rem;    /* 20px — event group titles      */
	--azl-size-xl: 1.875rem;   /* 30px — team stat card values   */
	--azl-size-2xl: 2rem;      /* 32px — leader card values      */

	--azl-font-size: var(--azl-size-base);
}

.azl-usssa {
	font-family: var(--azl-font);
	font-size: var(--azl-font-size);
	color: var(--azl-text);
	margin: 0 0 2.5rem;
}

.azl-usssa__title {
	margin: 0 0 var(--azl-gap);
	line-height: 1.2;
}

.azl-usssa__empty {
	padding: var(--azl-pad) 1rem;
	border: 1px dashed var(--azl-border);
	border-radius: var(--azl-radius);
	color: var(--azl-muted);
	margin: 0;
}

/* --- Season summary cards ------------------------------------------------ */

.azl-usssa__summary {
	display: flex;
	flex-wrap: wrap;
	gap: var(--azl-gap);
	margin-bottom: var(--azl-gap);
}

.azl-usssa__stat {
	flex: 1 1 8rem;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.85rem 1rem;
	background: var(--azl-primary);
	color: var(--azl-primary-ink);
	border-radius: var(--azl-radius);
}

.azl-usssa__stat-val {
	font-size: var(--azl-size-xl);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.azl-usssa__stat-key {
	font-size: var(--azl-size-min);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.8;
}

/* --- Tables -------------------------------------------------------------- */

/* Horizontal scroll container so wide tables don't blow out narrow themes. */
.azl-usssa__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.azl-usssa__table {
	width: 100%;
	border-collapse: collapse;
	background: var(--azl-bg);
}

.azl-usssa__table th {
	background: var(--azl-primary);
	color: var(--azl-primary-ink);
	text-align: left;
	padding: var(--azl-pad);
	font-size: var(--azl-size-min);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.azl-usssa__table th:first-child {
	border-top-left-radius: var(--azl-radius);
}

.azl-usssa__table th:last-child {
	border-top-right-radius: var(--azl-radius);
}

.azl-usssa__table td {
	padding: var(--azl-pad);
	border-bottom: 1px solid var(--azl-border);
	background: var(--azl-row);
	vertical-align: middle;
}

.azl-usssa__table tbody tr:nth-child(even) td {
	background: var(--azl-row-alt);
}

.azl-usssa__table tbody tr:hover td {
	background: var(--azl-row-hover);
}

/* Podium finishes get an accent rail. */
.azl-usssa__row--podium td:first-child {
	box-shadow: inset 3px 0 0 var(--azl-accent);
}

.azl-usssa__place {
	display: inline-block;
	min-width: 2.25rem;
	font-weight: 700;
}

.azl-usssa__place--first {
	color: var(--azl-accent);
}

.azl-usssa__event {
	font-weight: 600;
}

.azl-usssa__meta {
	display: inline-block;
	font-size: var(--azl-size-min);
	color: var(--azl-muted);
	font-weight: 400;
}

.azl-usssa__pos {
	color: var(--azl-win);
	font-weight: 600;
}

.azl-usssa__neg {
	color: var(--azl-loss);
	font-weight: 600;
}

/* --- Game list ----------------------------------------------------------- */

.azl-usssa__group {
	margin-bottom: 1.75rem;
}

.azl-usssa__group-title {
	display: flex;
	align-items: baseline;
	gap: 0.6rem;
	margin: 0 0 0.6rem;
	font-size: var(--azl-size-lg);
	padding-bottom: 0.4rem;
	border-bottom: 2px solid var(--azl-border);
}

.azl-usssa__group-record {
	font-size: var(--azl-size-min);
	font-weight: 600;
	color: var(--azl-muted);
	padding: 0.1rem 0.45rem;
	border: 1px solid var(--azl-border);
	border-radius: 999px;
}

.azl-usssa__games {
	list-style: none;
	margin: 0;
	padding: 0;
}

.azl-usssa__game {
	display: grid;
	grid-template-columns: 2.1rem 5.25rem 1fr auto;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.5rem;
	border-bottom: 1px solid var(--azl-border);
}

.azl-usssa__game:hover {
	background: var(--azl-row-hover);
}

.azl-usssa__game-result {
	display: grid;
	place-items: center;
	width: 2.1rem;
	height: 2.1rem;
	border-radius: 50%;
	font-size: var(--azl-size-min);
	font-weight: 700;
	color: #fff;
	background: var(--azl-tie);
}

.azl-usssa__game--win .azl-usssa__game-result {
	background: var(--azl-win);
}

.azl-usssa__game--loss .azl-usssa__game-result {
	background: var(--azl-loss);
}

.azl-usssa__game-score {
	font-size: 1.125rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}

.azl-usssa__game-opp {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.azl-usssa__game-date {
	color: var(--azl-muted);
	font-size: var(--azl-size-min);
	white-space: nowrap;
}

/* --- Player stats tables (GameChanger) ----------------------------------- */

.azl-usssa__jersey {
	color: var(--azl-muted);
	font-variant-numeric: tabular-nums;
	font-size: var(--azl-size-min);
}

.azl-usssa__player {
	font-weight: 600;
	white-space: nowrap;
}

/* Stat cells: tabular figures so decimal points line up down the column. */
.azl-usssa--stats .azl-usssa__table td {
	font-variant-numeric: tabular-nums;
}

/* Sortable headers */
.azl-usssa__table--sortable th {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.25rem;
}

.azl-usssa__table--sortable th:hover {
	background: color-mix(in srgb, var(--azl-primary) 85%, white);
}

.azl-usssa__table--sortable th::after {
	content: "";
	position: absolute;
	right: 0.45rem;
	top: 50%;
	transform: translateY(-50%);
	opacity: 0.35;
	border-left: 3px solid transparent;
	border-right: 3px solid transparent;
	border-bottom: 4px solid currentColor;
}

.azl-usssa__table--sortable th[aria-sort="descending"]::after {
	opacity: 1;
	border-bottom: 0;
	border-top: 4px solid currentColor;
}

.azl-usssa__table--sortable th[aria-sort="ascending"]::after {
	opacity: 1;
}

/* --- Season leader cards -------------------------------------------------- */

.azl-usssa__leaders {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
	gap: var(--azl-gap);
}

.azl-usssa__leader {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--azl-border);
	border-top: 3px solid var(--azl-accent);
	border-radius: var(--azl-radius);
	background: var(--azl-row-alt);
}

.azl-usssa__leader-cat {
	font-size: var(--azl-size-min);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--azl-muted);
}

.azl-usssa__leader-val {
	font-size: var(--azl-size-2xl);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	color: var(--azl-primary);
}

.azl-usssa__leader-who {
	font-size: var(--azl-size-min);
	font-weight: 600;
}

/* --- Freshness stamp ----------------------------------------------------- */

.azl-usssa__updated {
	font-size: var(--azl-size-min);
	color: var(--azl-muted);
	margin: 0 0 var(--azl-gap);
	font-style: italic;
}

/* --- Mobile: collapse tables into stacked cards -------------------------- */

@media (max-width: 640px) {
	.azl-usssa__table thead {
		/* Visually hidden, still read by screen readers via data-label pairing. */
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.azl-usssa__table,
	.azl-usssa__table tbody,
	.azl-usssa__table tr,
	.azl-usssa__table td {
		display: block;
		width: 100%;
	}

	.azl-usssa__table tr {
		margin-bottom: 0.75rem;
		border: 1px solid var(--azl-border);
		border-radius: var(--azl-radius);
		overflow: hidden;
	}

	.azl-usssa__table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 1rem;
		text-align: right;
		border-bottom: 1px solid var(--azl-border);
	}

	.azl-usssa__table td:last-child {
		border-bottom: 0;
	}

	.azl-usssa__table td::before {
		content: attr(data-label);
		font-size: var(--azl-size-min);
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: var(--azl-muted);
		text-align: left;
		flex: 0 0 auto;
	}

	/*
	 * EXCEPTION: stat tables stay tables on mobile.
	 *
	 * The card-stacking above is right for schedule/results (6 columns), but a
	 * batting table has 17. Stacked, that's 17 label/value rows per player and
	 * roughly a screen and a half of scrolling per kid. A box score is a grid —
	 * people read ACROSS it to compare players. So we keep the grid and scroll
	 * it sideways, with the player column frozen so you never lose track of
	 * whose row you're on.
	 */
	.azl-usssa--stats .azl-usssa__table thead {
		position: static;
		width: auto;
		height: auto;
		clip: auto;
		clip-path: none;
	}

	.azl-usssa--stats .azl-usssa__table,
	.azl-usssa--stats .azl-usssa__table tbody,
	.azl-usssa--stats .azl-usssa__table thead {
		display: table;
		width: 100%;
	}

	.azl-usssa--stats .azl-usssa__table thead {
		display: table-header-group;
	}

	.azl-usssa--stats .azl-usssa__table tbody {
		display: table-row-group;
	}

	.azl-usssa--stats .azl-usssa__table tr {
		display: table-row;
		margin: 0;
		border: 0;
		border-radius: 0;
	}

	.azl-usssa--stats .azl-usssa__table td {
		display: table-cell;
		width: auto;
		text-align: right;
		justify-content: unset;
		border-bottom: 1px solid var(--azl-border);
	}

	.azl-usssa--stats .azl-usssa__table td::before {
		content: none;
	}

	/* Freeze the player column while the stats scroll under it. */
	.azl-usssa--stats .azl-usssa__table th:nth-child(2),
	.azl-usssa--stats .azl-usssa__table td:nth-child(2) {
		position: sticky;
		left: 0;
		z-index: 1;
		text-align: left;
		background: var(--azl-bg, #fff);
		box-shadow: 1px 0 0 var(--azl-border);
	}

	.azl-usssa--stats .azl-usssa__table th:nth-child(2) {
		background: var(--azl-primary);
		z-index: 2;
	}

	.azl-usssa--stats .azl-usssa__table tbody tr:nth-child(even) td:nth-child(2) {
		background: #f6f6f7;
	}

	/* Jersey number is the least useful column on a phone — hide it. */
	.azl-usssa--stats .azl-usssa__table th:first-child,
	.azl-usssa--stats .azl-usssa__table td:first-child {
		display: none;
	}

	.azl-usssa__game {
		grid-template-columns: 2.1rem 5.25rem 1fr;
		grid-template-areas:
			"result score opp"
			"date   date  date";
	}

	.azl-usssa__game-result {
		grid-area: result;
	}

	.azl-usssa__game-score {
		grid-area: score;
	}

	.azl-usssa__game-opp {
		grid-area: opp;
	}

	.azl-usssa__game-date {
		grid-area: date;
	}
}

/* --- Print (parents genuinely print these) ------------------------------- */

@media print {
	.azl-usssa__table th {
		background: #000 !important;
		color: #fff !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* ==========================================================================
   [azlions_page] — full page shell
   ========================================================================== */

.azl-page {
	--azl-page-navh: 3.5rem;
}

/* --- Header -------------------------------------------------------------- */

.azl-page__head {
	margin-bottom: 2rem;
}

.azl-page__eyebrow {
	display: block;
	color: var(--azl-accent);
	font-weight: 700;
	font-size: var(--azl-size-min);
	text-transform: uppercase;
	letter-spacing: 0.14em;
	margin-bottom: 0.5rem;
}

.azl-page__h1 {
	margin: 0 0 1.5rem;
	line-height: 1.05;
	text-transform: uppercase;
	font-weight: 800;
	letter-spacing: -0.015em;
}

/* Optional intro sentence under the h1 */
.azl-page__intro {
	margin: 0 0 1.5rem;
	max-width: 46rem;
	font-size: 1.125rem;
	line-height: 1.55;
	color: var(--azl-muted);
}

/* KPI strip */
.azl-page__strip {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
	gap: var(--azl-gap);
}

.azl-page__kpi {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 1rem 1.1rem;
	background: var(--azl-primary);
	color: var(--azl-primary-ink);
	border-radius: var(--azl-radius);
	position: relative;
	overflow: hidden;
}

.azl-page__kpi::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	background: var(--azl-accent);
}

.azl-page__kpi-val {
	font-size: var(--azl-size-xl);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var(--azl-accent);
	font-variant-numeric: tabular-nums;
}

.azl-page__kpi-key {
	font-size: var(--azl-size-min);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.75;
}

.azl-page__kpi-key em {
	font-style: normal;
	opacity: 0.7;
}

/* --- Sticky sub-nav ------------------------------------------------------ */

.azl-page__nav {
	position: sticky;
	top: 0;
	z-index: 20;
	margin-bottom: 2.5rem;
	background: var(--azl-bg, #fff);
	border-bottom: 2px solid var(--azl-border);
	/* Bleed the sticky bar to the container edges so it doesn't look inset. */
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.azl-page__nav::-webkit-scrollbar {
	display: none;
}

.azl-page__nav ul {
	display: flex;
	gap: 0;
	list-style: none;
	margin: 0;
	padding: 0;
	white-space: nowrap;
}

.azl-page__nav a {
	display: block;
	padding: 0.9rem 1.1rem;
	font-size: var(--azl-size-min);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	text-decoration: none;
	color: var(--azl-muted);
	border-bottom: 3px solid transparent;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.azl-page__nav a:hover {
	color: var(--azl-text);
}

.azl-page__nav a.is-active {
	color: var(--azl-text);
	border-bottom-color: var(--azl-accent);
}

/* --- Sections ------------------------------------------------------------ */

.azl-page__section {
	/* Clears the sticky nav when you jump to an anchor, without JS. */
	scroll-margin-top: calc(var(--azl-page-navh) + 1.5rem);
	margin-bottom: 3.5rem;
}

.azl-page__section:last-child {
	margin-bottom: 2rem;
}

.azl-page__h2 {
	margin: 0 0 1.25rem;
	padding-bottom: 0.65rem;
	position: relative;
	line-height: 1.1;
	text-transform: uppercase;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.azl-page__h2::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 2.75rem;
	height: 3px;
	background: var(--azl-accent);
}

/* The inner shortcodes render with title="" — kill their own outer margin so
   the page controls all vertical rhythm. */
.azl-page__section .azl-usssa {
	margin: 0;
}

/* --- Provenance ---------------------------------------------------------- */

.azl-page__source {
	margin: 0;
	padding-top: 1.25rem;
	border-top: 1px solid var(--azl-border);
	font-size: var(--azl-size-min);
	color: var(--azl-muted);
}

.azl-page__source a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.azl-page__sep {
	opacity: 0.5;
	margin: 0 0.15rem;
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.azl-page__nav a {
		transition: none;
	}
}
