/*
Theme Name: aTheme
Theme URI: https://chlopaki.agency
Author: chłopaki sp. z o.o.
Author URI: https://chlopaki.agency
Description: Dedykowany motyw stworzony dla klientów z dbałością o optymalizację (Page Speed).
Version: 1.0.1
License: All rights reserved.
Text Domain: atheme
*/

*, *::before, *::after {
    box-sizing: border-box;
}

/* Fix dla pasków przewijania Windows przy .alignfull */
html, body {
    overflow-x: clip;
}

:root {
    /* Podstawowa paleta kolorów */
    --ath-primary-color: #2563eb;
    --ath-secondary-color: #334155;
    --ath-accent-color: #f59e0b;
    
    /* Kolory strukturalne */
    --ath-bg-color: #ffffff;
    --ath-text-color: #1e293b;

    /* Typografia */
    --ath-font-body: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ath-font-heading: 'Outfit', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Zaokrąglenia */
    --ath-border-radius-btn: 0.5rem;
    --ath-border-radius-img: 0.5rem;
    --ath-border-radius-input: 0.5rem;
}

body {
    background-color: var(--ath-bg-color);
    color: var(--ath-text-color);
    font-family: var(--ath-font-body);
    font-weight: var(--ath-body-font-weight, normal);
    text-transform: var(--ath-body-text-transform, none);
    letter-spacing: var(--ath-body-letter-spacing, normal);
    line-height: var(--ath-body-line-height, 1.6);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ath-font-heading);
    color: #0f172a;
}

h1, .h1 {
    font-size: var(--ath-h1-size, 2.5rem);
    font-weight: var(--ath-h1-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h1-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h1-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h1-line-height, var(--ath-heading-line-height, 1.2));
}

h2, .h2 {
    font-size: var(--ath-h2-size, 2rem);
    font-weight: var(--ath-h2-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h2-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h2-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h2-line-height, var(--ath-heading-line-height, 1.2));
}

h3, .h3 {
    font-size: var(--ath-h3-size, 1.75rem);
    font-weight: var(--ath-h3-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h3-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h3-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h3-line-height, var(--ath-heading-line-height, 1.2));
}

h4, .h4 {
    font-size: var(--ath-h4-size, 1.5rem);
    font-weight: var(--ath-h4-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h4-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h4-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h4-line-height, var(--ath-heading-line-height, 1.2));
}

h5, .h5 {
    font-size: var(--ath-h5-size, 1.25rem);
    font-weight: var(--ath-h5-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h5-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h5-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h5-line-height, var(--ath-heading-line-height, 1.2));
}

h6, .h6 {
    font-size: var(--ath-h6-size, 1rem);
    font-weight: var(--ath-h6-font-weight, var(--ath-heading-font-weight, bold));
    text-transform: var(--ath-h6-text-transform, var(--ath-heading-text-transform, none));
    letter-spacing: var(--ath-h6-letter-spacing, var(--ath-heading-letter-spacing, normal));
    line-height: var(--ath-h6-line-height, var(--ath-heading-line-height, 1.2));
}

/* Linki */
a {
    text-decoration: var(--ath-link-text-decoration, none);
    color: var(--ath-accent-color);
    font-weight: var(--ath-link-font-weight, inherit);
    text-transform: var(--ath-link-text-transform, inherit);
    letter-spacing: var(--ath-link-letter-spacing, normal);
}

a:hover {
    text-decoration: underline;
}

/* ----- PRZYCISKI (BUTTONS) ----- */
.wp-block-button__link {
    text-decoration: none !important;
    transition: all 0.3s ease-in-out;
    border-radius: var(--ath-border-radius-btn);
}

.wp-block-button__link:hover,
a.wp-block-button__link:hover {
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: var(--ath-shadow-btn-hover, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06));
    filter: brightness(1.1);
}

/* Domyślne kolory przycisku (jeśli w edytorze blokowym nie nadano własnych) */
.wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-text-color) {
    color: #ffffff;
}

.wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background):not(.has-background-color) {
    background-color: var(--ath-accent-color);
}

/* Domyślne kolory dla przycisku w wersji Outline */
.wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color) {
    color: var(--ath-accent-color);
}


