/**
 * Homepage demos - see inc/mishnah-home-demos.php.
 *
 * Colours read the site's variables (--primary, --secondary, --base, ...) with
 * a fallback, so the demos look right on a page that does not define them.
 * The phone and the sign are drawn in pixels on purpose: they are pictures of
 * objects, not layout, and should not scale with the page's type size.
 *
 * Nothing here touches .mishnah-ui or any m- class.
 */

.mish-demo {
	max-width: 100%;
	--mdm-blue: var(--primary, #2e77d1);
	--mdm-ink: var(--base, #0a1a2e);
	--mdm-gold: var(--secondary, #ffd36b);
	--mdm-soft: var(--primary-l-9, #d9e6f7);
	position: relative;
}

/* ---- Phone ---------------------------------------------------------- */

.mish-phone-demo {
	display: grid;
	place-items: center;
	min-height: 700px;
	padding-top: 34px;
}

.mish-phone-demo__glow {
	position: absolute;
	width: 520px;
	height: 520px;
	border-radius: 50%;
	background: radial-gradient(closest-side, var(--mdm-gold), transparent 72%);
	opacity: 0.2;
	filter: blur(30px);
}

.mish-phone-demo__stage {
	position: relative;
	width: 310px;
	height: 620px;
}

.mish-phone-demo__phone {
	position: relative;
	z-index: 2;
	width: 310px;
	height: 620px;
	padding: 12px;
	border-radius: 48px;
	background: #10151f;
	box-shadow: 0 70px 100px -40px rgba(0, 0, 0, 0.65), inset 0 0 0 2px #2a3140;
}

.mish-phone-demo__phone::before {
	content: "";
	position: absolute;
	z-index: 3;
	top: 22px;
	left: 50%;
	width: 92px;
	height: 25px;
	margin-left: -46px;
	border-radius: 99px;
	background: #10151f;
}

.mish-phone-demo__screen {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border-radius: 38px;
	background: #f5f7fb;
	color: #0a1a2e;
}

.mish-phone-demo__top {
	padding: 52px 18px 14px;
	background: #fff;
	border-bottom: 1px solid #e3e8f1;
}

.mish-phone-demo__bar {
	margin-bottom: 8px;
	font: 600 10.5px/1.2 Inter, sans-serif;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: #7a8699;
}

.mish-phone-demo__top h4 {
	margin: 0 0 12px;
	font-size: 21px;
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: #0a1a2e;
}

.mish-phone-demo__progress {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mish-phone-demo__track {
	flex: 1;
	height: 5px;
	overflow: hidden;
	border-radius: 9px;
	background: #e1e8f4;
}

.mish-phone-demo__track i {
	display: block;
	width: 0;
	height: 100%;
	border-radius: 9px;
	background: var(--mdm-blue);
	transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.mish-phone-demo__progress b {
	min-width: 48px;
	text-align: right;
	font: 400 22px/1 inherit;
	font-variant-numeric: tabular-nums;
}

.mish-phone-demo__list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-content: start;
	gap: 6px;
	padding: 10px 15px 16px;
}

.mish-phone-demo__list h5 {
	grid-column: 1 / -1;
	margin: 8px 0 1px;
	font: 600 10px/1.2 Inter, sans-serif;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: #8a95a8;
}

.mish-phone-demo__ch {
	overflow: hidden;
	padding: 10px;
	border: 1px solid #dce3ee;
	border-radius: 10px;
	background: #fff;
	font: 400 12.5px/1 Inter, sans-serif;
	white-space: nowrap;
	text-overflow: ellipsis;
	transition: background 0.45s, color 0.45s, border-color 0.45s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mish-phone-demo__ch.is-taken { border-color: transparent; background: #e1ecfb; }
.mish-phone-demo__ch.is-done  { border-color: var(--mdm-blue); background: var(--mdm-blue); color: #fff; }
.mish-phone-demo__ch.is-pop   { transform: scale(1.07); }

.mish-phone-demo__mail,
.mish-phone-demo__ring,
.mish-phone-demo__toast {
	position: absolute;
	z-index: 4;
	opacity: 0;
	transition: opacity 0.9s 0.9s, transform 0.9s 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.is-live .mish-phone-demo__mail,
.is-live .mish-phone-demo__ring { opacity: 1; }

.mish-phone-demo__mail {
	top: -30px;
	right: -66px;
	width: 232px;
	padding: 14px 16px;
	border-radius: 18px;
	background: #fff;
	color: #0a1a2e;
	box-shadow: 0 34px 50px -22px rgba(0, 0, 0, 0.55);
	transform: translateX(40px) rotate(6deg);
}

.is-live .mish-phone-demo__mail { transform: rotate(3deg); animation: mish-float 8s 2s ease-in-out infinite alternate; }

.mish-phone-demo__mail small {
	font: 600 10.5px/1.2 Inter, sans-serif;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--mdm-blue);
}

.mish-phone-demo__mail b { display: block; margin: 6px 0 4px; font-size: 20px; font-weight: 400; line-height: 1.1; }
.mish-phone-demo__mail p { margin: 0; font-size: 12.5px; line-height: 1.45; color: #5f6c7b; }

.mish-phone-demo__ring {
	top: 232px;
	left: -26px;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 20px 10px 10px;
	border-radius: 99px;
	background: #fff;
	color: #0a1a2e;
	box-shadow: 0 26px 44px -18px rgba(0, 0, 0, 0.5);
	transform: translateX(-30px);
}

.is-live .mish-phone-demo__ring { transform: none; animation: mish-float 9s 2s ease-in-out infinite alternate-reverse; }

.mish-phone-demo__ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.mish-phone-demo__ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.mish-phone-demo__ring .t { stroke: rgba(10, 26, 46, 0.12); }
.mish-phone-demo__ring .v { stroke: var(--mdm-blue); stroke-dasharray: 113; stroke-dashoffset: 113; transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.mish-phone-demo__ring b { display: block; font: 400 24px/1 inherit; font-variant-numeric: tabular-nums; }
.mish-phone-demo__ring span { font: 600 10.5px/1.2 Inter, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: #6b778a; }

.mish-phone-demo__toast {
	left: -40px;
	bottom: 96px;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 18px 9px 9px;
	border-radius: 99px;
	background: var(--mdm-blue);
	color: #fff;
	font: 400 13.5px/1.2 Inter, sans-serif;
	box-shadow: 0 24px 40px -16px rgba(0, 0, 0, 0.5);
	transform: translateX(-24px);
	transition: opacity 0.4s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.mish-phone-demo__toast.is-on { opacity: 1; transform: none; }
.mish-phone-demo__toast i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--mdm-blue); font: 700 13px/1 Inter, sans-serif; font-style: normal; }

@keyframes mish-float {
	from { translate: 0 -8px; }
	to   { translate: 0 8px; }
}

@media (max-width: 767px) {
	.mish-phone-demo { min-height: 600px; overflow: hidden; }
	.mish-phone-demo__stage,
	.mish-phone-demo__phone { width: 280px; height: 570px; }
	.mish-phone-demo__mail { top: -10px; right: -4px; width: 176px; padding: 11px 13px; }
	.mish-phone-demo__mail b { font-size: 17px; }
	.mish-phone-demo__mail p { display: none; }
	.mish-phone-demo__ring { top: 210px; left: -6px; }
	.mish-phone-demo__toast { left: -6px; bottom: 70px; font-size: 12.5px; }
}

/* ---- Sign ----------------------------------------------------------- */

.mish-sign-demo {
	display: grid;
	place-items: center;
	min-height: 640px;
}

.mish-sign-demo__stage {
	position: relative;
	width: 480px;
	height: 640px;
	display: grid;
	place-items: center;
}

.mish-sign-demo__paper {
	position: relative;
	display: grid;
	place-items: center;
	width: 392px;
	height: 524px;
	border-radius: 3px;
	background: #fff;
	transform: rotate(-1.6deg);
	box-shadow: 0 2px 3px rgba(0, 0, 0, 0.18), 0 50px 70px -28px rgba(0, 0, 0, 0.6);
}

/* a little paper grain and a shade at the edges */
.mish-sign-demo__paper::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 3px;
	pointer-events: none;
	background:
		linear-gradient(115deg, rgba(10, 26, 46, 0.05), transparent 16%, transparent 82%, rgba(10, 26, 46, 0.07)),
		repeating-linear-gradient(0deg, transparent 0 3px, rgba(10, 26, 46, 0.012) 3px 4px);
}

.mish-sign-demo__tape {
	position: absolute;
	z-index: 6;
	top: -12px;
	width: 98px;
	height: 30px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	background: rgba(214, 232, 253, 0.8);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.mish-sign-demo__tape--l { left: -26px; transform: rotate(-38deg); }
.mish-sign-demo__tape--r { right: -26px; transform: rotate(36deg); }

.mish-sign-demo__sign {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 300px;
	height: 430px;
	padding: 38px 22px 0;
	overflow: hidden;
	border: 2px solid var(--mdm-ink);
	border-radius: 150px 150px 14px 14px;
	background: #eaf3fe;
	color: var(--mdm-ink);
	font-family: Inter, sans-serif;
}

.mish-sign-demo__title { font: 700 22px/1.2 "Taamey D", serif; text-align: center; color: #1d5fb0; }
.mish-sign-demo__rule { width: 70%; height: 2px; margin: 10px 0 12px; background: var(--mdm-blue); opacity: 0.8; }
.mish-sign-demo__small { font: 600 11px/1.2 Inter, sans-serif; }
.mish-sign-demo__name { margin-top: 2px; font: 700 18px/1.2 "Taamey D", serif; }

.mish-sign-demo__box {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	width: 86%;
	margin-top: 14px;
	padding: 12px 10px 0;
	border: 1.5px solid var(--mdm-blue);
	border-radius: 12px 12px 0 0;
	text-align: center;
}

.mish-sign-demo__box b { font-size: 13px; }
.mish-sign-demo__box small { margin-top: 2px; font-size: 9.5px; color: #445; }
.mish-sign-demo__box strong { margin-top: 3px; font-size: 16px; }

.mish-sign-demo__qr {
	position: relative;
	width: 96px;
	height: 96px;
	margin-top: 10px;
	padding: 5px;
	border-radius: 6px;
	background: #fff;
}

.mish-sign-demo__qr img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

/* the viewfinder: four corners that breathe, and a line that sweeps the code */
.mish-sign-demo__finder { position: absolute; inset: -10px; pointer-events: none; animation: mish-finder 1.6s ease-in-out infinite alternate; }

.mish-sign-demo__finder i { position: absolute; width: 20px; height: 20px; border: 3px solid var(--mdm-blue); }
.mish-sign-demo__finder i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 7px 0 0 0; }
.mish-sign-demo__finder i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 7px 0 0; }
.mish-sign-demo__finder i:nth-child(3) { bottom: 0; left: 0; border-top: 0; border-right: 0; border-radius: 0 0 0 7px; }
.mish-sign-demo__finder i:nth-child(4) { right: 0; bottom: 0; border-top: 0; border-left: 0; border-radius: 0 0 7px 0; }

.mish-sign-demo__scan {
	position: absolute;
	top: 4px;
	right: -6px;
	left: -6px;
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, transparent, var(--mdm-blue) 20%, var(--mdm-blue) 80%, transparent);
	box-shadow: 0 0 14px var(--mdm-blue);
	animation: mish-scan 1.4s ease-in-out infinite alternate;
}

.mish-sign-demo__ripple {
	position: absolute;
	inset: 0;
	border: 2px solid var(--mdm-blue);
	border-radius: 10px;
	pointer-events: none;
	animation: mish-ripple 1.1s ease-out forwards;
}

.mish-sign-demo__foot { display: flex; align-items: center; justify-content: center; width: calc(100% + 44px); margin-top: auto; padding: 9px 0; background: var(--mdm-ink); }
.mish-sign-demo__foot img { display: block; width: auto; height: 14px; }

.mish-sign-demo__toast {
	position: absolute;
	z-index: 7;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 18px 9px 9px;
	border-radius: 99px;
	background: var(--mish-gold, var(--secondary, #ffd36b));
	color: #0a1a2e;
	font: 400 13.5px/1.2 Inter, sans-serif;
	box-shadow: 0 24px 40px -16px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: translateY(14px) scale(0.85);
	transition: opacity 0.4s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	white-space: nowrap;
}

.mish-sign-demo__toast--l { left: 0; }
.mish-sign-demo__toast--r { right: 0; }
.mish-sign-demo__toast.is-on { opacity: 1; transform: none; }
.mish-sign-demo__toast i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #0a1a2e; color: var(--mish-gold, var(--secondary, #ffd36b)); font: 700 13px/1 Inter, sans-serif; font-style: normal; }

@keyframes mish-finder { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes mish-scan   { from { top: 4px; } to { top: 84px; } }
@keyframes mish-ripple { from { transform: scale(1); opacity: 0.8; } to { transform: scale(2.6); opacity: 0; } }

@media (max-width: 767px) {
	/* Clip to the column: the tape and toasts overhang the paper, and the page must not scroll sideways. */
	.mish-sign-demo { overflow: hidden; min-height: 560px; padding: 12px 28px; }
	.mish-sign-demo__stage { width: 100%; max-width: 480px; height: 560px; }
	.mish-sign-demo__paper { width: 100%; transform: rotate(-1.6deg); }
	.mish-sign-demo__sign { transform: scale(0.9); }
	.mish-sign-demo__toast { font-size: 12px; }
}

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

.mish-reader-demo {
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: var(--radius-xl, 32px);
	background: rgba(255, 255, 255, 0.07);
	box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.6);
}

.mish-reader-demo__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 22px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mish-reader-demo__top b { font-size: 15px; }
.mish-reader-demo__tabs { font-size: 12.5px; color: var(--mdm-gold); }

.mish-reader-demo__heb {
	margin: 0;
	padding: 26px 26px 6px;
	font-family: "Taamey D", serif;
	font-size: 36px;
	line-height: 1.7;
}

.mish-reader-demo__heb span {
	padding: 0 3px;
	border-radius: 6px;
	transition: background 0.25s, box-shadow 0.25s;
}

.mish-reader-demo__heb span.is-on {
	background: rgba(255, 211, 107, 0.16);
	box-shadow: inset 0 -2px 0 var(--mdm-gold);
}

.mish-reader-demo__eng { margin: 0; padding: 6px 26px 24px; font-size: 16.5px; line-height: 1.65; opacity: 0.75; }

@media (max-width: 767px) {
	.mish-reader-demo__heb { font-size: 28px; }
}

/* ---- Hero wall ------------------------------------------------------ */

.mish-hero-wall {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
	user-select: none;
}

.mish-hero-wall__dim,
.mish-hero-wall__lit {
	position: absolute;
	inset: -10px;
	padding: 70px 30px;
	overflow: hidden;
	font-family: "Taamey D", serif;
	font-size: 31px;
	line-height: 1.55;
	text-align: justify;
}

.mish-hero-wall__dim { color: var(--primary-l-8, #c6daf2); opacity: 0.7; }

.mish-hero-wall__lit {
	color: var(--primary, #2e77d1);
	-webkit-mask-image: radial-gradient(circle 240px at var(--x, 70%) var(--y, 45%), #000 0, #000 40%, transparent 100%);
	mask-image: radial-gradient(circle 240px at var(--x, 70%) var(--y, 45%), #000 0, #000 40%, transparent 100%);
}

/* The text fades out under the headline so it stays readable. */
.mish-hero-wall::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, var(--primary-l-10, #ecf3fb) 0%, rgba(236, 243, 251, 0.85) 38%, rgba(236, 243, 251, 0) 70%),
		linear-gradient(0deg, rgba(236, 243, 251, 0.9), rgba(236, 243, 251, 0) 36%);
}

@media (max-width: 767px) {
	.mish-hero-wall__dim,
	.mish-hero-wall__lit { font-size: 22px; padding: 60px 14px; }

	/* On a phone the text runs the full width, so the fade has to cover it all. */
	.mish-hero-wall::after {
		background: linear-gradient(180deg, rgba(236, 243, 251, 0.94) 0%, rgba(236, 243, 251, 0.9) 70%, rgba(236, 243, 251, 0.97) 100%);
	}
}

/* ---- Rotating word -------------------------------------------------- */

.mish-rotor {
	display: inline-grid;
	overflow: hidden;
	/* room for descenders (the y in Study) without moving the line */
	padding-bottom: 0.14em;
	margin-bottom: -0.14em;
	vertical-align: top;
	font-style: italic;
	color: var(--mish-acc, var(--primary, #2e77d1));
}

.mish-rotor__word {
	grid-area: 1 / 1;
	white-space: nowrap;
}

/* each letter slides in a beat after the one before it */
.mish-rotor__l {
	display: inline-block;
	opacity: 0;
	transform: translateY(100%);
	animation: mish-rotor calc(var(--mish-rotor-n) * 2.1s) calc(var(--mish-rotor-i) * 2.1s + var(--mish-ci) * 0.06s) infinite;
}

/* the first word is visible before the animation starts, and without it */
.mish-rotor__word:first-child .mish-rotor__l { opacity: 1; transform: none; }

@keyframes mish-rotor {
	0%        { opacity: 0; transform: translateY(100%); }
	4%, 18%   { opacity: 1; transform: translateY(0); }
	22%, 100% { opacity: 0; transform: translateY(-100%); }
}

@media (prefers-reduced-motion: reduce) {
	.mish-rotor__l { animation: none; }
	.mish-sign-demo__finder,
	.mish-sign-demo__scan,
	.mish-phone-demo__mail,
	.mish-phone-demo__ring { animation: none !important; }
}


/* ---- Letters: Mishnah / Neshamah ------------------------------------- */

.mish-letters-demo {
	--mld-ink: var(--primary, #2e77d1);
	--mld-acc: var(--mish-acc, #ffd36b);
	--mld-bg: var(--mish-surface, #0a1a2e);
	position: relative;
	display: flex;
	justify-content: center;
	width: 350px;
	height: 155px;
	margin-inline: auto;
	align-self: center;
}

.mish-letters-demo__row {
	position: absolute;
	z-index: 2;
	display: flex;
	flex-direction: row;
	justify-content: center;
	direction: ltr;
}

.mish-letters-demo__row--2 { z-index: 1; }

.mish-letters-demo__l {
	margin: 0;
	font-family: "Taamey D", serif;
	font-size: 160px;
	font-weight: 400;
	line-height: 1;
	color: var(--mld-ink);
	text-shadow: 3px 3px 0 var(--mld-acc), -1px -1px 0 var(--mld-acc), 1px -1px 0 var(--mld-acc), -1px 1px 0 var(--mld-acc), 1px 1px 0 var(--mld-acc);
	animation-duration: 4s;
	animation-direction: alternate;
	animation-iteration-count: infinite;
	animation-timing-function: ease-in-out;
}

.mish-letters-demo__row--2 .mish-letters-demo__l {
	color: var(--mld-acc);
	text-shadow: 3px 3px 0 var(--mld-bg), -1px -1px 0 var(--mld-bg), 1px -1px 0 var(--mld-bg), -1px 1px 0 var(--mld-bg), 1px 1px 0 var(--mld-bg);
}

.mish-letters-demo__l--nun  { animation-name: mish-anim-nun;  animation-delay: 0.2s; }
.mish-letters-demo__l--shin { animation-name: mish-anim-shin; animation-delay: 0.15s; }
.mish-letters-demo__l--mem  { animation-name: mish-anim-mem;  animation-delay: 0.1s; }
.mish-letters-demo__l--hay  { animation-name: mish-anim-hay;  animation-delay: 0.25s; }

.mish-letters-demo__row--2 .mish-letters-demo__l--nun  { animation-delay: 0.25s; }
.mish-letters-demo__row--2 .mish-letters-demo__l--shin { animation-delay: 0.2s; }
.mish-letters-demo__row--2 .mish-letters-demo__l--mem  { animation-delay: 0.15s; }
.mish-letters-demo__row--2 .mish-letters-demo__l--hay  { animation-delay: 0.3s; }

@keyframes mish-anim-mem  { 0% { transform: translate(0); } 25% { transform: translate(0); } 50% { transform: translate(-130%); } 75% { transform: translate(-178%); } 100% { transform: translate(-178%); } }
@keyframes mish-anim-shin { 0% { transform: translate(0); } 25% { transform: translate(0); } 50% { transform: translate(-24%); }  75% { transform: translate(32%); }   100% { transform: translate(32%); } }
@keyframes mish-anim-nun  { 0% { transform: translate(0); } 25% { transform: translate(0); } 50% { transform: translate(150%); }  75% { transform: translate(380%); }  100% { transform: translate(380%); } }
@keyframes mish-anim-hay  { 0% { transform: translate(0); } 25% { transform: translate(0); } 50% { transform: translate(150%); }  75% { transform: translate(0); }       100% { transform: translate(0); } }

@media (max-width: 767px) {
	.mish-letters-demo { transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
	.mish-letters-demo__l { animation: none; }
}
