/* ==========================================================
   Home showcase sections (index.html) – uses tokens from home-modern.css
   ========================================================== */

.hm-section {
	padding: 64px 16px;
}

.hm-section.hm-alt {
	background: #fff;
	border-top: 1px solid var(--hm-line);
	border-bottom: 1px solid var(--hm-line);
}

.hm-explore {
	padding-top: 48px;
}

.hm-section-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 28px;
}

.hm-section-title {
	margin: 12px 0 0;
	font-family: var(--hm-font);
	font-size: clamp(24px, 2.6vw, 32px);
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--hm-ink);
}

.hm-section-sub {
	max-width: 560px;
	margin: 6px 0 0;
	font-size: 15px;
	color: var(--hm-muted);
}

.hm-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	padding: 9px 16px;
	border: 1px solid var(--hm-line);
	border-radius: 999px;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
	color: var(--hm-ink) !important;
	text-decoration: none !important;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.hm-link:hover {
	border-color: var(--hm-primary);
	color: var(--hm-primary) !important;
}

.hm-link i {
	font-size: 12px;
	transition: transform 0.2s ease;
}

.hm-link:hover i {
	transform: translateX(3px);
}

/* ---------- Explore tiles ---------- */

.hm-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 14px;
}

.hm-tile {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px;
	border: 1px solid var(--hm-line);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--hm-shadow-sm);
	text-decoration: none !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hm-tile:hover {
	transform: translateY(-3px);
	border-color: rgba(184, 77, 8,  0.2);
	box-shadow: var(--hm-shadow-lg);
}

.hm-tile-icon {
	display: grid;
	place-items: center;
	flex: 0 0 46px;
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background: var(--hm-primary-soft);
	color: var(--hm-primary);
	font-size: 18px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.hm-tile:hover .hm-tile-icon {
	background: var(--hm-primary);
	color: #fff;
}

.hm-tile-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.hm-tile-body b {
	font-size: 15px;
	font-weight: 700;
	color: var(--hm-ink);
}

.hm-tile-body small {
	font-size: 13px;
	color: var(--hm-muted);
}

.hm-tile-go {
	font-size: 13px;
	color: #9aa0ad;
	transition: transform 0.2s ease, color 0.2s ease;
}

.hm-tile:hover .hm-tile-go {
	transform: translateX(3px);
	color: var(--hm-primary);
}

/* ---------- Tabs ---------- */

.hm-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 22px;
}

.hm-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border: 1px solid var(--hm-line);
	border-radius: 999px;
	background: #fff;
	font-family: var(--hm-font);
	font-size: 14px;
	font-weight: 600;
	color: var(--hm-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.hm-tab span {
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--hm-bg);
	font-size: 12px;
	color: var(--hm-muted);
}

.hm-tab:hover {
	border-color: var(--hm-primary);
	color: var(--hm-primary);
}

.hm-tab.active {
	border-color: var(--hm-primary);
	background: var(--hm-primary);
	color: #fff;
	box-shadow: 0 6px 16px rgba(184, 77, 8,  0.22);
}

.hm-tab.active span {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

/* ---------- Carousel ---------- */

.hm-carousel {
	position: relative;
	display: none;
}

.hm-carousel.active {
	display: block;
}

.hm-track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 5 * 16px) / 6);
	gap: 16px;
	padding: 4px 2px 12px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.hm-track::-webkit-scrollbar {
	display: none;
}

.hm-arrow {
	position: absolute;
	top: calc(50% - 26px);
	z-index: 2;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 1px solid var(--hm-line);
	border-radius: 50%;
	background: #fff;
	color: var(--hm-ink);
	box-shadow: var(--hm-shadow-lg);
	cursor: pointer;
	transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hm-arrow:hover {
	border-color: var(--hm-primary);
	color: var(--hm-primary);
}

.hm-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

.hm-prev {
	left: -20px;
}

.hm-next {
	right: -20px;
}

.hm-res-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	scroll-snap-align: start;
	border: 1px solid var(--hm-line);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--hm-shadow-sm);
	text-decoration: none !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hm-res-card:hover {
	transform: translateY(-4px);
	border-color: rgba(184, 77, 8,  0.2);
	box-shadow: var(--hm-shadow-lg);
}

