/**
 * IFW Project Cards — front-end styles.
 */

.ifw-projects,
.ifw-projects *,
.ifw-projects *::before,
.ifw-projects *::after,
.ifw-project-single-page,
.ifw-project-single-page *,
.ifw-project-single-page *::before,
.ifw-project-single-page *::after,
.ifw-project-detail-shortcode,
.ifw-project-detail-shortcode *,
.ifw-project-detail-shortcode *::before,
.ifw-project-detail-shortcode *::after,
.ifw-lightbox,
.ifw-lightbox *,
.ifw-lightbox *::before,
.ifw-lightbox *::after {
	box-sizing: border-box;
}

.ifw-projects,
.ifw-project-single-page,
.ifw-project-detail-shortcode {
	--ifw-bg: #f5f7fa;
	--ifw-card-bg: #ffffff;
	--ifw-ink: #0d1b2e;
	--ifw-body: #4f5e71;
	--ifw-muted: #66758a;
	--ifw-blue: #1d4ed8;
	--ifw-blue-hover: #1e40af;
	--ifw-line: #e4e9f0;
	--ifw-soft: #eef1f6;
	--ifw-radius: 10px;
	color: var(--ifw-body);
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

html.ifw-no-scroll {
	overflow: hidden;
}

/* ---------------------------------------------------------------
 * Projects section
 * ------------------------------------------------------------- */

.ifw-projects {
	background: var(--ifw-bg);
	padding: clamp(30px, 5vw, 64px) clamp(16px, 4vw, 48px);
}

.ifw-projects__inner {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
}

.ifw-projects__header {
	margin: 0 0 clamp(24px, 3.5vw, 38px);
}

.ifw-projects__title {
	margin: 0 0 10px;
	color: var(--ifw-ink);
	font-size: clamp(2rem, 3.6vw, 2.9rem);
	font-weight: 800;
	line-height: 1.08;
	letter-spacing: -0.025em;
}

.ifw-projects__subtitle {
	margin: 0;
	max-width: 75ch;
	color: #56657a;
	font-size: clamp(1rem, 1.15vw, 1.1rem);
	font-weight: 400;
	line-height: 1.55;
}

.ifw-projects__grid {
	display: grid;
	grid-template-columns: repeat(var(--ifw-columns, 3), minmax(0, 1fr));
	gap: 28px 26px;
	align-items: stretch;
	transition: opacity 0.2s ease;
}

.ifw-projects.is-loading .ifw-projects__grid {
	opacity: 0.45;
	pointer-events: none;
}

.ifw-projects.is-loading .ifw-pagination {
	opacity: 0.6;
	pointer-events: none;
}

.ifw-projects__notice {
	margin: 22px 0 0;
	padding: 12px 16px;
	border-radius: 8px;
	background: #fef2f2;
	color: #b91c1c;
	font-size: 0.92rem;
	line-height: 1.5;
}

.ifw-projects__notice[hidden] {
	display: none;
}

.ifw-projects__empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: 36px 20px;
	border: 1px dashed #d5dee9;
	border-radius: var(--ifw-radius);
	background: var(--ifw-card-bg);
	color: var(--ifw-muted);
	font-size: 1rem;
	text-align: center;
}

.ifw-projects__pagination-wrap {
	margin: 0;
}

/* ---------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------- */

.ifw-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--ifw-line);
	border-radius: var(--ifw-radius);
	background: var(--ifw-card-bg);
	box-shadow: 0 1px 2px rgba(13, 27, 46, 0.04);
	transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.ifw-card:hover {
	border-color: #d7dfe9;
	box-shadow: 0 14px 32px rgba(13, 27, 46, 0.09);
	transform: translateY(-3px);
}

.ifw-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 3 / 2;
	background: #e9eef5;
}

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

.ifw-card:hover .ifw-card__img {
	transform: scale(1.035);
}

.ifw-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: 20px 20px 0;
}

.ifw-card__title {
	margin: 0 0 9px;
	color: var(--ifw-ink);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.012em;
}

