/**
 * TikTok Embed Cards — front-end styles.
 */

.ttc-feed {
	--ttc-accent: #fe2c55;
	--ttc-cols: 4;
	--ttc-gap: 20px;
	--ttc-radius: 18px;
	--ttc-ratio: 4 / 5;
	--ttc-bg: #ffffff;
	--ttc-fg: #0f172a;
	--ttc-muted: #64748b;
	--ttc-line: rgba(15, 23, 42, 0.08);
	--ttc-soft: #f8fafc;
	box-sizing: border-box;
	margin: 1.5rem 0;
	color: var(--ttc-fg);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	text-align: start;
	container-name: ttc-feed;
	container-type: inline-size;
}

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

.ttc-i {
	display: inline-block;
	flex: 0 0 auto;
	vertical-align: middle;
}

.ttc-feed--single {
	width: 100%;
	max-width: 380px;
}

/* Profile header -------------------------------------------------------- */

.ttc-profile {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
	padding: 14px 16px;
	background: var(--ttc-bg);
	border: 1px solid var(--ttc-line);
	border-radius: var(--ttc-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ttc-profile-main {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.ttc-profile-avatar {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 50%;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--ttc-accent) 38%, transparent);
}

.ttc-profile-avatar--letter {
	display: grid;
	place-items: center;
	color: #ffffff;
	font-size: 18px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--ttc-accent), #25f4ee);
}

.ttc-profile-info {
	min-width: 0;
}

