/**
 * Theme Name: CraftRank
 * Author: Przemysław Pinuszewski
 * Author URI: https://craftrank.pl
 * Description: Motyw stworzony przez CraftRank. Zoptymalizowany i oczyszczony.
 * Requires at least: 6.1
 * Tested up to: 7.0
 * Requires PHP: 8.0
 * Version: 1.1
 * License: GNU General Public License v2 or later
 * License URI: https://gnu.org
 * Text Domain: craftrank
 * Tags: full-site-editing, blog, theme-options, translation-ready, rtl-language-support, full-width-template
*/

/* --- SECURE FUNDAMENTALS --- */
html, body {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.wp-site-blocks, 
#wp--skip-link--target,
.wp-block-group {
    overflow: hidden !important;
    height: auto !important;
}

/* --- GŁADKIE PRZEWIJANIE STRONY (SMOOTH SCROLL) --- */
html {
    scroll-behavior: smooth;
}

/* Respektowanie ustawień systemowych użytkownika (Dostępność WCAG) */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}


/* --- SYSTEM UKRYWANIA NA URZĄDZENIACH (RWD) --- */
@media (max-width: 1024px) {
    .hide-on-mobile,
    .is-style-hide-on-mobile {
        display: none !important;
    }
}
@media (min-width: 1025px) {
    .hide-on-desktop,
    .is-style-hide-on-desktop {
        display: none !important;
    }
}


