/* Samenarchiv – Frontend
   Farben lassen sich im Theme über die Variablen anpassen, z. B.:
   .sa-archive { --sa-accent: #4a7a2c; }
*/
.sa-archive,
.sa-single {
	--sa-accent: #4a7a2c;
	--sa-accent-soft: #eef4e8;
	--sa-border: #dfe3da;
	--sa-muted: #6b7065;
	--sa-bg: #f6f7f4;
	--sa-radius: 8px;
}

.sa-visually-hidden {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

/* ---------- Bedienleiste ---------- */
.sa-controls {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 1em 1.25em;
	padding: 1.25em;
	margin-bottom: 1.5em;
	background: var(--sa-bg);
	border: 1px solid var(--sa-border);
	border-radius: var(--sa-radius);
}
.sa-search { position: relative; }
.sa-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: .7em 2.5em .7em .9em;
	font-size: 1.05em;
	border: 1px solid var(--sa-border);
	border-radius: var(--sa-radius);
	background: #fff;
}
.sa-search-input:focus { outline: 2px solid var(--sa-accent); outline-offset: 1px; border-color: var(--sa-accent); }
.sa-search-input::-webkit-search-cancel-button { display: none; }
.sa-search-clear {
	position: absolute; right: .4em; top: 50%; transform: translateY(-50%);
	width: 1.8em; height: 1.8em; padding: 0; line-height: 1;
	border: 0; border-radius: 50%; background: transparent; color: var(--sa-muted);
	font-size: 1.2em; cursor: pointer;
}
.sa-search-clear:hover { background: var(--sa-border); color: #000; }

.sa-select { display: flex; align-items: center; gap: .5em; }
.sa-select label { font-weight: 600; white-space: nowrap; }
.sa-select select {
	padding: .6em .8em; border: 1px solid var(--sa-border); border-radius: var(--sa-radius);
	background: #fff; min-width: 12em; max-width: 100%;
}

.sa-props { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: .4em; }
.sa-props legend { font-weight: 600; margin-bottom: .5em; padding: 0; }
.sa-props-hint { font-weight: normal; color: var(--sa-muted); font-size: .85em; }
.sa-chip { cursor: pointer; }
.sa-chip input { position: absolute; opacity: 0; pointer-events: none; }
.sa-chip span {
	display: inline-block; padding: .3em .8em; border: 1px solid var(--sa-border);
	border-radius: 999px; background: #fff; font-size: .9em; transition: background .15s, border-color .15s;
}
.sa-chip span small { color: var(--sa-muted); }
.sa-chip:hover span { border-color: var(--sa-accent); }
.sa-chip input:checked + span { background: var(--sa-accent); border-color: var(--sa-accent); color: #fff; }
.sa-chip input:checked + span small { color: rgba(255, 255, 255, .8); }
.sa-chip input:focus-visible + span { outline: 2px solid var(--sa-accent); outline-offset: 2px; }

.sa-status { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.sa-count { margin: 0; font-weight: 600; color: var(--sa-muted); }
.sa-reset {
	border: 0; background: none; padding: 0; color: var(--sa-accent);
	text-decoration: underline; cursor: pointer; font: inherit;
}

/* ---------- Sprungmarken ---------- */
.sa-jump { display: flex; flex-wrap: wrap; gap: .4em; margin: 0 0 1.5em; }
.sa-jump a {
	padding: .25em .7em; border-radius: 999px; background: var(--sa-accent-soft);
	color: inherit; text-decoration: none; font-size: .9em;
}
.sa-jump a:hover { background: var(--sa-accent); color: #fff; }
.sa-jump a span { opacity: .65; font-size: .85em; }

/* ---------- Gruppen & Tabelle ---------- */
.sa-group { margin-bottom: 2.25em; scroll-margin-top: 5em; }
.sa-group-title {
	display: flex; align-items: baseline; gap: .5em;
	padding-bottom: .35em; margin: 0 0 .5em; border-bottom: 2px solid var(--sa-accent);
}
.sa-group-count {
	font-size: .6em; font-weight: 600; padding: .15em .6em; border-radius: 999px;
	background: var(--sa-accent-soft); color: var(--sa-accent);
}

.sa-table { width: 100%; min-width: 100%; border-collapse: collapse; margin: 0; }
.sa-table th {
	text-align: left; font-size: .8em; text-transform: uppercase; letter-spacing: .04em;
	color: var(--sa-muted); padding: .5em .6em; border-bottom: 1px solid var(--sa-border);
}
.sa-table td { padding: .65em .6em; vertical-align: top; border-bottom: 1px solid var(--sa-border); }
.sa-table tbody tr:hover { background: var(--sa-bg); }
.sa-table tr[hidden] { display: none; }
.sa-table { table-layout: fixed; }
.sa-table th:nth-child(1) { width: 38%; }
.sa-table th:nth-child(2) { width: 20%; }
.sa-table th.sa-col-price { width: 11%; }
.sa-table td { overflow-wrap: anywhere; }
.sa-col-price { text-align: right; white-space: nowrap; }

.sa-name { display: flex; align-items: center; gap: .75em; }
.sa-thumbs { display: flex; gap: .3em; flex-shrink: 0; }
.sa-thumb img {
	display: block; width: 48px; height: 48px; object-fit: cover;
	border-radius: 6px; border: 1px solid var(--sa-border); background: #fff;
}
.sa-thumb:hover img { border-color: var(--sa-accent); }
.sa-name-text { display: flex; flex-direction: column; }
.sa-name-text a { color: inherit; }
.sa-latin { color: var(--sa-muted); font-size: .9em; }
.sa-keim { display: block; }
.sa-note { display: block; color: var(--sa-muted); }
.sa-tag {
	display: inline-block; margin: 0 .2em .25em 0; padding: .1em .55em; border-radius: 4px;
	background: var(--sa-accent-soft); font-size: .8em; white-space: nowrap;
}

.sa-empty { padding: 2em; text-align: center; color: var(--sa-muted); background: var(--sa-bg); border-radius: var(--sa-radius); }
.sa-group[hidden], .sa-jump a[hidden], .sa-empty[hidden], .sa-reset[hidden], .sa-search-clear[hidden] { display: none; }

/* ---------- Mobil: Tabelle als Karten ---------- */
@media (max-width: 640px) {
	.sa-controls { grid-template-columns: 1fr; padding: 1em; }
	.sa-select { flex-wrap: wrap; }
	.sa-select select { flex: 1; }
	.sa-table thead { display: none; }
	.sa-table, .sa-table tbody, .sa-table tr, .sa-table td { display: block; width: auto; }
	.sa-table tr { padding: .75em 0; border-bottom: 1px solid var(--sa-border); }
	.sa-table td { border: 0; padding: .2em 0; }
	.sa-table td:empty { display: none; }
	.sa-col-keim::before, .sa-col-price::before {
		content: attr(data-label) ": "; font-weight: 600; font-size: .85em; color: var(--sa-muted);
	}
	.sa-col-price { text-align: left; }
}

/* ---------- Einzelansicht ---------- */
.sa-single { margin-top: 2em; }
.sa-single-images { display: flex; flex-wrap: wrap; gap: 1em; margin-bottom: 1.5em; }
.sa-single-images figure { margin: 0; }
.sa-single-images img { width: 220px; height: 220px; object-fit: cover; border-radius: var(--sa-radius); display: block; }
.sa-single-images figcaption { font-size: .85em; color: var(--sa-muted); margin-top: .3em; }
.sa-single-list { display: grid; grid-template-columns: max-content 1fr; gap: .5em 1.5em; }
.sa-single-list dt { font-weight: 600; }
.sa-single-list dd { margin: 0; }

/* ---------- Lightbox ---------- */
.sa-lb-open { overflow: hidden; }
.sa-lightbox {
	position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center;
	background: rgba(15, 18, 12, .88); padding: 3em 4em;
}
.sa-lightbox[hidden] { display: none; }
.sa-lightbox figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
.sa-lightbox img { max-width: 100%; max-height: calc(100vh - 8em); border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.sa-lightbox figcaption { color: #fff; margin-top: .75em; }
.sa-lightbox button {
	position: absolute; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
	width: 2.4em; height: 2.4em; border-radius: 50%; font-size: 1.5em; line-height: 1; cursor: pointer;
}
.sa-lightbox button:hover { background: rgba(255, 255, 255, .28); }
.sa-lb-close { top: .6em; right: .6em; }
.sa-lb-prev { left: .6em; top: 50%; transform: translateY(-50%); }
.sa-lb-next { right: .6em; top: 50%; transform: translateY(-50%); }
.sa-lb-single .sa-lb-prev, .sa-lb-single .sa-lb-next { display: none; }
@media (max-width: 640px) { .sa-lightbox { padding: 3.5em .75em; } }
