/*
 * SWU Flashcards, in the StepWithUs app's design language (app/src/main/java/…/ui/theme):
 * cream/white surfaces, teal and coral, 20–24px radii, soft cool shadows, pill buttons with
 * uppercase letter-spaced labels; Baloo Da 2 for titles, Capriola for card text, Varela Round
 * for everything else. The fonts are served from the plugin, not Google Fonts (GDPR).
 *
 * Everything is scoped to .swufc and resets what the website theme (Flatsome) sets on buttons
 * and headings. In the app's dark mode the content page has the class swufc-dark.
 */

@font-face {
	font-family: "SWUFC Baloo Da 2";
	src: url("fonts/baloo_da_2.ttf") format("truetype");
	font-weight: 400 800;
	font-display: swap;
}

@font-face {
	font-family: "SWUFC Capriola";
	src: url("fonts/capriola_regular.ttf") format("truetype");
	font-display: swap;
}

@font-face {
	font-family: "SWUFC Varela Round";
	src: url("fonts/varela_round_regular.ttf") format("truetype");
	font-display: swap;
}

.swufc {
	--swufc-card: #fff;
	--swufc-surface: #fff8f4;
	--swufc-text: #3f4a4d;
	--swufc-body: #556063;
	--swufc-muted: #6b7679;
	--swufc-border: #e2e6e7;
	--swufc-track: #e2e6e7;
	--swufc-teal: #187f87;
	--swufc-teal-500: #1e919a;
	--swufc-tint-teal: #eef8f9;
	--swufc-coral: #b14843;
	--swufc-coral-500: #f2736b;
	--swufc-tint-coral: #fef4f3;
	--swufc-shadow: 0 6px 18px rgba(47, 58, 61, 0.14), 0 1px 3px rgba(47, 58, 61, 0.08);
	--swufc-title-font: "SWUFC Baloo Da 2", "Baloo Da 2", sans-serif;
	--swufc-card-font: "SWUFC Capriola", "Capriola", sans-serif;
	--swufc-body-font: "SWUFC Varela Round", "Varela Round", sans-serif;

	container-type: inline-size;
	margin: 24px 0;
	color: var(--swufc-text);
	font-family: var(--swufc-body-font);
	font-size: 15px;
	line-height: 1.45;
	text-align: left;
}

