/**
 * INTERLUX — Base styles
 *
 * A light normalisation plus the default look of raw HTML elements.
 * No layout here: see layout.css.
 */

/* -------------------------------------------------------------------------
 * Reset — minimal on purpose
 * ---------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background-color: var(--ilx-color-bg);
	color: var(--ilx-color-text);
	font-family: var(--ilx-font-sans);
	font-size: var(--ilx-text-body);
	font-weight: var(--ilx-weight-regular);
	line-height: var(--ilx-leading-relaxed);
	letter-spacing: var(--ilx-tracking-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	/*
	 * Defence only, not the fix. The real cause of horizontal overflow was
	 * mega-menu panels staying in layout while closed (see header.css); that is
	 * solved structurally. This guard remains because legacy WPBakery rows on
	 * pages this theme does not control can still overrun their container.
	 */
	overflow-x: hidden;
}

/* -------------------------------------------------------------------------
 * Typography
 * ---------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
	margin: 0 0 var(--ilx-space-sm);
	color: var(--ilx-color-ink);
	font-family: var(--ilx-font-display);
	font-weight: var(--ilx-weight-regular);
	line-height: var(--ilx-leading-snug);
	letter-spacing: var(--ilx-tracking-heading);
	text-wrap: balance;
}

/* h5/h6 act as labels, so they stay on the sans. */
h5,
h6 {
	margin: 0 0 var(--ilx-space-sm);
	color: var(--ilx-color-ink);
	font-family: var(--ilx-font-sans);
	line-height: var(--ilx-leading-snug);
}

h1 {
	font-size: var(--ilx-text-h1);
	line-height: var(--ilx-leading-snug);
	letter-spacing: var(--ilx-tracking-display);
}

h2 {
	font-size: var(--ilx-text-h2);
}

h3 {
	font-size: var(--ilx-text-h3);
}

h4 {
	font-size: var(--ilx-text-h4);
}

h5,
h6 {
	font-size: var(--ilx-text-small);
	font-weight: var(--ilx-weight-semibold);
	letter-spacing: var(--ilx-tracking-label);
	text-transform: uppercase;
}

p {
	margin: 0 0 var(--ilx-space-sm);
	text-wrap: pretty;
}

p:last-child {
	margin-bottom: 0;
}

small {
	font-size: var(--ilx-text-small);
}

strong,
b {
	font-weight: var(--ilx-weight-semibold);
	color: var(--ilx-color-ink);
}

hr {
	height: 0;
	margin: var(--ilx-space-lg) 0;
	border: 0;
	border-top: var(--ilx-border-width) solid var(--ilx-color-line);
}

blockquote {
	margin: var(--ilx-space-md) 0;
	padding-left: var(--ilx-space-md);
	border-left: 2px solid var(--ilx-color-accent);
	color: var(--ilx-color-ink);
	font-size: var(--ilx-text-lead);
	font-weight: var(--ilx-weight-light);
	line-height: var(--ilx-leading-normal);
}

code,
kbd,
pre,
samp {
	font-family: var(--ilx-font-mono);
	font-size: 0.875em;
}

code {
	padding: 0.15em 0.4em;
	border-radius: var(--ilx-radius-sm);
	background-color: var(--ilx-color-surface-alt);
}

pre {
	overflow-x: auto;
	padding: var(--ilx-space-sm);
	border-radius: var(--ilx-radius-md);
	background-color: var(--ilx-color-surface-alt);
}

ul,
ol {
	margin: 0 0 var(--ilx-space-sm);
	padding-left: 1.25em;
}

li + li {
	margin-top: var(--ilx-space-3xs);
}

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

a {
	color: var(--ilx-color-ink);
	text-decoration-color: var(--ilx-color-line-strong);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	transition: color var(--ilx-transition), text-decoration-color var(--ilx-transition);
}

a:hover {
	color: var(--ilx-color-accent-strong);
	text-decoration-color: currentColor;
}

/* -------------------------------------------------------------------------
 * Media
 * ---------------------------------------------------------------------- */

img,
picture,
video,
canvas,
svg,
iframe {
	display: block;
	max-width: 100%;
}

img,
video {
	height: auto;
}

figure {
	margin: 0;
}

figcaption {
	margin-top: var(--ilx-space-2xs);
	color: var(--ilx-color-muted);
	font-size: var(--ilx-text-small);
}

/* WordPress caption/alignment classes still used by existing content. */
.wp-caption {
	max-width: 100%;
}

.wp-caption-text {
	margin-top: var(--ilx-space-2xs);
	color: var(--ilx-color-muted);
	font-size: var(--ilx-text-small);
}

.alignleft {
	float: left;
	margin: 0 var(--ilx-space-md) var(--ilx-space-sm) 0;
}

.alignright {
	float: right;
	margin: 0 0 var(--ilx-space-sm) var(--ilx-space-md);
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

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

input,
select,
textarea,
button {
	font: inherit;
	color: inherit;
}

label {
	display: inline-block;
	margin-bottom: var(--ilx-space-3xs);
	color: var(--ilx-color-ink);
	font-size: var(--ilx-text-small);
	font-weight: var(--ilx-weight-medium);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: var(--ilx-border-width) solid var(--ilx-color-line-strong);
	border-radius: var(--ilx-radius-sm);
	background-color: var(--ilx-color-surface);
	color: var(--ilx-color-text);
	font-size: var(--ilx-text-body);
	line-height: 1.4;
	transition: border-color var(--ilx-transition), box-shadow var(--ilx-transition);
}

textarea {
	min-height: 8rem;
	resize: vertical;
}

select {
	padding-right: 2.25rem;
	background-image: linear-gradient(45deg, transparent 50%, var(--ilx-color-muted) 50%),
		linear-gradient(135deg, var(--ilx-color-muted) 50%, transparent 50%);
	background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	appearance: none;
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--ilx-color-accent);
	outline: none;
	box-shadow: 0 0 0 3px var(--ilx-color-accent-soft);
}

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

