/**
 * WordPress integration overrides for the Zachoszcz design.
 *
 * Loaded after zachoszcz-design.css. Bridges the static design system to
 * WordPress output: admin bar, Contact Form 7, generic page/post content,
 * accessibility helpers.
 *
 * @package Zachoszcz
 */

/* ---------- Sticky header: make position:sticky actually work ----------
   The design CSS sets `overflow-x: hidden` on html/body, which turns <body>
   into a scroll container — the sticky header then sticks to body (which
   never scrolls): it does not stick at all, and with the admin bar's
   `html { margin-top: 32px }` bump its top offset is measured from body's
   edge, doubling to 64px and covering the content below (e.g. breadcrumbs
   on the vehicle page). `overflow-x: clip` clips without creating a scroll
   container, so the header sticks to the real viewport again. */
html,
body {
	overflow-x: clip;
}

/* ---------- Admin bar offset for the sticky header ---------- */
.admin-bar .site-header { top: 32px; }
@media screen and (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}

/* ---------- Accessibility ---------- */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 200;
	background: var(--ink);
	color: #fff;
	padding: 12px 20px;
	border-radius: 0 0 4px 0;
	font-size: 14px;
}
.skip-link:focus { left: 0; }
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	word-wrap: normal !important;
}

/* ---------- Generic page / post content ---------- */
.page-content { padding: 72px 0 96px; }
.entry-content { max-width: 760px; margin: 0 auto; }
.entry-content > * + * { margin-top: 1.1em; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content h3 { margin-top: 1.4em; }
.entry-content img,
.entry-content .wp-block-image img { border-radius: var(--radius-lg); height: auto; }
.entry-content ul,
.entry-content ol { padding-left: 1.4em; }
.entry-content li { margin-top: 0.4em; }
.entry-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.entry-content blockquote {
	border-left: 3px solid var(--brand);
	padding-left: 20px;
	color: var(--muted);
	font-size: 18px;
}
.entry-content .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 22px;
	border-radius: var(--radius);
	font-weight: 600;
	font-size: 15px;
	background: var(--ink);
	color: #fff;
	text-decoration: none;
}
.entry-content .is-style-alternative .wp-block-button__link { background: var(--brand); }

