/*
Theme Name: Hrejcesky
Description: Vlastní bloková šablona webu hrejcesky.cz. Design tokeny jsou v theme.json, logika webu v pluginu Hrejcesky Core.
Version: 0.3.2
Requires at least: 6.6
Requires PHP: 8.1
Author: hrejcesky.cz
Text Domain: hrejcesky
*/

/* ---------- Režimy ----------
   Tmavý režim je výchozí (hodnoty v theme.json). Světlý režim přepisuje stejné proměnné,
   takže ho automaticky přebírají všechny bloky i vlastní komponenty. */

:root {
	color-scheme: dark;
	/* Barvy palety se v theme.json jmenují border-main, text-main a link-main. Slugy border, text a link by vytvořily
	   třídy has-border-color, has-text-color a has-link-color, kterými WordPress značí jen to, že blok má nastavenou
	   barvu rámečku, textu nebo odkazů, a přebarvily by mu text. Původní názvy proměnných zůstávají jako odkaz. */
	--wp--preset--color--border: var(--wp--preset--color--border-main);
	--wp--preset--color--text: var(--wp--preset--color--text-main);
	--wp--preset--color--link: var(--wp--preset--color--link-main);
	--hc-on-accent: #fff;
	--hc-focus: var(--wp--preset--color--link);
	--hc-text-soft: #c5ccd6;
	--hc-success-soft: rgba(47, 191, 113, 0.16);
	--hc-info-soft: rgba(91, 141, 239, 0.16);
	--hc-info: #7fa6f2;
	/* Kontrast AA: bílý text na tlačítku a drobný červený nebo zelený text potřebují tmavší či světlejší odstín než základní token. */
	--hc-accent-fill: #d62f32;
	--hc-accent-text: #f0575a;
	--hc-success-text: var(--wp--preset--color--success);
}

html[data-theme="light"] {
	color-scheme: light;
	--wp--preset--color--bg: #f5f6f8;
	--wp--preset--color--surface: #fff;
	--wp--preset--color--surface-2: #eef0f3;
	--wp--preset--color--border-main: #dde1e7;
	--wp--preset--color--text-main: #12161c;
	--wp--preset--color--text-muted: #5b6573;
	--wp--preset--color--accent: #d62f32;
	--wp--preset--color--link-main: #2f5fd0;
	--wp--preset--color--link-hover: #1f47a8;
	--wp--preset--color--success: #1e9e5a;
	--wp--preset--color--warning: #c97f00;
	--hc-text-soft: #323a45;
	--hc-success-soft: rgba(30, 158, 90, 0.14);
	--hc-info-soft: rgba(47, 95, 208, 0.12);
	--hc-info: #2f5fd0;
	--hc-accent-text: #c92a2d;
	--hc-success-text: #147a3b;
}

/* ---------- Základ ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.wp-site-blocks > * {
	margin-block-start: 0;
}

.wp-site-blocks > main {
	flex: 1 0 auto;
	padding-block: var(--wp--preset--spacing--70);
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--hc-focus);
	outline-offset: 2px;
}

.hc-container {
	width: 100%;
	max-width: calc(1200px + 2 * var(--wp--preset--spacing--50));
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--50);
}

.hc-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
	cursor: pointer;
}

.hc-icon-button:hover {
	border-color: var(--wp--preset--color--text-muted);
}

.hc-icon-button svg {
	width: 20px;
	height: 20px;
}

/* ---------- Hlavička ---------- */

.hc-header {
	position: relative;
	z-index: 20;
	border-bottom: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--bg);
}

.hc-header__inner {
	display: flex;
	align-items: center;
	gap: 16px 32px;
	padding-block: 16px;
}

.hc-logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--wp--preset--color--text);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
}

.hc-logo:hover {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hc-logo__mark {
	flex: none;
	width: 36px;
	height: 36px;
	fill: var(--hc-accent-fill);
}

.hc-logo__mark text {
	fill: var(--hc-on-accent);
	font-size: 19px;
	letter-spacing: -0.5px;
}

.hc-logo__text {
	font-size: 0.84em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hc-logo__accent {
	color: var(--wp--preset--color--accent);
}

.hc-logo__tld {
	color: var(--wp--preset--color--text-muted);
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
}

.hc-nav {
	flex: 1 1 auto;
}

.hc-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 15px;
	font-weight: 500;
}

.hc-nav__link {
	display: inline-block;
	padding-block: 10px;
	color: var(--wp--preset--color--text-muted);
	text-decoration: none;
}

.hc-nav__link:hover,
.hc-nav__link[aria-current] {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hc-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-inline-start: auto;
}

.hc-menu-toggle {
	display: none;
}

.hc-theme-toggle__sun,
html[data-theme="light"] .hc-theme-toggle__moon {
	display: none;
}

html[data-theme="light"] .hc-theme-toggle__sun {
	display: block;
}

.hc-search-panel {
	border-top: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--surface);
}

