/**
 * IG Newsfeed
 *
 * Deliberately quiet: this drops into an existing theme, so type and colour
 * inherit by default. Override any of the custom properties below in the theme
 * stylesheet to restyle without touching this file.
 */

.ignf {
	/* Set inline by the shortcode. --ignf-columns is resolved from these below
	   rather than being set inline itself, because an inline custom property
	   outranks every media query and would freeze the layout at one width. */
	--ignf-columns-desktop: 3;
	--ignf-columns-tablet: 2;
	--ignf-columns-mobile: 1;
	--ignf-min-width: 240px;

	--ignf-columns: var(--ignf-columns-desktop);
	--ignf-gap: 1.5rem;
	--ignf-radius: 10px;
	--ignf-border: rgba(0, 0, 0, 0.1);
	--ignf-surface: #fff;
	--ignf-muted: rgba(0, 0, 0, 0.55);
	--ignf-accent: currentColor;
	--ignf-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
	--ignf-overlay: rgba(15, 15, 18, 0.82);
	--ignf-focus: #2271b1;

	font-family: inherit;
	color: inherit;
}

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

.ignf :focus-visible {
	outline: 2px solid var(--ignf-focus);
	outline-offset: 2px;
}

/* ---------- Search ---------- */

.ignf-search {
	display: flex;
	gap: 0.5rem;
	margin: 0 0 1rem;
}

.ignf-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.7em 0.9em;
	font: inherit;
	color: inherit;
	background: var(--ignf-surface);
	border: 1px solid var(--ignf-border);
	border-radius: var(--ignf-radius);
}

.ignf-search__submit {
	flex: 0 0 auto;
	padding: 0.7em 1.4em;
	font: inherit;
	cursor: pointer;
	background: transparent;
	border: 1px solid var(--ignf-border);
	border-radius: var(--ignf-radius);
	color: inherit;
}

.ignf-search__submit:hover {
	border-color: currentColor;
}

/* ---------- Hashtag bar ---------- */

.ignf-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 0 1.5rem;
}

.ignf-tag {
	display: inline-flex;
	align-items: baseline;
	gap: 0.35em;
	padding: 0.3em 0.75em;
	font: inherit;
	font-size: 0.85em;
	line-height: 1.4;
	cursor: pointer;
	color: inherit;
	background: transparent;
	border: 1px solid var(--ignf-border);
	border-radius: 999px;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ignf-tag:hover,
.ignf-tag.is-active {
	border-color: currentColor;
}

.ignf-tag.is-active {
	background: rgba(0, 0, 0, 0.05);
}

.ignf-tag__hash {
	opacity: 0.5;
}

.ignf-tag__count {
	font-size: 0.85em;
	color: var(--ignf-muted);
}

.ignf-tag--clear {
	font-style: italic;
}

/* ---------- Grid ---------- */

.ignf-grid {
	display: grid;
	grid-template-columns: repeat(var(--ignf-columns), minmax(0, 1fr));
	gap: var(--ignf-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* columns="auto": fit as many cards as the container allows. min() keeps a
   single card from overflowing a container narrower than --ignf-min-width. */
.ignf--auto .ignf-grid {
	grid-template-columns: repeat(auto-fill, minmax(min(var(--ignf-min-width), 100%), 1fr));
}

.ignf-card {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ignf-card__button {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 0;
	overflow: hidden;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	background: var(--ignf-surface);
	border: 1px solid var(--ignf-border);
	border-radius: var(--ignf-radius);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ignf-card__button:hover {
	transform: translateY(-2px);
	box-shadow: var(--ignf-shadow);
}

.ignf-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
}

.ignf-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.ignf-card__button:hover .ignf-card__image {
	transform: scale(1.04);
}

.ignf-card__image--placeholder {
	background: repeating-linear-gradient(
		45deg,
		rgba(0, 0, 0, 0.03),
		rgba(0, 0, 0, 0.03) 10px,
		rgba(0, 0, 0, 0.06) 10px,
		rgba(0, 0, 0, 0.06) 20px
	);
}

.ignf-card__badge {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.7em;
	height: 1.7em;
	padding: 0 0.45em;
	font-size: 0.8rem;
	line-height: 1;
	color: #fff;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 999px;
	backdrop-filter: blur(4px);
}

.ignf-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem;
}

.ignf-card__date {
	font-size: 0.78em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ignf-muted);
}

.ignf-card__blurb {
	flex: 1 1 auto;
	font-size: 0.95em;
	line-height: 1.5;
}

/* ---------- Hashtag chips ---------- */

.ignf-hashtags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
}

.ignf-hashtag {
	font-size: 0.82em;
	color: var(--ignf-muted);
	cursor: pointer;
	transition: color 0.15s ease;
}

.ignf-hashtag:hover {
	color: inherit;
	text-decoration: underline;
}

.ignf-hashtag--inline {
	color: var(--ignf-focus);
}

/* ---------- Empty state ---------- */

.ignf-empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var(--ignf-muted);
	border: 1px dashed var(--ignf-border);
	border-radius: var(--ignf-radius);
}

/* ---------- Pagination ---------- */

.ignf-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
	justify-content: center;
	margin: 2rem 0 0;
}

.ignf-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4em;
	padding: 0.5em 0.8em;
	font-size: 0.92em;
	line-height: 1;
	color: inherit;
	text-decoration: none;
	border: 1px solid var(--ignf-border);
	border-radius: var(--ignf-radius);
}

