/* ==========================================================================
   TechDoc Assistant — base
   Context colours, the blueprint frame, sections, header and footer. Every
   value is a theme.json token (--wp--preset--* / --wp--custom--*), taken from
   the design system "Industry"; nothing is hard-coded here that the tokens
   already carry.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Context colours
   Blocks read --td-* instead of fixed colours, so the same heading, paragraph,
   kicker, link or button looks right on the light ground and on the steel
   field without the editor having to pick colours.
   -------------------------------------------------------------------------- */
:root,
.editor-styles-wrapper {
	--td-ground: var(--wp--preset--color--ground);
	--td-heading: var(--wp--preset--color--ink);
	--td-body: var(--wp--custom--color--body);
	--td-muted: var(--wp--custom--color--muted);
	--td-faint: var(--wp--custom--color--faint);
	--td-strong: var(--wp--preset--color--ink);
	--td-kicker: var(--wp--preset--color--steel-700);
	--td-accent: var(--wp--preset--color--steel);
	--td-link: var(--wp--preset--color--steel-700);
	--td-link-hover: var(--wp--preset--color--steel-900);
	--td-line: var(--wp--custom--color--line);
	--td-line-soft: var(--wp--custom--color--line-soft);
	--td-mark: var(--wp--custom--color--mark);
	--td-wash: var(--wp--custom--color--wash);
	--td-tint: var(--wp--preset--color--steel-100);
	--td-tint-text: var(--wp--preset--color--steel-800);
	--td-focus: var(--wp--preset--color--steel);
	--td-btn-bg: var(--wp--preset--color--steel-700);
	--td-btn-border: var(--wp--preset--color--steel-700);
	--td-btn-text: var(--wp--preset--color--ground);
	--td-btn-hover-bg: var(--wp--preset--color--steel-800);
	--td-btn-active-bg: var(--wp--preset--color--steel-900);
	--td-btn-outline-border: var(--wp--custom--color--line-strong);
	--td-btn-outline-text: var(--wp--preset--color--ink);
	--td-btn-outline-hover-bg: var(--wp--custom--color--wash);
	--td-btn-outline-active-bg: var(--wp--custom--color--wash-strong);
}

.is-style-section-surface {
	--td-ground: var(--wp--preset--color--surface);
}

/* Steel field: the accent's deep step as ground, type reversed to paper. */
.is-style-section-steel,
.td-context-steel {
	--td-ground: var(--wp--preset--color--steel-900);
	--td-heading: var(--wp--custom--color--on-steel);
	--td-body: var(--wp--custom--color--on-steel-body);
	--td-muted: var(--wp--custom--color--on-steel-muted);
	--td-faint: var(--wp--custom--color--on-steel-muted);
	--td-strong: var(--wp--custom--color--on-steel);
	--td-kicker: var(--wp--preset--color--steel-300);
	--td-accent: var(--wp--preset--color--steel-400);
	--td-link: var(--wp--preset--color--steel-300);
	--td-link-hover: var(--wp--preset--color--steel-100);
	--td-line: var(--wp--custom--color--on-steel-line);
	--td-line-soft: var(--wp--custom--color--on-steel-line-soft);
	--td-mark: var(--wp--custom--color--on-steel-mark);
	--td-wash: var(--wp--custom--color--on-steel-wash);
	--td-tint: var(--wp--custom--color--on-steel-wash);
	--td-tint-text: var(--wp--custom--color--on-steel);
	--td-focus: var(--wp--preset--color--steel-300);
	--td-btn-bg: var(--wp--preset--color--ground);
	--td-btn-border: var(--wp--preset--color--ground);
	--td-btn-text: var(--wp--preset--color--steel-900);
	--td-btn-hover-bg: var(--wp--preset--color--steel-100);
	--td-btn-active-bg: var(--wp--preset--color--steel-200);
	--td-btn-outline-border: var(--wp--custom--color--on-steel-mark);
	--td-btn-outline-text: var(--wp--custom--color--on-steel);
	--td-btn-outline-hover-bg: var(--wp--custom--color--on-steel-wash);
	--td-btn-outline-active-bg: var(--wp--custom--color--on-steel-line);
}