.hc-search-panel[hidden] {
	display: none;
}

.hc-search-form {
	display: flex;
	gap: 8px;
	padding-block: 16px;
}

.hc-search-form__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 52px;
	padding: 0 16px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--bg);
	color: var(--wp--preset--color--text);
	font: inherit;
}

.hc-search-form__input::placeholder {
	color: var(--wp--preset--color--text-muted);
	opacity: 1;
}

.hc-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 24px;
	border: 0;
	border-radius: var(--wp--custom--radius--button);
	background: var(--hc-accent-fill);
	color: var(--hc-on-accent);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.hc-button:hover {
	color: var(--hc-on-accent);
	filter: brightness(1.08);
	text-decoration: none;
}

/* Hlavička zůstává při rolování přilepená nahoře (obal části šablony je přímý potomek stránky).
   Přihlášenému redaktorovi se posune pod lištu administrace. */
.wp-site-blocks > .wp-block-template-part:first-child {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 20;
}

/* Kotvy v textu se nesmí schovat pod přilepenou hlavičku. */
html {
	scroll-padding-top: 88px;
}

@media (max-width: 600px) {
	/* Lišta administrace na úzkém displeji odroluje se stránkou. */
	.wp-site-blocks > .wp-block-template-part:first-child {
		top: 0;
	}
}

@media (max-width: 899px) {
	.hc-header__inner {
		flex-wrap: wrap;
		gap: 0 4px;
		min-height: 60px;
		padding-block: 8px;
	}

	.hc-logo {
		gap: 8px;
		font-size: 19px;
	}

	.hc-logo__mark {
		width: 30px;
		height: 30px;
	}

	.hc-header__actions {
		gap: 4px;
	}

	.hc-header .hc-icon-button {
		border-color: transparent;
		background: transparent;
	}

	.hc-header .hc-icon-button svg {
		width: 22px;
		height: 22px;
	}

	.hc-menu-toggle {
		display: inline-flex;
	}

	.hc-nav {
		flex: 1 0 100%;
		order: 3;
		display: none;
	}

	.hc-header.is-menu-open .hc-nav {
		display: block;
	}

	.hc-nav__list {
		flex-direction: column;
		gap: 0;
		padding-block: 8px;
		font-size: 16px;
	}

	.hc-nav__link {
		display: block;
		padding-block: 12px;
	}
}

@media (max-width: 599px) {
	.hc-container {
		padding-inline: var(--wp--preset--spacing--40);
	}

	body {
		--wp--style--root--padding-left: var(--wp--preset--spacing--40);
		--wp--style--root--padding-right: var(--wp--preset--spacing--40);
	}
}

/* ---------- Patička ---------- */

.hc-footer {
	border-top: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text-muted);
	font-size: 14px;
}

.hc-footer__inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 24px;
	padding-block: 40px;
}

.hc-footer__brand {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 360px;
}

.hc-footer__brand p {
	margin: 0;
}

.hc-footer .hc-logo {
	font-size: 18px;
}

.hc-footer__stats strong {
	color: var(--wp--preset--color--text);
	font-weight: 600;
}

.hc-footer__social {
	display: flex;
	gap: 8px;
}

.hc-social-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--button);
	color: var(--wp--preset--color--text);
	font-weight: 600;
	text-decoration: none;
}

.hc-social-link:hover {
	border-color: var(--wp--preset--color--text-muted);
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hc-social-link svg {
	width: 18px;
	height: 18px;
}

.hc-footer__nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hc-footer__nav a {
	display: inline-block;
	padding-block: 8px;
	color: var(--wp--preset--color--text-muted);
	text-decoration: none;
}

.hc-footer__nav a:hover {
	color: var(--wp--preset--color--text);
}

@media (max-width: 599px) {
	.hc-footer__inner {
		flex-direction: column;
		gap: 16px;
		padding-block: 28px 40px;
	}

	.hc-footer__social {
		order: -1;
	}

	.hc-social-link {
		flex: 1 1 0;
		justify-content: center;
	}

	.hc-footer__nav ul {
		gap: 0 20px;
	}
}

/* ---------- Našeptávač hledání ---------- */

.hc-suggest-wrap {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
}

.hc-suggest-wrap > input {
	flex: 1 1 auto;
	width: 100%;
}

.hc-suggest {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	z-index: 30;
	margin: 0;
	padding: 6px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--surface);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
	list-style: none;
	text-align: left;
}

