/* Gabelfreunde Rechner: Rechner (.gfc) und Umrechnungstabellen (.gft).
   Farben und Schriften kommen aus den Variablen der Seite (--gf-...). Die Ersatzwerte
   greifen dort, wo diese Variablen fehlen, zum Beispiel in der Druckansicht. */

.gfc,
.gft,
.gft-printdoc {
	--gfx-ink: var(--gf-ink, #23112f);
	--gfx-ink-soft: var(--gf-ink-soft, #5e5068);
	--gfx-brand: var(--gf-brand, #6a2a8c);
	--gfx-accent: var(--gf-accent, #ffc93c);
	--gfx-accent-soft: var(--gf-accent-soft, #fff3cf);
	--gfx-paper: var(--gf-paper, #fff);
	--gfx-mist: var(--gf-brand-soft, #f3eafa);
	--gfx-line: var(--gf-line, #e9dff1);
	--gfx-line-strong: var(--gf-line-strong, #9a86a8);
	--gfx-head: var(--gf-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	--gfx-body: var(--gf-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

.gfc,
.gft {
	font-family: var(--gfx-body);
	color: var(--gfx-ink);
	text-align: left;
}

.gfc *,
.gft * {
	box-sizing: border-box;
}

.gfc [hidden],
.gft [hidden] {
	display: none !important;
}

.gfc-frac {
	font-variant-numeric: diagonal-fractions;
}

.gfc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Rechner ---------- */

.gfc {
	background: var(--gfx-paper);
	border: 1px solid var(--gfx-line);
	border-radius: 28px;
	box-shadow: 0 2px 6px rgba(35, 17, 47, 0.07), 0 30px 60px -24px rgba(35, 17, 47, 0.4);
	overflow: hidden;
}

/* Anzeige: die Waage */
.gfc-out {
	position: relative;
	padding: 22px 28px 38px;
	background: var(--gfx-accent);
	background-image: radial-gradient(70% 120% at 100% 0%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
	color: var(--gfx-ink);
}

/* Skala wie am Messbecher: feine Striche, alle fünf ein langer */
.gfc-out::after {
	content: "";
	position: absolute;
	left: 28px;
	right: 0;
	bottom: 0;
	height: 16px;
	background-image:
		repeating-linear-gradient(90deg, var(--gfx-ink) 0, var(--gfx-ink) 2px, transparent 2px, transparent 60px),
		repeating-linear-gradient(90deg, var(--gfx-ink) 0, var(--gfx-ink) 1px, transparent 1px, transparent 12px);
	background-size: 100% 16px, 100% 8px;
	background-position: left bottom, left bottom;
	background-repeat: no-repeat;
	opacity: 0.5;
}

.gfc-out-label {
	margin: 0;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
}

.gfc-out-value {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 14px;
	margin: 6px 0 0;
	font-family: var(--gfx-head);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.035em;
	font-variant-numeric: lining-nums;
}

.gfc-out-number {
	display: inline-block;
	font-size: 84px;
	font-variant-numeric: lining-nums tabular-nums;
}

.gfc-out-number .gfc-frac {
	font-variant-numeric: lining-nums diagonal-fractions;
}

.gfc-out-unit {
	font-size: 38px;
}

.gfc-out-note {
	margin: 6px 0 0;
	font-size: 15px;
	line-height: 1.45;
}

@keyframes gfc-tick {
	from {
		opacity: 0.35;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.gfc-out-number.is-changed {
	animation: gfc-tick 0.18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
	.gfc-out-number.is-changed {
		animation: none;
	}
}

/* Eingaben */
.gfc-form {
	display: grid;
	gap: 14px;
	margin: 0;
	padding: 20px 28px 22px;
}

.gfc-mode {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 4px;
	min-width: 0;
	margin: 0;
	padding: 4px;
	border: 0;
	border-radius: 14px;
	background: var(--gfx-mist);
}

.gfc-mode-opt {
	position: relative;
	display: block;
	cursor: pointer;
}

.gfc-mode-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.gfc-mode-text {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 10px;
	border-radius: 10px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	color: var(--gfx-ink);
	transition: background-color 0.15s, color 0.15s;
}

.gfc-mode-input:checked + .gfc-mode-text {
	background: var(--gfx-ink);
	color: #fff;
}

.gfc-mode-input:focus-visible + .gfc-mode-text {
	outline: 3px solid var(--gfx-brand);
	outline-offset: 2px;
}

.gfc-field {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.gfc-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
	gap: 12px;
}

.gfc-label,
.gft-filter-label {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--gfx-ink);
}

.gfc-input,
.gfc-select,
.gft-filter-input {
	width: 100%;
	height: 50px;
	margin: 0;
	padding: 0 16px;
	border: 2px solid var(--gfx-ink);
	border-radius: 12px;
	background-color: var(--gfx-paper);
	color: var(--gfx-ink);
	font-family: inherit;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
	-webkit-appearance: none;
	appearance: none;
}

.gfc-select {
	padding-right: 44px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%232b1637' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 14px 9px;
	text-overflow: ellipsis;
	cursor: pointer;
}

.gft-filter-input {
	font-weight: 400;
}

.gft-filter-input::placeholder {
	color: var(--gfx-ink-soft);
	opacity: 1;
}

.gfc-input:focus-visible,
.gfc-select:focus-visible,
.gft-filter-input:focus-visible,
.gfc-chip:focus-visible,
.gft-print:focus-visible {
	outline: 3px solid var(--gfx-brand);
	outline-offset: 2px;
}

.gfc-input[aria-invalid="true"] {
	border-color: #b3261e;
	background-color: #fff5f4;
}

.gfc-static {
	display: flex;
	align-items: center;
	height: 50px;
	padding: 0 16px;
	border-radius: 12px;
	background: var(--gfx-mist);
	font-size: 18px;
	font-weight: 600;
}

.gfc-help {
	margin: -6px 0 0;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--gfx-ink-soft);
}

.gfc-quick {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
	gap: 6px;
}

.gfc-chip {
	width: 100%;
	min-width: 0;
	height: 40px;
	margin: 0;
	padding: 0 4px;
	border: 2px solid var(--gfx-line-strong);
	border-radius: 999px;
	background: var(--gfx-paper);
	color: var(--gfx-ink);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.gfc-chip:hover {
	border-color: var(--gfx-ink);
}

.gfc-chip[aria-pressed="true"] {
	border-color: var(--gfx-ink);
	background: var(--gfx-ink);
	color: #fff;
}

.gfc-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding-top: 14px;
	border-top: 1px solid var(--gfx-line);
}

.gfc-select--small {
	width: auto;
	max-width: 100%;
	height: 44px;
	border-color: var(--gfx-line-strong);
	font-size: 16px;
	font-weight: 400;
}

.gfc-noscript {
	margin: 0;
	padding: 0 28px 24px;
	font-size: 15px;
	line-height: 1.45;
	color: var(--gfx-ink-soft);
}

@media (max-width: 479px) {
	.gfc {
		border-radius: 18px;
	}

	.gfc-out {
		padding: 18px 20px 34px;
	}

	.gfc-out::after {
		left: 20px;
	}

	.gfc-out-number {
		font-size: 72px;
	}

	.gfc-out-unit {
		font-size: 34px;
	}

	.gfc-form {
		padding: 20px 20px 22px;
	}

	.gfc-noscript {
		padding: 0 20px 20px;
	}

	.gfc-chip {
		height: 44px;
	}
}

/* ---------- Weitere Rechner: Farben, Formen, Kacheln, Listen ---------- */

.gfc--peach .gfc-out {
	background-color: #ffc4b0;
}

.gfc--mint .gfc-out {
	background-color: #aee8cb;
}

.gfc--lilac .gfc-out {
	background-color: #d8c0ee;
}

.gfc-out-unit--pre {
	font-size: 56px;
	font-weight: 600;
}

.gfc-row--even {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gfc-nw {
	white-space: nowrap;
}

.gfc-row--one {
	grid-template-columns: minmax(0, 1fr);
}

.gfc-mode--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gfc-mode--3 .gfc-mode-text {
	min-height: 46px;
	padding: 4px 6px;
	font-size: 15px;
}

.gfc-quick--wide {
	grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

/* Zwei Formen im Vergleich */
.gfc-vis {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	padding: 20px 28px 0;
}

.gfc-vis-item {
	display: grid;
	justify-items: center;
	gap: 4px;
	min-width: 0;
}

.gfc-vis-svg {
	display: block;
	width: 100%;
	max-width: 150px;
	height: auto;
	overflow: visible;
}

.gfc-vis-svg circle,
.gfc-vis-svg rect {
	stroke-width: 2;
	transition: r 0.25s ease, width 0.25s ease, height 0.25s ease, x 0.25s ease, y 0.25s ease;
}

.gfc-vis-svg--a circle,
.gfc-vis-svg--a rect {
	fill: var(--gfx-mist);
	stroke: var(--gfx-line-strong);
	stroke-dasharray: 5 5;
}

.gfc-vis-svg--b circle,
.gfc-vis-svg--b rect {
	fill: var(--gfx-accent);
	stroke: var(--gfx-ink);
}

.gfc-vis-cap {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	color: var(--gfx-ink-soft);
}

.gfc-set {
	display: grid;
	gap: 10px;
	min-width: 0;
	padding: 14px;
	border: 1px solid var(--gfx-line);
	border-radius: 16px;
}

.gfc-set-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
}

.gfc-set-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
}

.gfc-shape {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: var(--gfx-mist);
}

.gfc-shape-opt {
	position: relative;
	display: block;
	cursor: pointer;
}

.gfc-shape-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.gfc-shape-text {
	display: flex;
	align-items: center;
	min-height: 36px;
	padding: 0 16px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--gfx-ink);
	transition: background-color 0.15s, color 0.15s;
}

.gfc-shape-input:checked + .gfc-shape-text {
	background: var(--gfx-ink);
	color: #fff;
}

.gfc-shape-input:focus-visible + .gfc-shape-text {
	outline: 3px solid var(--gfx-brand);
	outline-offset: 2px;
}

/* Mehrere Ergebnisse nebeneinander */
.gfc-tiles {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin: 12px 0 0;
}

.gfc-tile {
	min-width: 0;
	margin: 0;
	padding: 12px 12px 10px;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.6);
}

.gfc-tile-k {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
}

.gfc-tile-v {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 5px;
	margin: 6px 0 0;
	font-family: var(--gfx-head);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
}

.gfc-tile-n {
	display: inline-block;
	font-size: 44px;
	font-variant-numeric: lining-nums tabular-nums;
}

.gfc-tile-n .gfc-frac {
	font-variant-numeric: lining-nums diagonal-fractions;
}

.gfc-tile-u {
	font-size: 20px;
}

.gfc-tile-n.is-changed {
	animation: gfc-tick 0.18s ease-out;
}

/* Zutatenliste */
.gfc-textarea {
	display: block;
	width: 100%;
	min-height: 168px;
	margin: 0;
	padding: 12px 16px;
	border: 2px solid var(--gfx-ink);
	border-radius: 12px;
	background-color: var(--gfx-paper);
	color: var(--gfx-ink);
	font-family: inherit;
	font-size: 17px;
	line-height: 1.5;
	resize: vertical;
}

.gfc-textarea:focus-visible,
.gfc-copy:focus-visible {
	outline: 3px solid var(--gfx-brand);
	outline-offset: 2px;
}

.gfc-result {
	display: grid;
	gap: 12px;
	padding: 0 28px 26px;
}

.gfc-result-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
	padding-top: 18px;
	border-top: 1px solid var(--gfx-line);
}

.gfc-result-list {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gfc-result-item {
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--gfx-mist);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.gfc-result-item--empty {
	font-weight: 400;
	color: var(--gfx-ink-soft);
}

.gfc-copy {
	height: 40px;
	margin: 0;
	padding: 0 18px;
	border: 2px solid var(--gfx-ink);
	border-radius: 999px;
	background: var(--gfx-paper);
	color: var(--gfx-ink);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.gfc-copy:hover {
	background: var(--gfx-ink);
	color: #fff;
}

.gfc-copy[disabled] {
	opacity: 0.5;
	cursor: default;
}

@media (prefers-reduced-motion: reduce) {
	.gfc-tile-n.is-changed {
		animation: none;
	}

	.gfc-vis-svg circle,
	.gfc-vis-svg rect {
		transition: none;
	}
}

@media (max-width: 479px) {
	.gfc-out-unit--pre {
		font-size: 48px;
	}

	.gfc-row--stack {
		grid-template-columns: minmax(0, 1fr);
	}

	.gfc-vis {
		padding: 18px 20px 0;
	}

	.gfc-set {
		padding: 12px;
	}

	.gfc-tiles {
		gap: 8px;
	}

	.gfc-tile {
		padding: 10px 8px 8px;
		border-radius: 14px;
	}

	.gfc-tile-k {
		font-size: 13px;
	}

	.gfc-tile-n {
		font-size: 30px;
	}

	.gfc-tile-u {
		font-size: 16px;
	}

	.gfc-result {
		padding: 0 20px 22px;
	}

	.gfc-copy {
		height: 44px;
	}
}

/* ---------- Tabellen ---------- */

.gft {
	display: grid;
	gap: 32px;
}

.gft-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

.gft-filter {
	display: grid;
	flex: 1 1 280px;
	gap: 6px;
	max-width: 440px;
}

.gft-print {
	height: 50px;
	margin: 0;
	padding: 0 22px;
	border: 2px solid var(--gfx-ink);
	border-radius: 12px;
	background: transparent;
	color: var(--gfx-ink);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.gft-print:hover {
	background: var(--gfx-ink);
	color: #fff;
}

.gft-empty {
	margin: 0;
	padding: 16px 20px;
	border-radius: 12px;
	background: var(--gfx-accent-soft);
	font-size: 17px;
	line-height: 1.5;
}

.gft-group {
	display: grid;
	gap: 14px;
	scroll-margin-top: 24px;
}

.gft-group-title {
	margin: 0;
	font-family: var(--gfx-head);
	font-size: 26px;
	font-weight: 800;
	line-height: 1.15;
	color: var(--gfx-ink);
	font-variant-numeric: lining-nums;
}

.gft-table {
	width: 100%;
	border: 1px solid var(--gfx-line);
	border-radius: 16px;
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	background: var(--gfx-paper);
	font-size: 17px;
	line-height: 1.35;
	font-variant-numeric: lining-nums tabular-nums;
}

.gft-head {
	padding: 13px 18px;
	border-bottom: 2px solid var(--gfx-ink);
	background: var(--gfx-paper);
	font-size: 15px;
	font-weight: 600;
	text-align: right;
	white-space: nowrap;
	color: var(--gfx-ink);
}

.gft-head--name {
	width: 40%;
	text-align: left;
}

.gft-name,
.gft-val {
	padding: 12px 18px;
	border-bottom: 1px solid var(--gfx-line);
	vertical-align: baseline;
	transition: background-color 0.12s;
}

.gft-name {
	font-weight: 600;
	text-align: left;
}

.gft-val {
	text-align: right;
	white-space: nowrap;
}

.gft-name + .gft-val {
	font-weight: 600;
}

.gft-row:last-child .gft-name,
.gft-row:last-child .gft-val {
	border-bottom: 0;
}

.gft-row:hover .gft-name,
.gft-row:hover .gft-val {
	background: var(--gfx-accent-soft);
}

.gft-en,
.gft-hint {
	font-size: 15px;
	font-weight: 400;
	color: var(--gfx-ink-soft);
}

.gft-en {
	margin-left: 8px;
}

.gft-hint {
	display: block;
}

.gft-source {
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
	color: var(--gfx-ink-soft);
}

/* Handy: jede Zutat als eigener Block, Werte nebeneinander, nichts zum seitlichen Wischen */
@media screen and (max-width: 767px) {
	.gft {
		gap: 28px;
	}

	.gft-print {
		display: none;
	}

	.gft-filter {
		max-width: none;
	}

	.gft-group-title {
		font-size: 23px;
	}

	.gft-table {
		display: block;
		border: 0;
		border-radius: 0;
		overflow: visible;
		background: transparent;
		font-size: 16px;
	}

	.gft-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.gft-table tbody {
		display: grid;
		gap: 8px;
	}

	.gft-row {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: 10px 6px;
		padding: 14px 14px 13px;
		border: 1px solid var(--gfx-line);
		border-radius: 14px;
		background: var(--gfx-paper);
	}

	.gft-table--4 .gft-row {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.gft-name,
	.gft-val {
		padding: 0;
		border: 0;
	}

	.gft-name {
		display: block;
		grid-column: 1 / -1;
		font-size: 17px;
	}

	.gft-de,
	.gft-en {
		display: block;
	}

	.gft-en {
		margin-left: 0;
	}

	.gft-en,
	.gft-hint {
		font-size: 14px;
	}

	.gft-val {
		display: flex;
		flex-direction: column;
		gap: 2px;
		font-weight: 600;
		text-align: left;
	}

	.gft-val::before {
		content: attr(data-label);
		font-size: 12.5px;
		font-weight: 400;
		color: var(--gfx-ink-soft);
	}

	.gft-row:hover .gft-name,
	.gft-row:hover .gft-val {
		background: transparent;
	}

	/* Gruppen lassen sich auf dem Handy auf- und zuklappen (Knopf kommt per JavaScript) */
	.gft {
		gap: 20px;
	}

	.gft-group {
		gap: 12px;
	}

	.gft-group-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		width: 100%;
		min-height: 56px;
		margin: 0;
		padding: 8px 0;
		border: 0;
		border-bottom: 2px solid var(--gfx-ink);
		border-radius: 0;
		background: transparent;
		color: var(--gfx-ink);
		font: inherit;
		text-align: left;
		cursor: pointer;
	}

	.gft-group-toggle::after {
		content: "";
		flex: none;
		width: 11px;
		height: 11px;
		margin-right: 6px;
		border-right: 2.5px solid var(--gfx-ink);
		border-bottom: 2.5px solid var(--gfx-ink);
		transform: translateY(-3px) rotate(45deg);
		transition: transform 0.15s;
	}

	.gft-group-toggle[aria-expanded="true"]::after {
		transform: translateY(3px) rotate(225deg);
	}

	.gft-group-toggle:focus-visible {
		outline: 3px solid var(--gfx-brand);
		outline-offset: 2px;
	}

	.gft-group-count {
		margin-left: 8px;
		font-family: var(--gfx-body);
		font-size: 15px;
		font-weight: 400;
		color: var(--gfx-ink-soft);
	}

	.gft-group.is-collapsed .gft-table {
		display: none;
	}
}

/* ---------- Druck ---------- */

.gft-printdoc {
	margin: 0;
	padding: 0;
	background: #fff;
}

.gft-print-title {
	margin: 0 0 14pt;
	font-family: var(--gfx-head);
	font-size: 20pt;
	font-weight: 800;
	line-height: 1.1;
	color: #000;
}

@media print {
	.gft {
		gap: 16pt;
		color: #000;
	}

	.gft-tools,
	.gft-empty {
		display: none !important;
	}

	.gft-group {
		gap: 6pt;
		break-inside: avoid;
	}

	.gft-group-title {
		font-size: 13pt;
		color: #000;
	}

	.gft-table {
		border-color: #999;
		border-radius: 0;
		font-size: 10pt;
	}

	.gft-head,
	.gft-name,
	.gft-val {
		padding: 4pt 8pt;
		color: #000;
	}

	.gft-en,
	.gft-hint,
	.gft-source {
		font-size: 8.5pt;
		color: #333;
	}

	.gft-row {
		break-inside: avoid;
	}
}