.hm-res-logo {
	display: grid;
	place-items: center;
	height: 110px;
	padding: 18px;
	border-bottom: 1px solid var(--hm-line);
	background: #fff;
}

.hm-res-logo {
	overflow: hidden;
}

.hm-res-logo img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 0;
	object-fit: contain;
}

.hm-res-logo b,
.hm-res-logo i {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 14px;
	background: var(--hm-primary-soft);
	color: var(--hm-primary);
	font-size: 22px;
}

.hm-res-name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
	margin: 12px 14px 2px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--hm-ink);
}

.hm-res-meta {
	margin: 0 14px 14px;
	font-size: 12px;
	color: var(--hm-muted);
}

/* ---------- A-Z collections ---------- */

.hm-az-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 12px;
}

.hm-az-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 1px solid var(--hm-line);
	border-radius: 14px;
	background: #fff;
	text-decoration: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hm-az-card:hover {
	transform: translateY(-2px);
	border-color: rgba(184, 77, 8,  0.25);
	box-shadow: var(--hm-shadow-lg);
}

.hm-az-mark {
	display: grid;
	place-items: center;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--hm-primary), #2d5aa8);
	color: #fff;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.hm-az-body {
	display: flex;
	flex: 1;
	min-width: 0;
	flex-direction: column;
}

.hm-az-body b {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 15px;
	font-weight: 700;
	color: var(--hm-ink);
}

.hm-az-body small {
	font-size: 13px;
	color: var(--hm-muted);
}

.hm-az-card > i {
	font-size: 12px;
	color: #9aa0ad;
	transition: transform 0.2s ease, color 0.2s ease;
}

.hm-az-card:hover > i {
	transform: translateX(3px);
	color: var(--hm-primary);
}

/* ---------- Open access picks ---------- */

.hm-oa-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

.hm-oa-card {
	display: flex;
	gap: 16px;
	padding: 16px;
	border: 1px solid var(--hm-line);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--hm-shadow-sm);
	text-decoration: none !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hm-oa-card:hover {
	transform: translateY(-3px);
	border-color: rgba(184, 77, 8,  0.2);
	box-shadow: var(--hm-shadow-lg);
}

.hm-oa-thumb {
	display: grid;
	place-items: center;
	flex: 0 0 64px;
	width: 64px;
	height: 80px;
	overflow: hidden;
	border-radius: 10px;
	background: linear-gradient(160deg, #fff1d6, var(--hm-primary-soft));
	color: var(--hm-primary);
	font-size: 22px;
}

.hm-oa-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hm-oa-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.hm-oa-type {
	align-self: flex-start;
	padding: 2px 10px;
	border-radius: 999px;
	background: #ecfdf3;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #067647;
}

.hm-oa-body b {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--hm-ink);
}

.hm-oa-body small {
	font-size: 13px;
	color: var(--hm-muted);
}

/* ---------- Reader voices ---------- */

.hm-voices-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

.hm-voice {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 24px;
	border: 1px solid var(--hm-line);
	border-radius: 18px;
	background: #fff;
	box-shadow: var(--hm-shadow-sm);
}

.hm-voice-mark {
	font-size: 22px;
	color: var(--hm-accent);
}

.hm-voice blockquote {
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
	flex: 1;
	margin: 12px 0 18px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--hm-ink);
}

.hm-voice figcaption {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-top: 16px;
	border-top: 1px solid var(--hm-line);
}

.hm-voice-avatar {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--hm-primary-soft);
	font-size: 14px;
	font-weight: 700;
	color: var(--hm-primary);
}

