/*
 * The app on the site's own pages, in the landing page's design: the banner on free recipes
 * (recipe-public-banner-dynamic.html), the premium recipe gate
 * (recipe-app-exclusive-section-dynamic.html) and the gate's sign-in modal
 * (firebase-auth-modal.html).
 * Builds on app_landing.css (the tokens, buttons, the phone and the stars, all under
 * .app-landing) and, for the modal's sign-in buttons, app_funnel.css. Mobile first.
 */

/* ---------- Shared: a dark card on the light recipe page ---------- */

.app-landing.al-rbanner,
.app-landing.al-gate {
	padding: 0 15px;           /* the recipe page's gutter, so the card lines up with the recipe */
	background: transparent;   /* .app-landing paints paper; the recipe page is white */
	text-align: left;          /* the recipe container centres everything */
	overflow: visible;
}

.al-rbanner__card,
.al-gate__card {
	position: relative;
	overflow: hidden;
	display: grid;
	max-width: 62rem;
	margin: 0 auto;
	padding: 1.6rem 1.35rem 1.5rem;
	border-radius: 28px;
	background-color: var(--al-canvas);
	background-image:
		radial-gradient(60% 70% at 100% 100%, rgba(190, 227, 120, .14), transparent 70%),
		var(--al-glows);
	color: var(--al-ink);
	box-shadow: 0 24px 48px -28px rgba(26, 37, 24, .55);
}

.app-landing .al-rbanner__title,
.app-landing .al-gate__title {
	margin: 0 0 .55rem;
	font-family: var(--al-display);
	font-weight: normal;
	font-size: clamp(1.65rem, 6vw, 2.35rem);
	line-height: 1.06;
	letter-spacing: -.02em;
	color: var(--al-ink);
	text-wrap: balance;
}

.app-landing .al-rbanner__lead,
.app-landing .al-gate__lead {
	max-width: 30rem;
	margin: 0 0 1.15rem;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--al-sage);
}

.al-rbanner__media,
.al-gate__media {
	display: none;
}

/* The phone stands at the bottom right, cut off by the card's edge */
.app-landing .al-rbanner__media .al-phone,
.app-landing .al-gate__media .al-phone {
	--al-pw: 11.5rem;
}

@media (min-width: 768px) {
	.al-rbanner__card,
	.al-gate__card {
		grid-template-columns: minmax(0, 1fr) auto;
		column-gap: 2.5rem;
		padding: 2.25rem 2.5rem 2.25rem 2.75rem;
	}

	.al-rbanner__text,
	.al-gate__text {
		align-self: center;
	}

	.al-rbanner__media,
	.al-gate__media {
		display: block;
		align-self: start;
		height: 0;   /* takes no height: the card is as tall as its text */
		margin-right: .5rem;
	}

	.app-landing .al-rbanner__media .al-phone,
	.app-landing .al-gate__media .al-phone {
		transform: rotate(-4deg);
	}
}

/* ---------- Free recipes: the banner above the ingredients ---------- */

.al-rbanner__actions,
.al-gate__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .85rem 1.25rem;
}

.al-rbanner__rating {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	font-size: .875rem;
	font-weight: 500;
	color: var(--al-sage);
}

.al-rbanner__rating .al-stars {
	font-size: .95rem;
}

@media (min-width: 768px) {
	.al-rbanner__card {
		min-height: 15.5rem;
	}
}

/* ---------- Premium recipes: the gate ---------- */

/* The premium crown, as in the app: a mustard pill with a white crown */
.app-landing .al-gate__badge {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	margin: 0 0 1rem;
	font-size: .875rem;
	font-weight: 600;
	letter-spacing: .02em;
	color: var(--al-sage);
}

.al-gate__crown {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 22px;
	padding: 0 5px;
	border-radius: 6px;
	background: var(--al-mustard);
	box-shadow: 0 0 8px rgba(0, 0, 0, .5);
}

.al-gate__crown svg {
	display: block;
	width: calc(11px * 640 / 512);
	height: 11px;
}

/* One block of copy per state (data-state on the gate, data-gate on each block) */
.al-gate [data-gate] {
	display: none;
}

