/**
 * Home "broadest IB subject coverage" section styles — Figma node 2617:3301.
 */

.gh-subjects {
	max-width: 1120px;
	margin: 0 auto;
	padding: 96px 0;
}

.gh-subjects__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* ---- Heading ---- */
.gh-subjects__head {
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: center;
}

.gh-subjects__title {
	margin: 0;
	font-family: 'schibsted_grotesk_demi', Arial, sans-serif;
	font-weight: normal;
	font-size: 32px;
	line-height: 40px;
	color: var(--gh-text-primary);
}

.gh-subjects__subtitle {
	margin: 0;
	font-family: 'avenir_next_worldmedium', 'Verdana';
	font-weight: normal;
	font-size: 16px;
	line-height: 28px;
	color: var(--gh-text-secondary);
}

/* ---- Filter tabs ---- */
.gh-subjects__tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 20px;
	margin-top: 64px;
}

.gh-subjects__tab {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	border: 1px solid var(--gh-text-secondary);
	border-radius: 8px;
	background: transparent;
	color: var(--gh-text-primary);
	font-family: 'avenir_next_worlddemi', 'Verdana';
	font-weight: normal;
	font-size: 14px;
	line-height: 20px;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gh-subjects__tab:hover {
	border-color: var(--gh-text-primary);
}

.gh-subjects__tab.is-active {
	background: #000000;
	border-color: var(--gh-text-primary);
	color: var(--gh-white);
}

/* Empty groups (e.g. Group 2, Core) — shown but disabled. */
.gh-subjects__tab.is-disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

.gh-subjects__tab.is-disabled:hover {
	border-color: var(--gh-text-secondary);
}

/* The subject count only shows on the active tab (matches Figma). */
.gh-subjects__tab-count {
	display: none;
	font-family: 'avenir_next_worldregular', 'Verdana';
}

.gh-subjects__tab.is-active .gh-subjects__tab-count {
	display: inline;
}

/* Mobile-only filter dropdown (replaces the tab row ≤768px). */
.gh-subjects__select-wrap {
	display: none;
}

/* ---- Cards grid ---- */
.gh-subjects__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 32px;
	width: 100%;
	margin-top: 100px;
}

.gh-subjects__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	overflow: hidden;
}

.gh-subjects__card-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	justify-content: space-between;
	gap: 24px;
	min-height: 280px;
	padding: 40px;
	background: var(--gh-white);
}

.gh-subjects__card-text {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gh-subjects__card-title {
	margin: 0;
	font-family: 'schibsted_grotesk_medium', Arial, sans-serif;
	font-weight: normal;
	font-size: 24px;
	line-height: 32px;
	color: var(--gh-text-primary);
}

.gh-subjects__card-desc {
	margin: 0;
	font-family: 'avenir_next_worldmedium', 'Verdana';
	font-weight: normal;
	font-size: 14px;
	line-height: 24px;
	color: var(--gh-text-secondary);
}

.gh-subjects__card-cta {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 8px;
	font-family: 'avenir_next_worldmedium', 'Verdana';
	font-weight: normal;
	font-size: 16px;
	line-height: 28px;
	color: #008392;
	text-decoration: underline;
}

.gh-subjects__card-cta svg {
	flex-shrink: 0;
}

.gh-subjects__card-media {
	height: 200px;
	background: #cccccc;
	overflow: hidden;
}

.gh-subjects__card-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Empty-state message — shown only when the active group has no cards. */
.gh-subjects__empty {
	display: none;
	grid-column: 1 / -1;
	margin: 0;
	padding: 40px 0;
	text-align: center;
	font-family: 'avenir_next_worldmedium', 'Verdana';
	font-weight: normal;
	font-size: 16px;
	line-height: 28px;
	color: var(--gh-text-secondary);
}

/* ---- Progressive enhancement: only filter once JS is active ---- */
.gh-subjects--js .gh-subjects__card:not(.is-active) {
	display: none;
}

.gh-subjects--js.gh-subjects--empty .gh-subjects__empty {
	display: block;
}

/* ---- Responsive (Figma is desktop-only; breakpoints match cta/features) ---- */
@media (max-width: 1023px) {
	.gh-subjects {
		padding: 64px 24px;
	}

	.gh-subjects__grid {
		grid-template-columns: repeat(2, 1fr);
		margin-top: 56px;
	}

	.gh-subjects__tabs {
		margin-top: 40px;
	}
}

/* Mobile — Figma nodes 3173:14059 (heading), 3173:14063 (tabs), 3173:14067
   (cards). Heading left-aligns; the filter tabs scroll horizontally instead of
   wrapping; cards collapse to a single tight-stacked column with the accent
   background and no media (per the mobile design). Section sits inside
   .site-content's 16px gutter, so horizontal padding is 0 here (Figma 16px). */
@media (max-width: 768px) {
	.gh-subjects {
		padding: 48px 0;
	}

	.gh-subjects__head {
		align-items: flex-start;
		text-align: left;
	}

	/* Tabs give way to a single full-width dropdown (Figma node 3173:14063). */
	.gh-subjects__tabs {
		display: none;
	}

	.gh-subjects__select-wrap {
		display: block;
		position: relative;
		width: 100%;
		margin-top: 40px;
	}

	/* Visible label: group name (demi) + count (regular), with the Figma caret. */
	.gh-subjects__select-display {
		display: flex;
		align-items: center;
		padding: 8px 40px 8px 12px;
		border: 1px solid var(--gh-text-secondary);
		border-radius: 8px;
		/* Filled caret matching the Figma CaretDownFilled. */
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4z' fill='%23333333'/%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: right 12px center;
		background-size: 20px 20px;
		font-size: 14px;
		line-height: 20px;
		color: var(--gh-text-primary);
	}

	.gh-subjects__select-group {
		font-family: 'avenir_next_worlddemi', 'Verdana';
		font-weight: normal;
	}

	.gh-subjects__select-count {
		margin-left: 4px;
		font-family: 'avenir_next_worldregular', 'Verdana';
		font-weight: normal;
	}

	/* The real <select> sits invisibly on top so taps open the native picker. */
	.gh-subjects__select {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		margin: 0;
		padding: 0;
		border: 0;
		opacity: 0;
		font-size: 16px; /* ≥16px avoids iOS focus-zoom */
		cursor: pointer;
	}

	.gh-subjects__grid {
		grid-template-columns: 1fr;
		gap: 8px;
		margin-top: 32px;
	}

	/* Cards become flat accent panels (no border, no media) per the mobile node. */
	.gh-subjects__card {
		border: none;
		border-radius: 16px;
		background: var(--gh-accent);
	}

	.gh-subjects__card-body {
		gap: 8px;
		min-height: 0;
		padding: 24px;
		background: transparent;
	}

	.gh-subjects__card-title {
		font-size: 20px;
		line-height: 24px;
	}

	.gh-subjects__card-desc {
		display: none;
	}

	.gh-subjects__card-cta {
		font-size: 14px;
		line-height: 24px;
	}

	.gh-subjects__card-media {
		display: none;
	}
	.gh-subjects__select:focus-visible {
		outline: none;
	}
}
