/* ==========================================================================
   STK Samobor – custom styles on top of the Kadence theme
   Loaded by wp-content/mu-plugins/stk-custom.php
   ========================================================================== */

:root {
	--stk-magenta: var(--global-palette1, #aa0042);
	--stk-magenta-dark: var(--global-palette2, #780010);
	--stk-line: #eadfe4;
	--stk-zebra: #faf6f8;
	--stk-hover: #f3e8ed;
}

/* --------------------------------------------------------------------------
   1. Content typography & legacy (classic editor / Word paste) clean-up
   -------------------------------------------------------------------------- */
.entry-content {
	line-height: 1.7;
	overflow-wrap: anywhere; /* long URLs / names never push the page wider */
}
.entry-content p:empty { display: none; }
.entry-content font,
.entry-content [style*="font-family"] { font-family: inherit !important; }
.entry-content font[size] { font-size: inherit; }
.entry-content a { text-underline-offset: 2px; }

.entry-content img { max-width: 100%; height: auto; }
.entry-content .wp-caption { max-width: 100% !important; }
.entry-content .wp-caption-text,
.entry-content figcaption { font-size: .85em; color: var(--global-palette6, #6e6e7a); }

/* --------------------------------------------------------------------------
   2. Tables – legacy tables carry fixed width/height attributes from Word
   -------------------------------------------------------------------------- */
.entry-content table {
	display: block;               /* lets wide tables scroll instead of breaking the page */
	width: 100% !important;
	max-width: 100%;
	height: auto !important;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 1.5em 0;
	border: 0;
	border-collapse: collapse;
	font-size: .95em;
	font-variant-numeric: tabular-nums;
	overflow-wrap: break-word; /* not "anywhere": keeps "1." and scores in one piece */
}
.entry-content table > tbody,
.entry-content table > thead {
	display: table;
	width: 100%;
	border-collapse: collapse;
}
.entry-content table tr,
.entry-content table td,
.entry-content table th {
	height: auto !important;
}
.entry-content table td,
.entry-content table th {
	width: auto !important;
	padding: .55em .8em;
	border: 0;
	border-bottom: 1px solid var(--stk-line);
	vertical-align: top;
	text-align: left;
}
.entry-content table td[style*="center"],
.entry-content table th[style*="center"] { text-align: center; }
.entry-content table td p { margin: 0; }

/* header row: real <th>, or the first row of result tables (4+ columns, no images).
   Short ranking tables (1. / 2. / 3.) start with data, so they get no header styling. */
.entry-content table:not(:has(img)):has(td:nth-child(4)) tbody tr:first-child td,
.entry-content table th {
	font-weight: 600;
	color: var(--global-palette3, #1a1a1f);
	border-bottom: 2px solid var(--stk-magenta);
	background: #fff;
}
.entry-content table tbody tr:nth-child(even) td { background: var(--stk-zebra); }
.entry-content table tbody tr:hover td { background: var(--stk-hover); }
.entry-content table td:first-child { white-space: nowrap; } /* positions, dates */
.entry-content table:has(img) td:first-child { white-space: normal; }

/* result links (e.g. "4-6") read like scores */
.entry-content table td a { font-weight: 600; }

/* tables used only as image/text layout: no zebra, no header styling */
.entry-content table:has(img) tbody tr td {
	background: transparent;
	font-weight: inherit;
	border-bottom: 1px solid var(--stk-line);
	vertical-align: middle;
}
.entry-content table img { display: block; margin: 0 auto; }

/* --------------------------------------------------------------------------
   3. Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
	.entry-content table { font-size: .875em; }
	.entry-content table td,
	.entry-content table th { padding: .45em .55em; }

	/* wide data tables (4+ columns) keep readable columns and scroll sideways */
	.entry-content table:not(:has(img)):has(td:nth-child(4)) > tbody { min-width: 560px; }
	.entry-content table:not(:has(img)):has(td:nth-child(4)) td { white-space: nowrap; }

	/* front page sections need side padding on phones */
	.home .entry-content > .wp-block-group:not(.alignfull),
	.home .entry-content > .wp-block-group.alignfull > * {
		padding-left: 1.25rem !important;
		padding-right: 1.25rem !important;
	}

	/* image/text layout tables: stack cells */
	.entry-content table:has(img),
	.entry-content table:has(img) > tbody,
	.entry-content table:has(img) tr,
	.entry-content table:has(img) td {
		display: block;
		width: 100% !important;
	}
	.entry-content table:has(img) td { border-bottom: 0; padding: .5em 0; }
	.entry-content table:has(img) tr { border-bottom: 1px solid var(--stk-line); padding: .5em 0; }

	/* floated images: no tiny text columns next to them */
	.entry-content .alignleft,
	.entry-content .alignright {
		float: none;
		display: block;
		margin: 1em auto;
	}

	/* long titles */
	.entry-title, h1.entry-title { font-size: clamp(1.5rem, 6.5vw, 2rem); line-height: 1.25; }
	.entry-content h2 { font-size: 1.4rem; }
	.entry-content h3 { font-size: 1.2rem; }

	/* content card padding on small screens */
	.content-bg .entry-content-wrap { padding: 1.25rem; }
}

/* hint that a table scrolls sideways */
@media (max-width: 767px) {
	.entry-content table:not(:has(img)):has(td:nth-child(4)) {
		background:
			linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left/24px 100% no-repeat local,
			linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right/24px 100% no-repeat local,
			radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.15), transparent) left/10px 100% no-repeat scroll,
			radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.15), transparent) right/10px 100% no-repeat scroll;
	}
}