.al-gate[data-state="loading"] [data-gate~="loading"],
.al-gate[data-state="not_signed_in"] [data-gate~="not_signed_in"],
.al-gate[data-state="never_subscribed"] [data-gate~="never_subscribed"],
.al-gate[data-state="expired"] [data-gate~="expired"],
.al-gate[data-state="no_subscription"] [data-gate~="no_subscription"],
.al-gate[data-state="error"] [data-gate~="error"] {
	display: block;
}

.al-gate[data-state="access"] .al-gate__card {
	display: none;
}

.al-gate[data-state="access"] .al-gate__access {
	display: flex;
}

@media (min-width: 768px) {
	.al-gate__card {
		min-height: 20rem;
	}

	.app-landing .al-gate__media .al-phone {
		--al-pw: 13rem;
	}
}

.app-landing .al-gate__signin,
.app-landing .al-gate__account {
	margin: 0;
	font-size: .9375rem;
	color: var(--al-sage);
}

.app-landing .al-gate__account {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(248, 255, 246, .12);
	font-size: .875rem;
}

/* "Sign in" and "Sign out": buttons that read as links (#sign-in-link also has old styles) */
.app-landing .al-gate__link,
.app-landing #sign-in-link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-weight: 600;
	color: var(--al-lime);
	text-decoration: underline;
	text-underline-offset: .2em;
	cursor: pointer;
}

/* Signed in with access: the recipe shows below, with a slim strip above it */
.al-gate__access {
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	max-width: 62rem;
	margin: 0 auto;
	padding: .8rem 1.25rem;
	border-radius: 16px;
	border: 1px solid var(--al-line);
	background: var(--al-paper);
}

.app-landing .al-gate__access p {
	margin: 0;
	font-weight: 600;
	color: var(--al-dark);
}

.app-landing .al-gate__access .al-gate__link {
	color: #57701B;   /* the lime, darkened for light backgrounds, as in the apps */
}

/* While the script checks the account and fetches the recipe: three lime dots over the card, and
   "Getting your recipe…" under them once someone's signed in */
.al-gate__loading {
	position: absolute;
	inset: 0;
	z-index: 3;
	flex-direction: column;
	gap: .85rem;
	align-items: center;
	justify-content: center;
	background: rgba(26, 33, 22, .8);   /* dark enough that the line reads over the card's own text */
	opacity: 0;
	transition: opacity .3s;
}

.al-gate__loading.active {
	opacity: 1;
}

.al-gate__dots {
	display: flex;
	gap: .5rem;
}

.al-gate__loading-text {
	color: var(--al-ink);
	font-size: 1.0625rem;
	font-weight: 600;
}

.al-gate__loading-text:empty {
	display: none;
}

.al-gate__dots span {
	width: .65rem;
	height: .65rem;
	border-radius: 50%;
	background: var(--al-lime);
	animation: al-gate-dot 1.1s ease-in-out infinite;
}

.al-gate__dots span:nth-child(2) { animation-delay: .15s; }
.al-gate__dots span:nth-child(3) { animation-delay: .3s; }

@keyframes al-gate-dot {
	0%, 80%, 100% { opacity: .25; transform: scale(.7); }
	40% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.al-gate__dots span {
		animation-duration: 2.4s;
		transform: none;
	}
}

/* ---------- The gate's sign-in modal (firebase-auth-modal.html) ---------- */

.app-landing.al-authmodal {
	display: block;
	text-align: center;
	background-color: var(--al-canvas);
	background-image: var(--al-glows);
	color: var(--al-ink);
	border: 1px solid rgba(248, 255, 246, .12);
	border-radius: 28px;
	overflow-x: hidden;
}

.app-landing.al-authmodal #auth-modal-title {
	margin: 0 0 .35rem;
	font-family: var(--al-display);
	font-weight: normal;
	font-size: 2rem;
	letter-spacing: -.02em;
	color: var(--al-ink);
}

.app-landing.al-authmodal #auth-modal-subtitle {
	color: var(--al-sage);
}

.app-landing.al-authmodal .auth-modal-footer {
	border-top-color: rgba(248, 255, 246, .12);
}

.app-landing .al-authmodal__new {
	margin: 0;
	font-size: .875rem;
	color: var(--al-sage);
}

.app-landing .al-authmodal__new a {
	font-weight: 600;
	color: var(--al-lime);
	text-decoration: underline;
	text-underline-offset: .2em;
}

@media (max-width: 640px) {
	.app-landing.al-authmodal {
		border-radius: 0;
		border: 0;
	}
}
