/* --- themes/base.css --- */

/* SZKIELET I STYLE BAZOWE */

/* Reset i Fonty */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s ease;
}

.container-center {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* LOGO SECTION */
.logo-box {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    min-width: 0;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    text-transform: uppercase;
}

/* Polyfill for fa-fence (FontAwesome Pro icon) */
.fa-fence, i.fa-fence, .fa-solid.fa-fence {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1em !important;
    height: 1em !important;
    vertical-align: -0.125em !important;
    position: relative !important;
}
.fa-fence::before, i.fa-fence::before, .fa-solid.fa-fence::before {
    content: "" !important;
    display: block !important;
    width: 1em !important;
    height: 1em !important;
    background-color: currentColor !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3Cpath d='M6 8h4'/%3E%3Cpath d='M6 18h4'/%3E%3Cpath d='m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3Cpath d='M14 8h4'/%3E%3Cpath d='M14 18h4'/%3E%3Cpath d='m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3C/svg%3E") no-repeat center / contain !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3Cpath d='M6 8h4'/%3E%3Cpath d='M6 18h4'/%3E%3Cpath d='m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3Cpath d='M14 8h4'/%3E%3Cpath d='M14 18h4'/%3E%3Cpath d='m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z'/%3E%3C/svg%3E") no-repeat center / contain !important;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: #fff !important;
    
    letter-spacing: -1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* NAWIGACJA */
.site-nav {
    background: #0f172a;
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: #fff;
    opacity: 0.8;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}

.nav-menu a:hover {
    opacity: 1;
    color: var(--accent);
}

/* HAMBURGER */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
    flex-shrink: 0;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    transition: 0.3s;
}

/* GRID & CARDS */
.grid-3 {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    grid-template-rows: 240px 240px;
    gap: 15px;
    margin: 25px 0;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tile,
.card,
.btn-read,
.logo-icon,
.site-nav,
article,
aside,
img {
    border-radius: 0 !important;
}

/* DOMYŚLNY WYGLĄD KAFELKA (IMAGE OVERLAY) */
.tile {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #000;
    height: 100%;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: 0.4s;
}

.tile:hover img {
    opacity: 0.8;
    transform: scale(1.03);
}

.tile-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 25px;
    /* Subtelny gradient od dołu */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 40%, transparent 100%);
    color: white;
}

.tile-text h3 {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* LAYOUT - SIDEBAR */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-bottom: 50px;
    align-items: start;
}

/* DOMYŚLNY WYGLĄD KARTY */
.card {
    position: relative;
    background: #000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s;
    overflow: hidden;
    height: 320px;
}

.card:hover {
    transform: translateY(-5px);
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: 0.4s;
}

.card:hover img {
    opacity: 0.9;
}

.card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    /* Subtelny gradient od dołu */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.card-body h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #fff !important;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* PRZYCISKI */
.btn-read {
    display: inline-block;
    padding: 10px 22px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
    font-size: 11px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: 0.2s;
}

.btn-read:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

/* RESPONSIVE */
@media (max-width: 950px) {
    .content-layout {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .tile-big {
        grid-row: auto;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: #0f172a;
        padding: 20px;
        gap: 15px;
        border-bottom: 3px solid var(--primary);
    }

    .nav-menu.active {
        display: flex;
    }
}

/* Obrazki w treści artykułu i podpisy pod zdjęciami */
#view-post #p-body img,
#view-post .post-content img,
#p-body img,
.post-content img,
article img,
.article-content img {
    margin-bottom: 4px !important;
}

#view-post #p-body p:has(img),
#p-body p:has(img),
.post-content p:has(img),
article p:has(img) {
    margin-bottom: 2px !important;
}

#p-body .image-caption,
.post-content .image-caption,
#view-post .image-caption,
.article-content .image-caption,
.image-caption,
figcaption {
    font-size: 11px !important;
    color: var(--text-muted, #64748b) !important;
    margin-top: 2px !important;
    margin-bottom: 22px !important;
    text-align: left !important;
    font-style: italic !important;
    line-height: 1.4 !important;
    display: block !important;
}

/* Wyrównanie tekstu */
.ql-align-center, [style*="text-align: center"], [style*="text-align:center"] {
    text-align: center !important;
}
.ql-align-right, [style*="text-align: right"], [style*="text-align:right"] {
    text-align: right !important;
}
.ql-align-justify, [style*="text-align: justify"], [style*="text-align:justify"] {
    text-align: justify !important;
}
.ql-align-left, [style*="text-align: left"], [style*="text-align:left"] {
    text-align: left !important;
}

/* Zmniejszone odstępy przed nagłówkami H2 i H3 w treści */
#p-body h2,
.post-content h2,
.article-content h2,
#view-post h2,
article h2 {
    margin-top: 1.15em !important;
    margin-bottom: 0.45em !important;
    line-height: 1.3 !important;
}

#p-body h2:first-child,
.post-content h2:first-child,
.article-content h2:first-child,
#view-post h2:first-child,
article h2:first-child {
    margin-top: 0 !important;
}

#p-body h3,
.post-content h3,
.article-content h3,
#view-post h3,
article h3 {
    margin-top: 1.05em !important;
    margin-bottom: 0.4em !important;
    line-height: 1.3 !important;
}

#p-body h3:first-child,
.post-content h3:first-child,
.article-content h3:first-child,
#view-post h3:first-child,
article h3:first-child {
    margin-top: 0 !important;
}

#p-body h4,
.post-content h4,
.article-content h4,
#view-post h4,
article h4 {
    margin-top: 0.95em !important;
    margin-bottom: 0.35em !important;
    line-height: 1.3 !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
}

#p-body h4:first-child,
.post-content h4:first-child,
.article-content h4:first-child,
#view-post h4:first-child,
article h4:first-child {
    margin-top: 0 !important;
}

/* Styl sekcji FAQ i akordeonów */
.faq-box, details.faq-item, #p-body details, .post-content details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}
.faq-box summary, details.faq-item summary, #p-body details summary, .post-content details summary {
    font-weight: 700;
    color: var(--text-main, #1e293b);
    cursor: pointer;
    user-select: none;
    font-size: 1.05rem;
}
.faq-box[open], details.faq-item[open], #p-body details[open], .post-content details[open] {
    background: #ffffff;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.faq-box p, details.faq-item p, #p-body details p, .post-content details p {
    margin-top: 10px;
    margin-bottom: 0;
    color: var(--text-muted, #475569);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Wideo i iframe */
#p-body iframe, .post-content iframe, .article-content iframe, iframe.ql-video {
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 280px;
    max-height: 520px;
    border-radius: var(--radius, 8px);
    margin: 20px 0;
    border: none;
}

/* Linie poziome (HR) */
#p-body hr, .post-content hr, .article-content hr, hr.ql-divider {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 28px 0;
}

/* --- FAIL-SAFE DLA PANELU ADMINISTRATORA --- */
.admin-panel-overlay:not([style*="display: block"]):not([style*="display:block"]) {
    display: none !important;
}
