/**
 * Homepage sections - the shortcodes in inc/mishnah-home-sections.php.
 *
 * Sizes read the site's spacing and type variables (--space-*, --display-*,
 * --text-*), each with a fallback, so the sections still lay out on a page that
 * does not define them. Colours are taken from the section they sit in:
 * `color: inherit` for text, the page's --secondary / --primary where an
 * accent is wanted.
 *
 * Nothing here touches .mishnah-ui or any m- class. The cards inside
 * .mish-chart-grid keep their own styling from the design system; this file
 * only decides how many sit in a row.
 */

/* ---- Recent charts -------------------------------------------------- */

.mish-chart-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--space-s, 1.8rem);
}

@media (max-width: 991px) {
	.mish-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
	.mish-chart-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Stats ---------------------------------------------------------- */

/* A ruled list: each total on its own row, number left, label right. */
.mish-stats {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.mish-stat {
	display: flex;
	flex-direction: row;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-s, 1.8rem);
	padding: var(--space-xs, 1.35rem) 0;
	border-top: 1px solid var(--mish-line, rgba(10, 26, 46, 0.18));
}

.mish-stat:last-child {
	border-bottom: 1px solid var(--mish-line, rgba(10, 26, 46, 0.18));
}

.mish-stat__num {
	margin: 0;
	font-size: var(--display-l, 8rem);
	line-height: 0.9;
	letter-spacing: -0.035em;
	font-variant-numeric: tabular-nums;
}

.mish-stat__label {
	margin: 0;
	font-size: var(--text-2xs, 0.83rem);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-align: right;
	text-transform: uppercase;
	opacity: 0.7;
}

@media (max-width: 767px) {
	.mish-stat__num { font-size: var(--display-m, 6rem); }
}

/* ---- Globe ---------------------------------------------------------- */

.mish-globe {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	max-width: 64rem;
	justify-self: center;
}

.mish-globe__tip {
	position: absolute;
	z-index: 10;
	padding: 1.2rem 1.6rem;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	color: #333;
	font-size: 1.4rem;
	font-weight: 500;
	white-space: nowrap;
	pointer-events: none;
	transform: translate(-50%, -100%);
	margin-top: -10px;
	opacity: 0;
	transition: opacity 0.2s ease-in-out;
}

.mish-globe__tip.is-visible {
	opacity: 1;
}

/* The dots are the site's gold. */
.mish-globe__marker {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--secondary, #ffd36b);
	box-shadow: 0 0 15px var(--secondary, #ffd36b);
	cursor: pointer;
	transition: transform 0.2s ease-in-out, background 0.2s ease-in-out;
}

.mish-globe__marker:hover {
	transform: scale(1.3);
	background: #fff;
}

/* ---- Pledge counter ------------------------------------------------- */

/* "Over" / the number / "Mishnayos Pledged", right-aligned, like the mockup. */
.mish-pledge-counter {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
}

.mish-pledge-counter__lead {
	margin-bottom: 0.4rem;
	font-size: var(--text-2xs, 0.83rem);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	opacity: 0.65;
}

.mish-pledge-counter__num {
	margin: 0;
	font-size: var(--display-m, 8.8rem);
	font-weight: 400;
	line-height: 0.9;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
	color: inherit;
}

.mish-pledge-counter__label {
	margin: 0.8rem 0 0;
	font-size: var(--text-l, 2.67rem);
	font-style: italic;
	font-weight: 400;
	line-height: 1;
	color: var(--mish-acc, var(--primary, #2e77d1));
}

@media (max-width: 991px) {
	.mish-pledge-counter { align-items: flex-start; text-align: left; }
	.mish-pledge-counter__num { font-size: var(--display-s, 5rem); }
}

/* ---- Yomi marquee --------------------------------------------------- */

/*
 * Two identical cycles sit in the track, so sliding it left by half its
 * width and starting over is seamless. Scoped to .mish-marquee: the same
 * marquee-* class names are styled elsewhere on the live homepage and this
 * must not reach them.
 */
.mish-marquee { overflow: hidden; }

.mish-marquee a {
	display: block;
	color: inherit;
	text-decoration: none;
}

.mish-marquee .marquee-horizontal-alt-css { display: none; }

.mish-marquee .track-horizontal-alt {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	width: max-content;
	animation: mish-marquee 50s linear infinite;
}

.mish-marquee a:hover .track-horizontal-alt { animation-play-state: paused; }

.mish-marquee .marquee-text,
.mish-marquee .marquee-separator {
	flex: none;
	padding: 0 var(--space-s, 1.8rem);
	white-space: nowrap;
	font-size: var(--text-m, 1.6rem);
}

.mish-marquee .marquee-text-lc em { font-style: italic; }

@keyframes mish-marquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
	.mish-marquee .track-horizontal-alt { animation: none; }
}