/* --------------------------------------------------------------------------
   4. Front page
   -------------------------------------------------------------------------- */
.home .wp-block-cover h1 { font-size: clamp(2rem, 7vw, 3.25rem) !important; line-height: 1.15; }
.home .wp-block-cover { min-height: clamp(320px, 55vh, 480px) !important; }

/* news cards from the query block */
.home .wp-block-post-template > li {
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.05);
	padding-bottom: 1rem;
	transition: transform .15s ease, box-shadow .15s ease;
}
.home .wp-block-post-template > li:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.08), 0 12px 28px rgba(0,0,0,.08); }
.home .wp-block-post-template > li > *:not(.wp-block-post-featured-image) { padding-left: 1rem; padding-right: 1rem; }
.home .wp-block-post-template .wp-block-post-featured-image { margin-bottom: .75rem; }
.home .wp-block-post-template .wp-block-post-featured-image img { border-radius: 0 !important; }
.home .wp-block-post-template .wp-block-post-date { margin-top: 0; }
.home .wp-block-post-template .wp-block-post-title { margin: .25rem 0 .5rem; }
.home .wp-block-post-template .wp-block-post-title a { text-decoration: none; color: var(--global-palette3); }
.home .wp-block-post-template .wp-block-post-title a:hover { color: var(--stk-magenta); }
.home .wp-block-post-template .wp-block-post-excerpt__excerpt { margin: 0; font-size: .95em; }

/* quick-link cards */
.home .wp-block-column.has-background h3 a { text-decoration: none; color: var(--global-palette3); }
.home .wp-block-column.has-background:hover h3 a { color: var(--stk-magenta); }
.home .wp-block-column.has-background { transition: box-shadow .15s ease; }
.home .wp-block-column.has-background:hover { box-shadow: 0 6px 18px rgba(170,0,66,.12); }

@media (max-width: 781px) {
	.home .wp-block-post-template.is-layout-grid { grid-template-columns: 1fr !important; }
}

/* --------------------------------------------------------------------------
   5. Sidebar & archive
   -------------------------------------------------------------------------- */
.primary-sidebar .widget-title,
.primary-sidebar .widgettitle {
	font-size: .8rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding-bottom: .5rem;
	border-bottom: 2px solid var(--stk-magenta);
}
.primary-sidebar .widget ul { list-style: none; padding-left: 0; }
.primary-sidebar .widget ul li { padding: .35rem 0; border-bottom: 1px solid var(--stk-line); }
.primary-sidebar .widget ul li a { text-decoration: none; }
/* club anthem: verse lines, not paragraphs */
.primary-sidebar .textwidget p { margin: 0 0 .15em; font-style: italic; color: var(--global-palette5); }
.primary-sidebar .textwidget p:nth-last-child(-n+2) { margin-top: .8em; font-style: normal; font-size: .85em; }

/* don't show the shared admin username ("stksamobor") as author */
.entry-meta .posted-by { display: none; }

/* archive cards without featured image still look like cards */
.loop-entry .entry-content-wrap { padding-top: 1.25rem; }
