/*
Theme Name: edes
Description: E.D.S. Budownictwo — motyw blokowy (FSE). Wygląd w theme.json, styles/*.json i atrybutach bloków; tu tylko to, czego bloki nie potrafią.
Author: Kevin Bienias
Requires at least: 7.1
Requires PHP: 8.1
Version: 2.0.0
License: GNU General Public License v2 or later
Text Domain: edes
*/

:root {
	--eds-mark: url(assets/img/eds-mark.svg);
	--eds-stripes: repeating-linear-gradient(135deg, #1B2638 0 10px, #2A3852 10px 20px);
}

html, body { overflow-x: clip; }
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }
:where(h1, h2, h3) { text-wrap: balance; }
:where(p) { text-wrap: pretty; }
strong { color: var(--wp--preset--color--ink); font-weight: 600; }
[id] { scroll-margin-top: 110px; }

/* header / main / footer stykają się (rdzeń daje im blockGap) */
.wp-site-blocks > * { margin-block: 0; }

/* --- Nagłówek: sticky z atrybutu, rozmycie tła tylko w CSS ---------------- */
.eds-header { z-index: 50; }
/* rozmycie na ::before — backdrop-filter na samym nagłówku uwięziłby w nim overlay menu mobilnego (position: fixed) */
.eds-header::before { content: ""; position: absolute; inset: 0; z-index: -1; backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); }
.wp-site-blocks > header:has(> .eds-header) { display: contents; }

.wp-block-site-logo img { height: 46px; width: auto; }

/* Kontakt: pomarańczowe kółko ze strzałką */
.is-style-kontakt .wp-block-button__link { display: flex; align-items: center; gap: 12px; height: 44px; white-space: nowrap; }
.is-style-kontakt .wp-block-button__link::before {
	content: "→"; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
	background: var(--wp--preset--color--accent); color: #fff; font-size: 17px; letter-spacing: 0;
}