/* Nawigacja Główna (Header) */
.main-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.main-navigation li {
    position: relative;
}
.main-navigation a {
    color: var(--ath-text-color);
    font-weight: 500;
    transition: color 0.3s ease, background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}
.main-navigation a:hover {
    color: var(--ath-primary-color);
}

/* Dropdown Sub-menu w nagłówku */
.main-navigation .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--ath-bg-color);
    box-shadow: var(--ath-shadow-menu, 0 8px 16px rgba(0,0,0,0.1));
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    display: none; /* Domyślnie ukryte */
    min-width: 220px;
    z-index: 999;
    border-radius: var(--ath-border-radius-btn, 0.375rem);
    flex-direction: column;
    gap: 0;
}
.main-navigation li:hover > .sub-menu {
    display: flex;
}
.main-navigation .sub-menu li {
    width: 100%;
}
.main-navigation .sub-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 0.9em;
    font-weight: 400;
}
.main-navigation .sub-menu a:hover {
    background-color: rgba(0,0,0,0.03);
}

/* Kolejne poziomy zagnieżdżenia w nagłówku (potomkowie sub-menu) */
.main-navigation .sub-menu .sub-menu {
    top: 0;
    left: 100%;
    margin-left: 1px;
}

/* Menu Stopki */
.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.footer-nav-centered > ul {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Wyrównanie wysokości wszystkich slajdów (kart) do równej wysokości */
.ath-carousel-posts .splide__list {
    align-items: stretch !important;
}

.ath-carousel-posts .wp-block-post {
    display: flex;
    flex-direction: column;
    height: auto !important; 
}

/* Wypchnięcie dolnego elementu (np. przycisków i linku Czytaj dalej) na sam dół */
.ath-carousel-posts .wp-block-post > *:last-child {
    margin-top: auto;
}

/* Sztywne ucięcie zajawki (excerpt) do 3 wierszy z wielokropkiem */
.ath-carousel-posts .wp-block-post-excerpt__excerpt,
.ath-carousel-posts .wp-block-post-excerpt p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rozciągnięcie wewnętrznych kontenerów układu (Gutenberg Group) dodawanych przez użytkownika */
.ath-carousel-posts .wp-block-post > .wp-block-group {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-grow: 1;
}
.ath-carousel-posts .wp-block-post > .wp-block-group > *:last-child {
    margin-top: auto;
}

/* Placeholder dla brakujących wpisów w karuzeli */
.ath-post-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    height: auto; 
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--ath-border-radius-btn, 0.5rem);
    color: #9ca3af;
    text-align: left;
    padding: 1.5rem;
    box-sizing: border-box;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.ath-post-placeholder:hover {
    opacity: 0.7;
}
.ath-post-placeholder-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.ath-post-placeholder svg {
    opacity: 0.4;
}
.ath-post-placeholder h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    font-family: var(--ath-font-heading);
    color: #9ca3af;
}
.ath-post-placeholder p {
    margin: 0;
    font-size: 0.875rem;
    font-family: var(--ath-font-body);
}

/* Przycisk Hamburger Menu */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 9999;
}
.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}
.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;
}
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
    width: 30px;
    height: 3px;
    background-color: var(--ath-text-color);
    border-radius: 4px;
    position: absolute;
    transition: transform 0.15s ease, background-color 0.15s ease;
}
.hamburger-inner::before, .hamburger-inner::after {
    content: "";
    display: block;
}
.hamburger-inner::before { top: -8px; }
.hamburger-inner::after { bottom: -8px; }

.menu-toggle.is-active .hamburger-inner { background-color: transparent; }
.menu-toggle.is-active .hamburger-inner::before { transform: translateY(8px) rotate(45deg); }
.menu-toggle.is-active .hamburger-inner::after { transform: translateY(-8px) rotate(-45deg); }

/* Wersja Mobilna Menu */
@media screen and (max-width: 991px) {
    .menu-toggle {
        display: block;
    }
    .site-header .ath-justify-content-between {
        flex-wrap: wrap;
    }
    .main-navigation {
        display: none;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-top: 1rem;
        background: var(--ath-bg-color);
        padding: 1.5rem;
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
        position: absolute;
        left: 50%;
        border-top: 1px solid rgba(0,0,0,0.05);
        z-index: 1000;
    }
    .main-navigation.toggled {
        display: block;
    }
    .main-navigation ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .main-navigation .sub-menu {
        position: static;
        box-shadow: none;
        padding-left: 1rem;
        display: none;
        min-width: 100%;
        margin-top: 10px;
    }
    .main-navigation li:hover > .sub-menu,
    .main-navigation li:focus-within > .sub-menu {
        display: flex;
    }
}