/* --------------------------------------------------------------------------
   2. Global
   -------------------------------------------------------------------------- */
html {
	scroll-behavior: smooth;
}

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

a {
	text-underline-offset: 3px;
}

:where(h1, h2, h3, h4) {
	text-wrap: balance;
}

:where(p, li, dd) {
	text-wrap: pretty;
}

strong,
b {
	color: var(--td-strong);
	font-weight: 700;
}

/* Anchored sections land below the sticky header. */
:where([id]) {
	scroll-margin-top: calc(var(--wp--custom--header--height) + 16px);
}

/* Top-level template blocks and page sections sit flush; spacing comes from
   the sections themselves. */
.wp-site-blocks > * + *,
.td-sections > * + * {
	margin-block-start: 0;
}

/* Focus: the design system's 2px accent ring, never the browser default. */
:focus {
	outline: none;
}

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

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--steel-900);
	color: var(--wp--preset--color--ground);
	font-weight: 700;
	text-decoration: none;
}

::selection {
	background: var(--wp--preset--color--steel-200);
	color: var(--wp--preset--color--steel-900);
}

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

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* --------------------------------------------------------------------------
   3. Blueprint frame
   Framed objects are wireframe drawings: square, hairline-bordered, with a
   "+" registration mark on every corner. The design system draws the marks
   with four extra elements; here one pseudo-element draws all four, so a core
   block needs nothing but its block style. The pseudo-element overhangs the
   border by 6px, which puts the centre of each 11px mark on the corner.
   -------------------------------------------------------------------------- */
.is-style-card,
.is-style-card-tint,
.is-style-plate,
.wp-block-image.is-style-blueprint,
.td-frame {
	position: relative;
	border: 1px solid var(--td-line);
	border-radius: 0;
}

.is-style-card::before,
.is-style-card-tint::before,
.is-style-plate::before,
.wp-block-image.is-style-blueprint::before,
.td-frame::before {
	content: "";
	position: absolute;
	inset: -6px;
	z-index: 1;
	background:
		linear-gradient(var(--td-mark), var(--td-mark)) left 5px top 0 / 1px 11px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) left 0 top 5px / 11px 1px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) right 5px top 0 / 1px 11px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) right 0 top 5px / 11px 1px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) left 5px bottom 0 / 1px 11px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) left 0 bottom 5px / 11px 1px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) right 5px bottom 0 / 1px 11px no-repeat,
		linear-gradient(var(--td-mark), var(--td-mark)) right 0 bottom 5px / 11px 1px no-repeat;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Sections (core/group block styles)
   -------------------------------------------------------------------------- */
.is-style-section,
.is-style-section-surface,
.is-style-section-grid,
.is-style-section-steel {
	padding-top: var(--wp--custom--section--padding);
	padding-bottom: var(--wp--custom--section--padding);
}

.is-style-section-surface {
	background-color: var(--wp--preset--color--surface);
}

.is-style-section-steel {
	background-color: var(--wp--preset--color--steel-900);
	color: var(--wp--custom--color--on-steel);
}

/* Two plain sections in a row share one gap instead of stacking two. */
.is-style-section + .is-style-section {
	padding-top: 0;
}

/* Raster: the modular grid the layouts are built on, drawn faintly and fading
   out towards the content below. */
.is-style-section-grid {
	position: relative;
	isolation: isolate;
}

.is-style-section-grid::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image:
		linear-gradient(to right, var(--td-line-soft) 1px, transparent 1px),
		linear-gradient(to bottom, var(--td-line-soft) 1px, transparent 1px);
	background-position: center top;
	background-size: var(--wp--custom--grid--cell) var(--wp--custom--grid--cell);
	-webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
	pointer-events: none;
}

/* Hero: a little more air above, the product figure directly below. */
.td-hero {
	padding-top: clamp(48px, 7vw, 96px);
	padding-bottom: clamp(48px, 6vw, 80px);
}

.td-hero h1 {
	max-width: 15em;
}

/* Inner-page header: kicker, h1, lead. */
.td-page-header {
	padding-top: clamp(48px, 7vw, 88px);
	padding-bottom: clamp(32px, 4vw, 48px);
	border-bottom: 1px solid var(--td-line);
}

