/**
 * Page sections built from core blocks (patterns and the homepage).
 *
 * Each section is a core Group with a section style (base.css) plus an e-*
 * class naming its layout. Blocks inside stay core blocks, so editors can
 * change texts, links and order without touching code; these rules only
 * shape the layout the mockup draws.
 */

/* -------------------------------------------------------------------------
 * Shared
 * ---------------------------------------------------------------------- */

/* The two section gaps the stylesheets share (not editor settings: blocks
 * take their gaps from the spacing presets, the design system's space/*
 * scale). 40 → 80 and 24 → 44 px as the mockups space their sections. */
:root {
	--e-gap-lg: clamp(2.5rem, 1.6197rem + 3.7559vw, 5rem); /* 40 → 80 */
	--e-gap-md: clamp(1.5rem, 1.0599rem + 1.8779vw, 2.75rem); /* 24 → 44 */
}

/* Two columns side by side: the sections' columns, the head row with the
 * Google card (also on /referencje/) and the FAQ beside its title. */
:is(.e-hero, .e-intro, .e-calc, .e-reviews-section) > .wp-block-columns,
.wp-block-columns:is(.e-section-head, .e-faq-section__grid, .e-final-cta__grid) {
	gap: var(--e-gap-md) var(--e-gap-lg);
	margin-block-end: 0;
}

/* Section titles: an accent word picked with the inline colour format. */
:where(.is-style-section-graphite, .is-style-section-deep) h2 mark.has-inline-color.has-burgundy-color {
	color: var(--wp--preset--color--gold) !important;
}

/* Bigger rhythm between the parts of a section than between paragraphs. */
:is(.e-intro, .e-team-section, .e-offers-section, .e-reviews-section) > * + * {
	margin-block-start: var(--e-gap-md);
}

.e-intro > * + *,
.e-reviews-section > .wp-block-columns,
.e-reviews-section > .wp-block-eteria-video-testimonials {
	margin-block-start: var(--e-gap-lg);
}

/* -------------------------------------------------------------------------
 * Hero
 * ---------------------------------------------------------------------- */

.e-hero {
	--e-hero-top: clamp(1.5rem, -0.3333rem + 7.8247vw, 6.75rem);
	--e-header-h: 68px; /* site-header bar below 1280 px */
	padding-top: var(--e-hero-top);
	padding-bottom: 0;
}

/* Warsaw map behind the picture (Figma 4581:12356): from the very top of the
 * page, under the header, down to the statistics line; 1135 of 1680 px wide
 * and 164 px past the right edge. The header turns transparent over it and
 * the page behind the header takes the hero's cream. */
@media (min-width: 782px) {

	body:has(.wp-block-post-content > .e-hero:first-child) {
		background-color: var(--wp--preset--color--cream);
	}

	body:has(.wp-block-post-content > .e-hero:first-child) .wp-block-eteria-site-header {
		background-color: transparent;
	}

	/* clip, not hidden: the map still reaches up under the header, only
	 * the part past the right edge is cut, so the page never scrolls
	 * sideways. */
	.e-hero {
		isolation: isolate;
		overflow-x: clip;
		background: var(--wp--preset--color--cream);
	}

	.e-hero > .wp-block-columns {
		position: relative;
	}

	.e-hero > .wp-block-columns::before {
		content: "";
		position: absolute;
		z-index: -1;
		top: calc(-1 * (var(--e-hero-top) + var(--e-header-h)));
		right: calc(50% - 50vw - 9.7619vw);
		bottom: 0;
		width: 67.5595vw;
		background: url(../images/hero-map.webp) center 56% / cover no-repeat;
		pointer-events: none;
	}
}

@media (min-width: 1280px) {

	.e-hero {
		--e-header-h: var(--wp--custom--header);
	}
}

/* The text column: a little wider than the picture's, its blocks 30 px
 * apart («Odstęp bloków» of the column). */
