/**
 * Base: rendering, links, focus, button shape, forms.
 *
 * Colours, fonts and heading sizes come from the Customizer (Astra global palette
 * and typography). This file only covers what the Customizer doesn't expose.
 */

html {
	color-scheme: dark;
}

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

::selection {
	background-color: var(--lpz-accent);
	color: var(--lpz-on-accent);
}

/* ---------------------------------------------------------------- Headings */

h1, h2, h3, h4, h5, h6 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

small,
.lpz-muted {
	color: var(--lpz-text-muted);
}

hr {
	background-color: var(--lpz-border);
	border: 0;
	height: 1px;
}

/* ------------------------------------------------------------------- Links */

a {
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	transition: color var(--lpz-duration) var(--lpz-ease);
}

.entry-content a:not(.button, .wp-block-button__link, .ast-button) {
	text-decoration-line: underline;
}

/* ------------------------------------------------------------------- Focus */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
	outline: 2px solid var(--lpz-accent-hover);
	outline-offset: 2px;
	border-radius: 4px;
}

.skip-link:focus {
	background-color: var(--lpz-surface);
	color: var(--lpz-text);
	border-radius: var(--lpz-radius-sm);
	box-shadow: var(--lpz-shadow);
	z-index: 100000;
}

/* ----------------------------------------------------------------- Buttons */

.ast-button,
.ast-custom-button,
.button,
input#submit,
input[type="button"],
input[type="submit"],
input[type="reset"],
.wp-block-button .wp-block-button__link,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce-js a.button {
	border-radius: var(--lpz-radius-sm);
	font-weight: 700;
	letter-spacing: 0.02em;
	transition:
		background-color var(--lpz-duration) var(--lpz-ease),
		border-color var(--lpz-duration) var(--lpz-ease),
		color var(--lpz-duration) var(--lpz-ease),
		transform var(--lpz-duration) var(--lpz-ease);
}

.ast-button:active,
.button:active,
.wp-block-button__link:active,
input[type="submit"]:active {
	transform: translateY(1px);
}

/* Secondary/ghost button for components that need one. */
.lpz-button--ghost {
	background-color: transparent;
	border: 1px solid var(--lpz-border-strong);
	color: var(--lpz-text);
}

.lpz-button--ghost:hover,
.lpz-button--ghost:focus-visible {
	background-color: var(--lpz-surface-raised);
	border-color: var(--lpz-accent);
	color: var(--lpz-text);
}

/* ------------------------------------------------------------------- Forms */

input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
	background-color: var(--lpz-surface);
	border: 1px solid var(--lpz-border-strong);
	border-radius: var(--lpz-radius-sm);
	color: var(--lpz-text);
	transition: border-color var(--lpz-duration) var(--lpz-ease), box-shadow var(--lpz-duration) var(--lpz-ease);
}

input:focus,
textarea:focus,
select:focus {
	border-color: var(--lpz-accent);
	box-shadow: 0 0 0 3px var(--lpz-accent-soft);
	outline: 2px solid transparent; /* Keeps a visible focus in Windows high-contrast mode. */
}

::placeholder {
	color: var(--lpz-text-muted);
	opacity: 1;
}

label {
	color: var(--lpz-text);
}

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

table,
th,
td {
	border-color: var(--lpz-border);
}

th {
	color: var(--lpz-text);
}

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

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