.swufc-dark .swufc,
.swufc.swufc-dark {
	--swufc-card: #1c3033;
	--swufc-surface: #132326;
	--swufc-text: #f1f4f4;
	--swufc-body: #c9cfd1;
	--swufc-muted: #a9b1b3;
	--swufc-border: #2b4347;
	--swufc-track: #2b4347;
	--swufc-teal: #6fc1c8;
	--swufc-tint-teal: #173e43;
	--swufc-coral: #ff938a;
	--swufc-tint-coral: #3a2a2b;
	--swufc-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.swufc,
.swufc *,
.swufc *::before,
.swufc *::after {
	box-sizing: border-box;
}

/* Until flashcards.js has run: room for the deck, so the content below doesn't jump. */
.swufc-pending-set {
	min-height: 360px;
}

.swufc-pending-library {
	min-height: 240px;
}

.swufc h2,
.swufc h3,
.swufc p {
	margin: 0;
	padding: 0;
	border: 0;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
}

.swufc button {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 0;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.swufc button:disabled {
	cursor: default;
	opacity: 0.4;
}

.swufc button:focus-visible,
.swufc .swufc-card:focus-visible,
.swufc .swufc-tile:focus-visible {
	outline: 3px solid var(--swufc-teal-500);
	outline-offset: 3px;
}

.swufc .swufc-icon {
	display: inline-flex;
	width: 22px;
	height: 22px;
}

.swufc .swufc-icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */

.swufc .swufc-btn-round {
	width: 48px;
	height: 48px;
	border: 2px solid var(--swufc-border);
	border-radius: 999px;
	background: var(--swufc-card);
	color: var(--swufc-teal);
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.swufc .swufc-btn-round:not(:disabled):hover {
	border-color: var(--swufc-teal-500);
}

.swufc .swufc-btn-round:not(:disabled):active {
	background: var(--swufc-tint-teal);
}

.swufc .swufc-btn-next {
	width: 56px;
	height: 56px;
	border-color: var(--swufc-coral-500);
	background: var(--swufc-coral-500);
	color: #fff;
}

.swufc .swufc-btn-next:not(:disabled):hover {
	border-color: var(--swufc-coral-500);
	filter: brightness(0.95);
}

.swufc .swufc-btn-next:not(:disabled):active {
	background: var(--swufc-coral-500);
	filter: brightness(0.9);
}

.swufc .swufc-btn-next .swufc-icon {
	width: 28px;
	height: 28px;
}

.swufc .swufc-toggle[aria-pressed="true"] {
	border-color: var(--swufc-teal-500);
	background: var(--swufc-teal-500);
	color: #fff;
}

.swufc .swufc-btn-pill,
.swufc a.swufc-btn {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
	height: 44px;
	padding: 0 20px;
	border: 2px solid transparent;
	border-radius: 999px;
	font-family: var(--swufc-body-font);
	font-size: 13px;
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.swufc .swufc-btn-pill .swufc-icon {
	width: 18px;
	height: 18px;
}

.swufc .swufc-btn-primary,
.swufc a.swufc-btn-primary {
	background: var(--swufc-coral-500);
	color: #fff;
}

.swufc .swufc-btn-primary:hover {
	filter: brightness(0.95);
}

.swufc .swufc-btn-outline {
	border-color: var(--swufc-teal-500);
	color: var(--swufc-teal);
}

.swufc .swufc-btn-outline:active {
	background: var(--swufc-tint-teal);
}

/* ---------------------------------------------------------------
 * Card
 * ------------------------------------------------------------- */

.swufc .swufc-card {
	position: relative;
	display: block;
	width: 100%;
	perspective: 1400px;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	/* Horizontal swipes change cards; vertical ones still scroll the page. */
	touch-action: pan-y;
	border-radius: 24px;
}

.swufc .swufc-card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform 0.55s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.swufc .swufc-card.is-flipped .swufc-card-inner {
	transform: rotateY(180deg);
}

.swufc .swufc-face {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: 18px 20px 20px;
	border-radius: 24px;
	background: var(--swufc-card);
	box-shadow: var(--swufc-shadow);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	overflow: hidden;
}

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

/* Not clickable while turned away (e.g. its speaker), whatever the browser's hit testing. */
.swufc .swufc-card:not(.is-flipped) .swufc-back,
.swufc .swufc-card.is-flipped .swufc-front {
	pointer-events: none;
}

.swufc .swufc-face-hu {
	background: var(--swufc-tint-teal);
}

.swufc .swufc-face-en::after {
	/* The brand's "step" accent bar. */
	content: "";
	position: absolute;
	left: 20px;
	bottom: 18px;
	width: 44px;
	height: 6px;
	border-radius: 0 6px 0 6px;
	background: var(--swufc-coral-500);
}

.swufc .swufc-lang {
	align-self: flex-start;
	padding: 5px 12px;
	border-radius: 999px;
	background: var(--swufc-tint-coral);
	color: var(--swufc-coral);
	font-size: 12px;
	line-height: 1.2;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.swufc .swufc-face-hu .swufc-lang {
	background: var(--swufc-card);
	color: var(--swufc-teal);
}

.swufc .swufc-speak {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1;
	width: 48px;
	height: 48px;
	border-radius: 999px;
	background: var(--swufc-tint-teal);
	color: var(--swufc-teal);
}

.swufc .swufc-speak:active,
.swufc .swufc-speak.is-speaking {
	background: var(--swufc-teal-500);
	color: #fff;
}

.swufc .swufc-speak.is-speaking .swufc-icon {
	animation: swufc-pulse 0.9s ease-in-out infinite;
}

@keyframes swufc-pulse {
	50% {
		transform: scale(1.15);
	}
}

.swufc .swufc-face-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 8px 4px 18px;
	overflow-y: auto;
	text-align: center;
}

.swufc .swufc-image {
	display: block;
	max-width: 100%;
	max-height: 55%;
	min-height: 0;
	border-radius: 14px;
	object-fit: contain;
}

.swufc .swufc-text {
	max-width: 100%;
	color: var(--swufc-text);
	font-family: var(--swufc-card-font);
	line-height: 1.3;
	overflow-wrap: anywhere;
	white-space: pre-line;
}

.swufc .swufc-text-xl { font-size: 32px; }
.swufc .swufc-text-l { font-size: 25px; }
.swufc .swufc-text-m { font-size: 20px; }
.swufc .swufc-text-s { font-size: 16px; }

/* ---------------------------------------------------------------
 * Deck
 * ------------------------------------------------------------- */

.swufc .swufc-deck {
	max-width: 640px;
	margin: 0 auto;
}

.swufc .swufc-head {
	display: flex;
	gap: 12px;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 10px;
}

.swufc .swufc-title {
	flex: 1;
	color: var(--swufc-text);
	font-family: var(--swufc-title-font);
	font-size: 22px;
	font-weight: 600;
	line-height: 1.2;
}

.swufc .swufc-count {
	margin-left: auto;
	color: var(--swufc-muted);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.swufc .swufc-progress {
	height: 6px;
	margin-bottom: 16px;
	border-radius: 999px;
	background: var(--swufc-track);
	overflow: hidden;
}

.swufc .swufc-progress span {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--swufc-teal-500);
	transition: width 0.25s ease;
}

.swufc .swufc-stage {
	position: relative;
	/* Room for the card's shadow. */
	padding: 4px 2px 10px;
}

.swufc .swufc-stage .swufc-card,
.swufc .swufc-done {
	height: clamp(230px, 62vw, 320px);
}

.swufc .swufc-in-next {
	animation: swufc-in-next 0.28s ease-out;
}

.swufc .swufc-in-prev {
	animation: swufc-in-prev 0.28s ease-out;
}

@keyframes swufc-in-next {
	from {
		opacity: 0;
		transform: translateX(32px);
	}
}

@keyframes swufc-in-prev {
	from {
		opacity: 0;
		transform: translateX(-32px);
	}
}

.swufc .swufc-hint {
	margin-top: 2px;
	color: var(--swufc-muted);
	font-size: 13px;
	text-align: center;
}

.swufc .swufc-hint[hidden] {
	display: none;
}

.swufc .swufc-controls {
	display: flex;
	gap: 14px;
	align-items: center;
	justify-content: center;
	margin-top: 14px;
}

.swufc .swufc-done {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	justify-content: center;
	padding: 20px;
	border-radius: 24px;
	background: var(--swufc-tint-coral);
	text-align: center;
}

.swufc .swufc-done-title {
	color: var(--swufc-coral-500);
	font-family: var(--swufc-title-font);
	font-size: 30px;
	font-weight: 600;
	line-height: 1.15;
}

.swufc .swufc-done-body {
	color: var(--swufc-body);
}

.swufc .swufc-done-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 10px;
}

/* ---------------------------------------------------------------
 * Set view (grid)
 * ------------------------------------------------------------- */

.swufc .swufc-set-head {
	display: flex;
	gap: 14px;
	align-items: center;
	margin-bottom: 16px;
}

.swufc .swufc-set-title {
	color: var(--swufc-text);
	font-family: var(--swufc-title-font);
	font-size: 26px;
	font-weight: 600;
	line-height: 1.15;
}

.swufc .swufc-meta {
	color: var(--swufc-muted);
	font-size: 14px;
}

.swufc .swufc-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 18px;
}

.swufc .swufc-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.swufc .swufc-grid .swufc-card {
	height: 170px;
}

.swufc .swufc-grid .swufc-face {
	padding: 12px 12px 14px;
	border-radius: 20px;
}

.swufc .swufc-grid .swufc-face-en::after {
	left: 12px;
	bottom: 12px;
	width: 32px;
	height: 5px;
}

.swufc .swufc-grid .swufc-lang {
	padding: 4px 9px;
	font-size: 10px;
}

.swufc .swufc-grid .swufc-speak {
	top: 6px;
	right: 6px;
	width: 40px;
	height: 40px;
}

.swufc .swufc-grid .swufc-speak .swufc-icon {
	width: 20px;
	height: 20px;
}

.swufc .swufc-grid .swufc-face-body {
	padding: 4px 0 10px;
}

.swufc .swufc-grid .swufc-text-xl { font-size: 21px; }
.swufc .swufc-grid .swufc-text-l { font-size: 17px; }
.swufc .swufc-grid .swufc-text-m { font-size: 14px; }
.swufc .swufc-grid .swufc-text-s { font-size: 12.5px; }

/* ---------------------------------------------------------------
 * Library
 * ------------------------------------------------------------- */

.swufc .swufc-crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
	align-items: center;
	margin-bottom: 8px;
	color: var(--swufc-muted);
	font-size: 14px;
}

.swufc .swufc-crumb {
	padding: 6px 2px;
	color: var(--swufc-teal);
	line-height: 1.2;
}

.swufc button.swufc-crumb:hover {
	text-decoration: underline;
}

.swufc .swufc-crumb.is-current {
	color: var(--swufc-muted);
}

.swufc .swufc-library-title {
	margin-bottom: 18px;
	color: var(--swufc-text);
	font-family: var(--swufc-title-font);
	font-size: 30px;
	font-weight: 600;
	line-height: 1.15;
}

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

.swufc .swufc-tile {
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: flex-start;
	justify-content: flex-start;
	padding: 18px;
	border-radius: 24px;
	background: var(--swufc-card);
	box-shadow: var(--swufc-shadow);
	text-align: left;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swufc .swufc-tile:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(47, 58, 61, 0.18);
}

.swufc .swufc-tile-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	background: var(--swufc-tint-teal);
	color: var(--swufc-teal);
}