.ifw-card__title a {
	color: inherit;
	text-decoration: none;
}

.ifw-card__title a:hover {
	color: var(--ifw-blue);
}

.ifw-card__excerpt {
	flex: 1 1 auto;
	margin: 0;
	color: var(--ifw-body);
	font-size: 0.95rem;
	line-height: 1.58;
}

.ifw-card__footer {
	margin: 18px -20px 0;
	padding: 14px 20px 17px;
	border-top: 1px solid #edf1f6;
}

.ifw-card__link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--ifw-blue);
	font-size: 0.94rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: color 0.18s ease, gap 0.18s ease;
}

.ifw-card__link:hover {
	gap: 11px;
	color: var(--ifw-blue-hover);
}

.ifw-card__arrow {
	font-size: 1.05em;
	line-height: 1;
}

.ifw-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background:
		linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
		linear-gradient(145deg, #dde6f0 0%, #eaf0f7 100%);
	color: #9aabbf;
}

.ifw-placeholder svg {
	width: 20%;
	max-width: 64px;
	min-width: 34px;
	height: auto;
}

.ifw-placeholder--gallery svg {
	width: 12%;
	max-width: 84px;
}

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

.ifw-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	margin-top: clamp(28px, 4vw, 42px);
}

.ifw-pagination__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 16px;
	border: 0;
	border-radius: 8px;
	background: var(--ifw-soft);
	color: #5a687a;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease;
}

.ifw-pagination__btn:hover {
	background: #e3e9f1;
	color: var(--ifw-ink);
	text-decoration: none;
}

.ifw-pagination__btn.is-disabled {
	opacity: 0.48;
	pointer-events: none;
	cursor: default;
}

.ifw-pagination__arrow {
	font-size: 1.1em;
	line-height: 1;
}

.ifw-pagination__pages {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.ifw-page-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 9px;
	border-radius: 8px;
	background: var(--ifw-soft);
	color: #3f4d61;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background 0.18s ease, color 0.18s ease;
}

.ifw-page-num:hover {
	background: #e3e9f1;
	color: var(--ifw-ink);
	text-decoration: none;
}

.ifw-page-num.is-active {
	background: #2563eb;
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.ifw-pagination__ellipsis {
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	min-width: 24px;
	height: 38px;
	padding-bottom: 7px;
	color: #6c7a8d;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	user-select: none;
}

/* ---------------------------------------------------------------
 * Single project / detail
 * ------------------------------------------------------------- */

.ifw-project-single-page {
	min-height: 60vh;
	padding: clamp(28px, 5vw, 64px) clamp(16px, 4vw, 48px);
	background: var(--ifw-bg);
}

.ifw-project-single__container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
}

.ifw-back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 24px;
	color: #56657a;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: color 0.18s ease, gap 0.18s ease;
}

.ifw-back:hover {
	gap: 11px;
	color: var(--ifw-ink);
	text-decoration: none;
}

.ifw-back__arrow {
	font-size: 1.1em;
}

.ifw-project-detail {
	display: grid;
	grid-template-columns: minmax(0, 1.14fr) minmax(0, 0.86fr);
	gap: clamp(30px, 4vw, 54px);
	align-items: start;
}

.ifw-project-detail__media,
.ifw-project-detail__content {
	min-width: 0;
}

.ifw-project-detail__content {
	padding-top: 4px;
}

.ifw-project-detail__title {
	margin: 0 0 14px;
	color: var(--ifw-ink);
	font-size: clamp(2rem, 3.4vw, 2.9rem);
	font-weight: 800;
	line-height: 1.08;
	letter-spacing: -0.025em;
}

.ifw-project-detail__subtitle {
	margin: 0 0 26px;
	color: #58687c;
	font-size: clamp(1.02rem, 1.35vw, 1.18rem);
	font-weight: 400;
	line-height: 1.55;
}

.ifw-project-detail__divider {
	margin: 0 0 26px;
	border: 0;
	border-top: 1px solid #d9e1ea;
}