.ignf-page:hover:not(.is-disabled):not(.is-current) {
	border-color: currentColor;
}

.ignf-page.is-current {
	font-weight: 600;
	color: #fff;
	background: rgba(0, 0, 0, 0.85);
	border-color: rgba(0, 0, 0, 0.85);
}

.ignf-page.is-disabled {
	opacity: 0.4;
	cursor: default;
}

.ignf-page--gap {
	border-color: transparent;
}

/* ---------- Loading ---------- */

.ignf-results[aria-busy="true"] {
	opacity: 0.45;
	transition: opacity 0.15s ease;
	pointer-events: none;
}

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

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

.ignf-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(0.5rem, 3vw, 2.5rem);
}

.ignf-modal__backdrop {
	position: absolute;
	inset: 0;
	background: var(--ignf-overlay);
	animation: ignf-fade 0.2s ease;
}

.ignf-modal__panel {
	position: relative;
	display: flex;
	width: min(1080px, 100%);
	max-height: 100%;
	overflow: hidden;
	background: var(--ignf-surface);
	border-radius: var(--ignf-radius);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
	animation: ignf-rise 0.22s ease;
}

.ignf-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.2rem;
	height: 2.2rem;
	font-size: 1.5rem;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.55);
	border: 0;
	border-radius: 50%;
}

.ignf-modal__close:hover {
	background: rgba(0, 0, 0, 0.8);
}

.ignf-modal__body {
	display: flex;
	width: 100%;
	min-height: 0;
}

.ignf-modal__loading {
	padding: 4rem;
	margin: auto;
	color: var(--ignf-muted);
}

/* ---------- Detail ---------- */

.ignf-detail {
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
	width: 100%;
	min-height: 0;
}

.ignf-detail__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	background: #0d0d10;
}

.ignf-detail__image,
.ignf-detail__video {
	display: block;
	width: 100%;
	max-height: 82vh;
	object-fit: contain;
}

.ignf-detail__unavailable {
	padding: 3rem 1.5rem;
	color: rgba(255, 255, 255, 0.7);
	text-align: center;
}

.ignf-detail__content {
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	padding: 1.75rem;
	overflow-y: auto;
	max-height: 82vh;
}

.ignf-detail__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: baseline;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid var(--ignf-border);
}

.ignf-detail__author {
	font-weight: 600;
}

.ignf-detail__date {
	font-size: 0.82em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ignf-muted);
}

.ignf-detail__caption {
	font-size: 0.98em;
	line-height: 1.65;
	overflow-wrap: anywhere;
}

.ignf-detail__permalink {
	align-self: flex-start;
	margin-top: auto;
	padding: 0.6em 1.2em;
	font-size: 0.9em;
	text-decoration: none;
	color: inherit;
	border: 1px solid var(--ignf-border);
	border-radius: var(--ignf-radius);
}

.ignf-detail__permalink:hover {
	border-color: currentColor;
}

/* ---------- Carousel ---------- */

.ignf-carousel {
	position: relative;
	width: 100%;
}

.ignf-carousel__track {
	display: block;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ignf-slide {
	display: none;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ignf-slide.is-active {
	display: block;
}

.ignf-carousel__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.6rem;
	font-size: 1.6rem;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.45);
	border: 0;
	border-radius: 50%;
	transform: translateY(-50%);
}

.ignf-carousel__nav:hover {
	background: rgba(0, 0, 0, 0.75);
}

.ignf-carousel__nav--prev {
	left: 0.75rem;
}

.ignf-carousel__nav--next {
	right: 0.75rem;
}

.ignf-carousel__counter {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	padding: 0.25em 0.7em;
	font-size: 0.8rem;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border-radius: 999px;
}

.ignf-carousel__dots {
	position: absolute;
	bottom: 0.9rem;
	left: 50%;
	display: flex;
	gap: 0.4rem;
	transform: translateX(-50%);
}

.ignf-dot {
	width: 0.5rem;
	height: 0.5rem;
	padding: 0;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.45);
	border: 0;
	border-radius: 50%;
}

.ignf-dot.is-active {
	background: #fff;
}

/* ---------- Animation ---------- */

@keyframes ignf-fade {
	from {
		opacity: 0;
	}
}

@keyframes ignf-rise {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ignf *,
	.ignf-modal * {
		animation: none !important;
		transition: none !important;
	}

	.ignf-card__button:hover {
		transform: none;
	}

	.ignf-card__button:hover .ignf-card__image {
		transform: none;
	}
}

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

@media (max-width: 900px) {
	.ignf-detail {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
		overflow-y: auto;
	}

	.ignf-detail__image,
	.ignf-detail__video {
		max-height: 55vh;
	}

	.ignf-detail__content {
		max-height: none;
		overflow-y: visible;
	}

	.ignf-modal__panel {
		max-height: 92vh;
		overflow-y: auto;
	}
}

/* Tablet. Declared after the base rule, so it wins on equal specificity. */
@media (max-width: 900px) {
	.ignf {
		--ignf-columns: var(--ignf-columns-tablet);
		--ignf-gap: 1.25rem;
	}
}

/* Phone. */
@media (max-width: 600px) {
	.ignf {
		--ignf-columns: var(--ignf-columns-mobile);
		--ignf-gap: 1rem;
	}
}

@media (max-width: 480px) {
	.ignf-detail__content {
		padding: 1.25rem;
	}
}

/* Screen reader helper, in case the theme does not define one. */
.ignf .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