/* W stopce podmenu pokazujemy jako wcięcie */
.footer-nav .sub-menu {
    padding-left: 1rem;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-nav a {
    color: var(--ath-text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
.footer-nav a:hover {
    color: var(--ath-primary-color);
}

/* Klasy pomocnicze (Patterns) dla uniknięcia błędów parsowania in-line w edytorze blokowym */
.ath-radius { border-radius: var(--ath-border-radius-img) !important; overflow: hidden; }

/* Karta z efektem uniesienia i podświetlenia (Hover) */
.ath-card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}
.ath-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--ath-shadow-card, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));
    border-color: var(--ath-accent-color) !important;
}

/* --- Karuzele (Splide.js nadpisanie motywu) --- */
.splide {
    /* Usuwamy wewnętrzny margines, by slider (track) zgrywał się co do piksela w linii z resztą treści */
    padding: 0;
}
.splide__track {
    /* Miejsce pionowe na podskoczenie karty (hover: -5px) + poziome paddingi na odstęp cienia (0.75rem to połowa odstępu gap) */
    padding: 25px 0.75rem !important;
    /* Rekompensujemy padding na krawędziach ujemnym marginesem, by slajdy zgrywały się w pionie ze statyczną treścią */
    margin: -15px -0.75rem -25px -0.75rem !important;
}

.splide__track::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
    box-shadow: inset 40px 0 40px -40px rgba(0, 0, 0, 0.07), inset -40px 0 40px -40px rgba(0, 0, 0, 0.07);
    border-left: 1px solid #33333340;
    border-right: 1px solid #33333340;
    border-radius: 5px;
}

.splide__pagination__page.is-active {
    background: var(--ath-accent-color) !important;
}
.splide__arrow {
    background: var(--ath-bg-color) !important;
    border: 1px solid rgba(0,0,0,0.1);
    top: 50%;
    width: 4em !important;
    height: 4em !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Wypuszczamy strzałki całkowicie na zewnątrz slidera (-7em) */
.splide__arrow--prev {
    left: -7em !important;
}
.splide__arrow--next {
    right: -7em !important;
}

.splide__arrow svg {
    fill: var(--ath-accent-color) !important;
    width: 1.5em;
    height: 1.5em;
}

/* Ukrywamy strzałki na mniejszych urządzeniach mobilnych, polegając na "drag and swipe" */
@media (max-width: 768px) {
    .splide__arrow {
        display: none !important;
    }
}

/* Ukrycie strzałek, gdy brak elementów do przewijania (rozwiązuje problem małej liczby postów) */
.splide__arrow:disabled {
    display: none !important;
}

/* Ukrycie kropek paginacji, gdy istnieje tylko jedna kropka / jedna strona */
.splide__pagination:has(li:only-child),
.splide__pagination li:only-child {
    display: none !important;
}

/* Cienie */
.ath-shadow {
    box-shadow: var(--ath-shadow-card, 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025));
}

.ath-shadow-img {
    box-shadow: var(--ath-shadow-img, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.ath-shadow-menu {
    box-shadow: var(--ath-shadow-menu, 0 8px 16px rgba(0,0,0,0.1));
}

/* Pola formularzy - focus ring */
input:focus, textarea:focus, select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    border-color: var(--ath-primary-color);
}

/* Wsparcie dla stron i edytora blokowego (Gutenberg) */
.entry-content {
    margin-top: 4rem;
    margin-bottom: 4rem;
}

/* Ograniczenie szerokości tekstu do wąskiej, czytelnej kolumny dla zwykłych elementów */
.entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright) {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
}

/* Wyrównania WP */
.alignnone { margin: 0; }
.aligncenter { display: block; margin: 0 auto; text-align: center; }
.alignleft { float: left; margin: 0 1.5rem 1.5rem 0; }
.alignright { float: right; margin: 0 0 1.5rem 1.5rem; }

/* Wzorce - Pełne szerokości - omijają wąski grid strony */
.alignwide {
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

.alignfull {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    max-width: 100vw;
}
