/*
 * Blocks: styles for the core blocks allowed in content (see inc/editor.php).
 */

/* Content width: children of post/page content are constrained to contentSize,
 * .alignwide to wideSize, .alignfull spans the viewport. */
.entry-content > * {
	max-width: var(--wp--style--global--content-size, 720px);
	margin-inline: auto;
}

.entry-content > .alignwide {
	max-width: var(--wp--style--global--wide-size, 1200px);
}

.entry-content > .alignfull {
	max-width: none;
	width: 100vw;
	margin-inline: calc(50% - 50vw);
}

/* core/heading */
.entry-content :where(h2, h3, h4, h5, h6) {
	margin-block-start: 1.5em;
}

/* core/image, core/gallery */
.wp-block-image,
.wp-block-gallery {
	margin-block: 0 var(--wp--preset--spacing--40);
}

/* Gallery: even grid of cropped thumbnails (the lightbox shows the full image). */
.wp-block-gallery.wp-block-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
	gap: 12px;

	> .wp-block-image {
		width: auto;
		margin: 0;
	}

	> .wp-block-image img {
		width: 100%;
		height: 160px;
		object-fit: cover;
		border-radius: var(--wp--custom--radius-small);
	}

	> .wp-block-image a {
		display: block;
		cursor: zoom-in;
	}
}

.wp-element-caption,
.wp-block-image figcaption {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin-block-start: 0.5em;
}

/* core/list, style "numbered": 01, 02 … rows with dividers */
.is-style-numbered {
	list-style: none;
	padding: 0;
	counter-reset: vys-numbered;

	> li {
		display: flex;
		gap: 16px;
		padding-block: 14px;
		border-block-start: 1px solid var(--wp--preset--color--line);
		counter-increment: vys-numbered;

		&:last-child {
			border-block-end: 1px solid var(--wp--preset--color--line);
		}

		&::before {
			content: counter(vys-numbered, decimal-leading-zero);
			flex: none;
			font-family: var(--wp--preset--font-family--heading);
			font-weight: 700;
			color: var(--wp--preset--color--gold-dark);
		}
	}
}

/* core/file: download row (document icon, file name, "Stiahnuť") */
.wp-block-file {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius);

	&::before {
		content: "";
		flex: none;
		width: 28px;
		height: 28px;
		background: var(--wp--preset--color--gold-dark);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3C/svg%3E") center / contain no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3C/svg%3E") center / contain no-repeat;
	}

	> a:not(.wp-block-file__button) {
		flex: 1;
		font-weight: 700;
		color: var(--wp--preset--color--ink);
		text-decoration: none;

		&:hover {
			text-decoration: underline;
		}
	}

	.wp-block-file__button.wp-block-file__button {
		flex: none;
		border-radius: 0;
		padding: 0;
		background: none;
		border: 0;
		font-size: 15px;
		font-weight: 700;
		color: var(--wp--preset--color--gold-dark);
		text-decoration: none;

		&:hover {
			color: var(--wp--preset--color--gold-darker);
			text-decoration: underline;
		}
	}
}

.wp-block-file + .wp-block-file {
	margin-block-start: -10px; /* rows sit 10px apart, as in the design */
}

/* core/quote */
.wp-block-quote {
	border-inline-start: 3px solid var(--wp--preset--color--gold);
	padding-block: 8px;
	padding-inline-start: 28px;
	margin-inline: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-style: italic;
	font-size: 26px;
	line-height: 1.45;
	color: var(--wp--preset--color--ink);

	cite {
		display: block;
		margin-block-start: 0.5em;
		font-family: var(--wp--preset--font-family--body);
		font-size: var(--wp--preset--font-size--small);
		color: var(--wp--preset--color--muted);
		font-style: normal;
	}
}

/* core/table */
.wp-block-table {
	overflow-x: auto;

	table {
		border-collapse: collapse;
		width: 100%;
	}

	:where(th, td) {
		border: 1px solid var(--wp--preset--color--parchment);
		padding: 0.5em 0.75em;
		text-align: start;
	}

	thead {
		border-block-end: 2px solid var(--wp--preset--color--ink);
	}
}

/* core/buttons, core/button: same look as the theme's .button--primary / --secondary.
 * Every state sets its own text colour, so the global link hover never applies. */
.wp-block-button__link.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 26px;
	border: 1.5px solid var(--wp--preset--color--red);
	border-radius: var(--wp--custom--radius-small);
	background: var(--wp--preset--color--red);
	color: var(--wp--preset--color--white);
	font-weight: 700;
	text-decoration: none;

	&:hover,
	&:focus-visible {
		border-color: var(--wp--preset--color--ink);
		background: var(--wp--preset--color--ink);
		color: var(--wp--preset--color--white);
	}
}

.is-style-outline > .wp-block-button__link.wp-block-button__link {
	border-color: var(--wp--preset--color--ink);
	background: transparent;
	color: var(--wp--preset--color--ink);

	&:hover,
	&:focus-visible {
		background: var(--wp--preset--color--ink);
		color: var(--wp--preset--color--cream);
	}
}

/* core/separator */
.wp-block-separator {
	border: 0;
	border-block-start: 1px solid var(--wp--preset--color--parchment);
	margin-block: var(--wp--preset--spacing--50);
}

/* core/embed */
.wp-block-embed {
	margin-block: 0 var(--wp--preset--spacing--40);
}

/* core/group */
.wp-block-group.has-background {
	padding: var(--wp--preset--spacing--40);
}
