/*
 * EoY Table – Handy und Tablet (bis 1279px): Einträge als Karten statt breiter Tabelle,
 * ab 768px zweispaltig;
 * Filter hinter einem "Filter"-Knopf. Desktop bleibt unverändert.
 * Wird nach style.css und dem Theme-CSS geladen.
 */

/* Filter-Knopf existiert nur mobil */
.eoy-filter-toggle {
	display: none;
}

@media (max-width: 1279px) {

	/* ---------- Filter ---------- */
	#filter .js-select-wrapper {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: 0 10px;
	}
	#filter .select {
		height: auto;
		margin: 0 0 16px;
	}
	#filter .select.input.search {
		order: -2;
		flex: 1 1 0;
		width: auto !important;
		min-width: 0;
		margin-bottom: 16px;
	}
	#filter .select span {
		font-size: 22px;
		margin-bottom: 8px;
	}
	#filter .select.checkbox span {
		font-family: "EYInterstate Regular", Arial, sans-serif;
		font-size: 16px;
		font-weight: 400;
		color: #fff;
		margin: 0;
	}
	#filter .select.checkbox .flex-col {
		padding-top: 0;
		gap: 8px;
	}
	.eoy-filter-toggle {
		order: -1;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		height: 38px;
		margin: 0 0 16px;
		padding: 0 14px;
		border: 1px solid #ffe600;
		border-radius: 4px;
		background: transparent;
		color: #ffe600;
		font-family: "EYInterstate Bold", Arial, sans-serif;
		font-size: 15px;
		font-style: normal;
		font-weight: 700;
		line-height: 1;
		cursor: pointer;
	}
	.eoy-filter-toggle:hover,
	.eoy-filter-toggle:focus {
		background: transparent;
		color: #ffe600;
	}
	.eoy-filter-toggle[aria-expanded="true"] {
		background: #ffe600;
		color: #2e2e38;
	}
	.eoy-filter-toggle .eoy-filter-count:empty {
		display: none;
	}
	.eoy-filter-toggle .eoy-filter-count::before {
		content: "(";
	}
	.eoy-filter-toggle .eoy-filter-count::after {
		content: ")";
	}
	#filter .js-select-wrapper:not(.filters-open) > .select:not(.search) {
		display: none;
	}
	#filter .js-select-wrapper.filters-open > .select:not(.search) {
		width: 100%;
	}

	/* ---------- Karten ---------- */
	/* Theme-Grid zieht main.row um -15px nach aussen: Karten bekommen denselben Rand wie Suche und Jahr */
	main.site-main._filterList {
		width: auto;
		max-width: none;
		margin-left: 0;
		margin-right: 0;
	}
	section.table table {
		display: block;
		width: 100%;
		padding-top: 0;
		border: 0;
		background: transparent;
	}
	section.table table tbody {
		display: block;
	}
	section.table table.j_and_s,
	section.table table.j_and_s.active {
		display: none;
	}

	/* Kopfzeile: nur die Jahreszahl als Zwischentitel */
	section.table table tr:first-child {
		display: block;
		position: static;
		padding: 0;
		border: 0;
	}
	section.table table tr:first-child th {
		display: none;
	}
	section.table table tr:first-child th.year {
		display: block;
		position: static;
		margin: 32px 0 8px;
		padding: 0 !important;
		width: auto;
		font-size: 40px;
		line-height: 1.1;
		text-align: left;
	}
	section.table table tr:first-child th.year:empty {
		display: none;
	}

	/* Eintrag = Karte */
	section.table table tr:not(:first-child) {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 6px;
		position: static;
		padding: 16px 0;
		border-top: 1px solid #44444f;
		background: transparent;
	}
	section.table table tr.j_and_s:not(:first-child) {
		display: none;
	}
	section.table table tr.j_and_s.active:not(:first-child) {
		display: flex;
	}
	section.table table tr:not(:first-child) td {
		display: block;
		width: auto !important;
		min-width: 0 !important;
		padding: 0 !important;
		border: 0;
		background: transparent;
		white-space: normal;
	}
	section.table table tr:not(:first-child) td.year {
		display: none;
	}
	section.table table tr:not(:first-child) td.flex-row {
		display: contents;
	}
	section.table table tr:not(:first-child) .name {
		order: 1;
		flex: 1 0 100%;
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0;
		font-family: "EYInterstate Bold", Arial, sans-serif;
		font-size: 17px;
		line-height: 1.3;
		color: #fff;
	}
	section.table table tr:not(:first-child) .name .linkedin-image {
		flex: 0 0 auto;
		margin: 0;
	}
	section.table table tr:not(:first-child) td.company {
		order: 2;
		flex: 1 0 100%;
		font-size: 15px;
		color: #c4c4cd;
	}
	section.table table tr:not(:first-child) .desc {
		order: 3;
		flex: 1 0 100%;
		margin: 4px 0 6px;
		font-size: 15px;
		line-height: 1.45;
		color: #fff;
	}
	section.table table tr:not(:first-child) td.industry,
	section.table table tr:not(:first-child) td.reg {
		order: 4;
		padding: 3px 8px !important;
		border-radius: 4px;
		background: #44444f;
		font-size: 13px;
		line-height: 1.3;
		color: #fff;
	}
	section.table table tr:not(:first-child) td.industry:empty,
	section.table table tr:not(:first-child) td.reg:empty {
		display: none;
	}

	/* In der Jahresansicht steht das Jahr schon als Titel: Jahres-Etikett weglassen (Suchergebnisse behalten es) */
	section.table table:has(th.year:not(:empty)) tr:not(:first-child) td.reg:last-child {
		display: none;
	}
	#filter {
		padding-bottom: 0;
	}

	/* Gewinner-Etikett (nur wenn "Highlight Winners" aktiv) */
	section.table table tr:not(:first-child) td.img-hidden {
		order: 5;
		display: none;
	}
	section.table table tr:not(:first-child) td.img-hidden.winners.open {
		display: block;
		height: auto;
	}
	section.table table tr:not(:first-child) td.img-hidden.winners.open img {
		display: none !important;
	}
	section.table table tr:not(:first-child) td.img-hidden.winners.open::after {
		content: "Winner";
		display: inline-block;
		padding: 3px 8px;
		border-radius: 4px;
		background: #ffe600;
		color: #2e2e38;
		font-family: "EYInterstate Bold", Arial, sans-serif;
		font-size: 13px;
		line-height: 1.3;
	}
}

/* Tablet: Karten zweispaltig, Filter in einer Reihe wenn aufgeklappt */
@media (min-width: 768px) and (max-width: 1279px) {
	section.table table tbody {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		column-gap: 32px;
	}
	section.table table tr:first-child {
		grid-column: 1 / -1;
	}
	section.table table tr:not(:first-child) {
		align-content: flex-start;
	}
	#filter .js-select-wrapper.filters-open > .select:not(.search):not(.checkbox) {
		width: calc(50% - 5px);
	}
	#filter .select.input.search {
		flex: 0 1 420px;
	}
}