.swufc .swufc-tile-set .swufc-tile-icon {
	background: var(--swufc-tint-coral);
	color: var(--swufc-coral);
}

.swufc .swufc-tile-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.swufc .swufc-tile-title {
	color: var(--swufc-text);
	font-family: var(--swufc-card-font);
	font-size: 16px;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.swufc .swufc-tile-meta {
	color: var(--swufc-muted);
	font-size: 13px;
	line-height: 1.3;
}

.swufc .swufc-empty,
.swufc .swufc-loading {
	padding: 24px 0;
	color: var(--swufc-muted);
	text-align: center;
}

/* ---------------------------------------------------------------
 * Messages (not logged in, no subscription, failed to load)
 * ------------------------------------------------------------- */

.swufc .swufc-message-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
	max-width: 520px;
	margin: 0 auto;
	padding: 28px 22px;
	border-radius: 24px;
	background: var(--swufc-surface);
	text-align: center;
}

.swufc .swufc-message-title {
	color: var(--swufc-text);
	font-family: var(--swufc-title-font);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.2;
}

.swufc .swufc-message-body {
	color: var(--swufc-body);
}

.swufc .swufc-fallback {
	margin: 0;
	padding-left: 1.4em;
}

/* ---------------------------------------------------------------
 * Wider containers
 * ------------------------------------------------------------- */

@container (min-width: 520px) {
	.swufc .swufc-stage .swufc-card,
	.swufc .swufc-done {
		height: 320px;
	}

	.swufc .swufc-text-xl { font-size: 40px; }
	.swufc .swufc-text-l { font-size: 30px; }
	.swufc .swufc-text-m { font-size: 22px; }
	.swufc .swufc-text-s { font-size: 17px; }

	.swufc .swufc-grid {
		grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
		gap: 16px;
	}

	.swufc .swufc-grid .swufc-card {
		height: 200px;
	}

	.swufc .swufc-grid .swufc-text-xl { font-size: 26px; }
	.swufc .swufc-grid .swufc-text-l { font-size: 20px; }
	.swufc .swufc-grid .swufc-text-m { font-size: 16px; }
	.swufc .swufc-grid .swufc-text-s { font-size: 13.5px; }

	.swufc .swufc-tiles {
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
		gap: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.swufc .swufc-card-inner,
	.swufc .swufc-progress span,
	.swufc .swufc-tile {
		transition: none;
	}
}