.e-hero > .wp-block-columns > .wp-block-column:first-child {
	flex-grow: 1.15;
	padding-bottom: var(--wp--preset--spacing--80);
}

/* The page's H1 sits under the big line («Display» H2) as a label, as
 * production prints "agencja nieruchomości Warszawa" under its animated
 * "Wiarygodna". Size and colour are the heading's own settings. */
.e-hero h1 {
	margin-block-start: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: var(--wp--custom--letter-spacing--label);
	text-transform: uppercase;
}

.e-hero .is-style-lead {
	max-width: 26rem;
}

.e-hero__image {
	margin: 0 auto;
	max-width: 510px;
}

.e-hero__image img {
	display: block;
	width: 100%;
}

/* The clip on the phone's screen (assets/js/hero-video.js): the screen of
 * Figma 4581:12396 in the 510 × 551 picture, 219.4 × 471.7 at 178.9 / 8.4,
 * corners 33.75; the Dynamic Island (4581:12397) goes back on top of it. */
.e-hero__image[data-hero-video] {
	position: relative;
}

.e-hero__video {
	position: absolute;
	left: 35.042%;
	top: 1.531%;
	width: 42.976%;
	height: 85.605%;
	border-radius: 15.385% / 7.156%;
	object-fit: cover;
	background: transparent;
	opacity: 0;
	transition: opacity 0.6s ease;
	pointer-events: none;
}

.e-hero__image[data-hero-video]::after {
	content: "";
	position: absolute;
	left: 49.918%;
	top: 2.909%;
	width: 13.389%;
	height: 3.675%;
	border-radius: 999px;
	background: var(--wp--preset--color--graphite);
	opacity: 0;
	transition: opacity 0.6s ease;
	pointer-events: none;
}

.e-hero__image.has-video .e-hero__video,
.e-hero__image.has-video::after {
	opacity: 1;
}

@media (max-width: 781px) {

	.e-hero > .wp-block-columns > .wp-block-column:first-child {
		padding-bottom: var(--wp--preset--spacing--30);
	}

	.e-hero__image {
		max-width: 260px;
	}
}

/* The intro ("Biuro nieruchomości…", services I–IV as «Kroki», style
 * «Usługi») and the calculator beside the valuation form need nothing
 * more: their columns carry their own gaps, padding, sizes and colours. */

/* -------------------------------------------------------------------------
 * Head row with the Google card on the right (team, /referencje/)
 * ---------------------------------------------------------------------- */

.e-section-head > .wp-block-column:last-child {
	display: flex;
	justify-content: flex-end;
}

@media (max-width: 781px) {

	.e-section-head > .wp-block-column:last-child {
		justify-content: stretch;
	}
}

/* -------------------------------------------------------------------------
 * Offers + districts (one dark band). The districts' heading (the second
 * H2) opens the second half of the band: lighter, centred from 782 px.
 * ---------------------------------------------------------------------- */

.e-offers-section > h2:not(:first-child) {
	margin-block-start: var(--wp--custom--section);
	font-weight: 400;
	text-align: center;
}

@media (max-width: 781px) {

	.e-offers-section > h2:not(:first-child) {
		text-align: left;
	}
}

/* -------------------------------------------------------------------------
 * Reviews
 * ---------------------------------------------------------------------- */

.e-photo-card {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.e-photo-card > .wp-block-image {
	margin: 0;
}

.e-photo-card > .wp-block-image img {
	display: block;
	width: 100%;
	height: clamp(16.25rem, 11.4085rem + 20.6573vw, 26.25rem);
	object-fit: cover;
	object-position: center 60%;
}

.e-photo-card::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background: linear-gradient(180deg, rgb(14 14 12 / 0) 35%, rgb(14 14 12 / 0.75) 100%);
	pointer-events: none;
}

/* Eyebrow and title over the photo's lower left corner, 8 px apart (the
 * caption's own gap). */