.ttc-profile-name {
	display: flex;
	align-items: center;
	gap: 5px;
	overflow: hidden;
	color: var(--ttc-fg);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttc-profile-name:hover {
	color: var(--ttc-accent);
}

.ttc-profile-nick {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttc-profile-name:focus-visible {
	border-radius: 4px;
	outline: 2px solid var(--ttc-accent);
	outline-offset: 2px;
}

.ttc-profile-meta {
	margin-top: 4px;
	overflow: hidden;
	color: var(--ttc-muted);
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttc-profile-follow {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
	padding: 8px 14px;
	color: #ffffff;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	background: var(--ttc-accent);
	border-radius: 999px;
	box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--ttc-accent) 80%, transparent);
	transition:
		transform 0.18s ease,
		filter 0.18s ease;
}

.ttc-profile-follow:hover {
	color: #ffffff;
	filter: brightness(0.94);
	transform: translateY(-1px);
}

.ttc-profile-follow:focus-visible {
	outline: 3px solid #ffffff;
	outline-offset: 2px;
}

.ttc-profile-follow .ttc-i {
	width: 13px;
	height: 13px;
}

.ttc-grid {
	display: grid;
	grid-template-columns: repeat(var(--ttc-cols), minmax(0, 1fr));
	gap: var(--ttc-gap);
	align-items: stretch;
}

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

.ttc-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	background: var(--ttc-bg);
	border: 1px solid var(--ttc-line);
	border-radius: var(--ttc-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	transition:
		transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
		box-shadow 0.28s ease,
		border-color 0.28s ease;
}

@media (hover: hover) {
	.ttc-card:hover {
		transform: translateY(-4px);
		border-color: color-mix(in srgb, var(--ttc-accent) 38%, var(--ttc-line));
		box-shadow: 0 22px 45px -22px rgba(15, 23, 42, 0.35);
	}

	.ttc-card:hover .ttc-cover {
		transform: scale(1.045);
	}
}

/* Media ----------------------------------------------------------------- */

.ttc-media {
	position: relative;
	aspect-ratio: var(--ttc-ratio);
	overflow: hidden;
	background-color: #10121a;
	background-image:
		radial-gradient(120% 80% at 15% 10%, color-mix(in srgb, var(--ttc-accent) 55%, transparent), transparent 62%),
		radial-gradient(120% 80% at 85% 90%, rgba(37, 244, 238, 0.5), transparent 62%),
		linear-gradient(135deg, #10121a, #232838);
}

.ttc-media::after {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		to top,
		rgba(5, 7, 14, 0.62) 0%,
		rgba(5, 7, 14, 0) 46%,
		rgba(5, 7, 14, 0.07) 100%
	);
	content: "";
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.ttc-cover {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ttc-fallback {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #ffffff;
	opacity: 0.92;
}

.ttc-fallback .ttc-i {
	width: 54px;
	height: 54px;
	filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.ttc-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 9px;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1;
	background: rgba(8, 11, 20, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 999px;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.ttc-badge .ttc-i {
	width: 12px;
	height: 12px;
}

/* Play ------------------------------------------------------------------ */

.ttc-play {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: grid;
	place-items: center;
	padding: 0;
	color: #ffffff;
	background: transparent;
	border: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* Some themes style every <button> with an accent background. The play
 * button is a full-size transparent click target, so reset those styles
 * aggressively or it covers the whole cover image. */
.ttc-feed .ttc-card .ttc-media button.ttc-play,
.ttc-feed .ttc-card .ttc-media button.ttc-play:hover,
.ttc-feed .ttc-card .ttc-media button.ttc-play:focus,
.ttc-feed .ttc-card .ttc-media button.ttc-play:active {
	position: absolute !important;
	inset: 0 !important;
	display: grid !important;
	place-items: center !important;
	width: auto !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-decoration: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	transform: none !important;
}

.ttc-feed .ttc-card .ttc-media button.ttc-play::before,
.ttc-feed .ttc-card .ttc-media button.ttc-play::after {
	content: none !important;
	display: none !important;
}

.ttc-play:focus {
	outline: 0;
}

.ttc-play-ring {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 58px;
	height: 58px;
	margin: -29px 0 0 -29px;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 50%;
	animation: ttc-pulse 2.8s ease-out infinite;
}

.ttc-play-icon {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.38);
	border-radius: 50%;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
	backdrop-filter: blur(9px);
	-webkit-backdrop-filter: blur(9px);
	transition:
		transform 0.22s ease,
		background-color 0.22s ease,
		border-color 0.22s ease,
		box-shadow 0.22s ease;
}

.ttc-play-icon .ttc-i {
	width: 22px;
	height: 22px;
	margin-left: 3px;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.ttc-play:hover .ttc-play-icon,
.ttc-play:focus-visible .ttc-play-icon {
	background: var(--ttc-accent);
	border-color: transparent;
	box-shadow:
		0 0 0 10px color-mix(in srgb, var(--ttc-accent) 18%, transparent),
		0 14px 34px rgba(0, 0, 0, 0.36);
	transform: scale(1.08);
}

.ttc-play:focus-visible .ttc-play-icon {
	outline: 3px solid #ffffff;
	outline-offset: 3px;
}

@keyframes ttc-pulse {
	0% {
		opacity: 0.7;
		transform: scale(1);
	}
	70% {
		opacity: 0;
		transform: scale(1.55);
	}
	100% {
		opacity: 0;
		transform: scale(1.55);
	}
}

/* Body ------------------------------------------------------------------ */

.ttc-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 14px 14px 12px;
}

.ttc-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 24px;
}

.ttc-author {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-width: 0;
	color: inherit;
	font-size: 13px;
	font-weight: 650;
	line-height: 1.2;
	text-decoration: none;
}

.ttc-author:hover .ttc-username {
	color: var(--ttc-accent);
}

.ttc-author:focus-visible {
	border-radius: 6px;
	outline: 2px solid var(--ttc-accent);
	outline-offset: 2px;
}

.ttc-avatar {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	object-fit: cover;
	border-radius: 50%;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--ttc-accent) 35%, transparent);
}

.ttc-avatar--letter {
	display: grid;
	place-items: center;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--ttc-accent), #25f4ee);
}

.ttc-username {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: color 0.18s ease;
}

.ttc-verified {
	display: inline-flex;
	flex: 0 0 auto;
	color: #20a0ff;
}

.ttc-verified .ttc-i {
	width: 14px;
	height: 14px;
}

.ttc-time {
	flex: 0 0 auto;
	color: var(--ttc-muted);
	font-size: 11.5px;
	white-space: nowrap;
}

.ttc-top > .ttc-time:only-child {
	margin-left: auto;
}

.ttc-caption {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--ttc-fg);
	font-size: 13.5px;
	line-height: 1.5;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.ttc-caption a {
	color: var(--ttc-accent);
	font-weight: 600;
	text-decoration: none;
}

.ttc-caption a:hover {
	text-decoration: underline;
}

/* Bottom row ------------------------------------------------------------ */

.ttc-bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 10px;
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--ttc-line);
}