.td-page-header h1 {
	font-size: clamp(38px, 5vw, 60px);
}

/* Long-form text (legal pages, simple content pages). */
.td-prose {
	padding-top: clamp(40px, 5vw, 64px);
	padding-bottom: var(--wp--custom--section--padding);
}

.td-prose > :is(h2, h3, h4) {
	margin-block-start: 1.8em;
}

.td-prose > :is(h2, h3, h4):first-child {
	margin-block-start: 0;
}

.td-prose > :is(h2, h3, h4) + * {
	margin-block-start: 0.6em;
}

.td-prose > h2 {
	font-size: clamp(24px, 2.6vw, 30px);
	letter-spacing: -0.005em;
}

.td-prose > h3 {
	font-size: 21px;
}

/* --------------------------------------------------------------------------
   5. Header
   -------------------------------------------------------------------------- */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 50;
}

@media (max-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

.td-header {
	border-bottom: 1px solid var(--td-line);
	background-color: var(--wp--custom--color--header);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.td-header__bar {
	min-height: var(--wp--custom--header--height);
}

/* Brand: the boxed "TD" mark of the app, then the site title. */
.td-brand {
	margin: 0;
}

.td-brand a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--td-heading);
	text-decoration: none;
	white-space: nowrap;
}

.td-brand a::before {
	content: "TD";
	display: grid;
	flex: none;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1.5px solid var(--td-accent);
	color: var(--td-kicker);
	font-size: 13px;
	letter-spacing: 0.02em;
	line-height: 1;
}

/* --------------------------------------------------------------------------
   6. Footer
   -------------------------------------------------------------------------- */
.td-footer {
	padding-top: clamp(48px, 6vw, 72px);
	padding-bottom: 28px;
	border-top: 1px solid var(--td-line);
}

.td-footer__about {
	max-width: 34ch;
	color: var(--td-muted);
	font-size: 15px;
}

.td-footer__title {
	color: var(--td-kicker);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 500;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.td-footer__bottom {
	padding-top: 20px;
	border-top: 1px solid var(--td-line-soft);
	color: var(--td-faint);
	font-size: var(--wp--preset--font-size--small);
}

.td-footer__bottom p {
	color: inherit;
}

.td-footer__bottom a {
	color: inherit;
}

.td-footer__bottom a:hover {
	color: var(--td-link-hover);
}

/* --------------------------------------------------------------------------
   7. Utilities usable on any block via "Zusätzliche CSS-Klasse(n)"
   -------------------------------------------------------------------------- */
.td-measure {
	max-width: 38em;
}

.td-measure-narrow {
	max-width: 30em;
}

.td-lead {
	color: var(--td-body);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.55;
}

.td-muted {
	color: var(--td-muted);
}

.td-small {
	font-size: var(--wp--preset--font-size--small);
}

.td-align-center {
	align-items: center;
}

.td-align-start {
	align-items: start;
}

.td-gap-split {
	gap: var(--wp--custom--section--gap);
}

/* Section head: kicker, heading and intro that open a section. */
.td-section-head {
	margin-bottom: clamp(32px, 4vw, 48px);
}

.td-section-head > * + * {
	margin-block-start: 14px;
}

/* Headings measure in their own, larger em. */
:is(h1, h2).td-measure {
	max-width: 19em;
}

/* Kennzahl-Zeile — a figure (paragraph style "Kennzahl") with the sentence it
   belongs to: side by side where there is room, the sentence below the
   figure where there is not. */
.td-figure-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 28px;
}

.td-figure-row > * {
	margin-block-start: 0;
}

.td-figure-row > .is-style-figure {
	flex: none;
}

.td-figure-row > :not(.is-style-figure) {
	flex: 1 1 14em;
}

/* Split 1 : 2 — a narrow head column beside a wide content column (FAQ).
   Core's grid layout only makes equal columns, so this one is a class. */
.td-split-1-2 {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
	gap: var(--wp--custom--section--gap);
	align-items: start;
}

.td-split-1-2 > * {
	margin-block-start: 0;
}

@media (max-width: 860px) {
	.td-split-1-2 {
		grid-template-columns: minmax(0, 1fr);
	}
}
