/**
 * Admission pages — speciality tabs, programme accordions, exam lists.
 *
 * Loaded only on the pages listed in inc/legacy-admissions.php, which rebuilds
 * the imported Joomla markup this styles. Every colour resolves through a
 * --wp--preset--* property, so the dark and Material Design 2 variations
 * restyle it for free.
 *
 * The page works without JavaScript: the specialities are stacked sections,
 * each under its own <h2>. admissions.js adds .imz-adm--tabbed, and only then
 * do the tab rules below take effect.
 */

.imz-adm {
	--imz-adm-measure: 40rem;
}

/* -------------------------------------------------------------------------
 * 1. Tab strip — MUI Tabs with an underline indicator
 * ---------------------------------------------------------------------- */

/* Built by the script; there is nothing to show until then. */
.imz-adm__tablist {
	display: none;
}

.imz-adm--tabbed .imz-adm__tablist {
	border-bottom: 1px solid var(--mui-divider);
	display: flex;
	gap: var(--wp--preset--spacing--30);
	margin-bottom: var(--wp--preset--spacing--40);
	overflow-x: auto;
	scrollbar-width: none;
	scroll-snap-type: x proximity;
}

.imz-adm--tabbed .imz-adm__tablist::-webkit-scrollbar {
	display: none;
}

.imz-adm__tab {
	align-items: center;
	background: none;
	border: 0;
	border-radius: var(--mui-radius) var(--mui-radius) 0 0;
	color: var(--wp--preset--color--contrast-secondary);
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 auto;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	gap: 8px;
	line-height: 1.4;
	padding: 12px 4px 14px;
	position: relative;
	scroll-snap-align: start;
	transition: color var(--mui-transition);
}

.imz-adm__tab:hover {
	color: var(--wp--preset--color--primary-dark);
}

/* The indicator sits on the rail the tablist draws, hence the -1px. */
.imz-adm__tab::after {
	background-color: var(--wp--preset--color--primary);
	border-radius: 2px 2px 0 0;
	bottom: -1px;
	content: "";
	height: 2px;
	left: 0;
	opacity: 0;
	position: absolute;
	right: 0;
	transition: opacity var(--mui-transition);
}

.imz-adm__tab[aria-selected="true"] {
	color: var(--wp--preset--color--primary-dark);
	font-weight: 600;
}

.imz-adm__tab[aria-selected="true"]::after {
	opacity: 1;
}

/* -------------------------------------------------------------------------
 * 2. Speciality code — G8 / G9 / G10
 * ---------------------------------------------------------------------- */

/*
 * These are the codes students apply under, so they are given the weight of an
 * identifier: filled where the theme's category chips are outlined, and set in
 * tabular figures so G8 and G10 align in the strip.
 */
.imz-adm__code {
	background-color: var(--wp--preset--color--primary-surface);
	border-radius: var(--mui-radius-pill);
	color: var(--wp--preset--color--primary-dark);
	display: inline-block;
	flex: 0 0 auto;
	font-feature-settings: "tnum";
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.5;
	padding: 2px 9px;
}

.imz-adm__tab:not([aria-selected="true"]) .imz-adm__code {
	background-color: transparent;
	box-shadow: inset 0 0 0 1px var(--mui-divider);
	color: var(--wp--preset--color--contrast-secondary);
}

/* -------------------------------------------------------------------------
 * 3. Panels
 * ---------------------------------------------------------------------- */

.imz-adm__panel + .imz-adm__panel {
	border-top: 1px solid var(--mui-divider);
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--50);
}

.imz-adm--tabbed .imz-adm__panel[hidden] {
	display: none;
}

.imz-adm--tabbed .imz-adm__panel + .imz-adm__panel {
	border-top: 0;
	margin-top: 0;
	padding-top: 0;
}

.imz-adm__panel-title {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.25;
	margin: 0 0 var(--wp--preset--spacing--20);
}

/* With the tab strip up, this heading says exactly what the selected tab says.
   It stays for screen readers and for the document outline. */