.hm-voice figcaption b {
	display: block;
	font-size: 14px;
	color: var(--hm-ink);
}

.hm-voice figcaption small {
	font-size: 12px;
	color: var(--hm-muted);
}

/* the intro now sits between showcase sections */
.home-modern .hm-intro {
	padding: 64px 16px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1199.98px) {
	.hm-track {
		grid-auto-columns: calc((100% - 3 * 16px) / 4);
	}
}

@media (max-width: 991.98px) {
	.hm-oa-grid,
	.hm-voices-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.hm-track {
		grid-auto-columns: calc((100% - 2 * 16px) / 3);
	}

	.hm-prev {
		left: -8px;
	}

	.hm-next {
		right: -8px;
	}
}

@media (max-width: 575.98px) {
	.hm-section,
	.home-modern .hm-intro {
		padding: 44px 16px;
	}

	.hm-section-head {
		flex-direction: column;
		align-items: flex-start;
	}

	.hm-oa-grid,
	.hm-voices-grid {
		grid-template-columns: 1fr;
	}

	.hm-track {
		grid-auto-columns: 62%;
	}

	.hm-tiles {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.hm-tile {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		padding: 14px;
	}

	.hm-tile-icon {
		flex-basis: auto;
		width: 40px;
		height: 40px;
		font-size: 16px;
	}

	.hm-tile-body b {
		font-size: 14px;
	}

	.hm-tile-body small {
		font-size: 12px;
	}

	.hm-tile-go {
		display: none;
	}

	.hm-arrow {
		display: none;
	}

	.hm-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin-right: -16px;
		padding-right: 16px;
		scrollbar-width: none;
	}

	.hm-tab {
		flex-shrink: 0;
	}
}

/* sections already end with their own spacing */
.home-modern .footerSection {
	margin-top: 0;
}

/* ==========================================================
   Open content sections: research (OpenAlex), books (Open Library), links
   ========================================================== */

/* sections can be hidden when a source has no data – a hairline keeps
   neighbours with the same background visually separate */
.hm-section + .hm-section,
.hm-intro + .hm-section,
.hm-section + .hm-intro {
	border-top: 1px solid var(--hm-line);
}

.hm-credit {
	margin: 18px 0 0;
	font-size: 12px;
	color: var(--hm-muted);
}

.hm-credit a {
	color: inherit;
	text-decoration: underline;
}

/* ---------- Research band ---------- */

.hm-research {
	position: relative;
	overflow: hidden;
	border-top: 0 !important;
	background:
		radial-gradient(circle at 100% 0%, rgba(245, 165, 36,  0.16), transparent 40%),
		linear-gradient(135deg, var(--hm-primary) 0%, #0b2f55 100%);
	color: #fff;
}

.hm-research .hm-section-title {
	color: #fff;
}

.hm-research .hm-section-sub,
.hm-research .hm-credit {
	color: rgba(255, 255, 255, 0.75);
}

.hm-link-light {
	border-color: rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.08);
	color: #fff !important;
}

.hm-link-light:hover {
	border-color: #fff;
	background: rgba(255, 255, 255, 0.15);
	color: #fff !important;
}

.hm-research-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
}

.hm-paper {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px 22px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.06);
	transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hm-paper:hover {
	transform: translateY(-2px);
	border-color: rgba(255, 255, 255, 0.28);
	background: rgba(255, 255, 255, 0.1);
}

.hm-paper-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.hm-paper-field,
.hm-paper-oa {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hm-paper-field {
	background: rgba(255, 255, 255, 0.12);
	color: rgba(255, 255, 255, 0.9);
}

.hm-paper-oa {
	background: rgba(245, 165, 36,  0.18);
	color: var(--hm-accent);
}

.hm-paper h3 {
	margin: 2px 0 0;
	font-family: var(--hm-font);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
}

.hm-paper h3 a {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: #fff !important;
	text-decoration: none !important;
}

.hm-paper h3 a:hover {
	text-decoration: underline !important;
}

.hm-paper-authors {
	margin: 0;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.7);
}

