/* ── Single igcr_post (/p/{shortcode}/) ── */

/* ── Minimal template shell — reset theme layout ── */
.igcr-single-main {
	max-width: 100%;
	margin: 0 auto;
	padding: 0;
	float: none;
	width: 100%;
}

/* ── Wrapper ── */
.igcr-single-wrap {
	max-width: 1440px;
	margin-inline: auto;
	padding: 24px 20px 60px;
}

/* ── Top bar — back + automate ── */
.igcr-single-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.igcr-single-back {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.85em;
	color: var( --igcr-text-secondary, #737373 );
	text-decoration: none;
}

.igcr-single-back:hover {
	color: var( --igcr-text, #262626 );
	text-decoration: underline;
}

/* Automate CTA — distinct accent highlight */
.igcr-automate-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	border: none;
	border-radius: var( --igcr-radius, 8px );
	background: var( --igcr-accent, #0095F6 );
	color: #fff;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, box-shadow 0.15s;
	white-space: nowrap;
}

.igcr-automate-trigger:hover {
	background: var( --igcr-accent-hover, #345a7e );
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.15 );
}

.igcr-automate-trigger svg {
	flex-shrink: 0;
}

/* ── Post navigation (prev / next) ── */
.igcr-post-nav {
	display: flex;
	align-items: stretch;
	gap: 0;
}

.igcr-post-nav .igcr-single-post {
	flex: 1;
	min-width: 0;
}

.igcr-post-nav-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	flex-shrink: 0;
	color: var( --igcr-text-muted, #8e8e8e );
	text-decoration: none;
	transition: color 0.15s, background 0.15s;
	border-radius: var( --igcr-radius-sm, 4px );
}

.igcr-post-nav-btn:hover {
	color: var( --igcr-text, #262626 );
	background: var( --igcr-bg-muted, #f3f4f6 );
}

.igcr-post-nav-btn--disabled {
	visibility: hidden;
}

/* ── Card container ── */
.igcr-single-post {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) clamp( 340px, 33vw, 500px );
	min-height: 480px;
	max-height: min( calc( 100vh - 96px ), 898px );
	border: 1px solid var( --igcr-border, #dbdbdb );
	border-radius: var( --igcr-radius-sm, 4px );
	overflow: hidden;
	background: var( --igcr-bg, #fff );
}

/* ── Media column ── */
.igcr-single-media {
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	min-height: 0;
}

.igcr-media-image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.igcr-media-video--single {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	background: #000;
}

/* ── Carousel ── */
.igcr-carousel {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #000;
}

.igcr-carousel-track {
	position: relative;
	width: 100%;
	height: 100%;
}

.igcr-carousel-slide {
	display: none !important;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.igcr-carousel-slide.is-active {
	display: flex !important;
	align-items: center;
	justify-content: center;
}

.igcr-carousel-slide img,
.igcr-carousel-slide .igcr-media-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.igcr-carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	background: rgba( 255, 255, 255, 0.85 );
	border: none;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #262626;
	z-index: 10;
	transition: opacity 0.15s;
	box-shadow: 0 1px 5px rgba( 0, 0, 0, 0.15 );
}

.igcr-carousel-btn:hover {
	opacity: 0.8;
}

.igcr-carousel-prev { left: 8px; }
.igcr-carousel-next { right: 8px; }

.igcr-carousel-dots {
	position: absolute;
	bottom: 14px;
	left: 50%;
	transform: translateX( -50% );
	display: flex;
	gap: 4px;
	z-index: 10;
}

.igcr-carousel-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	border: none;
	background: rgba( 255, 255, 255, 0.4 );
	cursor: pointer;
	padding: 0;
	transition: background 0.15s, transform 0.15s;
}

.igcr-carousel-dot.is-active {
	background: #fff;
	transform: scale( 1.3 );
}

/* ── Content column ── */
.igcr-single-content {
	display: flex;
	flex-direction: column;
	border-left: 1px solid var( --igcr-border, #dbdbdb );
	overflow: hidden;
	min-height: 0;
}

/* ── Header strip ── */
.igcr-single-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	border-bottom: 1px solid var( --igcr-border, #dbdbdb );
	flex-shrink: 0;
}

.igcr-single-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.igcr-single-identity {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.igcr-single-username {
	font-size: 0.875em;
	font-weight: 600;
	color: var( --igcr-text, #262626 );
	text-overflow: ellipsis;
	overflow: hidden;
	white-space: nowrap;
}

.igcr-header-sep {
	color: var( --igcr-text-muted, #8e8e8e );
	font-size: 0.85em;
	flex-shrink: 0;
}

.igcr-follow-link {
	font-size: 0.875em;
	font-weight: 600;
	color: var( --igcr-accent, #0095f6 );
	text-decoration: none;
	flex-shrink: 0;
}

.igcr-follow-link:hover {
	color: var( --igcr-text, #262626 );
}

.igcr-header-menu {
	margin-left: auto;
	color: var( --igcr-text, #262626 );
	display: flex;
	flex-shrink: 0;
}

.igcr-header-menu:hover {
	opacity: 0.6;
}

/* ── Scrollable body (caption + comments) ── */
.igcr-single-body {
	flex: 1 1 0;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
}

/* ── Caption (comment-like row) ── */
.igcr-caption-row {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var( --igcr-border-light, #efefef );
}

.igcr-caption-row .igcr-comment-avatar {
	flex-shrink: 0;
}

.igcr-caption-row .igcr-comment-text {
	font-size: 0.875em;
	line-height: 1.5;
	color: var( --igcr-text, #262626 );
	margin: 0;
	white-space: pre-line;
	word-wrap: break-word;
}

/* ── Comments section ── */
.igcr-comments-section {
	border: none;
	padding: 0;
}

.igcr-comment-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.igcr-comment {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

/* Comment row: avatar + body + heart */
.igcr-comment-row {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

/* Avatar circle */
.igcr-comment-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var( --igcr-bg-muted, #efefef );
	color: var( --igcr-text-secondary, #737373 );
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75em;
	font-weight: 600;
	flex-shrink: 0;
	line-height: 1;
	overflow: hidden;
}

img.igcr-comment-avatar {
	object-fit: cover;
}

.igcr-comment-avatar--sm {
	width: 24px;
	height: 24px;
	font-size: 0.65em;
}

/* Comment body: author + text inline */
.igcr-comment-body {
	flex: 1;
	min-width: 0;
}

.igcr-comment-text {
	font-size: 0.875em;
	line-height: 1.45;
	color: var( --igcr-text, #262626 );
	margin: 0;
	word-wrap: break-word;
}

.igcr-comment-author {
	font-weight: 600;
	margin-right: 4px;
	color: var( --igcr-text, #262626 );
}

/* Comment meta: time + reply */
.igcr-comment-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
	font-size: 0.75em;
	color: var( --igcr-text-muted, #8e8e8e );
}

.igcr-comment-meta time {
	color: var( --igcr-text-muted, #8e8e8e );
}

.igcr-reply-toggle {
	background: none;
	border: none;
	cursor: pointer;
	font-size: inherit;
	font-weight: 600;
	color: var( --igcr-text-muted, #8e8e8e );
	padding: 0;
}

.igcr-reply-toggle:hover {
	color: var( --igcr-text-secondary, #737373 );
}

/* Comment heart icon (right side) */
.igcr-comment-heart {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 0 0 0;
	color: var( --igcr-text-muted, #8e8e8e );
	flex-shrink: 0;
	display: flex;
	align-items: flex-start;
	opacity: 0.7;
	transition: opacity 0.15s;
}

.igcr-comment-heart:hover {
	opacity: 1;
	color: #ed4956;
}

.igcr-comment-heart svg {
	width: 12px;
	height: 12px;
}

/* Reply threading */
.igcr-reply-list {
	list-style: none;
	margin: 8px 0 0 0;
	padding-left: 44px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.igcr-reply-list--collapsed {
	display: none;
}

.igcr-reply-list--expanded {
	display: flex;
}

/* "View all N replies" toggle */
.igcr-view-replies {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.75em;
	font-weight: 600;
	color: var( --igcr-text-muted, #8e8e8e );
	padding: 4px 0 4px 44px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.igcr-view-replies:hover {
	color: var( --igcr-text-secondary, #737373 );
}

/* Empty comments */
.igcr-comments-empty {
	font-size: 0.875em;
	color: var( --igcr-text-muted, #8e8e8e );
	text-align: center;
	padding: 24px 0;
}

/* Reply context (hidden, used by JS) */
.igcr-reply-context {
	display: none;
}

/* ── Footer (pinned bottom) ── */
.igcr-single-footer {
	border-top: 1px solid var( --igcr-border, #dbdbdb );
	flex-shrink: 0;
}

/* ── Action bar ── */
.igcr-action-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 16px 0;
}

.igcr-action-bar-left,
.igcr-action-bar-right {
	display: flex;
	align-items: center;
	gap: 16px;
}

.igcr-action-icon {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px 0;
	color: var( --igcr-text, #262626 );
	display: flex;
	text-decoration: none;
}

.igcr-action-icon:hover {
	opacity: 0.6;
}

.igcr-action-icon--disabled {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

.igcr-action-icon svg {
	width: 24px;
	height: 24px;
}

/* ── Like count ── */
.igcr-like-count {
	padding: 0 16px 2px;
	font-size: 0.875em;
	color: var( --igcr-text, #262626 );
}

.igcr-like-count strong {
	font-weight: 600;
}

/* ── Post date ── */
.igcr-post-date {
	display: block;
	padding: 2px 16px 4px;
	font-size: 0.625em;
	color: var( --igcr-text-muted, #8e8e8e );
	text-transform: uppercase;
	letter-spacing: 0.2px;
}

/* ── Admin toolbar (Automate + Post) ── */
.igcr-admin-toolbar {
	display: flex;
	border-top: 1px solid var( --igcr-border, #dbdbdb );
}

.igcr-admin-toolbar-toggle {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.8em;
	font-weight: 600;
	color: var( --igcr-text-muted, #8e8e8e );
	padding: 8px 16px;
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1;
}

.igcr-admin-toolbar-toggle:hover {
	color: var( --igcr-text, #262626 );
	background: var( --igcr-bg-subtle, #fafafa );
}

/* Accent highlight for primary action (Automate) */
.igcr-admin-toolbar-toggle--accent {
	color: var( --igcr-accent, #0095F6 );
}

.igcr-admin-toolbar-toggle--accent:hover {
	color: var( --igcr-accent, #0095F6 );
	opacity: 0.8;
}

/* Publish draft button */
.igcr-admin-toolbar-toggle--publish {
	color: #fff;
	background: var( --igcr-accent, #3D6792 );
	border-radius: 6px;
	margin: 4px;
	flex: none;
	padding: 6px 14px;
}
.igcr-admin-toolbar-toggle--publish:hover {
	opacity: 0.9;
	color: #fff;
	background: var( --igcr-accent, #3D6792 );
}

/* Draft badge in topbar */
.igcr-draft-badge {
	display: inline-block;
	padding: 2px 10px;
	background: var( --igcr-accent, #3D6792 );
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-radius: 4px;
	line-height: 1.4;
}

/* Draft post wrapper — dashed border indicator */
.igcr-single-wrap--draft .igcr-single-post {
	border: 2px dashed var( --igcr-accent, #3D6792 );
}

/* ── Inline comment form ── */
.igcr-comment-form--inline {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	border-top: 1px solid var( --igcr-border, #dbdbdb );
	margin: 0;
}

.igcr-comment-form--inline .igcr-comment-textarea {
	width: 100%;
	resize: none;
	border: none;
	padding: 0;
	font-size: 0.875em;
	font-family: inherit;
	line-height: 1.4;
	min-height: unset;
	height: auto;
	outline: none;
	background: transparent;
	color: var( --igcr-text, #262626 );
	box-sizing: border-box;
}

.igcr-comment-form--inline .igcr-comment-textarea::placeholder {
	color: var( --igcr-text-muted, #8e8e8e );
}

.igcr-comment-post-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.875em;
	font-weight: 600;
	color: var( --igcr-accent, #0095f6 );
	padding: 0;
	flex-shrink: 0;
	border-radius: 0;
	width: auto;
	height: auto;
}

.igcr-comment-post-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

.igcr-comment-post-btn:not(:disabled):hover {
	color: var( --igcr-text, #00376b );
}

.igcr-comment-form--inline .igcr-comment-status {
	display: none;
}

.igcr-comment-form--inline .igcr-comment-status:not(:empty) {
	display: block;
	font-size: 0.75em;
	color: #ed4956;
	position: absolute;
	bottom: -18px;
	left: 16px;
}

/* Login prompt */
.igcr-login-prompt {
	font-size: 0.875em;
	color: var( --igcr-text-muted, #8e8e8e );
	padding: 10px 16px;
	border-top: 1px solid var( --igcr-border, #dbdbdb );
	margin: 0;
}

.igcr-login-prompt a {
	color: var( --igcr-accent, #0095f6 );
	text-decoration: none;
	font-weight: 600;
}

.igcr-login-prompt a:hover {
	text-decoration: underline;
}

/* ── Automation Modal override ── */
.igcr-auto-modal .igcr-modal-box {
	max-width: 500px;
	padding: 0;
}

/* ── Create Post Modal override ── */
.igcr-create-post-modal .igcr-modal-box {
	max-width: 520px;
	padding: 0;
}

/* ── More posts from ── */
.igcr-more-posts {
	margin-top: 48px;
}

.igcr-more-posts-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 20px;
}

.igcr-more-posts-line {
	flex: 1;
	height: 1px;
	background: var( --igcr-border, #dbdbdb );
}

.igcr-more-posts-label {
	font-size: 0.875em;
	color: var( --igcr-text-secondary, #737373 );
	white-space: nowrap;
}

.igcr-more-grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 4px;
}

.igcr-more-grid-item {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	display: block;
	background: var( --igcr-bg-muted, #efefef );
}

.igcr-more-grid-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.15s;
}

.igcr-more-grid-item:hover img {
	opacity: 0.85;
}

/* ── Sync badge & spinner ── */
.igcr-sync-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.82em;
	font-weight: 600;
	color: var( --igcr-accent, #0095f6 );
}

.igcr-sync-spinner {
	display: inline-block;
	width: 12px;
	height: 12px;
	border: 2px solid rgba( 0, 149, 246, 0.25 );
	border-top-color: var( --igcr-accent, #0095f6 );
	border-radius: 50%;
	animation: igcr-spin 0.7s linear infinite;
	flex-shrink: 0;
}

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

/* ── Reconnect button ── */
.igcr-reconnect-btn {
	font-size: 0.8em !important;
}

/* ── Ultra-wide ── */
@media ( min-width: 1600px ) {
	.igcr-single-wrap {
		max-width: 1280px;
	}
}

/* ── Tablet ── */
@media ( min-width: 736px ) and ( max-width: 1024px ) {
	.igcr-single-post {
		grid-template-columns: minmax( 0, 1fr ) 340px;
		min-height: 420px;
		max-height: min( calc( 100vh - 96px ), 700px );
	}
}

/* ── Mobile ── */
@media ( max-width: 735px ) {
	.igcr-single-wrap {
		padding: 0 0 40px;
	}

	.igcr-single-topbar {
		padding: 12px 12px 8px;
	}

	.igcr-post-nav-btn {
		display: none;
	}

	.igcr-single-post {
		grid-template-columns: 1fr;
		height: auto;
		border-radius: 0;
		border-left: none;
		border-right: none;
	}

	.igcr-single-media {
		min-height: 300px;
	}

	.igcr-media-image,
	.igcr-media-video--single {
		object-fit: contain;
	}

	.igcr-single-content {
		border-left: none;
		min-height: unset;
	}

	.igcr-single-body {
		overflow-y: visible;
		max-height: unset;
		min-height: unset;
		flex: none;
	}

	.igcr-reply-list {
		padding-left: 36px;
	}

	.igcr-view-replies {
		padding-left: 36px;
	}
}

@media ( max-width: 480px ) {
	.igcr-more-grid {
		gap: 2px;
	}

	.igcr-action-bar-left {
		gap: 12px;
	}
}
