/**
 * Craftvyn global front end styles.
 *
 * Colours, typography and spacing come from theme.json through
 * --wp--preset--* custom properties, so niche style variations restyle
 * everything automatically.
 */

/* Skip link (core adds .skip-link on block themes). */
.skip-link.screen-reader-text:focus {
	background-color: var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius--small);
	/* stylelint-disable-next-line property-no-deprecated -- Matches core's screen reader text reset. */
	clip: auto;
	clip-path: none;
	color: var(--wp--preset--color--base);
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	height: auto;
	left: 0.5rem;
	line-height: normal;
	padding: 0.875rem 1.5rem;
	text-decoration: none;
	top: 0.5rem;
	width: auto;
	z-index: 100000;
}

/* Sticky header. */
.craftvyn-header {
	position: sticky;
	top: 0;
	z-index: 50;
	transition: box-shadow var(--wp--custom--transition);
}

.admin-bar .craftvyn-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

.craftvyn-header.is-scrolled {
	box-shadow: var(--wp--preset--shadow--soft);
}

/* Form fields. Also styles most form plugins that output standard markup. */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.4;
	max-width: 100%;
	padding: 0.7em 0.9em;
	transition: border-color var(--wp--custom--transition), box-shadow var(--wp--custom--transition);
}

textarea {
	min-height: 8rem;
	width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 3px var(--wp--preset--color--border);
}

input[type="submit"],
button[type="submit"]:not(.wp-element-button) {
	background-color: var(--wp--preset--color--primary);
	border: 0;
	border-radius: var(--wp--custom--radius--medium);
	color: var(--wp--preset--color--base);
	cursor: pointer;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	padding: 0.9em 1.6em;
	transition: background-color var(--wp--custom--transition);
}

input[type="submit"]:hover,
button[type="submit"]:not(.wp-element-button):hover {
	background-color: var(--wp--preset--color--primary-dark);
}

::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

/* Post content helpers. */
.wp-block-post-content :where(img, video) {
	height: auto;
	max-width: 100%;
}

.wp-block-table {
	overflow-x: auto;
}

.wp-block-post-featured-image img {
	display: block;
}

/* Default image radius. The core "Rounded" style keeps priority. */
.wp-block-image:not(.is-style-rounded) img {
	border-radius: var(--wp--custom--radius--medium);
}

/* Cards in query loops lift slightly on hover. */
.craftvyn-post-card {
	transition: box-shadow var(--wp--custom--transition), transform var(--wp--custom--transition);
}

.craftvyn-post-card:hover,
.craftvyn-post-card:focus-within {
	box-shadow: var(--wp--preset--shadow--medium);
	transform: translateY(-2px);
}

/* Anchored sections should not hide under the sticky header. */
[id] {
	scroll-margin-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {

	.craftvyn-post-card:hover,
	.craftvyn-post-card:focus-within {
		transform: none;
	}
}

/* Layout: no gap between the page content and the footer. */
.wp-site-blocks > .wp-block-template-part:last-child {
	margin-block-start: 0;
}

/* Links on dark backgrounds. */
:is(.has-dark-background-color, .has-primary-dark-background-color, .has-contrast-background-color, .has-dark-fade-gradient-background) a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--on-dark-muted);
}

:is(.has-primary-background-color, .has-primary-glow-gradient-background) a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--base);
}

:is(.has-dark-background-color, .has-primary-dark-background-color, .has-contrast-background-color, .has-primary-background-color, .has-dark-fade-gradient-background, .has-primary-glow-gradient-background) a:where(:not(.wp-element-button)):hover {
	color: var(--wp--preset--color--base);
}

.craftvyn-footer .wp-block-page-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.craftvyn-footer .wp-block-page-list a {
	text-decoration: none;
}

.craftvyn-footer .wp-block-separator {
	border-color: currentcolor;
	opacity: 0.2;
}

/* Search block. */
.wp-block-search__button {
	cursor: pointer;
}

.craftvyn-footer .wp-block-search__input {
	min-width: 0;
}

.craftvyn-footer .wp-block-search__inside-wrapper {
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* Cards whose last button group should sit at the bottom (pricing, plans). */
.craftvyn-card-stack > .wp-block-buttons {
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--30);
}

/* Media cards: an illustration on top of a padded body (menus, listings, classes, projects). */
.craftvyn-media-card {
	overflow: hidden;
	padding: 0;
}

.craftvyn-media-card > .wp-block-image {
	margin: 0;
}

.craftvyn-media-card > .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

.craftvyn-media-card > .wp-block-group {
	flex-grow: 1;
}

/* Tables: striped rows and a clear header row. */
.wp-block-table table {
	border-collapse: collapse;
	width: 100%;
}

.wp-block-table th,
.wp-block-table td {
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.65em 0.9em;
	text-align: start;
}

.wp-block-table thead th {
	background: var(--wp--preset--color--surface);
	border-bottom: 2px solid var(--wp--preset--color--primary);
	font-weight: 700;
}

.wp-block-table.is-style-stripes {
	border: 0;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--surface);
}

.wp-block-table.is-style-stripes th,
.wp-block-table.is-style-stripes td {
	border-color: var(--wp--preset--color--border);
}
