/* ═══════════════════════════════════════════════════════════════
   MODUŁ: FORMULARZ KONTAKTOWY (Contact Form 7)
   ══════════════════════════════════════════════════════════════

   Narzędzie "pyk i działa" — dorzuć gdy projekt potrzebuje formularza.

   Użycie (3 kroki):
   1. Zainstaluj i skonfiguruj wtyczkę Contact Form 7 (+ opcjonalnie Flamingo).
   2. W functions.php odkomentuj blok "MODUŁ: FORMULARZ KONTAKTOWY"
      (enqueue tego pliku + js/modules/contact-form.js).
   3. Dodaj markup sekcji z klasami .contact-section (patrz struktura
      poniżej) do wybranego pattern/template — patronuje jej
      inc/cf7-form.php (skrócony tag [contact-form-7 ...]).

   Wymagana struktura HTML (minimalny szkielet):
   <section class="contact-section anim-contact">
     <div class="contact-section__inner">
       <div class="contact-section__layout">
         <div class="contact-section__info"> ... </div>
         <div class="contact-section__form-wrap">
           <div class="contact-section__form-card">[contact-form-7 ...]</div>
         </div>
       </div>
     </div>
   </section>
   ══════════════════════════════════════════════════════════════ */

.contact-section {
    position: relative;
    overflow: hidden;
    background-color: var(--wp--preset--color--surface);
    padding-block: clamp(4rem, 10vw, 8rem);
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Dekoracje tła — lekki akcent górny */
.contact-section__deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.contact-section__deco-ring {
    position: absolute;
    top: -18%;
    right: -6%;
    width: clamp(14rem, 32vw, 28rem);
    height: clamp(14rem, 32vw, 28rem);
    border: 1px solid var(--wp--preset--color--contrast);
    border-radius: 50%;
    opacity: 0.045;
}

.contact-section__deco-ring::before {
    content: '';
    position: absolute;
    inset: 12%;
    border: 1px solid var(--wp--preset--color--primary);
    border-radius: 50%;
    opacity: 0.6;
}

/* Layout wewnętrzny */
.contact-section__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1450px);
    margin: 0 auto;
    padding-left: var(--wp--style--root--padding-left, clamp(1rem, 2vw, 2rem));
    padding-right: var(--wp--style--root--padding-right, clamp(1rem, 2vw, 2rem));
}

.contact-section__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(3rem, 6vw, 5rem);
    min-width: 0;
}

@media (min-width: 1024px) {
    .contact-section__layout {
        grid-template-columns: 2fr 3fr;
        align-items: start;
        gap: clamp(3rem, 5vw, 6rem);
    }
}

.contact-section__info,
.contact-section__form-wrap {
    min-width: 0;
    max-width: 100%;
}

/* Lewa kolumna — info */
.contact-section__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--sm);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--wp--preset--color--primary);
    margin: 0 0 1.25rem;
}

.contact-section__title {
    font-family: var(--wp--preset--font-family--serif);
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--wp--preset--color--contrast);
    margin: 0 0 var(--wp--preset--spacing--30);
}

.contact-section__rule {
    width: 4rem;
    height: 3px;
    background: linear-gradient(
        to right,
        var(--wp--preset--color--primary),
        rgba(59, 110, 246, 0.25)
    );
    margin: 0 0 var(--wp--preset--spacing--40);
}

.contact-section__lead {
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--base);
    line-height: 1.7;
    color: var(--wp--preset--color--secondary);
    margin: 0 0 2.5rem;
}

/* Lista danych kontaktowych */
.contact-section__details {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.contact-section__detail {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.contact-section__detail-link {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    width: 100%;
    text-decoration: none !important;
    color: inherit;
    border-radius: 4px;
    transition: color 180ms ease;
}

.contact-section__detail-link:hover .contact-section__detail-value,
.contact-section__detail-link:focus-visible .contact-section__detail-value {
    color: var(--wp--preset--color--primary);
}

.contact-section__detail-link:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 3px;
}

.contact-section__detail--static {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.contact-section__detail-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10%;
    background: var(--wp--preset--color--base);
    color: var(--wp--preset--color--primary);
    border: 1px solid rgba(0,0,0,0.07);
    margin-top: 0.1rem;
}

.contact-section__detail-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.contact-section__detail-label {
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(59, 110, 246, 0.85);
    line-height: 1;
}

.contact-section__detail-value {
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--sm);
    color: var(--wp--preset--color--contrast);
    line-height: 1.5;
    transition: color 180ms ease;
}

