/* FirmaJet — Responsive shell & layout fixes (load last). */

:root {
	--fj-gutter: clamp(1rem, 4.5vw, 1.5rem);
}

/* ── Global shell ── */
.fj-container {
	padding-left: max(var(--fj-gutter), env(safe-area-inset-left, 0px));
	padding-right: max(var(--fj-gutter), env(safe-area-inset-right, 0px));
}

.fj-main,
.fj-section,
.fj-page,
.fj-hero,
.fj-footer {
	max-width: 100%;
}

.fj-hero,
.fj-footer,
.fj-section--map-browse,
.fj-section--cta,
.fj-cta {
	overflow-x: clip;
}

/* Grid / flex children must shrink on narrow screens */
.fj-company-grid,
.fj-archive-layout,
.fj-archive-layout__main,
.fj-company-single__layout,
.fj-company-single__main,
.fj-company-single__sidebar,
.fj-hero__grid,
.fj-map-browse,
.fj-dashboard,
.fj-layout {
	min-width: 0;
}

/* WordPress block alignment inside theme pages */
.fj-page .alignwide,
.fj-page .alignfull,
.fj-article__content .alignwide,
.fj-article__content .alignfull {
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

.fj-article__content img,
.fj-article__content iframe,
.fj-article__content video,
.fj-article__content table {
	max-width: 100%;
	height: auto;
}

.fj-article__content table {
	display: block;
	overflow-x: auto;
}

/* Leaflet map */
.leaflet-container {
	width: 100% !important;
	max-width: 100%;
}

.fj-map-browse__canvas,
.fj-map-browse__list {
	max-width: 100%;
}

/* ── Header ── */
@media (max-width: 767px) {
	.fj-header__inner {
		gap: 0.5rem;
	}

	.fj-header__brand {
		flex: 1;
		min-width: 0;
	}

	.fj-header__brand .custom-logo-link,
	.fj-header__brand .custom-logo-link img {
		display: block;
		max-width: min(160px, 42vw);
		max-height: 36px;
		width: auto;
		height: auto;
		object-fit: contain;
	}

	.fj-header__actions {
		gap: 0.375rem;
		flex-shrink: 0;
	}

	.fj-header__actions .fj-btn--sm {
		padding: 0.3125rem 0.5rem;
		font-size: 0.6875rem;
		white-space: nowrap;
	}
}

/* ── Hero & search ── */
@media (max-width: 639px) {
	.fj-hero {
		padding: 1.25rem 0 1.75rem;
	}

	.fj-hero__title {
		font-size: clamp(1.375rem, 6.5vw, 1.75rem);
	}

	.fj-hero .fj-search-form--hero {
		flex-direction: column !important;
		flex-wrap: nowrap !important;
		gap: 0.5rem;
	}

	.fj-hero .fj-search-form--hero .fj-search-form__field,
	.fj-hero .fj-search-form--hero .fj-search-form__submit {
		width: 100%;
		flex: 1 1 100%;
		min-width: 0;
	}

	.fj-hero__stats {
		grid-template-columns: 1fr;
		gap: 0.5rem;
	}

	.fj-hero__trust {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ── Sections ── */
@media (max-width: 639px) {
	.fj-section {
		padding: 1.75rem 0;
	}

	.fj-section__header--row {
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
	}

	.fj-section__header--row .fj-btn,
	.fj-section__header--row .fj-link-arrow,
	.fj-section__header--row #fj-nearby-btn {
		width: 100%;
		justify-content: center;
	}

	.fj-section__title {
		font-size: clamp(1.125rem, 5vw, 1.5rem);
	}
}

/* ── Pages & archive ── */
@media (max-width: 767px) {
	.fj-page {
		padding-top: 1rem;
		padding-bottom: 1.75rem;
	}

	.fj-page__title {
		font-size: clamp(1.25rem, 5.5vw, 1.75rem);
		word-break: break-word;
	}

	.fj-archive-layout {
		gap: 1rem;
		margin-top: 1rem;
	}

	.fj-filters {
		padding: 1rem;
	}

	.fj-search-page {
		margin-bottom: 0.75rem;
	}

	.fj-search-page .fj-search-form--hero {
		flex-direction: column;
	}

	.fj-search-page .fj-search-form--hero .fj-search-form__field,
	.fj-search-page .fj-search-form--hero .fj-search-form__submit {
		width: 100%;
		flex: 1 1 100%;
	}
}

/* ── Company single ── */
@media (max-width: 639px) {
	.fj-company-single__profile {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}

	.fj-company-single__logo {
		width: 72px;
		height: 72px;
		margin-top: -28px;
	}

	.fj-company-single__info {
		min-width: 0;
		width: 100%;
	}

	.fj-company-single__title {
		font-size: clamp(1.25rem, 5.5vw, 1.5rem);
	}

	.fj-company-single__badges {
		gap: 0.375rem;
	}

	.fj-company-single__body {
		padding-top: 0;
	}

	.fj-company-single__cover-img {
		height: clamp(140px, 38vw, 200px);
	}

	.fj-info-list {
		grid-template-columns: 1fr;
	}

	.fj-gallery__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ── CTA band ── */
@media (max-width: 639px) {
	.fj-cta {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
		padding: 1.25rem;
		gap: 1rem;
	}

	.fj-cta .fj-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ── Footer ── */
@media (max-width: 767px) {
	.fj-footer__grid {
		gap: 1.5rem;
	}

	.fj-footer__bottom {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
		text-align: left;
	}
}

/* ── Company cards ── */
@media (max-width: 639px) {
	.fj-company-card__cover {
		height: 108px;
	}

	.fj-company-card__body {
		padding: 1.75rem 0.75rem 0.75rem;
	}

	.fj-company-grid {
		gap: 0.75rem;
	}
}

/* ── Dashboard ── */
@media (max-width: 639px) {
	.fj-dashboard__stats {
		grid-template-columns: 1fr;
	}

	.fj-dashboard__table-wrap {
		margin: 0 calc(-1 * var(--fj-gutter));
		padding: 0 var(--fj-gutter);
	}
}