.hm-paper-foot {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hm-paper-source {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.hm-paper-source b {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 13px;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.92);
}

.hm-paper-source small {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
}

.hm-paper-pdf {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--hm-accent);
	font-size: 13px;
	font-weight: 700;
	color: #0b2f55 !important;
	text-decoration: none !important;
	transition: background-color 0.2s ease;
}

.hm-paper-pdf:hover {
	background: var(--hm-accent-dark);
}

/* ---------- Book shelves ---------- */

.hm-book-track {
	grid-auto-columns: calc((100% - 5 * 18px) / 6);
	gap: 18px;
}

.hm-book {
	display: flex;
	flex-direction: column;
	scroll-snap-align: start;
	text-decoration: none !important;
}

.hm-book-cover {
	position: relative;
	display: block;
	aspect-ratio: 2 / 3;
	overflow: hidden;
	border-radius: 6px 12px 12px 6px;
	background: linear-gradient(160deg, #f3ece9, #e9dfdb);
	box-shadow: 0 1px 2px rgba(27, 37, 54,  0.1), 0 10px 20px -8px rgba(27, 37, 54,  0.35);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* spine highlight */
.hm-book-cover::after {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 8px;
	background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(255, 255, 255, 0.12), transparent);
}

.hm-book-cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hm-book:hover .hm-book-cover {
	transform: translateY(-6px) rotate(-1deg);
	box-shadow: 0 2px 4px rgba(27, 37, 54,  0.1), 0 20px 32px -12px rgba(138, 58, 6,  0.45);
}

.hm-book-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-top: 12px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--hm-ink);
}

.hm-book:hover .hm-book-title {
	color: var(--hm-primary);
}

.hm-book-meta {
	margin-top: 2px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 12px;
	color: var(--hm-muted);
}

.hm-books .hm-arrow {
	top: calc(40% - 21px);
}

/* ---------- Important links ---------- */

.hm-links-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}

.hm-ext {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 16px;
	border: 1px solid var(--hm-line);
	border-radius: 14px;
	background: #fff;
	text-decoration: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hm-ext:hover {
	transform: translateY(-2px);
	border-color: rgba(184, 77, 8,  0.25);
	box-shadow: var(--hm-shadow-lg);
}

.hm-ext-mark {
	display: grid;
	place-items: center;
	flex: 0 0 46px;
	width: 46px;
	height: 46px;
	border-radius: 12px;
	border: 1px solid var(--hm-line);
	background: var(--hm-bg);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: var(--hm-primary);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.hm-ext:hover .hm-ext-mark {
	border-color: var(--hm-primary);
	background: var(--hm-primary);
	color: #fff;
}

.hm-ext-body {
	display: flex;
	flex: 1;
	min-width: 0;
	flex-direction: column;
	gap: 2px;
}

.hm-ext-body b {
	font-size: 14px;
	font-weight: 700;
	color: var(--hm-ink);
}

.hm-ext-body small {
	font-size: 12px;
	line-height: 1.45;
	color: var(--hm-muted);
}

.hm-ext > i {
	margin-top: 3px;
	font-size: 12px;
	color: #9aa0ad;
}

.hm-ext:hover > i {
	color: var(--hm-primary);
}

/* ---------- Responsive ---------- */

@media (max-width: 1199.98px) {
	.hm-book-track {
		grid-auto-columns: calc((100% - 3 * 18px) / 4);
	}

	.hm-links-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 991.98px) {
	.hm-research-grid {
		grid-template-columns: 1fr;
	}

	.hm-links-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 575.98px) {
	.hm-book-track {
		grid-auto-columns: 42%;
		gap: 14px;
	}

	.hm-links-grid {
		grid-template-columns: 1fr;
	}

	.hm-paper {
		padding: 16px;
	}
}
