/*
 * Shared components: element cells, mini tags, teacher cards, empty states,
 * buttons, breadcrumbs. Uses theme.json presets with fallbacks, so blocks
 * stay readable under any theme.
 */

.tfk-cell,
.tfk-tag,
.tfk-tcard,
.tfk-empty,
.tfk-btn,
.tfk-former,
.tfk-fcell {
	--tfk-ink: var(--wp--preset--color--ink, #121417);
	--tfk-white: var(--wp--preset--color--white, #fff);
	--tfk-display: var(--wp--preset--font-family--display, system-ui, sans-serif);
	box-sizing: border-box;
}

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

.tfk-label {
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.07em;
	text-transform: uppercase;
}

/* ---------- Element cell ---------- */

.tfk-cell {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto 1fr auto;
	grid-template-areas:
		"num cap"
		"sym sym"
		"name name";
	aspect-ratio: 1;
	min-width: 0;
	padding: 8px;
	container-type: inline-size;
	border: 2px solid var(--tfk-ink);
	border-radius: 0;
	background: var(--el-color, var(--tfk-white));
	color: var(--tfk-ink);
	text-decoration: none;
}

.tfk-cell__num {
	grid-area: num;
	font-family: var(--tfk-display);
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}

.tfk-cell__cap {
	grid-area: cap;
	justify-self: end;
	font-size: clamp(10px, 9cqi, 12px);
	font-weight: 700;
	line-height: 1.1;
	white-space: nowrap;
}

.tfk-cell__sym {
	grid-area: sym;
	place-self: center;
	font-family: var(--tfk-display);
	font-size: clamp(22px, 34cqi, 56px);
	font-weight: 800;
	line-height: 1;
}

.tfk-cell__name {
	grid-area: name;
	margin: 0;
	font-size: clamp(11px, 9.5cqi, 14px);
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	overflow-wrap: anywhere;
	hyphens: auto;
}

.tfk-cell__ext {
	position: absolute;
	right: 6px;
	bottom: 6px;
	display: flex;
}

.tfk-cell--lg .tfk-cell__sym {
	font-size: clamp(28px, 36cqi, 72px);
}

a.tfk-cell:hover,
.tfk-tag:hover,
.tfk-btn:hover,
.tfk-tcard__name a:hover {
	outline: 3px solid var(--tfk-ink);
	outline-offset: 2px;
}

a.tfk-cell:focus-visible,
.tfk-tag:focus-visible,
.tfk-btn:focus-visible,
.tfk-fcell:focus-visible,
.tfk-works a:focus-visible,
.tfk-tcard a:focus-visible,
.tfk-crumbs a:focus-visible {
	outline: 3px solid var(--tfk-ink);
	outline-offset: 2px;
}

/* ---------- Mini tags ---------- */

.tfk-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tfk-tags > li {
	margin: 0;
}

.tfk-tag {
	display: grid;
	place-items: center;
	/* 34px visual cell; the 44px hit area comes from the padding box below. */
	width: 34px;
	height: 34px;
	border: 1.5px solid var(--tfk-ink);
	background: var(--el-color, var(--tfk-white));
	color: var(--tfk-ink);
	font-family: var(--tfk-display);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
}

a.tfk-tag {
	position: relative;
}

a.tfk-tag::after {
	content: "";
	position: absolute;
	inset: -5px;
}

/* ---------- Photos ---------- */

.wp-block-post-featured-image img,
.tfk-photo img,
.tfk-tcard__photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(0.15) contrast(1.05);
}

.tfk-photo-ph {
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 4 / 5;
	container-type: inline-size;
	background: var(--wp--preset--color--placeholder, #E9E9E3);
	color: var(--wp--preset--color--muted-text, #3A3D42);
	font-family: var(--wp--preset--font-family--display, system-ui, sans-serif);
	font-size: clamp(18px, 26cqi, 64px);
	font-weight: 700;
	line-height: 1;
}

/* ---------- Teacher grid ---------- */

.tfk-tgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
	gap: 16px;
}

.tfk-tcard {
	margin: 0;
}

.tfk-tcard__in {
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 100%;
	padding: 16px;
	border: 2px solid var(--tfk-ink);
	background: var(--tfk-white);
	color: var(--tfk-ink);
}

.tfk-tcard__top {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	gap: 12px;
	margin-bottom: 4px;
}

.tfk-tcard__photo {
	width: 96px;
	aspect-ratio: 4 / 5;
	overflow: hidden;
}

.tfk-tcard__el {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto 1fr;
	align-self: start;
	aspect-ratio: 1;
	max-width: 120px;
	padding: 6px 8px;
	border: 2px solid currentColor;
}

.tfk-tcard__num {
	font-family: var(--tfk-display);
	font-size: 13px;
	font-weight: 700;
}

.tfk-tcard__cat {
	justify-self: end;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tfk-tcard__sym {
	grid-column: 1 / -1;
	place-self: center;
	font-family: var(--tfk-display);
	font-size: 40px;
	font-weight: 800;
	line-height: 1;
}

.tfk-tcard__name {
	margin: 0;
	font-family: var(--tfk-display);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

.tfk-tcard__name a {
	color: inherit;
	text-decoration: none;
}

.tfk-tcard__role,
.tfk-tcard__meta,
.tfk-tcard__note,
.tfk-tcard__mail {
	margin: 0;
	font-size: 16px;
	line-height: 1.45;
}

.tfk-tcard__role {
	font-weight: 800;
}

.tfk-tcard__note {
	color: var(--wp--preset--color--muted-text, #3A3D42);
}

.tfk-tcard .tfk-tags {
	margin-top: auto;
	padding-top: 8px;
}

.tfk-tcard__mail a {
	overflow-wrap: anywhere;
}

.tfk-tcard--compact .tfk-tcard__top {
	grid-template-columns: 96px;
}

.tfk-tcard--head .tfk-tcard__in {
	background: var(--tfk-ink);
	color: var(--tfk-white);
}

.tfk-tcard--head .tfk-tcard__note {
	color: var(--wp--preset--color--on-dark-muted, #D5D7DB);
}

.tfk-tcard--head a {
	color: var(--tfk-white);
}

.tfk-tcard--head a:hover,
.tfk-tcard--head a:focus-visible {
	outline-color: var(--tfk-white);
}

.tfk-tcard--head .tfk-tag {
	border-color: var(--tfk-white);
	color: var(--tfk-ink);
}

@media (min-width: 640px) {
	.tfk-tcard--head {
		grid-column: span 2;
	}

	.tfk-tcard--head .tfk-tcard__top {
		grid-template-columns: 144px 120px;
	}

	.tfk-tcard--head .tfk-tcard__photo {
		width: 144px;
	}

	.tfk-tcard--head .tfk-tcard__name {
		font-size: 22px;
	}
}

/* List layout */

.tfk-tlist {
	border-top: 2px solid var(--wp--preset--color--ink, #121417);
}

.tfk-tlist__item {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) auto;
	gap: 16px;
	align-items: start;
	margin: 0;
	padding: 16px 0;
	border-bottom: 1px solid var(--wp--preset--color--muted-border, #6B6F76);
}

.tfk-tlist__sym {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border: 2px solid var(--wp--preset--color--ink, #121417);
	font-family: var(--wp--preset--font-family--display, sans-serif);
	font-size: 20px;
	font-weight: 800;
}

.tfk-tlist__name {
	margin: 0 0 4px;
	font-size: 17px;
}

.tfk-tlist__name a {
	color: inherit;
}

.tfk-tlist__meta {
	margin: 0;
}

.tfk-tlist__quals {
	margin: 8px 0 0;
	padding-left: 20px;
}

@media (max-width: 599px) {
	.tfk-tlist__item {
		grid-template-columns: 48px minmax(0, 1fr);
	}

	.tfk-tlist__item > .tfk-tags {
		grid-column: 2;
	}

	.tfk-tlist__sym {
		width: 48px;
		height: 48px;
	}
}

/* Former teachers */

.tfk-former-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 170px));
	gap: 12px;
}

.tfk-former {
	display: grid;
	grid-template-rows: 1fr auto;
	aspect-ratio: 1;
	margin: 0;
	padding: 12px;
	border: 2px solid var(--wp--preset--color--muted-border, #6B6F76);
	background: var(--wp--preset--color--surface, #EFEFEB);
	color: var(--wp--preset--color--muted-text, #3A3D42);
}

.tfk-former__sym {
	place-self: center;
	font-family: var(--tfk-display);
	font-size: 44px;
	font-weight: 800;
	line-height: 1;
}

.tfk-former__name {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
}

.tfk-former__name a {
	color: inherit;
}

/* ---------- Empty state ---------- */

.tfk-empty {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: center;
	padding: 20px;
	border: 2px dashed var(--wp--preset--color--muted-border, #6B6F76);
	background: var(--wp--preset--color--surface, #EFEFEB);
	color: var(--wp--preset--color--muted-text, #3A3D42);
}

.tfk-empty__cell {
	display: grid;
	grid-template-rows: auto 1fr;
	flex: 0 0 96px;
	width: 96px;
	height: 96px;
	padding: 6px 8px;
	border: 2px dashed var(--wp--preset--color--muted-border, #6B6F76);
	background: var(--tfk-white);
}

.tfk-empty__num {
	font-family: var(--tfk-display);
	font-size: 13px;
	font-weight: 700;
}

.tfk-empty__sym {
	place-self: center;
	font-family: var(--tfk-display);
	font-size: 32px;
	font-weight: 800;
	line-height: 1;
}

.tfk-empty__body {
	flex: 1 1 240px;
}

.tfk-empty__title {
	margin: 0 0 4px;
	color: var(--tfk-ink);
	font-weight: 800;
}

.tfk-empty__text {
	margin: 0;
}

/* ---------- Buttons and links ---------- */

.tfk-btn {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	min-height: 44px;
	padding: 8px 18px;
	border: 2px solid var(--tfk-ink);
	border-radius: 0;
	font-weight: 800;
	line-height: 1.2;
	text-decoration: none;
}

.tfk-btn--dark {
	background: var(--tfk-ink);
	color: var(--tfk-white);
}

.tfk-btn--light {
	background: var(--tfk-white);
	color: var(--tfk-ink);
}

.tfk-pending {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 14px;
	border: 2px dashed var(--wp--preset--color--muted-border, #6B6F76);
	background: var(--wp--preset--color--surface, #EFEFEB);
	color: var(--wp--preset--color--muted-text, #3A3D42);
	font-weight: 600;
}

.tfk-ext-icon {
	flex: none;
	margin-left: 4px;
	vertical-align: -1px;
}

/* ---------- Breadcrumbs ---------- */

.tfk-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 0;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 15px;
}

.tfk-crumbs li + li::before {
	content: "/";
	margin: 0 10px;
	color: var(--wp--preset--color--muted-border, #6B6F76);
}

.tfk-crumbs [aria-current] {
	font-weight: 700;
}

/* ---------- Facebook ---------- */

.tfk-fb {
	max-width: 500px;
}

.tfk-fb__frame {
	display: block;
	width: 100%;
	max-width: 500px;
	border: 2px solid var(--wp--preset--color--ink, #121417);
	background: var(--wp--preset--color--white, #fff);
}

.tfk-fb__link,
.tfk-fb__video {
	margin: 12px 0 0;
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
	.tfk-cell,
	.tfk-tag,
	.tfk-btn,
	.tfk-fcell {
		transition: none !important;
	}
}

@media print {
	.tfk-works__filters,
	.tfk-fb {
		display: none !important;
	}

	.tfk-tcard,
	.tfk-cell,
	.tfk-former,
	.tfk-works__item,
	.tfk-dlist__item,
	.tfk-empty {
		break-inside: avoid;
	}

	.tfk-tcard--head .tfk-tcard__in {
		background: #fff !important;
		color: #000 !important;
	}

	.tfk-tcard--head a {
		color: #000 !important;
	}

	.tfk-btn--dark {
		background: #fff !important;
		color: #000 !important;
	}
}

/* ---------- Legend and section titles ---------- */

.tfk-legend__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tfk-legend__item {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	min-height: 44px;
	color: inherit;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
}

.tfk-legend__item:hover span:last-child {
	text-decoration: underline;
}

.tfk-block-title {
	margin: 0 0 24px;
}