.hc-suggest[hidden] {
	display: none;
}

.hc-suggest__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	color: var(--wp--preset--color--text);
	text-decoration: none;
	cursor: pointer;
}

.hc-suggest__item[aria-selected="true"],
.hc-suggest__item:hover {
	background: var(--wp--preset--color--surface-2);
}

.hc-suggest__cover {
	flex: 0 0 auto;
	width: 36px;
	height: 48px;
	border-radius: 6px;
	background: var(--wp--preset--color--surface-2);
	object-fit: cover;
}

.hc-suggest__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.hc-suggest__title {
	overflow: hidden;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hc-suggest__meta {
	color: var(--wp--preset--color--text-muted);
	font-size: 13px;
}

.hc-suggest__empty {
	padding: 10px;
	color: var(--wp--preset--color--text-muted);
	font-size: 14px;
}

/* ---------- Sdílené komponenty ---------- */

/* Stránky s vlastním rozvržením přes celou šířku (detail hry). */
.wp-site-blocks > main.hc-main-flush {
	padding-block: 0;
}

.hc-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--wp--preset--color--text-muted);
	font-size: 14px;
}

.hc-breadcrumb a {
	display: inline-block;
	padding-block: 4px;
}

.hc-breadcrumb li {
	display: flex;
	align-items: center;
}

.hc-breadcrumb li + li::before {
	content: "›";
	margin-inline-end: 8px;
}

.hc-breadcrumb--muted a {
	color: var(--wp--preset--color--text-muted);
	text-decoration: none;
}

.hc-breadcrumb--muted a:hover {
	color: var(--wp--preset--color--text);
	text-decoration: underline;
}

.hc-pill {
	display: inline-block;
	padding: 4px 10px;
	border-radius: var(--wp--custom--radius--pill);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.hc-pill--dark {
	padding: 5px 12px;
	background: rgba(14, 17, 22, 0.75);
	color: #e8ecf1;
	font-size: 13px;
	font-weight: 500;
}

.hc-pill--success {
	background: var(--hc-success-soft);
	color: var(--hc-success-text);
}

.hc-pill--info {
	background: var(--hc-info-soft);
	color: var(--hc-info);
}

/* Štítek slevy (stránka Slevy, úvod, box „Kde koupit“). */
.hc-deal__badge {
	display: inline-block;
	padding: 4px 9px;
	border-radius: 8px;
	background: var(--hc-success-soft);
	color: var(--hc-success-text);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

.hc-avatar {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 999px;
	background: var(--wp--preset--color--surface-2);
	color: var(--wp--preset--color--text);
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
}

.hc-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hc-cards {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.hc-cards--compact {
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.hc-game-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hc-game-card:hover {
	border-color: var(--wp--preset--color--text-muted);
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hc-game-card__cover {
	position: relative;
	display: block;
	aspect-ratio: 3 / 4;
	background: var(--wp--preset--color--surface-2);
}

.hc-game-card__cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hc-game-card__tag {
	position: absolute;
	top: 8px;
	left: 8px;
	max-width: calc(100% - 16px);
	overflow: hidden;
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 600;
	text-overflow: ellipsis;
}

.hc-game-card__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 12px;
}

.hc-game-card__title {
	font-weight: 600;
	line-height: 1.3;
}

.hc-game-card__meta {
	color: var(--wp--preset--color--text-muted);
	font-size: 13px;
}

@media (max-width: 899px) {
	.hc-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {
	.hc-cards,
	.hc-cards--compact {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.hc-game-card,
	.hc-shop,
	.hc-button {
		transition: border-color 0.15s, filter 0.15s;
	}
}

/* ---------- Obsah ---------- */

.hc-card {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--surface);
}

/* Tlačítka v obsahu článku se nepodtrhávají. */
.wp-block-post-content a:where(:not(.wp-element-button)) {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
	.hc-icon-button,
	.hc-social-link,
	.hc-nav__link {
		transition: color 0.15s, border-color 0.15s;
	}
}