.ifw-project-detail__overview-title {
	margin: 0 0 12px;
	color: var(--ifw-ink);
	font-size: 1.28rem;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.ifw-project-detail__desc {
	color: #4b5a6d;
	font-size: 1rem;
	line-height: 1.75;
	overflow-wrap: anywhere;
}

.ifw-project-detail__desc > *:first-child {
	margin-top: 0;
}

.ifw-project-detail__desc > *:last-child {
	margin-bottom: 0;
}

.ifw-project-detail__desc p {
	margin: 0 0 1.05em;
}

.ifw-project-detail__desc a {
	color: var(--ifw-blue);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ifw-project-detail__desc img {
	max-width: 100%;
	height: auto;
}

/* ---------------------------------------------------------------
 * Gallery
 * ------------------------------------------------------------- */

.ifw-gallery__stage {
	position: relative;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 3 / 2;
	border-radius: 12px;
	background: #dfe7f0;
	box-shadow: 0 2px 6px rgba(13, 27, 46, 0.05);
}

.ifw-gallery__slides {
	position: absolute;
	inset: 0;
}

.ifw-gallery__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.35s ease;
}

.ifw-gallery__slide.is-active {
	z-index: 1;
	opacity: 1;
	pointer-events: auto;
}

.ifw-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ifw-gallery__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.96);
	color: #16243a;
	box-shadow: 0 4px 14px rgba(13, 27, 46, 0.2);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background 0.18s ease, transform 0.18s ease;
}

.ifw-gallery__arrow svg {
	width: 22px;
	height: 22px;
}

.ifw-gallery__arrow:hover {
	background: #ffffff;
	transform: translateY(-50%) scale(1.06);
}

.ifw-gallery__arrow--prev {
	left: 18px;
}

.ifw-gallery__arrow--next {
	right: 18px;
}

.ifw-gallery__fullscreen {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.96);
	color: #16243a;
	box-shadow: 0 3px 10px rgba(13, 27, 46, 0.16);
	cursor: pointer;
	transition: background 0.18s ease, transform 0.18s ease;
}

.ifw-gallery__fullscreen svg {
	width: 20px;
	height: 20px;
}

.ifw-gallery__fullscreen:hover {
	background: #ffffff;
	transform: scale(1.05);
}

.ifw-gallery__counter {
	position: absolute;
	left: 18px;
	bottom: 18px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 9px 13px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.96);
	color: #182539;
	font-size: 0.86rem;
	font-weight: 600;
	line-height: 1;
	box-shadow: 0 2px 9px rgba(13, 27, 46, 0.13);
}

.ifw-gallery__counter-num {
	font-variant-numeric: tabular-nums;
}

.ifw-gallery__thumbs {
	display: grid;
	grid-template-columns: repeat(var(--ifw-thumbs, 5), minmax(0, 1fr));
	gap: 12px;
	margin-top: 14px;
}

.ifw-gallery__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 3 / 2;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	background: #e4ebf3;
	cursor: pointer;
	transition: border-color 0.18s ease, transform 0.18s ease;
}

.ifw-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ifw-gallery__thumb:hover {
	border-color: #aebfd4;
	transform: translateY(-1px);
}

.ifw-gallery__thumb.is-active {
	border-color: #2563eb;
}

/* ---------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------- */

.ifw-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 28px;
	background: rgba(7, 14, 26, 0.94);
}

.ifw-lightbox.is-open {
	display: flex;
}

.ifw-lightbox__img {
	display: block;
	max-width: min(1200px, 92vw);
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.ifw-lightbox__close {
	position: absolute;
	top: 24px;
	right: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #ffffff;
	font-size: 2rem;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	transition: background 0.18s ease;
}

.ifw-lightbox__close:hover {
	background: rgba(255, 255, 255, 0.26);
}

.ifw-lightbox__nav {
	position: absolute;
	top: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0 0 6px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
	font-size: 2.5rem;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
	transition: background 0.18s ease;
}

.ifw-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.24);
}

.ifw-lightbox__nav--prev {
	left: 24px;
}

.ifw-lightbox__nav--next {
	right: 24px;
}