/* Ikony telefon / mail (tekst tylko dla czytników) */
.is-style-icon .wp-block-button__link { width: 44px; height: 44px; font-size: 0; display: grid; place-items: center; }
.is-style-icon .wp-block-button__link::before {
	content: ""; width: 18px; height: 18px; background: currentColor;
	-webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.eds-ico-phone { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Crect x='6' y='2.5' width='12' height='19' rx='2.5'/%3E%3Cline x1='10.5' y1='18' x2='13.5' y2='18'/%3E%3C/svg%3E"); }
.eds-ico-mail { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='1.5'/%3E%3Cpolyline points='3.5,6.5 12,13 20.5,6.5'/%3E%3C/svg%3E"); }

/* Menu mobilne (overlay bloku Nawigacja) */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content { font-size: 32px; font-weight: 300; }

/* --- Eyebrow z kreską ----------------------------------------------------- */
.is-style-eyebrow-line { display: flex; align-items: center; gap: 12px; }
.is-style-eyebrow-line::before { content: ""; flex: none; width: 40px; height: 4px; background: var(--wp--preset--color--accent); }
.eds-hero .is-style-eyebrow-line::before { height: 3px; }

/* --- Hero: film w sygnecie ------------------------------------------------- */
.eds-hero { position: relative; }
.eds-hero > .wp-block-columns { margin: 0; }
.eds-hero__text { position: relative; z-index: 1; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.eds-hero__mark { position: relative; margin: 0; height: min(76vh, 860px); min-height: 420px; }
.eds-hero.has-video .eds-hero__mark { cursor: pointer; }
.eds-hero__mark::before {
	content: ""; position: absolute; inset: 0; background: var(--eds-stripes);
	-webkit-mask: var(--eds-mark) center / contain no-repeat; mask: var(--eds-mark) center / contain no-repeat;
	transition: opacity .4s ease;
}
@media (max-width: 781px) { .eds-hero__mark { height: auto; min-height: 0; aspect-ratio: 1409 / 1621; } } /* kolumny jedna pod drugą: sygnet bez pustego miejsca */
.eds-hero__mark img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; opacity: .45; pointer-events: none; transition: opacity .4s ease; }
/* Podpowiedź pod sygnetem; znika po rozwinięciu filmu */
.eds-hero .wp-block-column:has(.eds-hero__mark) { position: relative; }
.eds-hero__hint { position: absolute; left: 50%; bottom: 0; z-index: 2; transform: translateX(-50%); width: max-content; white-space: nowrap; pointer-events: none; transition: opacity .4s ease; }
.eds-hero__hint svg { animation: eds-tap 1.6s ease-in-out infinite; }
@keyframes eds-tap {
	0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 rgb(255 90 31 / .45); }
	30% { transform: translateY(3px) scale(.92); box-shadow: 0 0 0 0 rgb(255 90 31 / .45); }
	70% { box-shadow: 0 0 0 14px rgb(255 90 31 / 0); }
}
.eds-hero.is-expanded .eds-hero__hint, .eds-hero:not(.has-video) .eds-hero__hint { opacity: 0; }
.eds-hero.is-expanded .eds-hero__mark::before,
.eds-hero.is-expanded .eds-hero__mark img { opacity: 0; }

.eds-hero__video {
	--ease: cubic-bezier(.7, 0, .2, 1);
	position: absolute; top: 0; bottom: 0; left: calc(50% - var(--cw, 100vw) / 2); width: var(--cw, 100vw);
	margin: 0; z-index: 0; overflow: hidden; pointer-events: none;
	clip-path: inset(0 round 0 0 32px 32px);
	-webkit-mask-image: var(--eds-mark), linear-gradient(#000, #000); mask-image: var(--eds-mark), linear-gradient(#000, #000);
	-webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
	-webkit-mask-position: var(--mx) var(--my), var(--cx) var(--cy); mask-position: var(--mx) var(--my), var(--cx) var(--cy);
	-webkit-mask-size: var(--mw) var(--mh), 0 0; mask-size: var(--mw) var(--mh), 0 0;
}
.eds-hero__video.is-animated { transition: -webkit-mask-position .8s var(--ease), -webkit-mask-size .8s var(--ease), mask-position .8s var(--ease), mask-size .8s var(--ease); }
.eds-hero.is-expanded .eds-hero__video {
	-webkit-mask-position: var(--mx) var(--my), 0 0; mask-position: var(--mx) var(--my), 0 0;
	-webkit-mask-size: var(--mw) var(--mh), var(--fw) var(--fh); mask-size: var(--mw) var(--mh), var(--fw) var(--fh);
}
.eds-hero__video video { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .eds-hero__video.is-animated { transition: none; } }

/* Przycisk „przewiń” — skacząca strzałka */
.is-style-scroll .wp-block-button__link { width: 56px; height: 56px; font-size: 0; display: grid; place-items: center; }
.is-style-scroll .wp-block-button__link::before { content: "↓"; font-size: 22px; animation: eds-bounce 1.6s ease-in-out infinite; }
@keyframes eds-bounce { 50% { transform: translateY(4px); } 0%, 100% { transform: translateY(-4px); } }

/* --- Karty / listy --------------------------------------------------------- */
.eds-tiles { overflow: hidden; }
.eds-card { position: relative; transition: background-color .2s; }
.eds-card:hover { background-color: var(--wp--preset--color--surface) !important; }
.eds-card a::after, .eds-stretch a::after { content: ""; position: absolute; inset: 0; z-index: 1; }

.eds-perks > p { display: flex; gap: 14px; align-items: baseline; margin: 0 0 0 -1px; padding: 28px 32px; border-left: 1px solid var(--wp--preset--color--line); }
.eds-perks > p::before, .eds-squares li::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--wp--preset--color--accent); transform: translateY(-2px); }
.eds-perks > p::before { border-radius: 50%; }
.eds-squares { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 24px; padding: 0; list-style: none; }
.eds-squares li { display: flex; gap: 10px; align-items: baseline; }

.eds-fill, .eds-fill img { height: 100%; min-height: 440px; width: 100%; object-fit: cover; }

/* Taksonomie nie mają własnych stron — terminy to sam tekst */
.wp-block-post-terms a { pointer-events: none; }
.is-style-pill a { display: inline-block; }

/* Realizacje — wybrane (1 duża + 2 małe) */
.eds-featured .wp-block-post-template { grid-template-columns: 1.4fr 1fr; grid-template-rows: 360px 360px; }
.eds-featured li:first-child { grid-row: span 2; }
.eds-featured .wp-block-cover { min-height: 0; height: 100%; overflow: hidden; }
.eds-projects .wp-block-cover { min-height: 0; }
.eds-featured .wp-block-cover__inner-container { width: 100% !important; } /* rdzeń: width:auto przy własnej pozycji treści */
@media (max-width: 781px) {
	.eds-featured .wp-block-post-template { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: 320px; }
	.eds-featured li:first-child { grid-row: auto; }
}

/* Realizacje — siatka z filtrami */
.eds-projects li[hidden] { display: none; }
.typ-realizacji-stan-surowy .is-style-pill a { background: var(--wp--preset--color--ink); }
.eds-projects .is-style-pill a { padding: 8px 14px; }
.eds-filters .wp-block-button__link.is-active { background: var(--wp--preset--color--white); color: var(--wp--preset--color--ink); }
.eds-filters .wp-block-button__link span { opacity: .6; margin-left: 6px; }

/* Wiersze list (kontrakty, oferty pracy) */
.eds-row { position: relative; display: grid; gap: 24px; align-items: center; }
.eds-row > * { margin: 0 !important; }
.eds-row--contract { grid-template-columns: 90px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr); transition: background-color .2s; }
.eds-row--contract:hover { background: var(--wp--preset--color--surface); }
.eds-row--job { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
@media (max-width: 781px) {
	.eds-row--contract, .eds-row--job { grid-template-columns: 1fr; gap: 8px; }
}

/* Dane biura: etykieta 120px | wartość */
.eds-dl { grid-template-columns: 120px 1fr !important; }

/* --- Partnerzy ------------------------------------------------------------- */
.eds-partners__viewport { overflow: hidden; }
.eds-partners__track { transition: transform .6s cubic-bezier(.6, 0, .2, 1); }
.eds-partners__track > figure { box-sizing: border-box; flex: 1 0 20%; min-width: 180px; height: 140px; margin: 0; padding: 24px; border-right: 1px solid var(--wp--preset--color--line); display: grid; place-items: center; } /* 1 0: mniej niż 5 logo wypełnia pasek */
.eds-partners__track img { width: auto; max-width: min(100%, 200px); max-height: 64px; object-fit: contain; }
.is-style-arrow .wp-block-button__link { width: 56px; height: 56px; display: grid; place-items: center; cursor: pointer; }

/* --- Formularz (wtyczka aq-forms) ----------------------------------------- */
/* maks. 2 kolumny (imię|firma, e-mail|telefon), 1 kolumna gdy formularz < ~420px */
.aqf { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(200px, calc((100% - 18px) / 2)), 1fr)); gap: 18px; }
.aqf > :not(.aqf-field--text, .aqf-field--email, .aqf-field--tel) { grid-column: 1 / -1; }
.aqf-field { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.aqf-label { font-size: 14px; color: #8FA3C6; letter-spacing: .04em; text-transform: uppercase; }
.aqf-req { display: none; }
.aqf-input, .aqf-select, .aqf-textarea {
	width: 100%; box-sizing: border-box; padding: 14px; font: inherit; font-size: 17px; color: #fff;
	background: #16233D; border: 1px solid #33456A; border-radius: 12px;
}
.aqf-textarea { resize: vertical; }
.aqf-input:focus, .aqf-select:focus, .aqf-textarea:focus { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 1px; }
.aqf :user-invalid, .aqf-field--invalid :is(input, select, textarea) { border-color: var(--wp--preset--color--accent); }
.aqf-option { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: #8FA3C6; }
.aqf-check { margin-top: 3px; accent-color: var(--wp--preset--color--accent); }
.aqf-submit {
	padding: 18px; border: 0; border-radius: 999px; cursor: pointer; background: var(--wp--preset--color--accent); color: #fff;
	font: 500 18px/normal var(--wp--preset--font-family--jost); letter-spacing: .08em; text-transform: uppercase;
}
.aqf-submit:hover { background: var(--wp--preset--color--accent-hover); }
.aqf-msg { white-space: pre-line; font-size: 18px; color: var(--wp--preset--color--on-dark-2); }
.aqf-msg--error { color: var(--wp--preset--color--accent-soft); }
/* Sukces: zamiast formularza „Dziękujemy!” (1. linia komunikatu) */
.eds-form:has(.aqf-msg--ok) > :not(.aqf), .aqf:has(.aqf-msg--ok) > :not(.aqf-msg) { display: none; }
.aqf-msg--ok { padding: 60px 0 40px; background: linear-gradient(var(--wp--preset--color--accent), var(--wp--preset--color--accent)) 0 40px / 40px 4px no-repeat; }
.aqf-msg--ok::first-line { font-size: 40px; font-weight: 300; line-height: 1.4; text-transform: uppercase; color: #fff; }

/* --- Animacje sekcji (strona główna) ---------------------------------------
   Klasy .eds-reveal / .is-visible nadaje assets/js/eds.js (raz, gdy element
   pojawi się w oknie). Bez JS lub przy „ograniczeniu ruchu” nic nie jest ukryte. */
.eds-reveal { opacity: 0; transform: translateY(56px); transition: opacity .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0s), transform .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
.eds-reveal.has-ink-background-color { transform: scale(.92); }
.eds-reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
	/* zdjęcia realizacji: delikatny zoom podczas przewijania + powiększenie po najechaniu */
	@keyframes eds-zoom { from { scale: 1.18; } }
	@supports (animation-timeline: view()) {
		.home .eds-featured .wp-block-cover__image-background { animation: eds-zoom linear both; animation-timeline: view(); animation-range: entry 0% cover 60%; }
	}
	.eds-featured .wp-block-cover__image-background { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
	.eds-featured li:hover .wp-block-cover__image-background { transform: scale(1.05); }
}