/* ---------- Contact Form 7 → design form styling ---------- */
.contact-cf7 .wpcf7-form .row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
}
@media (max-width: 768px) {
	.contact-cf7 .wpcf7-form .row { grid-template-columns: 1fr; }
}
.contact-cf7 .wpcf7-form .field { margin-bottom: 16px; }
.contact-cf7 .wpcf7-form .row .field { margin-bottom: 0; }
.contact-cf7 .wpcf7-form-control-wrap { display: block; }
.contact-cf7 .wpcf7-form input[type="text"],
.contact-cf7 .wpcf7-form input[type="email"],
.contact-cf7 .wpcf7-form input[type="tel"],
.contact-cf7 .wpcf7-form input[type="url"],
.contact-cf7 .wpcf7-form input[type="number"],
.contact-cf7 .wpcf7-form input[type="date"],
.contact-cf7 .wpcf7-form textarea,
.contact-cf7 .wpcf7-form select {
	width: 100%;
	padding: 15px 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: 15px;
	font-family: inherit;
	background: #fff;
	color: var(--ink);
	transition: border-color 0.15s ease;
}
.contact-cf7 .wpcf7-form textarea { resize: vertical; min-height: 120px; }
.contact-cf7 .wpcf7-form input:focus,
.contact-cf7 .wpcf7-form textarea:focus,
.contact-cf7 .wpcf7-form select:focus {
	outline: none;
	border-color: var(--brand);
}
.contact-cf7 .wpcf7-form input::placeholder,
.contact-cf7 .wpcf7-form textarea::placeholder { color: var(--muted-2); }
.contact-cf7 .wpcf7-form .wpcf7-submit {
	width: 100%;
	height: 56px;
	border: none;
	border-radius: var(--radius);
	background: var(--ink);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s ease;
	margin-top: 8px;
}
.contact-cf7 .wpcf7-form .wpcf7-submit:hover { background: #2a2a35; }
.contact-cf7 .wpcf7-form .wpcf7-spinner { margin: 12px auto 0; display: block; }
.contact-cf7 .wpcf7-not-valid-tip {
	color: #c0392b;
	font-size: 12px;
	margin-top: 6px;
	font-family: "Geist Mono", monospace;
}
.contact-cf7 .wpcf7-form input.wpcf7-not-valid,
.contact-cf7 .wpcf7-form textarea.wpcf7-not-valid,
.contact-cf7 .wpcf7-form select.wpcf7-not-valid { border-color: #c0392b; }
.contact-cf7 .wpcf7-response-output {
	margin: 20px 0 0 !important;
	padding: 14px 18px !important;
	border-radius: var(--radius);
	font-size: 14px;
}
.contact-cf7 .wpcf7 form.sent .wpcf7-response-output { border-color: #27ae60; background: #eafaf0; }
.contact-cf7 .wpcf7 form.invalid .wpcf7-response-output,
.contact-cf7 .wpcf7 form.failed .wpcf7-response-output { border-color: #c0392b; background: #fdeeec; }

/* Inline vehicle-inquiry CF7 (on single vehicle aside) */
.vd-inquiry .wpcf7-form input[type="text"],
.vd-inquiry .wpcf7-form input[type="email"],
.vd-inquiry .wpcf7-form input[type="tel"],
.vd-inquiry .wpcf7-form textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: 14px;
	font-family: inherit;
	margin-bottom: 10px;
	background: #fff;
}
.vd-inquiry .wpcf7-form textarea { min-height: 90px; resize: vertical; }
.vd-inquiry .wpcf7-form input:focus,
.vd-inquiry .wpcf7-form textarea:focus { outline: none; border-color: var(--brand); }
.vd-inquiry .wpcf7-form .wpcf7-submit {
	width: 100%;
	height: 48px;
	border: none;
	border-radius: var(--radius);
	background: var(--brand);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
}
.vd-inquiry .wpcf7-form .wpcf7-submit:hover { background: var(--brand-600); }
.vd-inquiry .wpcf7-not-valid-tip { font-size: 11px; color: #c0392b; }

/* ---------- Pagination (WP archive) mirrors design .of-pagination ---------- */
.wp-pagenavi,
.pagination-classic { display: flex; justify-content: center; gap: 8px; margin-top: 48px; flex-wrap: wrap; }
.pagination-classic a,
.pagination-classic span {
	min-width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: 14px;
	color: var(--ink);
	text-decoration: none;
	padding: 0 8px;
}
.pagination-classic a:hover { border-color: var(--ink); }
.pagination-classic .current {
	background: var(--ink);
	color: #fff;
	border-color: var(--ink);
}

/* Featured-image cover fill for cards / list / gallery / news */
.vcard__media img.vcard__img,
.vlist__media img,
.news__img,
.blog-card__img { display: block; }

/* Badges and favourite buttons must stay above the cover photo
   (design CSS positions them without z-index, so a later <img> wins). */
.vcard__media .badge,
.vlist__media .badge { z-index: 3; }
.vcard__fav { z-index: 3; }

/* ---------- Header: 7 nav items need more room than the design's 6 ----------
   Labels must never wrap (a wrapped line pokes out of the 76px bar and paints
   over the content below, e.g. breadcrumbs on the vehicle page), and the
   drawer takes over earlier than the design's 1024px cut-off. */
.nav a { white-space: nowrap; }
.site-header__inner { flex-wrap: nowrap; }
@media (max-width: 1240px) {
	.nav { display: none; }
	.header-cta { display: none; }
	.hamburger { display: block; }
}

/* ---------- Home quick-search: working selects in the design bar ---------- */
.searchbar__field .val select {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: 0;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	padding: 0;
	margin: 0;
	cursor: pointer;
	outline: none;
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.searchbar__field .val select:focus-visible { outline: 1px solid var(--brand); outline-offset: 3px; border-radius: 2px; }
/* The native dropdown list opens on a light panel. */
.searchbar__field .val select option { color: var(--ink); background: #fff; }

/* ---------- Rezerwacja: watermark z logo nad zdjęciem pojazdu ---------- */
.vcard__media,
.vlist__media,
.vd-gallery > div { position: relative; }
.vres {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: grid;
	place-items: center;
	background: rgba(14, 14, 18, 0.55);
	pointer-events: none;
	overflow: hidden;
}
.vres__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	transform: rotate(-7deg);
}
.vres svg {
	width: min(58%, 230px);
	height: auto;
	opacity: 0.95;
	filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.4));
}
.vres__label {
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.34em;
	text-indent: 0.34em; /* optically centres the letter-spaced caps */
	text-transform: uppercase;
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 3px;
	padding: 7px 14px;
	background: rgba(14, 14, 18, 0.35);
	white-space: nowrap;
}
.vlist__media .vres__inner { gap: 8px; }
.vlist__media .vres svg { width: 68%; }
.vlist__media .vres__label { font-size: 9px; padding: 4px 8px; letter-spacing: 0.22em; text-indent: 0.22em; }
.vd-gallery > div:first-child .vres svg { width: min(42%, 300px); }
.vd-gallery > div:first-child .vres__label { font-size: 14px; }
.vd-head__tag--reserved {
	background: #b42318;
	border-color: #b42318;
	color: #fff;
}

/* ---------- Language switch: real Polylang links (design styled <button>) ---------- */
.lang-switch a {
	background: none;
	border: 0;
	padding: 6px 8px;
	font-family: inherit;
	font-size: 12px;
	color: var(--muted);
	cursor: pointer;
	text-decoration: none;
	letter-spacing: 0.05em;
}
.lang-switch a.active { color: var(--ink); font-weight: 600; }
.lang-switch a:hover { color: var(--ink); }
/* The drawer copy stays visible on mobile (the header one hides <1284px).
   The drawer is dark (--ink background), so the header colours (--muted /
   --ink) would be invisible here — restyle as a light-on-dark segmented
   control matching the drawer's bordered controls (.drawer__close). */
.lang-switch--drawer {
	display: inline-flex;
	align-items: stretch;
	gap: 0;
	align-self: flex-start;
	margin-bottom: 18px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 4px;
	overflow: hidden;
	font-family: 'Geist Mono', ui-monospace, monospace;
}
.lang-switch--drawer a {
	padding: 9px 18px;
	font-size: 12px;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.55);
	background: transparent;
	transition: color 0.15s ease, background 0.15s ease;
}
.lang-switch--drawer a + a { border-left: 1px solid rgba(255, 255, 255, 0.15); }
.lang-switch--drawer a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.lang-switch--drawer a.active {
	color: #fff;
	background: var(--brand);
	font-weight: 600;
}

/* ---------- Lightbox: nav buttons sit 72px outside the stage (92vw wide),
   which pokes past the viewport edge between 901-1343px — and overflow-x:clip
   makes the clipped part unreachable. Pull them inside for that range
   (mirrors the design's own <=900px corrective rule). ---------- */
@media (min-width: 901px) and (max-width: 1360px) {
	.lightbox__nav--prev { left: 12px; }
	.lightbox__nav--next { right: 12px; }
}

/* ---------- Wyposażenie / dokumenty: poprawiony znacznik "check" ----------
   The design draws the tick with an absolutely-positioned ::after that lands
   above the circle (visibly broken). Draw the tick inside the circle instead. */
.vd-features li::before {
	width: 18px;
	height: 18px;
	margin-top: 1px;
	background-color: var(--brand-50);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232091ff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 10px 10px;
}
.vd-features li::after { display: none; }
.vd-features li { align-items: center; }

/* ---------- Doradca handlowy: ikona zamiast inicjałów ---------- */
.advisor__avatar svg { width: 20px; height: 20px; }
.advisor__phone { font-size: 15px; }

/* ---------- Wniosek o leasing (sekcja formularza na stronie finansowania) ---------- */
.fin-apply { scroll-margin-top: 96px; }
.fin-apply .contact-cf7 { max-width: 640px; }
.fin-apply .wpcf7-acceptance .wpcf7-list-item {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
	line-height: 1.5;
}
.fin-apply .wpcf7-acceptance a { color: var(--brand); }

/* ---------- Strony statyczne (np. polityka prywatności): treść wyrównana
   do tytułu hero (.sub-hero__inner: max-width 880px, lewa krawędź kontenera)
   zamiast wąskiej wyśrodkowanej kolumny. Wpisy bloga zachowują węższą,
   wyśrodkowaną miarę czytelniczą. ---------- */
.page-content .entry-content {
	max-width: 880px;
	margin: 0;
}

/* ---------- Płynne przewijanie kotwic (#top w stopce, #wniosek) ---------- */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