.ifw-lightbox__counter {
	position: absolute;
	bottom: 24px;
	left: 50%;
	padding: 7px 13px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	transform: translateX(-50%);
}

/* ---------------------------------------------------------------
 * Focus states
 * ------------------------------------------------------------- */

.ifw-projects a:focus-visible,
.ifw-projects button:focus-visible,
.ifw-project-single-page a:focus-visible,
.ifw-project-single-page button:focus-visible,
.ifw-project-detail-shortcode a:focus-visible,
.ifw-project-detail-shortcode button:focus-visible,
.ifw-lightbox button:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 3px;
}

.ifw-projects .ifw-card__media:focus-visible {
	outline-offset: -3px;
}

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

@media (max-width: 1024px) {
	.ifw-projects__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ifw-project-detail {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.ifw-project-detail__content {
		padding-top: 0;
	}

	.ifw-project-detail__title {
		font-size: clamp(1.85rem, 5vw, 2.5rem);
	}
}

@media (max-width: 640px) {
	.ifw-projects {
		padding: 34px 18px 40px;
	}

	.ifw-projects__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 22px;
	}

	.ifw-projects__header {
		margin-bottom: 24px;
	}

	.ifw-card__body {
		padding: 18px 18px 0;
	}

	.ifw-card__footer {
		margin-right: -18px;
		margin-left: -18px;
		padding: 13px 18px 16px;
	}

	.ifw-card__title {
		font-size: 1.18rem;
	}

	.ifw-pagination {
		gap: 8px;
		margin-top: 30px;
	}

	.ifw-pagination__btn {
		min-height: 40px;
		padding: 0 13px;
	}

	.ifw-page-num {
		min-width: 36px;
		height: 36px;
	}

	.ifw-project-single-page {
		padding: 26px 18px 42px;
	}

	.ifw-gallery__stage {
		aspect-ratio: 4 / 3;
		border-radius: 10px;
	}

	.ifw-gallery__arrow {
		width: 38px;
		height: 38px;
	}

	.ifw-gallery__arrow svg {
		width: 18px;
		height: 18px;
	}

	.ifw-gallery__arrow--prev {
		left: 10px;
	}

	.ifw-gallery__arrow--next {
		right: 10px;
	}

	.ifw-gallery__fullscreen {
		top: 10px;
		right: 10px;
		width: 38px;
		height: 38px;
	}

	.ifw-gallery__counter {
		left: 10px;
		bottom: 10px;
		padding: 8px 11px;
		font-size: 0.8rem;
	}

	.ifw-gallery__thumbs {
		gap: 8px;
		margin-top: 10px;
	}

	.ifw-lightbox {
		padding: 14px;
	}

	.ifw-lightbox__close {
		top: 12px;
		right: 12px;
		width: 42px;
		height: 42px;
	}

	.ifw-lightbox__nav {
		width: 42px;
		height: 42px;
		font-size: 2rem;
	}

	.ifw-lightbox__nav--prev {
		left: 10px;
	}

	.ifw-lightbox__nav--next {
		right: 10px;
	}
}

@media (max-width: 480px) {
	.ifw-pagination__btn {
		width: 40px;
		padding: 0;
	}

	.ifw-pagination__label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.ifw-pagination__pages {
		gap: 5px;
	}

	.ifw-page-num {
		min-width: 34px;
		height: 34px;
		padding: 0 7px;
		font-size: 0.85rem;
	}

	.ifw-pagination__ellipsis {
		min-width: 18px;
		height: 34px;
	}

	.ifw-project-detail__title {
		font-size: 1.85rem;
	}

	.ifw-project-detail__desc {
		font-size: 0.97rem;
		line-height: 1.7;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ifw-card,
	.ifw-card__img,
	.ifw-gallery__slide,
	.ifw-gallery__thumb,
	.ifw-gallery__arrow,
	.ifw-gallery__fullscreen,
	.ifw-card__link,
	.ifw-back {
		transition: none;
	}

	.ifw-card:hover {
		transform: none;
	}

	.ifw-card:hover .ifw-card__img {
		transform: none;
	}
}
