/* American Flip Cards — front-end styles
   Colors and sizing come from inline CSS custom properties set per card.
   The card is always 100% wide; height follows the image (the "sizer" face)
   on tablet/desktop, and is fixed on mobile so the overlay content fits. */

.afc-scene {
	--afc-radius: 24px;
	--afc-mobile-h: 420px;
	--afc-front-footer: #ffffff;
	--afc-back-footer: #e7d7fb;
	--afc-before-pill: #ffffff;
	--afc-after-pill: #dcc6f8;
	--afc-text: #141414;
	--afc-muted: #6b7280;

	width: 100%;
	perspective: 1600px;
	cursor: pointer;
	outline: none;
}

.afc-scene:focus-visible {
	outline: 3px solid var(--afc-after-pill);
	outline-offset: 6px;
	border-radius: calc(var(--afc-radius) + 4px);
}

/* The element that rotates */
.afc-inner {
	position: relative;
	width: 100%;
	transform-style: preserve-3d;
	transition: transform 0.85s cubic-bezier(0.4, 0.15, 0.2, 1);
	will-change: transform;
}

/* Flip triggers: hover on pointer devices, tap/keyboard via .is-flipped */
@media (hover: hover) and (pointer: fine) {
	.afc-scene:hover .afc-inner {
		transform: rotateY(180deg);
	}
}

.afc-scene.is-flipped .afc-inner {
	transform: rotateY(180deg);
}

/* --- Faces ---------------------------------------------------------------
   By default a face is absolutely stacked. The face flagged .is-sizer sits
   in normal flow so its <img> gives the whole card its responsive height. */
.afc-face {
	position: absolute;
	inset: 0;
	border-radius: var(--afc-radius);
	overflow: hidden;
	background-color: #d9d9d9;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.afc-face.is-sizer {
	position: relative;
	inset: auto;
}

.afc-face--back {
	transform: rotateY(180deg);
}

/* --- Image = relative parent that carries the height --------------------- */
.afc-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.afc-face.is-sizer .afc-img {
	height: auto; /* natural aspect ratio drives the card height */
}

/* --- Content container: absolutely above the image, spaced top/bottom ---- */
.afc-content {
	position: absolute;
	inset: 0;
	z-index: 2;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: space-between; /* pill top, footer bottom */
	align-items: stretch;
	gap: 12px;
	padding: clamp(14px, 3%, 22px);
}

/* Before / After pill */
.afc-pill {
	align-self: flex-start;
	padding: 8px 22px;
	border-radius: 999px;
	font-family: Georgia, "Times New Roman", serif;
	font-style: italic;
	font-size: clamp(15px, 2.4vw, 20px);
	font-weight: 600;
	color: var(--afc-text);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	line-height: 1;
}

.afc-pill--front {
	background: var(--afc-before-pill);
}

.afc-pill--back {
	background: var(--afc-after-pill);
}

/* Footer bar (the "inner container" whose color changes per face) */
.afc-footer {
	position: relative;
	box-sizing: border-box;
	padding: 20px 24px;
	border-radius: 14px;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.afc-face--front .afc-footer {
	background: var(--afc-front-footer);
}

.afc-face--back .afc-footer {
	background: var(--afc-back-footer);
}

.afc-title {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 700;
	font-size: clamp(18px, 3.4vw, 26px);
	color: var(--afc-text);
	line-height: 1.15;
}

.afc-loc {
	margin-top: 4px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: clamp(12px, 2vw, 15px);
	color: var(--afc-muted);
}

/* Corner bracket accents inside the footer */
.afc-bracket {
	position: absolute;
	width: 14px;
	height: 14px;
	border-color: var(--afc-text);
	border-style: solid;
	opacity: 0.85;
}

.afc-bracket--tl {
	top: 10px;
	left: 12px;
	border-width: 2px 0 0 2px;
}

.afc-bracket--br {
	bottom: 10px;
	right: 12px;
	border-width: 0 2px 2px 0;
}

/* --- Mobile: give the card a fixed height so content always fits --------- */
@media (max-width: 600px) {
	.afc-inner {
		height: var(--afc-mobile-h);
	}
	.afc-face.is-sizer {
		position: absolute;
		inset: 0;
	}
	.afc-img,
	.afc-face.is-sizer .afc-img {
		height: 100%;
		object-fit: cover;
	}
}

/* Editor-only empty state */
.afc-empty {
	margin: 0 auto;
	padding: 16px 20px;
	border: 1px dashed #b3b3b3;
	border-radius: 12px;
	color: #555;
	font-size: 14px;
	text-align: center;
	background: #fafafa;
}

/* Respect users who prefer no motion: cross-fade instead of flipping */
@media (prefers-reduced-motion: reduce) {
	.afc-inner {
		transform: none !important;
		transform-style: flat;
		transition: none;
	}
	.afc-face--back {
		transform: none;
		opacity: 0;
		transition: opacity 0.3s ease;
	}
	.afc-scene:hover .afc-face--back,
	.afc-scene.is-flipped .afc-face--back {
		opacity: 1;
	}
}