.e-photo-card__caption {
	position: absolute;
	right: var(--wp--preset--spacing--30);
	bottom: var(--wp--preset--spacing--30);
	left: var(--wp--preset--spacing--30);
	z-index: 1;
	margin: 0 !important;
}

.e-photo-card__caption h2 {
	max-width: 22ch;
}

/* The rating in the photo's lower right corner is the desktop layout
 * (4581:12692); phones show the head row (the section's columns: rating
 * and intro) under the photo instead (6040:6605), and desktop has neither
 * that row nor its intro; desktop parts the Google reviews from the videos
 * with a hairline (the section's separator). */
.e-photo-card__rating,
.e-reviews-section > .wp-block-separator {
	display: none;
}

@media (min-width: 1024px) {

	.e-reviews-section > .wp-block-columns {
		display: none;
	}

	.e-photo-card__rating {
		position: absolute;
		right: var(--wp--preset--spacing--30);
		bottom: var(--wp--preset--spacing--30);
		z-index: 1;
		display: block;
		margin: 0 !important;
		color: var(--wp--preset--color--white);
	}

	.e-photo-card__rating .e-google-rating {
		flex-direction: column;
		gap: var(--wp--preset--spacing--4);
		align-items: flex-end;
		text-align: right;
	}

	.e-photo-card__rating .e-google-rating__meta {
		align-items: flex-end;
	}

	.e-reviews-section > .wp-block-separator + * {
		margin-block-start: 0;
	}

	.e-reviews-section > .wp-block-separator {
		display: block;
		width: 100%;
		max-width: none;
		height: 0;
		margin-block: var(--e-gap-md);
		border: 0;
		border-top: 1px solid var(--wp--preset--color--border-dark);
		opacity: 1;
	}
}