/* --- KLASY NARZĘDZIOWE DO KONTROLI CENTROWANIA NA MOBILE (ZAMIAST GLOBALNEGO PRZYMUSU) --- */
@media (max-width: 1024px) {
    /* Wystarczy dodać klasę .center-mob do Grupy w edytorze, aby ją bezpiecznie wycentrować */
    .center-mob {
        text-align: center !important;
    }
    .center-mob .wp-block-columns,
    .center-mob .wp-block-column,
    .center-mob .wp-block-buttons {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .center-mob .wp-block-image {
        display: flex !important;
        justify-content: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* --- ZAAWANSOWANE SIATKI ROZCIĄGANE (BOX/GRID STRETCH) --- */
/* Spycha ostatni element (np. przycisk) na sam dół grupy w kolumnie */
.wp-block-columns.grid-stretch > .wp-block-column > .wp-block-group > *:last-child {
    margin-top: auto !important;
}

@media (max-width: 768px) {
    .wp-block-columns.grid-stretch {
        grid-template-columns: 1fr !important;
    }
}

/* Wymusza dokładnie taką samą wysokość sąsiadujących kolumn i kafli */
.wp-block-columns.box-stretch {
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch !important;
}

.wp-block-columns.box-stretch .wp-block-column,
.wp-block-columns.box-stretch .wp-block-column > *,
.wp-block-columns.box-stretch .wp-block-group {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    flex: 1 1 auto !important;
}

@media (max-width: 782px) {
    .wp-block-columns.box-stretch {
        grid-auto-flow: row !important;
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    .wp-block-columns.box-stretch .wp-block-column {
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .wp-block-columns.box-stretch .wp-block-column > .wp-block-group {
        height: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* --- ESTETYCZNA PĘTLA BLOGA (QUERY LOOP - RÓWNE KAFLE) --- */
.wp-block-query ul.wp-block-post-template,
.wp-block-query-loop ul.wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    align-items: stretch !important;
}

.wp-block-query .wp-block-post,
.wp-block-query-loop .wp-block-post {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

.wp-block-query .wp-block-post > .wp-block-group,
.wp-block-query-loop .wp-block-post > .wp-block-group {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: 100% !important;
}

@media (max-width: 782px) {
    .wp-block-query ul.wp-block-post-template,
    .wp-block-query-loop ul.wp-block-post-template {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    .wp-block-query .wp-block-post,
    .wp-block-query-loop .wp-block-post,
    .wp-block-query .wp-block-post > .wp-block-group,
    .wp-block-query-loop .wp-block-post > .wp-block-group {
        height: auto !important;
        width: 100% !important;
    }
}

/* --- KLASY ZDOBNICZE I NARZĘDZIOWE --- */
/* Dodawanie cienia z płynnym przejściem (Klamra została poprawnie domknięta) */
.add-shadow {
    box-shadow: 0px 4px 12px 0px rgba(213, 221, 231, 0.55) !important;
}

/* Dodawanie żółtego cienia z płynnym przejściem (Klamra została poprawnie domknięta) */
.alt-shadow {
    box-shadow: 0px 4px 20px 0px rgba(255, 195, 0, 0.20) !important;
}

/* Wyjątek dla list: bezpieczne wyrównanie do lewej i naprawa kropek na mobile */
@media (max-width: 1024px) {
    .wp-block-column ul, 
    .wp-block-column ol,
    .wp-block-group ul, 
    .wp-block-group ol,
    ul.wp-block-list, 
    ol.wp-block-list {
        text-align: left !important;
        align-self: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        padding-left: 25px !important;
    }
    .wp-block-column li,
    .wp-block-group li,
    li.wp-block-list-item {
        text-align: left !important;
        margin-bottom: 8px;
    }
}

/* --- ODWRACANIE KOLUMN NA SMARTFONACH --- */
@media (max-width: 768px) {
    .wp-block-columns.reverse-on-mobile {
        display: flex !important;
        flex-direction: column-reverse !important;
    }
    .wp-block-columns.reverse-on-mobile > .wp-block-column {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }
    .wp-block-group.is-layout-row.reverse-on-mobile {
        display: flex !important;
        flex-direction: column-reverse !important;
    }
}

/* --- KLASA NARZĘDZIOWA: SZTYWNY PADDING itd NA MOBILE/TABLET --- */
@media (max-width: 768px) {
    /* Wpisz klasę p-mob-10 w edytorze w polu Dodatkowe klasy CSS */
    .p-mob-10 {
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
    }
    /* Wpisz klasę p-mob-15 w edytorze w polu Dodatkowe klasy CSS */
    .p-mob-15 {
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 1024px) {
    /* Wpisz klasę p-mob-10 w edytorze w polu Dodatkowe klasy CSS */
    .p-mob-10 {
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
    }
    /* Wpisz klasę p-mob-15 w edytorze w polu Dodatkowe klasy CSS */
    .p-mob-15 {
        padding-left: 25px !important;
        padding-right: 25px !important;
        box-sizing: border-box !important;
    }
}


/* ==========================================================================
    KOMPLEKSOWY I RESPONSYWNY LIFTING CONTACT FORM 7 (CRAFTRANK FORM)
    ========================================================================== */

.wpcf7 .wpcf7-form { 
    position: relative; 
    /* Używamy czcionki nagłówkowej z theme.json dla głównych etykiet pól */
    font-family: var(--wp--preset--font-family--inter), sans-serif !important;
    padding: 30px 0 0 0 !important; 
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Wymuszamy domyślne wyrównanie do lewej dla kontenerów pól formularza */
.wpcf7 .wpcf7-form > div, 
.wpcf7 .wpcf7-form > p { 
    margin-bottom: 1.2em; 
    box-sizing: border-box !important;
    text-align: left !important;
}

.wpcf7 .wpcf7-form-control-wrap { 
    width: 100%; 
    display: block; 
    box-sizing: border-box !important;
}

/* Pola tekstowe i obszar wiadomości (Tekst wpisywany przez użytkownika) */
.wpcf7 input:not([type=submit]):not([type=checkbox]), 
.wpcf7 select, 
.wpcf7 textarea { 
    /* Używamy czcionki zwykłego tekstu/akapitu z theme.json dla wpisywanej treści */
    font-family: var(--wp--custom--font-family--body), sans-serif !important;
    width: 100% !important; 
    padding: .75em !important; 
    box-sizing: border-box !important;
    border-radius: 6px;
    border: 1px solid #01131C !important; /* Dodana widoczna, neutralna ramka bazowa */
    background-color: #fff;
}

.wpcf7 input:not([type=submit]):not([type=checkbox]):focus, 
.wpcf7 select:focus, 
.wpcf7 textarea:focus { 
    border-color: #01131C !important; 
    outline: 0; 
    box-shadow: 0 0 0 2px rgba(1, 19, 28, 0.1); /* Delikatna poświata focusu */
}

/* Przycisk wysyłania - Płynny i Zsynchronizowany z Primary/Secondary z theme.json */
.wpcf7 input[type=submit] {
    font-family: var(--wp--preset--font-family--inter), sans-serif !important;
    text-transform: uppercase !important; 
    letter-spacing: 1px; 
    display: block !important;
    margin: 20px auto 0 auto !important; /* Centruje przycisk na środku formularza */
    padding: 16px 25px 15px 25px;
    font-size: 16px;
    
    /* Dynamiczne kolory i przejście pobierane z konfiguracji globalnej */
    background-color: var(--wp--preset--color--heading) !important; 
    color: var(--wp--preset--color--background) !important; 
    
    border: 1px solid var(--wp--preset--color--heading) !important;
    border-radius: 4px; 
    cursor: pointer;
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out, border-color 0.25s ease-in-out !important;
}

/* Efekt najechania na przycisk (Hover) - zabezpieczony kontrast */
.wpcf7 input[type=submit]:hover {
    background-color: var(--wp--preset--color--background) !important; 
    color: var(--wp--preset--color--heading) !important; /* Odwrócenie kolorów dla czytelności */
}

/* --- IDEALNE WYRÓWNANIE I BLOKADA CHECKBOXA ZGODY (RODO) --- */
.wpcf7 .wpcf7-form .wpcf7-checkbox .wpcf7-list-item {
    display: block !important;
    text-align: left !important;
    margin: 15px 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Elastyczny wiersz pozycjonujący kwadracik względem tekstu */
.wpcf7 .wpcf7-form .wpcf7-checkbox .wpcf7-list-item label {
    display: flex !important;
    flex-direction: row !important; 
    align-items: flex-start !important; /* Wyrównuje kwadracik idealnie do 1. linijki tekstu zgody */
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    cursor: pointer;
}

/* Pancerna blokada rozmiaru i deformacji małego kwadracika checkboxa */
.wpcf7 .wpcf7-form .wpcf7-checkbox input[type="checkbox"] {
    width: 16px !important; 
    height: 16px !important;
    margin-top: 4px !important; 
    margin-right: 14px !important; 
    margin-left: 0 !important; 
    flex-shrink: 0 !important; /* Nie pozwala na zgniatanie kwadracika na mniejszych ekranach */
    cursor: pointer;
}

/* Treść samej klauzuli prawnej RODO */
.wpcf7 .wpcf7-form .wpcf7-checkbox .wpcf7-list-item-label {
    /* Tekst samej zgody RODO pisany jest czcionką zwykłej treści podstrony */
    font-family: var(--wp--custom--font-family--body), sans-serif !important;
    display: inline !important;
    text-align: left !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
}

/* Obsługa komunikatów walidacji Contact Form 7 */
.wpcf7 form .wpcf7-not-valid-tip {
    font-size: 13px !important;
    color: #dc2626 !important;
    margin-top: 4px !important;
}

.wpcf7 form.invalid .wpcf7-not-valid,
.wpcf7 form.unaccepted .wpcf7-not-valid {
    border-color: #dc2626 !important;
}

.wpcf7-response-output {
    margin: 20px 0 0 0 !important;
    padding: 10px 15px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    text-align: center !important;
}

/* --- SZYBKI FIX DLA WYŚRODKOWANIA MENU POD HAMBURGEREM --- */
@media (max-width: 1024px) {
    /* 1. Celujemy bezpośrednio w natywny kontener okna modalnego hamburgera (Overlay) */
    .wp-block-navigation__responsive-container-open .wp-block-navigation__responsive-container-content,
    .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin: 0 auto !important;
        text-align: center !important;
        width: 100% !important;
    }

    /* Wyrównujemy same odnośniki wewnątrz hamburgera */
    .wp-block-navigation__responsive-container-open .wp-block-navigation-item,
    .wp-block-navigation__responsive-container-open .wp-block-navigation-link {
        text-align: center !important;
        margin: 10px 0 !important; /* Estetyczny odstęp pionowy między linkami w hamburgerze */
    }

    /* 2. POPRAWKA STOPKI: Bezpieczne i stabilne centrowanie menu w stopce z klasą .center-mob */
    .center-mob .wp-block-navigation:not(.has-responsive-menu) ul.wp-block-navigation__container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: auto !important; /* Zapobiega rozciąganiu i wyrównywaniu do lewej */
        margin: 0 auto !important;
    }
}

/* --- NIEZAWODNY FIX NA PRZYCISKI (ZSYNCHRONIZOWANY Z THEME.JSON) --- */

/* Stan bazowy - dodajemy płynność dla koloru tła i tekstu */
.wp-block-button__link,
input[type="submit"] {
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out !important;
}

/* Stan Hover - płynna zmiana koloru tła na Secondary */
.wp-block-button__link:hover,
.wp-block-button .wp-block-button__link:hover,
input[type="submit"]:hover {
    background-color: var(--wp--preset--color--background) !important;
    color: var(--wp--preset--color--heading) !important; /* Gwarantuje idealny kontrast tekstu */
}


/* ==========================================================================
   AUTORSKI SYSTEM STYLIZACJI MENU (CRAFTRANK NAVIGATION)
   ========================================================================== */

/* --- Płynność dla wszystkich linków w menu --- */
.wp-block-navigation .wp-block-navigation-item a,
.wp-block-navigation .wp-block-navigation-link {
    transition: color 0.25s ease-in-out !important;
}

/* --- Stan Hover: Po najechaniu myszką --- */
.wp-block-navigation .wp-block-navigation-item a:hover,
.wp-block-navigation .wp-block-navigation-link:hover {
    color: var(--wp--preset--color--secondary) !important;
}

/* --- Stan Active: Podświetlenie aktualnej strony --- */
.wp-block-navigation .current-menu-item a,
.wp-block-navigation .current_page_item a,
.wp-block-navigation .wp-block-navigation-item.current-menu-item .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-item.current-menu-ancestor .wp-block-navigation-item__content {
    color: var(--wp--preset--color--secondary) !important;
}



/* ==========================================================================
   KLASA NARZĘDZIOWA: KAFELKI KONTAKTOWE JEDNO POD DRUGIM (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1250px) {
    /* 1. Przełączamy kontener główny Kolumn w pionowy stos Flexbox */
    body .wp-block-columns.contact-grid,
    body .wp-block-columns.contact-grid.is-layout-flex {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important; /* Estetyczny odstęp pionowy między kafelkami */
    }

    /* 2. Zmuszamy absolutnie każdą kolumnę w środku do zajęcia 100% szerokości ekranu */
    body .wp-block-columns.contact-grid > .wp-block-column,
    body .wp-block-columns.contact-grid > .wp-block-column.is-layout-flow {
        flex-basis: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 0 10px 0 !important;
    }

    /* 3. Wymuszamy, by wewnętrzne białe kafelki rozciągały się na całą dostępną przestrzeń */
    body .wp-block-columns.contact-grid > .wp-block-column > * {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Klasa narzędziowa do centrowania akordeonu z notą prawną RRSO */
.u-details-centered {
    display: block !important;
    width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 20px !important;
    margin-bottom: 10px !important;
    text-align: center !important;
}

/* Stylizacja tekstu linku rozwijającego */
.u-details-centered > summary {
    font-family: var(--wp--preset--font-family--inter) !important;
    font-size: 14px !important;
    color: var(--wp--preset--color--primary) !important; /* Twój złoty #E8B866 */
    cursor: pointer !important;
    font-weight: 500 !important;
    transition: color 0.2s ease !important;
}

.u-details-centered > summary:hover {
    color: var(--wp--preset--color--secondary) !important; /* Twój granat #031B3B */
}

/* Wyśrodkowanie ukrytej treści (noty prawnej) po rozwinięciu */
.u-details-centered .wp-block-paragraph,
.u-details-centered p {
    font-size: 12px !important;
    color: var() !important;
    margin-top: 10px !important;
    text-align: center !important;
    max-width: 600px !important; /* Ograniczenie szerokości tekstu prawnego dla lepszego UX */
}

/* Klasa dla przycisków mobilnych 12px */
@media (max-width: 768px) {
    .btn-mobile-sm .wp-block-button__link {
        font-size: 12px !important; /* Tutaj wpisz docelowy rozmiar na desktop */
    }
	
    /* Centrowanie kontenera przycisków na mobile */
    .btn-mobile-sm.wp-block-buttons {
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Padding góra/dół 50px wyłącznie na mobile */
@media (max-width: 767px) {
    .pad-y-mobile-50 {
        padding-top: 50px !important;
        padding-bottom: 50px !important;
    }
}

/* Zmiana zaokrąglenia rogów obrazu wyłącznie na mobile */
@media (max-width: 767px) {
    .img-corner-mobile img {
        /* Resetujemy zaokrąglenia z PC */
        border-top-right-radius: 0px !important;
        border-bottom-right-radius: 0px !important;
        
        /* Wdrażamy nowe zaokrąglenia na dół obrazu */
        border-bottom-left-radius: 6px !important;  /* Tutaj wpisz swoją wartość, np. 12px lub 16px */
        border-bottom-right-radius: 6px !important; /* Wartość musi być taka sama dla obu dolnych rogów */
    }
}

/*Nagłówki stopka */
.custom-header-size {
    font-size: 22px !important;
}

@media (max-width: 767px) {
    /* Wymuszenie centrowania tekstu/elementów liniowych w kontenerze */
    .wp-block-navigation .is-style-logos-only,
    .is-style-logos-only {
        display: block !important;
        text-align: center !important;
        padding: 0 !important;
        margin: auto !important;
        width: 100% !important;
    }
}

/* --- Przycisk Akceptuj wszystko (Pełne tło) --- */
.cky-consent-container .cky-btn-accept {
    background-color: #121317 !important; /* Nowy kolor główny */
    color: #ffffff !important;           /* Biały tekst */
    border-radius: 4px !important;       /* Zaokrąglenie 4px */
    border: 1px solid #121317 !important; 
    padding: 12px 24px !important;       
    font-weight: bold !important;        
}

/* --- Przycisk Odrzuć wszystko (Styl czysty/ramka) --- */
.cky-consent-container .cky-btn-reject {
    background-color: transparent !important; /* Przezroczyste tło */
    color: #121317 !important;               /* Tekst w kolorze głównym */
    border-radius: 4px !important;           /* Zaokrąglenie 4px */
    border: 1px solid #121317 !important;    /* Ramka w kolorze głównym */
    padding: 12px 24px !important;
    font-weight: bold !important;
}

/* --- Przycisk Dostosuj/Ustawienia (Styl tekstowy) --- */
.cky-consent-container .cky-btn-customize {
    background-color: transparent !important;
    color: #121317 !important;               /* Tekst w kolorze głównym */
    border-radius: 4px !important;           /* Zaokrąglenie 4px */
    border: none !important;                 /* Bez ramki */
    padding: 12px 24px !important;
    font-weight: bold !important;
    text-decoration: underline !important;   /* Podkreślenie dla wyróżnienia */
}

.cky-btn-revisit-wrapper {
	background: #121317 !important;
}

.cky-btn-preferences {
	background-color: transparent !important;
    color: #121317 !important;               /* Tekst w kolorze głównym */
    border: 1px solid
    border-radius: 4px !important;           /* Zaokrąglenie 4px */
    border-color: #121317 !important; 
    padding: 12px 24px !important;
    font-weight: bold !important;
}