/*
Theme Name: Mago Child
Theme URI: https://magointeriordesign.pl/
Description: Motyw potomny Hello Elementor. Tokeny i style komponentów żyją w Elementorze (Variables, klasy globalne); tutaj tylko style treści wpisów, focus, ruch i rzeczy spoza Elementora.
Author: Crosium
Template: hello-elementor
Version: 0.3.3
Requires at least: 7.0
Requires PHP: 8.1
Text Domain: mg-child
*/

/* Źródło bloków: megawat-child/style.css (wiersze 13–71, 917–930, 978–980), prefiks mw → px.
   Zmienne --mg-* definiuje Variables Manager Elementora; wartości po przecinku to zapas, gdy zmiennej brak. */

/* ===== Treść wpisów (kontener z klasą mg-prose w szablonie wpisu) ===== */
.mg-prose {
	max-inline-size: 68ch;
	margin-inline: auto;
	font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
	line-height: 1.55;
	color: var(--mg-text, #22272e);
}

.mg-prose > * + * {
	margin-block-start: 1em;
}

.mg-prose h2 {
	margin-block-start: 2em;
	font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem);
	line-height: 1.2;
}

.mg-prose h3 {
	margin-block-start: 1.6em;
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
	line-height: 1.25;
}

.mg-prose a {
	color: var(--mg-accent-text, #22272e);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.mg-prose a:hover,
.mg-prose a:focus-visible {
	text-decoration-thickness: 2px;
}

.mg-prose img {
	block-size: auto;
	max-inline-size: 100%;
	border-radius: 16px;
}

.mg-prose table {
	inline-size: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.mg-prose th,
.mg-prose td {
	padding: 0.75em 1em;
	border-block-end: 1px solid var(--mg-border, #e1e5ea);
	text-align: start;
}

.mg-lead-prose {
	font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
	line-height: 1.45;
	font-weight: 500;
}

/* ===== Focus: jeden styl w całym serwisie ===== */
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--mg-accent-text, #22272e);
	outline-offset: 2px;
}

/* ===== Ograniczony ruch ===== */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ===== Pomocnicze ===== */
.mg-nowrap {
	white-space: nowrap;
}

/* ===== Formularze V4 (e-form): reguła Kitu dla input/textarea (0,3,1) wygrywała z klasami V4 =====
   Szare tło, tekst 12 px, ramka w kolorze tła. Selektor 0,6,2 przywraca wygląd z design systemu;
   ramka #6F665D ma kontrast 5,6:1 z białym (WCAG 1.4.11 wymaga 3:1). */
body .e-form-base input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
body .e-form-base textarea,
body .e-form-base select {
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--mg-ink, #3b322c);
	background-color: var(--mg-surface, #fff);
	border: 1px solid var(--mg-text, #6f665d);
	border-radius: var(--mg-radius, 2px);
	box-shadow: none;
}

body .e-form-base textarea {
	min-block-size: 140px;
	padding: 12px 16px;
}

body .e-form-base input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]):focus,
body .e-form-base textarea:focus,
body .e-form-base select:focus {
	color: var(--mg-ink, #3b322c);
	background-color: var(--mg-surface, #fff);
	border-color: var(--mg-accent, #7d5631);
	box-shadow: inset 0 0 0 1px var(--mg-accent, #7d5631);
}

body .e-form-base input[type="checkbox"],
body .e-form-base input[type="radio"] {
	inline-size: 20px;
	block-size: 20px;
	flex-shrink: 0;
	margin: 2px 0 0;
	accent-color: var(--mg-accent, #7d5631);
}

/* ===== Akapit V4 będący w całości linkiem (e-paragraph z polem link) =====
   Elementor nadaje wewnętrznemu <a> „all: unset”, więc klikalny był sam tekst (np. 26 px wysokości w stopce),
   a min-height i padding zostawały na otaczającym elemencie. Link wypełnia teraz cały element. */
.e-paragraph-base > a.e-paragraph-link-base:only-child {
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	align-self: stretch;
	min-block-size: inherit;
}

/* Bieżąca strona w menu nagłówka (aria-current dopisuje motyw, inc/frontend.php). */
.mg-nav-link > a[aria-current="page"] {
	color: var(--mg-accent, #7d5631);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

/* ===== Rewizja wizualna P1 → P2 (DEC-40) ===== */

/* Tekst: Manrope także poza elementami V4 (treść wpisów, formularz Pro, widżety V3); Century Gothic zostaje w logo. */
body.elementor-kit-11,
body.elementor-kit-11 .elementor-widget-text-editor,
body.elementor-kit-11 .mg-prose {
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.mg-prose h2,
.mg-prose h3 {
	font-family: "Cormorant Garamond", Georgia, serif;
	font-weight: 500;
	color: var(--mg-ink, #3b322c);
}

.mg-prose h3 {
	font-family: "Manrope", system-ui, sans-serif;
	font-weight: 600;
}

/* Lepki nagłówek: menu i „Bezpłatna wycena” dostępne na długich stronach. */
.elementor-location-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}

/* Etapy numerowane (klasy V4 mg-steps / mg-step). */
.mg-steps {
	counter-reset: mg-step;
}

.mg-step {
	counter-increment: mg-step;
}

/* Elementor V4 używa ::before kontenera (.e-con) jako nakładki tła (position: absolute; inset: 0):
   numer stoi absolutnie w lewym górnym rogu, w miejscu zostawionym paddingiem etapu (64–76 px na stronach). */
.mg-step::before {
	position: absolute;
	inset: auto;
	top: 12px;
	left: 0;
	background: none;
	content: counter(mg-step, decimal-leading-zero);
	font-family: "Cormorant Garamond", Georgia, serif;
	font-size: 3rem;
	font-weight: 500;
	line-height: 1;
	color: var(--mg-accent, #7d5631);
}

/* Kadry: delikatne powiększenie po najechaniu (karty pętli, ramki obrazów). */
.e-collection-loop-item,
.mg-frame {
	overflow: hidden;
}

/* Właściwość scale (nie transform): składa się z lokalnym transform: scale(1.1–1.25), którym kadrujemy znaki wodne. */
.e-collection-loop-item img,
.mg-frame img,
.mg-frame.e-image-base {
	transition: scale 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.e-collection-loop-item:hover img,
.mg-frame:hover img {
	scale: 1.035;
}

/* Wejście sekcji przy przewijaniu (CSS, bez JS); element nigdy nie jest w pełni przezroczysty. */
@keyframes mg-reveal {
	from {
		opacity: 0.35;
		transform: translateY(18px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.mg-step,
		.mg-card,
		.mg-row-item,
		.mg-quote {
			animation: mg-reveal linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 30%;
		}
	}
}

/* Formularz Elementor Pro (checklista): ten sam wygląd co formularze V4. */
body .elementor-form .elementor-field-group .elementor-field:not([type="checkbox"]):not([type="radio"]) {
	min-block-size: 48px;
	padding: 12px 16px;
	font-family: inherit;
	font-size: 1rem;
	color: var(--mg-ink, #3b322c);
	background-color: var(--mg-surface, #fff);
	border: 1px solid var(--mg-text, #6f665d);
	border-radius: var(--mg-radius, 2px);
}

body .elementor-form .elementor-field-group .elementor-field:focus {
	border-color: var(--mg-accent, #7d5631);
	box-shadow: inset 0 0 0 1px var(--mg-accent, #7d5631);
}

body .elementor-form .elementor-button[type="submit"] {
	min-block-size: 48px;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-transform: none;
	color: #fff;
	background-color: var(--mg-accent, #7d5631);
	border-color: var(--mg-accent, #7d5631);
	border-radius: var(--mg-radius, 2px);
}

body .elementor-form .elementor-button[type="submit"]:hover {
	background-color: var(--mg-ink, #3b322c);
	border-color: var(--mg-ink, #3b322c);
}

/* ===== Runda 5 (po P2) ===== */

/* Cyfry wyrównane do linii: nautyczne cyfry Cormoranta („01” czytane jak „OI”, „4,9” rozjechane). */
body {
	font-variant-numeric: lining-nums;
}

.mg-step::before {
	font-variant-numeric: lining-nums tabular-nums;
}

/* Etykiety i zgody w formularzach V4 i Pro: Manrope zamiast Century Gothic z Kitu (z literówką „Sans-seriff”). */
body .e-form-base,
body .e-form-base label,
body .e-form-base span,
body .elementor-form .elementor-field-label,
body .elementor-form .elementor-field-option label {
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ===== 0.3.0 — kierunek DEC-41: edytorski, architektoniczny (atrament, kamień, cegła) ===== */

/* Skala: większe, lżejsze nagłówki szeryfowe; ostre krawędzie (zmienne rozmiaru wymagają Pro w Variables Managerze). */
html:root {
	--mg-fs-h1: clamp(3rem, 1.9rem + 4.6vw, 6.75rem);
	--mg-fs-h2: clamp(2.25rem, 1.55rem + 2.8vw, 4.25rem);
	--mg-fs-h3: clamp(1.3rem, 1.2rem + 0.5vw, 1.625rem);
	--mg-radius: 0px;
}

::selection {
	background-color: var(--mg-accent, #8a3b26);
	color: #fff;
}

/* Nagłówki: optyczne wyrównanie i balans łamania. */
.mg-h1,
.mg-h2,
.mg-display {
	text-wrap: balance;
	font-kerning: normal;
}

.mg-h1 em,
.mg-h2 em,
.mg-display em {
	font-style: italic;
	color: var(--mg-accent, #8a3b26);
}

.mg-lead,
.mg-text {
	text-wrap: pretty;
}

/* Etykieta sekcji z kreską — rysunkowa „linia wymiarowa”. */
.mg-eyebrow::before {
	content: "";
	display: inline-block;
	inline-size: 2.25rem;
	block-size: 1px;
	margin-inline-end: 0.85rem;
	vertical-align: 0.3em;
	background-color: currentColor;
}

/* Przyciski: strzałka, która przesuwa się po najechaniu. */
.mg-btn:not(.mg-btn--ghost):not([href*="facebook"]):not([href*="instagram"])::after {
	content: "\2192";
	display: inline-block;
	margin-inline-start: 0.65em;
	transition: translate 0.3s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.mg-btn:not(.mg-btn--ghost):hover::after,
.mg-btn:not(.mg-btn--ghost):focus-visible::after {
	translate: 4px 0;
}

/* Linki w tekście: cienkie podkreślenie w kolorze cegły, pełne po najechaniu. */
.mg-text a,
.mg-lead a,
.mg-prose a,
.mg-small a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	text-decoration-color: color-mix(in srgb, var(--mg-accent, #8a3b26) 55%, transparent);
	transition: text-decoration-color 0.2s, color 0.2s;
}

.mg-text a:hover,
.mg-lead a:hover,
.mg-prose a:hover,
.mg-small a:hover {
	color: var(--mg-accent, #8a3b26);
	text-decoration-color: currentColor;
}

/* Kadry: znaczniki narożne jak na planszy projektowej (nie zasłaniają obrazu, nie łapią kliknięć). */
.mg-frame,
.mg-feature {
	position: relative;
}

/* Tylko sekcja obrazowa (mg-feature, jedna na stronę); zwykłe kadry bez ozdobnika (P3: „celowniki wszędzie”). */
.mg-feature::after {
	content: "";
	position: absolute;
	inset: 16px;
	z-index: 2;
	pointer-events: none;
	--mg-mark: rgba(255, 255, 255, 0.85);
	background:
		linear-gradient(var(--mg-mark), var(--mg-mark)) top left / 22px 1px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) top left / 1px 22px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) top right / 22px 1px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) top right / 1px 22px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) bottom left / 22px 1px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) bottom left / 1px 22px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) bottom right / 22px 1px no-repeat,
		linear-gradient(var(--mg-mark), var(--mg-mark)) bottom right / 1px 22px no-repeat;
}

/* Listy realizacji i wpisów: numer porządkowy nad tytułem, tytuł z podkreśleniem po najechaniu. */
.e-collection-loop-layout,
.mg-petla {
	counter-reset: mg-item;
}

.e-collection-loop-item,
.mg-petla__item {
	counter-increment: mg-item;
}

.e-collection-loop-item h3::before,
.mg-petla__title::before {
	content: counter(mg-item, decimal-leading-zero);
	display: block;
	margin-block-end: 0.6rem;
	font-family: "Manrope", system-ui, sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	font-variant-numeric: lining-nums tabular-nums;
	color: var(--mg-accent, #8a3b26);
}

.e-collection-loop-item h3 a,
.mg-petla__title a {
	color: inherit;
	text-decoration: none;
	background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
	transition: background-size 0.4s cubic-bezier(0.2, 0.6, 0.2, 1), color 0.2s;
}

.e-collection-loop-item:hover h3 a,
.e-collection-loop-item h3 a:focus-visible,
.mg-petla__item:hover .mg-petla__title a,
.mg-petla__title a:focus-visible {
	color: var(--mg-accent, #8a3b26);
	background-size: 100% 1px;
}

/* Zapasowa lista (inc/petle.php, gdy pętla V4 Pro nie jest dostępna). */
.mg-petla {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(32px, 2rem + 1.5vw, 56px) clamp(20px, 1rem + 1.5vw, 40px);
	inline-size: 100%;
}

.mg-petla.mg-projekty-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mg-petla__item {
	display: flex;
	flex-direction: column;
	gap: 20px;
	overflow: visible;
}

.mg-petla__media {
	display: block;
	overflow: hidden;
}

.mg-petla__img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	object-fit: cover;
	transition: scale 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.mg-petla__item:hover .mg-petla__img {
	scale: 1.035;
}

.mg-petla__body {
	gap: 10px;
}

.mg-petla__title {
	margin: 0;
}

.mg-petla__excerpt {
	margin: 0;
}

/* Projekty: co trzecia realizacja na pełną szerokość siatki — rytm zamiast równej kratki. */
.mg-petla.mg-projekty-grid .mg-petla__item:nth-child(3n + 1) {
	grid-column: 1 / -1;
}

.mg-petla.mg-projekty-grid .mg-petla__item:nth-child(3n + 1) .mg-petla__img {
	aspect-ratio: 21 / 9 !important;
}

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

@media (max-width: 767px) {
	.mg-petla,
	.mg-petla.mg-projekty-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.mg-petla.mg-projekty-grid .mg-petla__item:nth-child(3n + 1) .mg-petla__img {
		aspect-ratio: 4 / 3 !important;
	}
}

/* Odsłanianie kadrów przy przewijaniu (przycięcie, nie przezroczystość: obraz LCP i tak widoczny od razu). */
@keyframes mg-unveil {
	from {
		clip-path: inset(6% 6% 6% 6%);
	}
	to {
		clip-path: inset(0 0 0 0);
	}
}

@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.mg-feature__img,
		.mg-petla__media,
		.e-collection-loop-item .e-image-base {
			animation: mg-unveil linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 45%;
		}
	}
}

/* Etykiety przycisków w jednej linii na tablecie i komputerze. */
@media (min-width: 768px) {
	.mg-btn {
		white-space: nowrap;
	}
}

/* Spis artykułów (Q&A, archiwum, „czytaj dalej” we wpisie): bez miniatur, jak spis treści magazynu. */
.mg-petla.mg-petla--spis {
	display: block;
	border-block-end: 1px solid var(--mg-line, #ddd3c6);
}

.mg-petla--spis .mg-petla__item {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 5fr) minmax(0, 4fr);
	gap: 12px clamp(20px, 1rem + 2vw, 56px);
	align-items: baseline;
	padding-block: clamp(24px, 1rem + 1.5vw, 40px);
	border-block-start: 1px solid var(--mg-line, #ddd3c6);
	position: relative;
}

.mg-petla--spis .mg-petla__body {
	display: contents;
}

.mg-petla--spis .mg-petla__date {
	margin: 0;
}

.mg-petla--spis .mg-petla__title {
	font-family: var(--mg-font-display, "Cormorant Garamond"), Georgia, serif;
	font-size: clamp(1.625rem, 1.3rem + 1.1vw, 2.375rem);
	font-weight: 400;
	line-height: 1.12;
	letter-spacing: -0.005em;
}

.mg-petla--spis .mg-petla__title::before {
	display: none;
}

/* Cały wiersz klikalny (link tytułu rozciągnięty na wiersz). */
.mg-petla--spis .mg-petla__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.mg-petla--spis .mg-petla__item:hover .mg-petla__date {
	color: var(--mg-accent, #8a3b26);
}

@media (max-width: 767px) {
	.mg-petla--spis .mg-petla__item {
		grid-template-columns: minmax(0, 1fr);
	}
}

.mg-petla--spis .mg-petla__date {
	font-family: "Manrope", system-ui, sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--mg-text, #5c544c);
	transition: color 0.2s;
}

/* Tło strony = jasna powierzchnia palety (bez białych szczelin przy kadrach wychodzących do krawędzi). */
body.elementor-kit-11 {
	background-color: var(--mg-surface, #fbf8f3);
}

/* ===== 0.3.3 — runda 7 (po P3) ===== */

/* Tekst ciągły odrobinę cięższy (Manrope zmienny): „za blady i za lekki” u art directora. */
body .mg-text,
body .mg-lead,
body .mg-prose {
	font-weight: 450;
}

/* Nagłówki w treści wpisów w tej samej grubości co w całym serwisie. */
.mg-prose h2 {
	font-weight: 400;
}
