/*
 * Pauly Werkstoffdatenbank – Frontend
 * Farben über CSS-Variablen; im Theme überschreibbar, z. B.:
 * .pw-werkstoff { --pw-accent: #0a3d62; }
 */

.pw-werkstoff,
.pw-table,
.pw-quicksearch {
	--pw-accent: var(--primary_color, #1f4e79);
	--pw-border: #dde2e7;
	--pw-head: #f4f6f8;
	--pw-muted: #5f6b76;
	--pw-notice: #fff6e5;
}

.pw-werkstoff { margin-top: 1.5em; }
.pw-section { margin: 0 0 2.25em; }
.pw-section h2 { margin: 0 0 .6em; }
/* Zwischenüberschriften der Normen bewusst klein. Avadas „responsive typography“ setzt die Größe
   per JavaScript mit !important (Klasse fusion-responsive-typography-calculated), daher hier ebenso. */
.pw-werkstoff h3.pw-subheading { font-size: 1.05rem !important; line-height: 1.4 !important; margin: 1em 0 .4em; }

.pw-intro p { font-size: 1.05em; line-height: 1.6; }

/* Werkstoffbild neben der Einleitung, auf dem Handy darüber (Reihenfolge im HTML: Bild zuerst) */
.pw-lead--image { display: grid; grid-template-columns: minmax(0, 1fr) min(420px, 40%); gap: 0 2.5em; align-items: start; margin: 0 0 2.25em; }
.pw-lead--image .pw-image { grid-column: 2; grid-row: 1; margin: 0; }
.pw-lead--image .pw-intro { grid-column: 1; grid-row: 1; margin: 0; }
.pw-image img { display: block; width: 100%; height: auto; border-radius: 6px; }
@media (max-width: 760px) {
	.pw-lead--image { grid-template-columns: 1fr; gap: 1em; }
	.pw-lead--image .pw-image, .pw-lead--image .pw-intro { grid-column: 1; grid-row: auto; }
}
.pw-description { margin: 0 0 2.25em; }
.pw-notice { background: var(--pw-notice); border-left: 4px solid #e0a100; padding: .75em 1em; }

/* Tabellen */
.pw-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pw-table { width: 100%; border-collapse: collapse; margin: 0; font-variant-numeric: tabular-nums; }
.pw-table caption { caption-side: top; text-align: left; color: var(--pw-muted); font-size: .9em; padding: 0 0 .5em; }
/* Breite Tabelle im Scrollbereich (Handy): Beschriftung bleibt links stehen und bricht in der sichtbaren Breite um.
   Nur in den eigenen Vorlagen; in Avada-Spalten könnte die Größeneindämmung einen Textblock schrumpfen lassen. */
.pw-werkstoff .pw-table-scroll { container-type: inline-size; }
.pw-werkstoff .pw-table-scroll > .pw-table > caption { position: sticky; left: 0; width: max-content; max-width: 100cqi; }
/* baseline statt top: Avada setzt th (Space Grotesk) und td (IBM Plex Sans) unterschiedlich, mit top stand th bis zu 10 px versetzt */
.pw-table th,
.pw-table td { border-bottom: 1px solid var(--pw-border); padding: .55em .75em; text-align: left; vertical-align: baseline; }
.pw-table thead th { background: var(--pw-head); font-weight: 600; border-bottom: 2px solid var(--pw-border); white-space: nowrap; }
.pw-table--kv th { width: 30%; min-width: 9em; background: var(--pw-head); font-weight: 600; }
.pw-table--composition tbody th { width: 7em; white-space: nowrap; }
.pw-table--composition abbr[title] { text-decoration: none; border: 0; cursor: help; }
.pw-table--list tbody th { white-space: nowrap; }

/* Kennwerte aus der Analyse (PREN, CEV) unter der Analysetabelle */
.pw-indices { margin-top: 1.5em; }
.pw-table--indices tbody th { width: 45%; font-weight: 600; }
.pw-formula { display: block; font-weight: 400; color: var(--pw-muted); font-size: .88em; }
.pw-table--indices td strong { white-space: nowrap; margin-right: .6em; }
.pw-calc-link { font-size: .92em; white-space: nowrap; }
.pw-indices-note { margin: .5em 0 0; }
.pw-table--properties tbody th { width: 35%; }
.pw-property-note { display: block; }
/* Werkstoffvergleich [pw_vergleich]: erste Spalte bleibt beim waagerechten Scrollen stehen, Unterschiede hervorgehoben */
.pw-compare { --pw-accent: var(--primary_color, #1f4e79); --pw-border: #dde2e7; --pw-head: #f4f6f8; --pw-muted: #5f6b76; --pw-notice: #fff6e5; --pw-diff: #fff8e1; }
.pw-compare-table { min-width: 36em; }
.pw-compare-table thead th { vertical-align: top; white-space: normal; min-width: 9em; }
.pw-compare-table thead th > a:first-child { font-weight: 700; }
.pw-compare-name { display: block; font-weight: 400; }
.pw-compare-remove { display: inline-block; margin-top: .3em; font-size: .85em; font-weight: 400; }
.pw-compare-table tbody th[scope="row"],
.pw-compare-table thead td { position: sticky; left: 0; z-index: 1; background: var(--pw-head); min-width: 7em; font-weight: 600; }
.pw-compare-table abbr[title] { text-decoration: none; border: 0; cursor: help; }
.pw-compare-section th { background: #fff; padding-top: 1.2em; font-size: 1.05em; border-bottom: 2px solid var(--pw-border); }
.pw-compare-table tr.pw-diff td { background: var(--pw-diff); }

/* Knöpfe „Vergleichen“ und Leiste mit der Auswahl (assets/js/vergleich.js) */
.pw-compare-toggle[hidden] { display: none !important; }
.pw-compare-toggle[aria-pressed="true"]::before { content: "✓ "; }
/* Klasse doppelt (Spezifität 0,4,1): Themes färben Knöpfe sonst mit button:not(:hover):not(:active)… (0,3,1) ein */
.pw-search-results .pw-table--results button.pw-compare-toggle.pw-compare-toggle,
.pw-analysis .pw-analysis-table button.pw-compare-toggle.pw-compare-toggle { display: block; margin-top: .25em; padding: 0; border: 0; background: none; color: var(--pw-accent); font: inherit; font-size: .82em; font-weight: 400; text-decoration: underline; cursor: pointer; }
.pw-compare-bar {
	/* Mittig über left/right/margin statt left: 50% (sonst stünde nur die halbe Breite zur Verfügung) */
	position: fixed; left: 0; right: 0; bottom: 1em; z-index: 9999; margin: 0 auto; width: max-content;
	display: flex; flex-wrap: wrap; align-items: center; gap: .5em .9em; max-width: calc(100vw - 1.5em); box-sizing: border-box;
	padding: .7em 1em; border-radius: 8px; background: #1a1a1a; color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); font-size: .95em;
}
.pw-compare-bar[hidden] { display: none; }
.pw-compare-bar a, .pw-compare-bar button { color: #fff; font: inherit; }
.pw-compare-bar .pw-compare-go { padding: .45em .9em; border-radius: 2px; background: var(--awb-color5, #028e39); font-weight: 600; text-decoration: none; }
.pw-compare-bar .pw-compare-go[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.pw-compare-bar.pw-compare-bar button.pw-compare-clear.pw-compare-clear { padding: 0; border: 0; background: none; color: #fff; text-decoration: underline; cursor: pointer; }
.pw-compare-msg { flex-basis: 100%; font-size: .88em; color: #ffd27a; }
.pw-compare-msg:empty { display: none; }

/* Analyse-Suche [pw_analyse]: Eingabe aus dem Prüfzeugnis, Bewertung je Element */
.pw-analysis { --pw-accent: var(--primary_color, #1f4e79); --pw-border: #dde2e7; --pw-head: #f4f6f8; --pw-muted: #5f6b76; --pw-notice: #fff6e5; }
.pw-analysis-form label { display: block; font-weight: 600; margin: 0 0 .4em; }
.pw-analysis-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-variant-numeric: tabular-nums; padding: .6em .75em; border: 1px solid #9aa5b1; border-radius: 4px; }
.pw-analysis-form textarea:focus { outline: 3px solid var(--pw-accent); outline-offset: 1px; }
.pw-analysis-results { margin-top: 1.5em; }
.pw-analysis-table tbody th { min-width: 9em; }
.pw-analysis-table tbody th .pw-muted { display: block; font-weight: 400; }
.pw-element-check { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3em .5em; }
.pw-element-check li { margin: 0; padding: .15em .5em; border-radius: 3px; border: 1px solid var(--pw-border); white-space: nowrap; font-size: .92em; }
.pw-element-check li::before { margin-right: .3em; font-weight: 700; }
.pw-el-im_bereich { background: #eef8f1; border-color: #9fd4b0 !important; }
.pw-el-im_bereich::before { content: "✓"; color: #1e7b3a; }
.pw-el-knapp { background: #fff6e5; border-color: #e0a100 !important; }
.pw-el-knapp::before { content: "≈"; color: #8a5a00; }
.pw-el-abweichend { background: #fdecec; border-color: #e3a1a1 !important; }
.pw-el-abweichend::before { content: "✗"; color: #b02a2a; }

/* Hinweis über dem vorbelegten Rechner (assets/js/rechner.js) */
.pw-calc-note { background: var(--pw-notice, #fff6e5); border-left: 4px solid #e0a100; padding: .6em .9em; margin: 0 0 1em; }
.pw-is-withdrawn td,
.pw-is-withdrawn th { color: var(--pw-muted); }

.pw-inline-list { list-style: none; margin: 0; padding: 0; }
.pw-inline-list li { display: inline; margin: 0; }
.pw-inline-list li + li::before { content: " · "; color: var(--pw-muted); }

.pw-standard-list { columns: 2 14em; column-gap: 2em; margin: 0; padding-left: 1.1em; }
.pw-standard-list li { break-inside: avoid; margin: 0 0 .2em; }

.pw-link-list { list-style: none; margin: 0; padding: 0; }
.pw-link-list li { padding: .35em 0; border-bottom: 1px solid var(--pw-border); }
.pw-link-list li a { font-weight: 600; margin-right: .5em; }

.pw-muted { color: var(--pw-muted); font-size: .92em; }
.pw-badge { display: inline-block; padding: .1em .55em; border-radius: 3px; background: var(--pw-notice); border: 1px solid #e0a100; font-size: .9em; }

/* Schaltflächen */
.pw-actions { display: flex; flex-wrap: wrap; gap: .75em; margin: 0; }
.pw-button {
	display: inline-block; padding: .7em 1.2em; border: 2px solid var(--pw-accent); border-radius: 2px;
	background: var(--pw-accent); color: #fff; font: inherit; font-weight: 600; line-height: 1.2;
	text-decoration: none; cursor: pointer;
}
.pw-button:hover,
.pw-button:focus-visible { filter: brightness(1.1); color: #fff; }
.pw-button--secondary { background: transparent; color: var(--pw-accent); }
.pw-button--secondary:hover,
.pw-button--secondary:focus-visible { background: var(--pw-accent); color: #fff; filter: none; }
.pw-button:focus-visible { outline: 3px solid var(--pw-accent); outline-offset: 2px; }

.pw-disclaimer { border-top: 1px solid var(--pw-border); padding-top: 1em; color: var(--pw-muted); font-size: .88em; }
.pw-disclaimer p { margin: 0 0 .4em; }

.pw-print-only { display: none; }

/* Suchfeld unten auf der Werkstoffseite: Fläche im grünen Pauly-Verlauf wie Kopfzeile und Werkstoffbilder.
   Farben aus Avadas Palette (color5 Grün, color8 Mint), sonst die Pauly-Werte. Selektoren bewusst etwas spezifischer,
   weil Avada Überschriften, Links und Felder sonst überschreibt. */
.pw-quicksearch {
	--pw-qs-green: var(--awb-color5, #028e39);
	--pw-qs-dark: #022e13;
	--pw-qs-mint: var(--awb-color8, #c3feda);
	background:
		radial-gradient(ellipse at 6% 0%, rgba(195, 254, 218, .24), rgba(195, 254, 218, 0) 55%),
		linear-gradient(115deg, var(--pw-qs-green) 0%, #035d27 55%, var(--pw-qs-dark) 100%);
	color: #fff; padding: 2em 2.25em 1.75em; border-radius: 8px;
}
.pw-werkstoff .pw-quicksearch h2,
.pw-quicksearch h2 { color: #fff; margin: 0 0 .75em; }
.pw-quicksearch label { display: block; font-weight: 600; margin: 0 0 .5em; color: #fff; }
.pw-quicksearch-row { display: flex; flex-wrap: wrap; gap: .75em; }
.pw-quicksearch-field { position: relative; flex: 1 1 18em; min-width: 0; display: block; }
.pw-quicksearch-icon { position: absolute; left: 1em; top: 50%; width: 1.3em; height: 1.3em; transform: translateY(-50%); color: #5f6b76; pointer-events: none; }
.pw-quicksearch .pw-quicksearch-field input[type="search"] {
	width: 100%; height: auto; min-height: 58px; margin: 0; box-sizing: border-box;
	padding: .65em 1em .65em 3.1em; border: 2px solid #fff; border-radius: 6px;
	background: #fff; color: #1a1a1a; font: inherit; font-size: 1em; line-height: 1.3;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .18); -webkit-appearance: none; appearance: none;
}
.pw-quicksearch .pw-quicksearch-field input[type="search"]::placeholder { color: #6b7680; opacity: 1; }
.pw-quicksearch .pw-quicksearch-field input[type="search"]:focus { outline: 3px solid var(--pw-qs-mint); outline-offset: 2px; border-color: var(--pw-qs-green); }
/* Klasse doppelt (Spezifität 0,4,1): Themes färben Knöpfe teils mit button:not(:hover):not(:active)… (0,3,1) und laden danach */
.pw-quicksearch.pw-quicksearch .pw-quicksearch-row > button.pw-quicksearch-button {
	min-height: 58px; margin: 0; padding: .65em 1.8em; border: 0; border-radius: 6px;
	background: var(--pw-qs-mint); color: var(--pw-qs-dark); font: inherit; font-weight: 700; line-height: 1.2; cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .18); transition: background-color .15s ease;
}
.pw-quicksearch.pw-quicksearch .pw-quicksearch-row > button.pw-quicksearch-button:hover { background: #fff; color: var(--pw-qs-dark); }
.pw-quicksearch.pw-quicksearch .pw-quicksearch-row > button.pw-quicksearch-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pw-quicksearch .pw-quicksearch-more { margin: 1.1em 0 0; }
.pw-quicksearch .pw-quicksearch-more a {
	color: #fff; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .55);
	text-decoration-thickness: 1px; text-underline-offset: .25em;
}
.pw-quicksearch .pw-quicksearch-more a:hover,
.pw-quicksearch .pw-quicksearch-more a:focus-visible { color: #fff; text-decoration-color: #fff; }
.pw-quicksearch .pw-quicksearch-more a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (max-width: 640px) {
	.pw-quicksearch { padding: 1.4em 1.1em 1.25em; }
	.pw-quicksearch.pw-quicksearch .pw-quicksearch-row > button.pw-quicksearch-button { flex: 1 1 100%; }
}

/* Gruppen- und Nummernkreisseiten, Verzeichnis aller Gruppen und Nummernkreise */
.pw-archive-title { margin: 0 0 .6em; }
.pw-archive-intro { font-size: 1.05em; line-height: 1.6; max-width: 60em; }
.pw-directory { margin: 2.5em 0 2.25em; }
.pw-directory-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(20em, 100%), 1fr)); gap: 0 2.5em; }
.pw-directory-list { list-style: none; margin: 0; padding: 0; }
.pw-directory-list li { margin: 0; padding: .4em 0; border-bottom: 1px solid var(--pw-border, #dde2e7); }
.pw-directory-list a { font-weight: 600; }
.pw-search .pw-directory { background: #fff; border-radius: 8px; padding: 1.25em 1.5em 1.5em; box-shadow: 0 8px 28px rgba(0, 0, 0, .14); color: #1a1a1a; }
.pw-search .pw-directory h2, .pw-search .pw-directory h3 { color: #1a1a1a; }

/* Brotkrumen über dem Titel (Avada-Vorlage) bzw. am Anfang der Werkstoffausgabe */
.pw-breadcrumbs { margin: 0 0 1em; font-size: .9em; color: var(--pw-muted, #5f6b76); }
/* Inline statt Flex: Lange Einträge brechen auf dem Handy im Textfluss um, „›“ bleibt vor dem Eintrag */
.pw-breadcrumbs ol { list-style: none; margin: 0; padding: 0; }
.pw-breadcrumbs li { margin: 0; display: inline; }
.pw-breadcrumbs li + li::before { content: "›"; color: var(--pw-muted, #5f6b76); margin: 0 .35em 0 .1em; }
.pw-breadcrumbs a { color: inherit; text-decoration: underline; text-decoration-color: rgba(95, 107, 118, .45); text-underline-offset: .2em; }
.pw-breadcrumbs a:hover, .pw-breadcrumbs a:focus-visible { color: var(--awb-color5, #028e39); text-decoration-color: currentColor; }
.pw-breadcrumbs [aria-current] { color: #1a1a1a; font-weight: 600; }

/* Ganz unten: zurück zur Werkstoffdatenbank */
.pw-back { margin: 0 0 2.25em; }
.pw-werkstoff .pw-back .pw-back-link { display: inline-flex; align-items: center; gap: .5em; padding: .8em 1.4em; border-radius: 6px; }
.pw-back .pw-back-link span { transition: transform .15s ease; }
.pw-back .pw-back-link:hover span { transform: translateX(-3px); }
@media (prefers-reduced-motion: reduce) {
	.pw-quicksearch.pw-quicksearch .pw-quicksearch-row > button.pw-quicksearch-button, .pw-back .pw-back-link span { transition: none; }
}

/* Werkstoffsuche */
/* Eigene helle Flächen und Textfarbe: lesbar auch in dunklen Avada-Containern (z. B. grüner Hintergrund).
   Formensprache wie das Suchfeld auf der Werkstoffseite: weiße Karte, 6 px Rundung, große Felder, Pauly-Grün.
   Felder werden hier vollständig gestaltet, weil Avada type="search" nicht und Auswahllisten nur teilweise erfasst. */
.pw-search {
	--pw-accent: var(--primary_color, var(--awb-color5, #028e39)); --pw-border: #dde2e7; --pw-head: #f4f6f8; --pw-muted: #5f6b76;
	--pw-field-border: #c9d1d8; --pw-dark: #022e13;
	color: #1a1a1a; text-align: left;
}
.pw-search-form { background: #fff; border-radius: 8px; padding: 1.75em 1.75em 1.25em; margin: 0 0 1.5em; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
.pw-search-results { background: #fff; border-radius: 8px; padding: 1.25em 1.5em 1.5em; box-shadow: 0 8px 28px rgba(0, 0, 0, .14); }
.pw-search label, .pw-search legend, .pw-search summary, .pw-search th, .pw-search td, .pw-search caption { color: inherit; }
.pw-search .pw-muted, .pw-search .pw-analysis-cell { color: var(--pw-muted); }
/* Fieldsets sind sonst mindestens so breit wie ihr Inhalt und ragen auf dem Handy über den Rand */
.pw-search fieldset { min-width: 0; }
.pw-search-main { display: grid; grid-template-columns: 2fr 1fr; gap: 1.1em 1.5em; align-items: end; }
.pw-field { margin: 0; }
.pw-field label { display: block; font-weight: 600; margin: 0 0 .45em; }

/* Felder einheitlich: Suchfeld mit Lupe, Gruppenauswahl mit eigenem Pfeil (gleich hoch, gleiche Rundung) */
.pw-search .pw-input-icon { position: relative; display: block; }
.pw-search .pw-input-icon-svg { position: absolute; left: 1em; top: 50%; width: 1.3em; height: 1.3em; transform: translateY(-50%); color: var(--pw-muted); pointer-events: none; }
.pw-search .pw-field input[type="search"],
.pw-search .pw-field select {
	display: block; width: 100%; height: 58px; min-height: 58px; margin: 0; box-sizing: border-box;
	border: 1.5px solid var(--pw-field-border); border-radius: 6px; background-color: #fff; color: #1a1a1a;
	font: inherit; font-size: 1em; line-height: 1.3; box-shadow: none; -webkit-appearance: none; appearance: none;
}
.pw-search .pw-field input[type="search"] { padding: .65em 1em .65em 3.1em; }
.pw-search .pw-field select {
	padding: .65em 2.75em .65em 1em; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23022e13' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 1em center; background-size: 1.1em;
}
.pw-search .pw-field input[type="search"]::placeholder { color: #6b7680; opacity: 1; }
.pw-search .pw-field input[type="search"]:focus,
.pw-search .pw-field select:focus,
.pw-search .pw-element input:focus { outline: 3px solid rgba(2, 142, 57, .35); outline-offset: 1px; border-color: var(--pw-accent); }

/* Häkchen und Auswahlknöpfe in Pauly-Grün */
.pw-search input[type="checkbox"], .pw-search input[type="radio"] { accent-color: var(--pw-accent); }
.pw-field--check { grid-column: 1 / -1; display: flex; gap: .6em; align-items: center; }
.pw-field--check label { display: inline; font-weight: 400; margin: 0; cursor: pointer; }
.pw-field--check input { width: 1.25em; height: 1.25em; margin: 0; flex: none; cursor: pointer; }

/* Aufklappbare Bereiche: eigener Pfeil statt Dreieck, als Schaltfläche erkennbar */
.pw-analysis { margin: 1.25em 0 0; border-top: 1px solid var(--pw-border); padding-top: .5em; }
.pw-analysis > summary, .pw-more-elements > summary {
	display: flex; align-items: center; gap: .55em; cursor: pointer; list-style: none;
	font-weight: 600; color: var(--pw-dark); padding: .6em 0; min-height: 24px;
}
.pw-analysis > summary::-webkit-details-marker, .pw-more-elements > summary::-webkit-details-marker { display: none; }
.pw-analysis > summary::before, .pw-more-elements > summary::before {
	content: ""; flex: none; width: 1.6em; height: 1.6em; border-radius: 50%;
	background: var(--pw-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 6 6 6-6 6' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 1em;
	transition: transform .15s ease;
}
.pw-analysis[open] > summary::before, .pw-more-elements[open] > summary::before { transform: rotate(90deg); }
.pw-analysis > summary:hover, .pw-more-elements > summary:hover { color: var(--pw-accent); }
.pw-analysis > summary:focus-visible, .pw-more-elements > summary:focus-visible { outline: 2px solid var(--pw-accent); outline-offset: 3px; border-radius: 4px; }
.pw-more-elements { margin: .75em 0 0; }

.pw-mode { border: 0; margin: .5em 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4em 1em; align-items: center; }
.pw-mode legend { float: left; width: 100%; padding: 0; margin: 0 0 .3em; font-size: 1em; font-weight: 600; line-height: 1.5; }
/* Grundlinie statt Mitte: bricht der Text auf dem Handy um, bleibt der Radio-Button an der ersten Zeile */
.pw-mode .pw-radio { display: inline-flex; align-items: baseline; gap: .45em; margin: 0 1.5em 0 0; font-weight: 400; min-height: 24px; cursor: pointer; }
.pw-mode .pw-radio input { margin: 0; flex: none; width: 1.1em; height: 1.1em; }
.pw-hint { margin: .3em 0 .9em; font-size: .9em; }

/* Elemente: ruhige Kästen mit Symbol und Namen, Felder „von/bis“ */
.pw-element-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15em, 100%), 1fr)); gap: .75em 1em; }
.pw-element {
	border: 1px solid var(--pw-border); border-radius: 6px; background: var(--pw-head); margin: 0; padding: .45em .75em .7em;
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .3em .5em;
}
.pw-element legend { padding: 0 .3em; font-weight: 700; color: var(--pw-dark); }
.pw-element legend .pw-muted { font-weight: 400; margin-left: .35em; }
.pw-search .pw-element input {
	width: 100%; min-width: 0; height: 42px; min-height: 42px; margin: 0; box-sizing: border-box; padding: .3em .6em;
	border: 1.5px solid var(--pw-field-border); border-radius: 4px; background: #fff; color: #1a1a1a; font: inherit; font-size: .95em; box-shadow: none;
}
.pw-element label { margin: 0; font-size: .9em; color: var(--pw-muted); }
.pw-element abbr[title] { text-decoration: none; border: 0; }

/* Knöpfe wie im neuen Suchfeld: 6 px Rundung, gleiche Höhe */
.pw-search-actions { display: flex; gap: .75em; flex-wrap: wrap; margin: 1.25em 0 .25em; }
.pw-search .pw-search-actions .pw-button { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: .7em 1.8em; border-radius: 6px; }
/* Klasse doppelt (0,4,1): Themes färben button-Elemente teils mit button:not(:hover):not(:active)… (0,3,1) */
.pw-search.pw-search .pw-search-actions button.pw-button { background: var(--pw-accent); border-color: var(--pw-accent); color: #fff; }
.pw-search.pw-search .pw-search-actions button.pw-button:hover { filter: brightness(1.1); }
@media (prefers-reduced-motion: reduce) {
	.pw-analysis > summary::before, .pw-more-elements > summary::before { transition: none; }
}
.pw-result-count { font-weight: 600; margin: 0 0 .75em; }
.pw-result-count:focus { outline: 2px solid var(--pw-accent); outline-offset: 2px; }
.pw-table--results tbody th a { font-weight: 600; white-space: nowrap; }
.pw-analysis-cell { font-variant-numeric: tabular-nums; color: var(--pw-muted); }
/* Element und Wert bleiben zusammen („Ni 8,00-10,5“); umbrochen wird an den Trennpunkten.
   inline-block statt nowrap: ein einzelner sehr langer Wert darf in sich noch umbrechen. */
.pw-analysis-cell span { display: inline-block; }
.pw-pagination ul { list-style: none; margin: 1.25em 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35em; }
.pw-pagination li { margin: 0; }
.pw-pagination a, .pw-pagination span { display: inline-block; min-width: 2.5em; min-height: 2.5em; line-height: 2.5em; text-align: center; padding: 0 .6em; border: 1px solid var(--pw-border); text-decoration: none; box-sizing: border-box; }
.pw-pagination span[aria-current] { background: var(--pw-accent); border-color: var(--pw-accent); color: #fff; font-weight: 600; }
.pw-pagination li[aria-hidden] { padding: 0 .3em; line-height: 2.5em; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
	.pw-search-main { grid-template-columns: 1fr; }
	.pw-search-form { padding: 1.25em 1em .75em; }
	.pw-search-results { padding: 1em 1em 1.1em; }
	.pw-search .pw-search-actions .pw-button { flex: 1 1 auto; }

	/* Trefferliste gestapelt statt Querscrollen: Nummer und Kurzname in einer Zeile, Analyse darunter.
	   Kopfzeile, Gruppe und AISI nur optisch ausgeblendet: Für Screenreader bleibt jede Zeile vollständig,
	   die ARIA-Rollen im Markup erhalten die Tabellensemantik. */
	.pw-table--results, .pw-table--results tbody { display: block; }
	.pw-table--results thead,
	.pw-table--results tbody td:nth-child(3),
	.pw-table--results tbody td:nth-child(4) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	/* Grundlinie: Avada setzt th und td in unterschiedlichen Schriften, Nummer und Kurzname sollen auf einer Linie stehen */
	.pw-table--results tbody tr { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: .1em .75em; padding: .6em 0; border-bottom: 1px solid var(--pw-border); }
	.pw-table--results tbody th, .pw-table--results tbody td { display: block; padding: 0; border: 0; overflow-wrap: anywhere; }
	.pw-table--results tbody .pw-analysis-cell { grid-column: 1 / -1; font-size: .9em; }
}

@media (max-width: 640px) {
	/* Kennwerte ohne Varianten: Wert unter die Beschriftung statt waagerecht scrollen */
	.pw-table--stack tbody th, .pw-table--stack tbody td { display: block; width: auto; }
	.pw-table--stack td { border-bottom-width: 2px; }
	/* Kennwerte und Analyse-Treffer zeilenweise statt waagerecht scrollen (wie die Suchtreffer) */
	.pw-table--properties thead, .pw-analysis-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.pw-table--properties, .pw-table--properties tbody, .pw-analysis-table, .pw-analysis-table tbody { display: block; }
	.pw-table--properties tbody tr, .pw-analysis-table tbody tr { display: block; padding: .6em 0; border-bottom: 1px solid var(--pw-border); }
	.pw-table--properties tbody th, .pw-table--properties tbody td,
	.pw-analysis-table tbody th, .pw-analysis-table tbody td { display: block; width: auto; padding: .1em 0; border: 0; }
	.pw-table--properties caption, .pw-analysis-table caption { display: block; }
	.pw-table--properties td[data-label] { display: inline; }
	.pw-table--properties td.pw-empty { display: none; }
	.pw-table--properties td[data-label]::after { content: " · "; color: var(--pw-muted); }
	.pw-table--properties td.pw-property-value { display: inline; font-weight: 600; }
	/* Vergleichsleiste kompakt: Anzahl statt Nummernliste */
	.pw-compare-bar { bottom: .5em; padding: .5em .8em; gap: .4em .8em; font-size: .88em; }
	.pw-compare-list { display: none; }
	.pw-table--kv th { width: auto; min-width: 0; }
	.pw-table--kv th,
	.pw-table--kv td { display: block; width: 100%; }
	.pw-table--kv td { border-bottom-width: 2px; }
	.pw-standard-list { columns: 1; }
}

/* Druckansicht: nur das Datenblatt, ohne Kopf, Navigation und Fuß der Website */
@media print {
	@page { size: A4; margin: 14mm 14mm 16mm; }

	#wpadminbar, header, footer:not(.pw-disclaimer), nav,
	.fusion-header-wrapper, .fusion-tb-header, .fusion-tb-footer, .fusion-footer,
	.fusion-page-title-bar, .avada-page-titlebar-wrapper, #sliders-container,
	.fusion-sharing-box, .related-posts, .single-related-posts, .fusion-meta-info, .single-navigation,
	.post-content-meta, #comments, .comment-respond, .to-top-container, #toTop,
	#sidebar, .sidebar, .fusion-sidebar, .fusion-breadcrumbs,
	.pw-no-print, .pw-compare-bar, .pw-compare-toggle { display: none !important; }

	/* Titel steht in der Kopfzeile des Datenblatts, die Seitenüberschrift des Themes entfällt */
	body:has(.pw-werkstoff) .entry-title,
	body:has(.pw-werkstoff) .fusion-post-title { display: none !important; }
	/* Bild entfällt im Druck, die Einleitung nimmt die volle Breite */
	.pw-lead--image { display: block; }

	body, #main, #content, .post-content { background: #fff !important; color: #000 !important; }
	#content, .fusion-row, #main, .post-content { width: 100% !important; max-width: none !important; float: none !important; margin: 0 !important; padding: 0 !important; }

	.pw-werkstoff { font-size: 10pt; line-height: 1.4; margin: 0; color: #000; }
	.pw-print-only { display: block; }
	.pw-print-head { border-bottom: 2px solid #000; padding-bottom: 3mm; margin-bottom: 5mm; }
	.pw-print-head strong { display: block; font-size: 15pt; margin-bottom: 1mm; }
	.pw-print-head span { font-size: 8.5pt; }

	.pw-section { margin: 0 0 6mm; }
	.pw-section h2 { font-size: 12pt; margin: 0 0 2mm; page-break-after: avoid; break-after: avoid; }
	.pw-table th, .pw-table td { padding: 1.2mm 2mm; border-color: #999; }
	.pw-table thead { display: table-header-group; }
	.pw-table tr { page-break-inside: avoid; break-inside: avoid; }
	.pw-table--kv th, .pw-table thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.pw-table-scroll { overflow: visible; }
	.pw-standard-list { columns: 2; }
	a { color: #000 !important; text-decoration: none !important; }
	a[href]::after { content: none !important; }
	.pw-notice, .pw-badge { background: none !important; border-color: #000 !important; }
	.pw-disclaimer { color: #333; font-size: 8pt; }
	.pw-analysis-form { display: none !important; }
	/* Kennwerte (kurze Tabelle) nicht über einen Seitenumbruch zerreißen, Hinweise klein */
	.pw-indices { break-inside: avoid; page-break-inside: avoid; }
	.pw-formula, .pw-indices-note { font-size: 8pt; color: #333 !important; }
	.pw-compare .pw-diff { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
