/* Termaneh public catalog. Inherits the theme's font and colours; three optional tokens
   (--trm-ink, --trm-stamp, --trm-paper) are set from the settings. */
.trm-catalog {
	--ink: var(--trm-ink, currentColor);
	--accent: var(--trm-ink, #1f2a5a);
	--stamp: var(--trm-stamp, #b5342a);
	--paper: var(--trm-paper, #fffdf7);
	--rule: color-mix(in srgb, currentColor 18%, transparent);
	--muted: color-mix(in srgb, currentColor 68%, transparent);
	direction: rtl;
	text-align: right;
	line-height: 1.8;
	max-width: 100%;
	margin-block: 1.5em;
}
.trm-catalog *, .trm-catalog *::before, .trm-catalog *::after { box-sizing: border-box; }
.trm-catalog :is(h2, h3, h4, p, dl, dd, dt) { margin: 0; }
.trm-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.trm-filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); margin-bottom: 1.4em; }
.trm-filter { display: flex; flex-direction: column; gap: 2px; font-size: .9em; min-width: 140px; flex: 1 1 140px; }
.trm-filter span { font-weight: 600; }
.trm-filter select { min-height: 44px; border: 0; border-bottom: 1.5px solid var(--rule); background: transparent; color: inherit; font: inherit; padding: 4px 2px; border-radius: 0; }
.trm-term { margin-bottom: 2em; }
.trm-term-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding-bottom: .5em; border-bottom: 2px solid var(--accent); margin-bottom: 1em; }
.trm-term-name { font-size: 1.5em; line-height: 1.4; }
.trm-term-dates { color: var(--muted); font-size: .95em; }
.trm-stamp { display: inline-block; padding: 0 .7em; border: 1.5px solid var(--stamp); border-radius: 3px; color: var(--stamp); font-weight: 700; font-size: .85em; transform: rotate(-2deg); box-shadow: inset 0 0 0 1px var(--paper), inset 0 0 0 2px var(--stamp); margin-inline-start: auto; }
.trm-cards { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.trm-cols-1 .trm-cards { --cols: 1; }
.trm-cols-2 .trm-cards { --cols: 2; }
.trm-cols-3 .trm-cards { --cols: 3; }
.trm-card { position: relative; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 20px 14px; overflow: hidden; }
.trm-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: var(--trm-course, var(--accent)); }
.trm-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: .6em; }
.trm-card-title { font-size: 1.25em; line-height: 1.5; }
.trm-level { color: var(--muted); font-size: .95em; }
.trm-facts { display: grid; gap: 0; }
.trm-facts > div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.trm-facts > div:last-child { border-bottom: 0; }
.trm-facts dt { color: var(--muted); font-size: .9em; }
.trm-facts dd { font-weight: 600; overflow-wrap: break-word; text-wrap: pretty; }
.trm-card-title bdi, .trm-facts bdi { unicode-bidi: isolate; }
.trm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; }
.trm-fee { font-size: 1.15em; font-weight: 700; }
.trm-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 1.5px solid var(--accent); border-radius: 5px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.trm-button:hover { filter: brightness(1.12); }
.trm-button:focus-visible, .trm-filter select:focus-visible { outline: 3px solid #d8a31a; outline-offset: 2px; }
.trm-empty { padding: 2em 1em; text-align: center; color: var(--muted); border: 1px dashed var(--rule); border-radius: 6px; }
/* One card per row on phones and small tablets; the label sits above the value so long values (the weekly programme) use the full width. */
@media (max-width: 640px) {
	.trm-cards, .trm-cols-2 .trm-cards, .trm-cols-3 .trm-cards { --cols: 1; grid-template-columns: minmax(0, 1fr); }
	.trm-facts > div { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 8px 0; }
	.trm-facts dt { font-size: .85em; }
	.trm-card { padding: 14px 16px 12px; }
	.trm-card-foot { flex-wrap: wrap; }
	.trm-card-foot .trm-button { flex: 1 1 100%; }
}
@media (min-width: 641px) and (max-width: 900px) { .trm-cols-3 .trm-cards { --cols: 2; } }
@media (prefers-reduced-motion: no-preference) { .trm-button { transition: filter .12s; } }

.trm-nowrap { white-space: nowrap; }
.trm-slot { display: block; }
.trm-slot + .trm-slot { margin-top: 2px; }
.trm-seats { font-size: .9em; font-weight: 700; color: #2f6b3f; }
.trm-seats.is-full { color: var(--stamp); }
.trm-button-ghost { background: transparent; color: var(--accent); }
.trm-card { container-type: inline-size; }
@container (max-width: 380px) {
	.trm-facts > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
	.trm-facts dt { font-size: .82em; }
}

/* Card picture and the link to the class page */
.trm-card.has-image { padding-top: 0; }
.trm-card-image { display: block; margin: 0 -20px 12px; aspect-ratio: 16 / 9; overflow: hidden; background: color-mix(in srgb, currentColor 8%, transparent); }
.trm-card-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.trm-card-title a { color: inherit; text-decoration: none; }
.trm-card-title a:hover, .trm-card-title a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.trm-link-more { margin-inline-start: auto; font-size: .92em; color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.trm-fee small { font-size: .72em; font-weight: 500; color: var(--muted); }
@media (max-width: 640px) { .trm-card-image { margin-inline: -16px; } .trm-card-foot .trm-link-more { margin-inline-start: 0; } }

/* The page of one class */
.trm-detail { max-width: 980px; margin-inline: auto; }
.trm-back-link { display: inline-block; margin-bottom: .8em; color: var(--muted); font-size: .92em; }
.trm-detail-head { margin-bottom: 1em; }
.trm-detail-title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); line-height: 1.4; }
.trm-detail-sub { color: var(--muted); }
.trm-detail-image { margin: 0 0 1.2em; border-radius: 8px; overflow: hidden; aspect-ratio: 21 / 9; background: color-mix(in srgb, currentColor 8%, transparent); }
.trm-detail-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.trm-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.trm-detail-side { position: sticky; top: 24px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: 14px 18px 18px; }
.trm-detail-side .trm-facts > div { grid-template-columns: 5.5em minmax(0, 1fr); }
.trm-button-wide { display: flex; width: 100%; margin-top: 14px; text-align: center; }
.trm-prose > * + * { margin-top: .8em; }
.trm-teacher { display: flex; gap: 16px; align-items: flex-start; margin-top: 1.6em; padding: 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.trm-teacher-photo { flex: 0 0 96px; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.trm-teacher-name { font-size: 1.1em; margin-bottom: .3em; }
@media (max-width: 780px) {
	.trm-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
	.trm-detail-side { position: static; order: -1; }
	.trm-detail-image { aspect-ratio: 16 / 9; }
	.trm-detail-side .trm-facts > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