/* Odznaka RODO/zaufanie */
.contact-section__trust {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.875rem 1rem;
    background: var(--wp--preset--color--base);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 6px;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--xs);
    line-height: 1.5;
    color: var(--wp--preset--color--secondary);
}

.contact-section__trust svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: var(--wp--preset--color--primary);
    opacity: 0.8;
}

/* Prawa kolumna — karta z formularzem */
.contact-section__form-card {
    background: var(--wp--preset--color--base);
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 4px;
    padding: clamp(1.75rem, 4vw, 3rem);
    box-shadow: 0 2px 24px rgba(17,24,39,0.06);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* ────────────────────────────────────────────────────────────
   OVERRIDE — Contact Form 7 (selektory .wpcf7-*)
   Wszystkie reguły scoped do .contact-section, żeby nie
   kolidować z ewentualnymi innymi formularzami CF7.
   ─────────────────────────────────────────────────────────── */

.contact-section .wpcf7 {
    margin: 0;
    min-width: 0;
    max-width: 100%;
}

/* CF7 — ukryte pola techniczne (CSS wtyczki wyłączony w motywie) */
.contact-section .wpcf7 .hidden-fields-container {
    display: none !important;
}

/* CF7 — komunikat dla czytników ekranu, nie dla oczu */
.contact-section .wpcf7 .screen-reader-response {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.contact-section .wpcf7 form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
}

/* Każde pole w osobnym bloku */
.contact-section .wpcf7 p {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    max-width: 100%;
}

.contact-section .wpcf7 .wpcf7-form-control-wrap {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Inputy, select, textarea */
.contact-section .wpcf7 input[type="text"],
.contact-section .wpcf7 input[type="email"],
.contact-section .wpcf7 input[type="tel"],
.contact-section .wpcf7 select,
.contact-section .wpcf7 textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--base);
    color: var(--wp--preset--color--contrast);
    background: var(--wp--preset--color--surface);
    border: 1px solid rgba(17,24,39,0.18);
    border-radius: 3px;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    appearance: none;
    -webkit-appearance: none;
}

.contact-section .wpcf7 select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23111827' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.contact-section .wpcf7 textarea {
    resize: vertical;
    min-height: 5.5rem;
    max-height: 9rem;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.contact-section .wpcf7 input:focus,
.contact-section .wpcf7 select:focus,
.contact-section .wpcf7 textarea:focus,
.contact-section .wpcf7 input:focus-visible,
.contact-section .wpcf7 select:focus-visible,
.contact-section .wpcf7 textarea:focus-visible {
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px rgba(59,110,246,0.18);
}

/* Placeholder */
.contact-section .wpcf7 input::placeholder,
.contact-section .wpcf7 textarea::placeholder {
    color: var(--wp--preset--color--contrast);
    opacity: 0.3;
}

/* Checkbox RODO — checkbox obok tekstu, wyśrodkowany w pionie */
.contact-section .wpcf7 p:has(.wpcf7-acceptance) {
    display: block;
    margin-top: 0.25rem;
}

.contact-section .wpcf7 .wpcf7-acceptance {
    display: block;
}

.contact-section .wpcf7 .wpcf7-acceptance .wpcf7-list-item {
    margin: 0;
    display: block;
}

.contact-section .wpcf7 .wpcf7-acceptance .wpcf7-list-item label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
}

.contact-section .wpcf7 .wpcf7-acceptance input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    flex: 0 0 1.05rem;
    margin: 0;
    accent-color: var(--wp--preset--color--primary);
    cursor: pointer;
}

.contact-section .wpcf7 .wpcf7-acceptance .wpcf7-list-item-label {
    flex: 1;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--xs);
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: normal;
    text-transform: none;
    color: var(--wp--preset--color--secondary);
}

.contact-section .wpcf7 .wpcf7-acceptance .wpcf7-list-item-label a {
    color: var(--wp--preset--color--contrast);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 180ms ease;
}

.contact-section .wpcf7 .wpcf7-acceptance .wpcf7-list-item-label a:hover {
    color: var(--wp--preset--color--primary);
}

/* Błędy walidacji — pod polem, bez duplikatu u góry */
.contact-section .wpcf7 .wpcf7-not-valid-tip {
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--xs);
    color: #b91c1c;
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.4;
}