.imz-adm--tabbed .imz-adm__panel-title {
	clip-path: inset(50%);
	height: 1px;
	margin: 0;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.imz-adm__lede {
	color: var(--wp--preset--color--contrast-secondary);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.6;
	margin-bottom: var(--wp--preset--spacing--40);
	max-width: var(--imz-adm-measure);
}

.imz-adm__lede--long {
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.7;
}

.imz-adm__lede p {
	margin: 0 0 0.75em;
}

.imz-adm__lede p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * 4. Programmes — MUI Accordion on top of <details>
 * ---------------------------------------------------------------------- */

.imz-adm__programmes {
	border-block: 1px solid var(--mui-divider);
}

/* On a panel with no opening paragraph the list starts right under the tab
   rail, and two hairlines that close together read as a mistake. */
.imz-adm__panel-title + .imz-adm__programmes {
	border-top: 0;
}

.imz-adm__programme + .imz-adm__programme {
	border-top: 1px solid var(--mui-divider);
}

.imz-adm__summary {
	align-items: baseline;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	display: flex;
	font-size: 1.0625rem;
	font-weight: 600;
	gap: 10px;
	line-height: 1.4;
	list-style: none;
	padding: var(--wp--preset--spacing--20) 0;
	transition: color var(--mui-transition);
}

/* Both spellings are needed to drop the native disclosure triangle. */
.imz-adm__summary::-webkit-details-marker {
	display: none;
}

.imz-adm__summary::marker {
	content: "";
}

.imz-adm__summary:hover {
	color: var(--wp--preset--color--primary-dark);
}

.imz-adm__summary:focus-visible {
	outline: var(--mui-focus-ring);
	outline-offset: -2px;
}

.imz-adm__programme[open] > .imz-adm__summary {
	color: var(--wp--preset--color--primary-dark);
}

/* The kind of degree — ОП, ОНП or ОПП — is a real distinction, so it is read
   as a label rather than left buried in the middle of the title. */
.imz-adm__kind {
	border: 1px solid var(--mui-divider);
	border-radius: var(--mui-radius-sm);
	color: var(--wp--preset--color--contrast-secondary);
	flex: 0 0 auto;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.6;
	padding: 1px 6px;
	position: relative;
	top: -0.1em;
}

.imz-adm__summary-text {
	flex: 1 1 auto;
}

.imz-adm__chevron {
	border-bottom: 2px solid currentColor;
	border-right: 2px solid currentColor;
	flex: 0 0 auto;
	height: 7px;
	margin-top: 0.35em;
	transform: rotate(45deg);
	transition: transform var(--mui-transition);
	width: 7px;
}

.imz-adm__programme[open] > .imz-adm__summary .imz-adm__chevron {
	transform: rotate(-135deg);
}

.imz-adm__body {
	color: var(--wp--preset--color--contrast-secondary);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.7;
	max-width: var(--imz-adm-measure);
	padding-bottom: var(--wp--preset--spacing--30);
}

.imz-adm__body p {
	margin: 0 0 0.9em;
}

.imz-adm__body p:last-child {
	margin-bottom: 0;
}

.imz-adm__body a {
	color: var(--wp--preset--color--primary-dark);
	text-underline-offset: 3px;
}

/* Opening is the one thing on this page that moves, and only because someone
   asked it to. */
.imz-adm__programme[open] > .imz-adm__body {
	animation: imz-adm-reveal 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes imz-adm-reveal {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
}

/* -------------------------------------------------------------------------
 * 5. Entrance exam programmes
 * ---------------------------------------------------------------------- */

.imz-adm__exams {
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--mui-divider);
	border-radius: var(--mui-radius);
	margin-top: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--30);
}

.imz-adm__exams-title {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.01em;
	margin: 0 0 var(--wp--preset--spacing--20);
}

.imz-adm__exam-list {
	display: grid;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.imz-adm__exam-list li {
	margin: 0;
}

.imz-adm__exam {
	align-items: baseline;
	border-radius: var(--mui-radius-sm);
	color: var(--wp--preset--color--contrast);
	display: flex;
	font-size: 0.9375rem;
	gap: 10px;
	justify-content: space-between;
	padding: 8px 10px;
	text-decoration: none;
	transition: background-color var(--mui-transition), color var(--mui-transition);
}

.imz-adm__exam:hover {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-dark);
}

.imz-adm__exam-name {
	align-items: baseline;
	display: flex;
	flex: 1 1 auto;
	gap: 8px;
	/* Lets a long programme name wrap instead of pushing the PDF badge onto a
	   line of its own. */
	min-width: 0;
}

.imz-adm__exam-type {
	color: var(--wp--preset--color--contrast-secondary);
	flex: 0 0 auto;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
}

.imz-adm__exam:hover .imz-adm__exam-type {
	color: var(--wp--preset--color--primary-dark);
}

/* -------------------------------------------------------------------------
 * 6. Narrow screens
 * ---------------------------------------------------------------------- */

@media (max-width: 600px) {
	.imz-adm--tabbed .imz-adm__tablist {
		gap: var(--wp--preset--spacing--20);
	}

	.imz-adm__tab {
		font-size: 0.875rem;
	}

	.imz-adm__panel-title {
		font-size: var(--wp--preset--font-size--x-large);
	}

	.imz-adm__lede {
		font-size: var(--wp--preset--font-size--medium);
	}

	.imz-adm__summary {
		font-size: 1rem;
	}

	.imz-adm__exam {
		gap: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.imz-adm__programme[open] > .imz-adm__body {
		animation: none;
	}
}