.e-reviews-section > .wp-block-buttons {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* -------------------------------------------------------------------------
 * Title band of an offer. The page title band is the section style
 * «Nagłówek strony» (is-style-section-page-hero, base.css).
 * ---------------------------------------------------------------------- */

/* Title band of an offer: breadcrumbs, title, status, address. */
.e-offer-hero {
	padding-top: var(--wp--preset--spacing--30);
	padding-bottom: clamp(1.5rem, 1.1479rem + 1.5023vw, 2.5rem);
}

.e-offer-hero > .wp-block-eteria-offer {
	margin-block-start: clamp(1.5rem, 1.1479rem + 1.5023vw, 2.5rem);
}

/* /o-nas/, /referencje/, /nasze-realizacje/ (stage 4): pages/about.css,
 * testimonials.css, cases.css. */

/* -------------------------------------------------------------------------
 * Sections converted from the old flexible layouts (eteria-core
 * migrations/flexible.php, flexible-landings.php): the vacancy and the
 * landings. Their insides are core blocks with their own settings (text
 * alignment, sizes, colours, «Siatka» / «Stos» layouts, «Karta» cards,
 * «Liczba», «Kroki»); e-flex only sets the rhythm between a section's
 * parts, which no block gap can (it grows with the screen).
 * ---------------------------------------------------------------------- */

.e-flex > * + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.e-flex > :is(h2, .wp-block-group, .wp-block-columns, .wp-block-buttons, .wp-block-eteria-video, .wp-block-eteria-steps) + *,
.e-flex > * + :is(.wp-block-group, .wp-block-columns, .wp-block-buttons, .wp-block-eteria-video, .wp-block-eteria-steps) {
	margin-block-start: var(--e-gap-md);
}

.e-flex .is-style-lead {
	max-width: 50rem;
}

/* A centred head (heading and text centred with the alignment control)
 * keeps a reading measure. */
.e-flex > :is(h2, p).has-text-align-center {
	max-width: 60rem;
	text-wrap: balance;
}

.e-flex > .is-style-lead.has-text-align-center {
	max-width: 46rem;
}

/* Bold words in a card's small, subtle text read darker; opening a point
 * of a list they take the body size. */
.e-flex .is-style-card :is(b, strong) {
	font-weight: 500;
	color: var(--wp--preset--color--text-primary);
}

.e-flex .is-style-card li strong {
	font-size: var(--wp--preset--font-size--body);
}

/* Banners: centred, dark. The page's last one carries the burgundy glow of
 * the homepage's final call to action, so it does not melt into the footer. */
.e-flex-banner {
	text-align: center;
}

.e-flex-banner > * {
	max-width: 56rem;
	margin-inline: auto !important;
	text-wrap: balance;
}

.e-flex-banner--final {
	background:
		radial-gradient(90% 120% at 50% 0%, rgb(117 24 50 / 0.35) 0%, rgb(14 14 12 / 0) 65%),
		var(--wp--preset--color--graphite-deep);
}

/* An opening: title and town, the call to apply on the right. */
.e-flex-job {
	display: flex;
	flex-direction: column;
	gap: 24px;
	box-sizing: border-box;
	width: 100%;
	max-width: 56rem;
	margin-inline: auto !important;
	padding: clamp(1.5rem, 1.0599rem + 1.8779vw, 2.75rem);
	text-align: left;
	background-color: var(--wp--preset--color--cream);
	border-left: 3px solid var(--wp--preset--color--burgundy);
}

.e-flex-job > * {
	margin: 0 !important;
}

/* The town, after a pin. */
.e-flex-job p {
	display: inline-flex;
	gap: 8px;
	align-items: center;
}

.e-flex-job p::before {
	content: "";
	width: 16px;
	height: 16px;
	background-color: var(--wp--preset--color--burgundy);
	mask: url(../icons/pin.svg) center / contain no-repeat;
}

@media (min-width: 782px) {

	.e-flex-job {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.e-flex-job > .wp-block-buttons {
		flex: none;
	}
}

/* The team film, centred. */
.e-flex .wp-block-eteria-video {
	max-width: 960px;
	margin-inline: auto !important;
}

/* A heading beside a list: the vacancy's questions, numbered. */
.wp-block-columns.e-flex-split {
	gap: var(--e-gap-md) var(--e-gap-lg);
	margin-block-end: 0;
}

@media (min-width: 782px) {

	.e-flex-split > .wp-block-column:first-child {
		position: sticky;
		top: var(--wp--preset--spacing--40);
		align-self: flex-start;
	}
}

/* Four cards in a row on a desktop, two by two below 1100 px, one column
 * on phones: never three and a lone fourth (flexible.php, review of
 * 20.11.2026). The class beats core's generated grid by one class. */
@media (max-width: 1099px) {

	.e-grid-quad.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {

	.e-grid-quad.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* A hero whose form follows a long text column on a desktop (production's
 * "sticky_form" of the «wyceniarka» layout, /umow-konsultacje/). */
@media (min-width: 782px) {

	.e-sticky-aside > .wp-block-column:last-child {
		position: sticky;
		top: var(--wp--preset--spacing--40);
		align-self: flex-start;
	}
}

/* The form: a white card next to the heading and a team photo. */
.e-lead-form__card {
	padding: clamp(1.5rem, 0.9718rem + 2.2535vw, 3rem);
	background-color: var(--wp--preset--color--white);
}

.e-lead-form__card > * {
	margin-block: 0 !important;
}

.e-lead-form__image {
	margin-top: var(--e-gap-md) !important;
}

.e-lead-form__image img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 560px;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: center 85%;
}

@media (max-width: 781px) {

	.e-lead-form__image {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * Lead form section ("Nie znalazłeś idealnej nieruchomości?")
 *
 * Contact Form 7 in the design system's fields, on every page that has a
 * form (lead form sections, the vacancy, forms inside articles), until the
 * theme's own forms replace it. The form's markup carries Bootstrap and
 * old-theme classes (d-flex, contact__*) that mean nothing here.
 * ---------------------------------------------------------------------- */

.wp-block-columns.e-lead-form__grid {
	gap: var(--e-gap-md) var(--e-gap-lg);
	margin-block-end: 0;
}

.wpcf7-form p {
	display: block;
	margin: 0 0 var(--wp--preset--spacing--16);
}

.wpcf7-form br {
	display: none;
}

.wpcf7-form label {
	display: block;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-subtle);
}

.wpcf7-form .wpcf7-form-control-wrap {
	display: block;
	margin-top: 6px;
}

.wpcf7-form :is(input[type="text"], input[type="email"], input[type="tel"], textarea, select) {
	box-sizing: border-box;
	width: 100%;
	padding: 14px 16px;
	font: inherit;
	font-size: var(--wp--preset--font-size--body);
	color: var(--wp--preset--color--text-primary);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--border-cream);
	border-radius: 0;
}

.wpcf7-form :is(input, textarea):focus {
	border-color: var(--wp--preset--color--burgundy);
	outline: none;
}

.wpcf7-form .wpcf7-submit {
	width: 100%;
	padding: 18px 32px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 400;
	letter-spacing: var(--wp--custom--letter-spacing--button);
	color: var(--wp--preset--color--text-inverse);
	text-transform: uppercase;
	cursor: pointer;
	background: var(--wp--preset--color--burgundy);
	border: 0;
	border-radius: 0;
}

.wpcf7-form .wpcf7-submit:hover {
	background: var(--wp--preset--color--burgundy-hover);
}

/* -------------------------------------------------------------------------
 * FAQ
 * ---------------------------------------------------------------------- */

.e-faq-section__grid > .wp-block-column:first-child > * + * {
	margin-block-start: var(--wp--preset--spacing--16);
}

@media (min-width: 782px) {

	.e-faq-section__grid > .wp-block-column:first-child {
		position: sticky;
		top: var(--wp--preset--spacing--40);
		align-self: flex-start;
	}
}

/* -------------------------------------------------------------------------
 * Final call to action
 * ---------------------------------------------------------------------- */

.e-final-cta {
	background:
		radial-gradient(120% 90% at 20% 0%, rgb(117 24 50 / 0.18) 0%, rgb(14 14 12 / 0) 60%),
		var(--wp--preset--color--graphite-deep);
}

/* On phones the advisor's card sits between the text and the buttons, as in
 * the mobile mockup: the two columns dissolve into one grid. */
@media (max-width: 781px) {

	.e-final-cta__grid {
		display: grid !important;
		gap: 24px;
	}

	.e-final-cta__grid > .wp-block-column {
		display: contents;
	}

	.e-final-cta__grid > .wp-block-column:last-child > * {
		margin: 0 !important;
	}

	.e-final-cta__grid > .wp-block-column:first-child > * {
		order: 3;
	}

	.e-final-cta__grid > .wp-block-column:last-child > :nth-child(1) {
		order: 1;
	}

	.e-final-cta__grid > .wp-block-column:last-child > :nth-child(2) {
		order: 2;
	}

	.e-final-cta__grid > .wp-block-column:last-child > :nth-child(3) {
		order: 4;
	}

	.e-final-cta__grid > .wp-block-column:last-child > :nth-child(4) {
		order: 5;
		text-align: center;
	}
}

/* -------------------------------------------------------------------------
 * /styleguide/ (patterns/styleguide.php)
 * ---------------------------------------------------------------------- */

.e-sg > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.e-sg-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: 24px 16px;
}

.e-sg-swatch {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: var(--wp--preset--font-size--xs);
}

.e-sg-swatch span {
	height: 64px;
	border: 1px solid var(--wp--preset--color--border-cream);
}

.e-sg-swatch code,
.e-sg-type code,
.e-sg-type small {
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--text-muted);
}

.e-sg-type__row {
	display: grid;
	grid-template-columns: 6rem 1fr;
	gap: 4px 16px;
	align-items: baseline;
	padding-block: 12px;
	border-bottom: 1px solid var(--wp--preset--color--border-cream);
}

.e-sg-type__row small {
	grid-column: 2;
}

.e-sg-type__row span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