.contact-section .wpcf7 .wpcf7-not-valid-tip::before {
    content: '';
    flex-shrink: 0;
    width: 0.9rem;
    height: 0.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.contact-section .wpcf7 .wpcf7-not-valid {
    border-color: #b91c1c !important;
    background-color: #fffafa;
}

/* Komunikaty po wysłaniu — tylko sukces/błąd wysyłki (nie duplikat walidacji) */
.contact-section .wpcf7 form.init .wpcf7-response-output,
.contact-section .wpcf7 form.resetting .wpcf7-response-output,
.contact-section .wpcf7 form.submitting .wpcf7-response-output,
.contact-section .wpcf7 form.invalid .wpcf7-response-output,
.contact-section .wpcf7 form.unaccepted .wpcf7-response-output,
.contact-section .wpcf7 .wpcf7-response-output:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.contact-section .wpcf7 .wpcf7-response-output {
    order: 99;
    margin: 0.5rem 0 0;
    padding: 0.875rem 1rem;
    border-radius: 3px;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--sm);
    font-weight: 600;
    line-height: 1.5;
    border: none !important;
}

.contact-section .wpcf7 .wpcf7-mail-sent-ok {
    background: #f0fdf4;
    color: #166534;
    border-left: 3px solid #22c55e !important;
}

.contact-section .wpcf7 .wpcf7-mail-sent-ng,
.contact-section .wpcf7 .wpcf7-spam-blocked {
    background: #fef2f2;
    color: #991b1b;
    border-left: 3px solid #ef4444 !important;
}

.contact-section .wpcf7 .wpcf7-validation-errors {
    display: none;
}

/* Przycisk submit — spójny ze sweep hover CTA nagłówka */
.contact-section .wpcf7 input[type="submit"],
.contact-section .wpcf7 .wpcf7-submit {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2.25rem;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--sm);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: var(--wp--preset--color--contrast);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: color 300ms ease;
    margin-top: 0.5rem;
    min-height: 48px;
    width: 100%;
}

.contact-section .wpcf7 input[type="submit"]::before,
.contact-section .wpcf7 .wpcf7-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--wp--preset--color--primary);
    transform: translateX(-101%);
    transition: transform 300ms cubic-bezier(0.76,0,0.24,1);
}

.contact-section .wpcf7 input[type="submit"]:hover::before,
.contact-section .wpcf7 .wpcf7-submit:hover::before {
    transform: translateX(0);
}

.contact-section .wpcf7 input[type="submit"] span,
.contact-section .wpcf7 .wpcf7-submit span {
    position: relative;
    z-index: 1;
}

.contact-section .wpcf7 input[type="submit"]:focus-visible,
.contact-section .wpcf7 .wpcf7-submit:focus-visible {
    outline: 3px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* Spinner CF7 */
.contact-section .wpcf7 .ajax-loader {
    display: none !important;
}

/* Komunikat setup (gdy CF7 nie skonfigurowany) */
.contact-section__setup-notice {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-family: var(--wp--preset--font-family--system-sans);
    font-size: var(--wp--preset--font-size--sm);
    line-height: 1.6;
    color: #92400e;
}

.contact-section__setup-notice svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #d97706;
}

.contact-section__setup-notice code {
    background: rgba(0,0,0,0.07);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* ANIM guard — stan początkowy dla GSAP (js/modules/contact-form.js) */
.anim-contact {
    opacity: 0;
    visibility: hidden;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 767px) {
    .contact-section__title {
        font-size: clamp(1.875rem, 6.5vw, 2.35rem);
    }

    .contact-section__eyebrow {
        font-size: 0.65rem;
        letter-spacing: 0.12em;
    }

    .contact-section__info {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .contact-section__title,
    .contact-section__lead {
        text-align: center;
    }

    .contact-section__rule {
        margin-left: auto;
        margin-right: auto;
    }

    .contact-section__details {
        width: 100%;
        max-width: 18rem;
        align-items: stretch;
    }

    .contact-section__detail {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }

    .contact-section__detail-link,
    .contact-section__detail--static {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }

    .contact-section__detail-icon {
        margin-top: 0;
    }

    .contact-section__detail-body {
        align-items: center;
    }

    .contact-section__trust {
        flex-direction: column;
        align-items: center;
        text-align: center;
        max-width: 18rem;
    }

    .contact-section__form-card {
        padding: 1.5rem;
    }

    .contact-section .wpcf7 input[type="submit"],
    .contact-section .wpcf7 .wpcf7-submit {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .contact-section {
        width: 100svw;
        max-width: 100svw;
        margin-left: calc(50% - 50svw);
        margin-right: calc(50% - 50svw);
    }
}
