/*
 * Base element styles: typography defaults, links, focus, media.
 * Uses only tokens from tokens.css. No page- or section-specific rules here.
 */

/* In-page links (#stellen, AGB sections) stop below the sticky header and glide there. */
html { scroll-padding-top: calc(var(--wilke-header-height) + var(--wilke-space-md)); }
/* Pages with the sticky page navigation bar: compact header (60 px) + bar (~50 px). */
html:has(.wilke-subnav) { scroll-padding-top: calc(60px + 50px + var(--wilke-space-md)); }

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

body {
	font-family: var(--wilke-font-sans);
	font-size: var(--wilke-text-body);
	font-weight: var(--wilke-weight-regular);
	line-height: var(--wilke-leading-body);
	color: var(--wilke-color-text);
	background-color: var(--wilke-color-white);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* ── Headings ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--wilke-font-sans);
	font-weight: var(--wilke-weight-semibold);
	color: var(--wilke-color-text);
	margin-block: 0 var(--wilke-space-sm);
	text-wrap: balance;
}

h1 { font-size: var(--wilke-text-h1); line-height: 1.05; letter-spacing: var(--wilke-tracking-tighter); }
h2 { font-size: var(--wilke-text-h2); line-height: var(--wilke-leading-tight); letter-spacing: var(--wilke-tracking-tight); }
h3 { font-size: var(--wilke-text-h3); line-height: var(--wilke-leading-snug); letter-spacing: var(--wilke-tracking-snug); }
h4 { font-size: var(--wilke-text-h4); line-height: var(--wilke-leading-snug); letter-spacing: var(--wilke-tracking-snug); }

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

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

/* ── Links ────────────────────────────────────────────────── */
a {
	color: var(--wilke-color-primary-text);
	text-underline-offset: 0.2em;
	transition: color var(--wilke-duration-fast) var(--wilke-ease);
}

a:hover { color: var(--wilke-color-text); }

/* ── Keyboard focus (visible, consistent, never removed) ──── */
:focus-visible {
	outline: 2px solid var(--wilke-color-focus);
	outline-offset: 2px;
}

/* ── Code & technical text ────────────────────────────────── */
code, kbd, samp, pre {
	font-family: var(--wilke-font-mono);
	font-size: 0.9em;
}

pre {
	padding: var(--wilke-space-sm);
	background: var(--wilke-color-bg-light);
	border: var(--wilke-border-width) solid var(--wilke-color-border);
	border-radius: var(--wilke-radius-md);
	overflow-x: auto;
}

/* ── Media ────────────────────────────────────────────────── */
img, svg, video {
	max-width: 100%;
	height: auto;
}

hr {
	border: 0;
	border-top: var(--wilke-border-width) solid var(--wilke-color-border);
	margin-block: var(--wilke-space-lg);
}

/* ── Page shell ───────────────────────────────────────────── */
.site-main { overflow-x: clip; }

/* Standard page body text: comfortable reading width. */
.wilke-page-content > :is(p, ul, ol, h2, h3, h4, blockquote) { max-width: var(--wilke-text-max); }

/* A heading after a card grid starts a new group (e.g. Entwicklungskits: Starterkits … / Zubehör). */
.wilke-page-content > .wilke-grid + :is(h2, h3),
.wilke-page-content > .wilke-heading--group { margin-top: var(--wilke-space-xl); }

.screen-reader-text:not(:focus) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

::selection {
	background: var(--wilke-color-brand-green);
	color: var(--wilke-color-text);
}

/* ── Tables in text (Hello's reset draws boxes + stripes): clean hairline rows like the spec table ── */
table { font-size: var(--wilke-text-small); }

table td,
table th {
	padding: var(--wilke-space-sm);
	border: 0;
	border-bottom: var(--wilke-border-width) solid var(--wilke-color-border);
	text-align: left;
}

table tr:first-child > :is(td, th) { border-top: var(--wilke-border-width) solid var(--wilke-color-border); }
table th { font-weight: var(--wilke-weight-medium); color: var(--wilke-color-text-secondary); }

table tbody > tr:nth-child(odd) > :is(td, th),
table tbody tr:hover > :is(td, th) { background-color: transparent; }

/* ── Print (e.g. a product page as a quick datasheet) ─────── */
@media print {
	/* Everything visible regardless of scroll animations. */
	.wilke-reveal,
	.wilke-word,
	.wilke-hero * { opacity: 1 !important; transform: none !important; filter: none !important; animation: none !important; }

	/* Navigation, actions and decoration are useless on paper. */
	.wilke-header__nav,
	.wilke-header__actions,
	.wilke-header__panel,
	.wilke-breadcrumb,
	.wilke-cta,
	.wilke-footer nav,
	.wilke-footer__legal,
	.wilke-btn,
	.elementor-widget-button,
	.e-con.wilke-hero__actions,
	.skip-link { display: none !important; }

	.wilke-header { position: static; border-bottom: 1px solid #000; }
	.wilke-hero::before,
	.e-con.wilke-hero::before,
	.wilke-section::after,
	.wilke-footer::after { display: none !important; }

	.wilke-section,
	.elementor .e-con.wilke-section { padding-block: 1.5rem; border-top: 0; }

	/* Hello's print reset prints every link URL; keep that only for links in running text. */
	a[href]::after { content: none !important; }
	.wilke-page-content a[href^="http"]::after,
	.elementor-widget-text-editor a[href^="http"]::after { content: " (" attr(href) ")" !important; font-size: 0.8em; }

	.wilke-card,
	.wilke-spec-table tr,
	.wilke-feature-list li,
	.wilke-downloads__item { break-inside: avoid; }
}