input[type="checkbox"],
input[type="radio"] {
	width: 1rem;
	height: 1rem;
	margin-right: var(--ilx-space-3xs);
	accent-color: var(--ilx-color-accent);
	vertical-align: -2px;
}

fieldset {
	margin: 0 0 var(--ilx-space-md);
	padding: var(--ilx-space-md);
	border: var(--ilx-border-width) solid var(--ilx-color-line);
	border-radius: var(--ilx-radius-md);
}

legend {
	padding-inline: var(--ilx-space-2xs);
	font-size: var(--ilx-text-small);
	font-weight: var(--ilx-weight-semibold);
	letter-spacing: var(--ilx-tracking-label);
	text-transform: uppercase;
}

/* -------------------------------------------------------------------------
 * Buttons
 *
 * `.ilx-button` is the canonical class. Native button elements and the
 * WooCommerce `.button` class inherit the same look so plugin markup we do
 * not control still reads as ours.
 * ---------------------------------------------------------------------- */

.ilx-button,
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ilx-space-2xs);
	padding: 0.9rem 1.75rem;
	border: var(--ilx-border-width) solid var(--ilx-color-ink);
	border-radius: var(--ilx-radius-sm);
	background-color: var(--ilx-color-ink);
	color: var(--ilx-color-on-dark);
	font-size: var(--ilx-button-size);
	font-weight: var(--ilx-weight-medium);
	letter-spacing: var(--ilx-tracking-label);
	line-height: 1;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--ilx-transition), border-color var(--ilx-transition),
		color var(--ilx-transition);
}

.ilx-button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.wp-block-button__link:hover {
	border-color: var(--ilx-color-accent-strong);
	background-color: var(--ilx-color-accent-strong);
	color: var(--ilx-color-on-dark);
}

.ilx-button:disabled,
button:disabled,
input[type="submit"]:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Secondary — outlined */
.ilx-button--secondary {
	background-color: transparent;
	color: var(--ilx-color-ink);
}

.ilx-button--secondary:hover {
	border-color: var(--ilx-color-ink);
	background-color: var(--ilx-color-ink);
	color: var(--ilx-color-on-dark);
}

/* Quiet — a text link that behaves like a button */
.ilx-button--quiet {
	padding-inline: 0;
	border-color: transparent;
	background-color: transparent;
	color: var(--ilx-color-ink);
}

.ilx-button--quiet:hover {
	border-color: transparent;
	background-color: transparent;
	color: var(--ilx-color-accent-strong);
}

.ilx-button--small {
	padding: 0.65rem 1.15rem;
	font-size: var(--ilx-text-xs);
}

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

table {
	width: 100%;
	margin-bottom: var(--ilx-space-md);
	border-collapse: collapse;
	font-size: var(--ilx-text-small);
}

th,
td {
	padding: var(--ilx-space-xs) var(--ilx-space-2xs);
	border-bottom: var(--ilx-border-width) solid var(--ilx-color-line);
	text-align: left;
	vertical-align: top;
}

th {
	color: var(--ilx-color-ink);
	font-weight: var(--ilx-weight-semibold);
	letter-spacing: var(--ilx-tracking-nav);
}

/* -------------------------------------------------------------------------
 * Accessibility
 * ---------------------------------------------------------------------- */

:focus-visible {
	outline: 2px solid var(--ilx-color-focus);
	outline-offset: 2px;
}

/* A section reached through a link on the page takes focus for keyboard and
   screen-reader users; it is not a control, so it draws no ring. */
[tabindex="-1"]:focus {
	outline: none;
}

/* Remove the ring for pointer users only; keyboard focus above still shows. */
:focus:not(:focus-visible) {
	outline: none;
}

/* Focus moved by script after a click — into a drawer, back to the button that
   opened it — is not keyboard focus, though Safari rings it as such. While the
   pointer is in use (assets/js/theme.js), the header and its overlays show no
   ring; after Tab or an arrow key they do again. */
html[data-ilx-input="pointer"] :is(.mm-header, .site-header, .ilx-search, .ilx-minicart, .ilx-drawer) :focus-visible {
	outline: none;
}

.screen-reader-text,
.ilx-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus,
.ilx-skip-link:focus {
	position: fixed !important;
	top: var(--ilx-space-2xs);
	left: var(--ilx-space-2xs);
	z-index: var(--ilx-z-toast);
	width: auto;
	height: auto;
	margin: 0;
	padding: var(--ilx-space-2xs) var(--ilx-space-sm);
	overflow: visible;
	clip: auto;
	clip-path: none;
	border-radius: var(--ilx-radius-sm);
	background-color: var(--ilx-color-ink);
	color: var(--ilx-color-on-dark);
	font-size: var(--ilx-text-small);
	text-decoration: none;
}

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

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