.ttc-stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px 11px;
	min-width: 0;
	color: var(--ttc-muted);
	font-size: 11.5px;
	font-weight: 500;
}

.ttc-stat {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	white-space: nowrap;
}

.ttc-stat .ttc-i {
	width: 13px;
	height: 13px;
	opacity: 0.8;
}

.ttc-cta {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	margin-left: auto;
	color: var(--ttc-accent);
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.ttc-cta .ttc-i {
	width: 13px;
	height: 13px;
	transition: transform 0.2s ease;
}

.ttc-cta:hover .ttc-i {
	transform: translate(2px, -2px);
}

.ttc-cta:focus-visible {
	border-radius: 4px;
	outline: 2px solid var(--ttc-accent);
	outline-offset: 2px;
}

/* Dark theme ------------------------------------------------------------ */

.ttc-theme-dark {
	--ttc-bg: #14161f;
	--ttc-fg: #f8fafc;
	--ttc-muted: #94a3b8;
	--ttc-line: rgba(255, 255, 255, 0.09);
	--ttc-soft: #1c1f2b;
}

.ttc-theme-dark .ttc-card {
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ttc-theme-dark .ttc-author:hover .ttc-username,
.ttc-theme-dark .ttc-caption a,
.ttc-theme-dark .ttc-cta {
	color: color-mix(in srgb, var(--ttc-accent) 78%, #ffffff);
}

@media (prefers-color-scheme: dark) {
	.ttc-theme-auto {
		--ttc-bg: #14161f;
		--ttc-fg: #f8fafc;
		--ttc-muted: #94a3b8;
		--ttc-line: rgba(255, 255, 255, 0.09);
		--ttc-soft: #1c1f2b;
	}

	.ttc-theme-auto .ttc-card {
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
	}

	.ttc-theme-auto .ttc-author:hover .ttc-username,
	.ttc-theme-auto .ttc-caption a,
	.ttc-theme-auto .ttc-cta {
		color: color-mix(in srgb, var(--ttc-accent) 78%, #ffffff);
	}
}

/* Inline playback ------------------------------------------------------- */

.ttc-iframe {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	width: 100%;
	height: 100%;
	background: #000000;
	border: 0;
}

.ttc-media--embed {
	background: #000000;
}

.ttc-media--embed::after {
	display: none;
}

.ttc-media.is-loading .ttc-cover,
.ttc-media.is-playing .ttc-cover {
	opacity: 0;
	transform: none;
}

.ttc-media.is-loading .ttc-play,
.ttc-media.is-playing .ttc-play,
.ttc-media.is-loading .ttc-badge,
.ttc-media.is-playing .ttc-badge {
	opacity: 0;
	pointer-events: none;
}

.ttc-media.is-loading::after,
.ttc-media.is-playing::after {
	opacity: 0;
}

.ttc-loader {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	place-items: center;
	background: rgba(4, 6, 12, 0.62);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

.ttc-loader span {
	display: block;
	width: 34px;
	height: 34px;
	border: 3px solid rgba(255, 255, 255, 0.22);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: ttc-spin 0.8s linear infinite;
}

.ttc-inline-error {
	position: absolute;
	inset: 0;
	z-index: 6;
	display: grid;
	place-items: center;
	padding: 18px;
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
	text-decoration: underline;
	background: rgba(4, 6, 12, 0.86);
}

.ttc-inline-error:hover {
	color: #ffffff;
}

@keyframes ttc-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Modal ----------------------------------------------------------------- */

.ttc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.ttc-modal[hidden] {
	display: none;
}

.ttc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 12, 0.82);
	backdrop-filter: blur(7px);
	-webkit-backdrop-filter: blur(7px);
	animation: ttc-fade 0.2s ease both;
}

.ttc-modal-inner {
	position: relative;
	z-index: 2;
	animation: ttc-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ttc-modal-frame {
	position: relative;
	width: auto;
	height: min(88vh, 800px);
	height: min(88dvh, 800px);
	max-width: 94vw;
	aspect-ratio: 9 / 16;
	overflow: hidden;
	background: #000000;
	border-radius: 16px;
	box-shadow: 0 32px 90px rgba(0, 0, 0, 0.65);
}

.ttc-modal-frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.ttc-modal-close {
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 6;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: #0f172a;
	background: #ffffff;
	border: 0;
	border-radius: 50%;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	transition:
		transform 0.18s ease,
		background-color 0.18s ease;
}

.ttc-modal-close:hover {
	transform: rotate(90deg);
}

.ttc-modal-close .ttc-i {
	width: 18px;
	height: 18px;
}

.ttc-modal-close:focus-visible {
	outline: 3px solid var(--ttc-accent, #fe2c55);
	outline-offset: 3px;
}

.ttc-modal .ttc-loader {
	position: absolute;
}

body.ttc-lock {
	overflow: hidden;
}

@keyframes ttc-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes ttc-pop {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Editor notice --------------------------------------------------------- */

.ttc-notice {
	margin: 1.5rem 0;
	padding: 14px 16px;
	color: #475467;
	font-size: 13px;
	line-height: 1.5;
	background: #f9fafb;
	border: 1px dashed #d0d5dd;
	border-radius: 12px;
}

.ttc-notice code {
	padding: 1px 5px;
	font-size: 12px;
	background: #ffffff;
	border: 1px solid #eaecf0;
	border-radius: 4px;
	overflow-wrap: anywhere;
}

/* Responsive columns ---------------------------------------------------- */

@container ttc-feed (max-width: 980px) {
	.ttc-feed[data-cols="4"] .ttc-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@container ttc-feed (max-width: 700px) {
	.ttc-feed[data-cols="3"] .ttc-grid,
	.ttc-feed[data-cols="4"] .ttc-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@container ttc-feed (max-width: 430px) {
	.ttc-feed:not(.ttc-feed--single) .ttc-grid {
		grid-template-columns: 1fr;
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 1100px) {
		.ttc-feed[data-cols="4"] .ttc-grid {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}
	}

	@media (max-width: 900px) {
		.ttc-feed[data-cols="3"] .ttc-grid,
		.ttc-feed[data-cols="4"] .ttc-grid {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}
	}

	@media (max-width: 560px) {
		.ttc-feed:not(.ttc-feed--single) .ttc-grid {
			grid-template-columns: 1fr;
		}
	}
}

@media (max-width: 560px) {
	.ttc-feed--single {
		max-width: none;
	}

	.ttc-profile {
		gap: 10px;
		padding: 12px;
	}

	.ttc-profile-avatar {
		width: 40px;
		height: 40px;
	}

	.ttc-profile-follow {
		padding: 7px 11px;
		font-size: 11.5px;
	}

	.ttc-modal {
		padding: 14px;
	}

	.ttc-modal-frame {
		width: min(94vw, 420px);
		height: auto;
		max-width: none;
		aspect-ratio: 9 / 16;
	}

	.ttc-modal-close {
		top: 8px;
		right: 8px;
	}
}

/* Motion preferences ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.ttc-card,
	.ttc-cover,
	.ttc-play-icon,
	.ttc-cta .ttc-i,
	.ttc-avatar,
	.ttc-modal-close {
		transition: none;
	}

	.ttc-play-ring,
	.ttc-modal-backdrop,
	.ttc-modal-inner {
		animation: none;
	}

	.ttc-loader span {
		animation-duration: 1.6s;
	}
}
