/* ===================================
   SEMTAK Base — base.css
   Wspolne style dla wszystkich zaplecz.
   Prefix: stb- (semtak-base)
   =================================== */

/* === Reset === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text, #2c3e50);
    background-color: var(--color-bg, #f8f9fa);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-primary, #333);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-accent, #d4a574);
}

/* === CSS Custom Properties (child nadpisuje) === */
:root {
    --color-primary: #333333;
    --color-bg: #f8f9fa;
    --color-text: #2c3e50;
    --color-accent: #d4a574;
    --color-header-bg: #1a1a2e;
    --color-header-text: #ffffff;
    --color-footer-bg: #1a1a2e;
    --color-footer-text: #cccccc;
    --color-card-bg: #ffffff;
    --color-border: #e0e0e0;
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --container-width: 1200px;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* === Container === */
.stb-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Header === */
.stb-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-header-bg);
    color: var(--color-header-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stb-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 1rem;
}

.stb-site-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-header-text);
    text-decoration: none;
}

.stb-site-title:hover {
    color: var(--color-accent);
}

.stb-header .custom-logo-link img {
    max-height: 50px;
    width: auto;
}

/* === Navigation === */
.stb-nav .stb-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.stb-nav .stb-menu li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-header-text);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
}

.stb-nav .stb-menu li a:hover,
.stb-nav .stb-menu li.current-menu-item a {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-accent);
}

/* Sub-menu */
.stb-nav .stb-menu li {
    position: relative;
}

.stb-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--color-header-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    list-style: none;
    z-index: 101;
    padding: 0.5rem 0;
}

.stb-nav .stb-menu li:hover > .sub-menu {
    display: block;
}

.stb-nav .sub-menu li a {
    padding: 0.4rem 1.25rem;
    font-size: 0.85rem;
}

/* Hamburger */
.stb-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.stb-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-header-text);
    transition: transform 0.3s, opacity 0.3s;
}

.stb-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.stb-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.stb-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === Main Content === */
.stb-main {
    padding: 2rem 0;
    min-height: 60vh;
}

/* === Layout: Content + Sidebar === */
.stb-layout-sidebar .stb-layout-inner {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    align-items: start;
}

/* === Post Grid (archive, index) === */
.stb-post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* === Card === */
.stb-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s, transform 0.3s;
}

.stb-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stb-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.stb-card-thumb {
    aspect-ratio: 370 / 250;
    overflow: hidden;
}

.stb-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.stb-card:hover .stb-card-thumb img {
    transform: scale(1.05);
}

.stb-card-body {
    padding: 1.25rem;
}

.stb-card-cat {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.stb-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.stb-card-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.stb-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #999;
}

/* === Article Content (single.php) === */
.stb-post-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.stb-post-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.stb-featured-image {
    margin-bottom: 2rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.stb-featured-image img {
    width: 100%;
}

.stb-post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.stb-post-content h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    color: var(--color-text);
}

.stb-post-content h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--color-text);
}

.stb-post-content h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.stb-post-content p {
    margin-bottom: 1.25rem;
}

.stb-post-content ul,
.stb-post-content ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.stb-post-content li {
    margin-bottom: 0.5rem;
}

.stb-post-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--color-accent);
    background: rgba(0, 0, 0, 0.02);
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.stb-post-content img {
    border-radius: var(--radius);
    margin: 1.5rem auto;
}

.stb-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.stb-post-content th,
.stb-post-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.stb-post-content th {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    font-weight: 600;
}

/* === Tags === */
.stb-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.stb-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    color: #666;
}

.stb-tag a {
    color: inherit;
}

.stb-tag:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* === Related Posts === */
.stb-related {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.stb-related-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.stb-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.stb-related-card {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s;
}

.stb-related-card:hover {
    box-shadow: var(--shadow-hover);
}

.stb-related-thumb {
    aspect-ratio: 370 / 250;
    overflow: hidden;
}

.stb-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stb-related-card-title {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

/* === Sidebar === */
.stb-sidebar {
    position: sticky;
    top: 80px;
}

.stb-widget {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.stb-widget-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-accent);
}

.stb-widget ul {
    list-style: none;
}

.stb-widget ul li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.stb-widget ul li:last-child {
    border-bottom: none;
}

.stb-widget ul li a {
    font-size: 0.9rem;
}

/* === Breadcrumbs === */
.stb-breadcrumbs {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.stb-breadcrumbs a {
    color: #888;
}

.stb-breadcrumbs a:hover {
    color: var(--color-accent);
}

.stb-breadcrumbs-sep {
    margin: 0 0.4rem;
    color: #ccc;
}

.stb-breadcrumbs-current {
    color: var(--color-text);
}

/* === Archive Header (page title bar) === */
.stb-archive-header {
    background: var(--color-bg-alt, #f5f5f5);
    margin-bottom: 2rem;
}

.stb-archive-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    max-height: 100px;
    padding-top: 1rem;
    padding-bottom: 1rem;
    gap: 1.5rem;
}

.stb-archive-header h1,
.stb-archive-header .stb-post-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.stb-archive-header .stb-breadcrumbs {
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.stb-archive-desc {
    margin-top: 0.5rem;
    color: #666;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .stb-archive-header-inner {
        flex-direction: column;
        align-items: flex-start;
        max-height: none;
        gap: 0.25rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .stb-archive-header h1,
    .stb-archive-header .stb-post-title {
        font-size: 1.2rem;
    }
}

/* === Pagination === */
.navigation.pagination {
    margin-top: 2.5rem;
    text-align: center;
}

.navigation.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

.navigation.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-card-bg);
    box-shadow: var(--shadow);
    transition: background 0.2s, color 0.2s;
}

.navigation.pagination .page-numbers:hover,
.navigation.pagination .page-numbers.current {
    background: var(--color-header-bg);
    color: var(--color-header-text);
}

/* === TOC === */
.stb-toc {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem;
}

.stb-toc-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.stb-toc-list {
    padding-left: 1.25rem;
}

.stb-toc-list li {
    margin-bottom: 0.3rem;
}

.stb-toc-list li a {
    font-size: 0.9rem;
    color: var(--color-text);
}

.stb-toc-list li a:hover {
    color: var(--color-accent);
}

.stb-toc-sub {
    margin-left: 1rem;
    font-size: 0.85rem;
}

/* === Footer === */
.stb-footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 2rem 0;
    margin-top: 3rem;
}

.stb-footer-links {
    margin-bottom: 1rem;
}

.stb-footer-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
    gap: 1rem;
}

.stb-footer-menu li a {
    color: var(--color-footer-text);
    font-size: 0.9rem;
}

.stb-footer-menu li a:hover {
    color: var(--color-accent);
}

.stb-footer-legal {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
}

.stb-footer-legal p {
    margin-bottom: 0.25rem;
}

/* === 404 === */
.stb-404 {
    text-align: center;
    padding: 4rem 0;
}

.stb-404 h1 {
    font-family: var(--font-heading);
    font-size: 6rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
}

.stb-404 p {
    font-size: 1.2rem;
    color: #666;
    margin: 1rem 0 2rem;
}

/* === Button === */
.stb-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--color-header-bg);
    color: var(--color-header-text);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.2s;
}

.stb-btn:hover {
    transform: translateY(-1px);
    color: var(--color-header-text);
    opacity: 0.9;
}

/* === Back to Top === */
.stb-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-header-bg);
    color: var(--color-header-text);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow-hover);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 50;
}

.stb-back-to-top:hover {
    transform: translateY(-2px);
}

/* === No Results === */
.stb-no-results {
    text-align: center;
    padding: 3rem 0;
}

.stb-no-results h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stb-no-results p {
    color: #666;
    margin-bottom: 1rem;
}

/* === Reading Time === */
.stb-reading-time::before {
    content: '⏱ ';
}

/* === Homepage Sections (used by child front-page.php) === */
.stb-section {
    margin-bottom: 3rem;
}

.stb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.stb-section-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.stb-section-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-accent);
}

/* === Slider (homepage) === */
.stb-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.stb-slider-track {
    display: flex;
    transition: transform 0.5s ease;
}

.stb-slide {
    min-width: 100%;
    position: relative;
}

.stb-slide-image {
    aspect-ratio: 770 / 515;
    overflow: hidden;
}

.stb-slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stb-slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
}

.stb-slide-cat {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.stb-slide-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stb-slider-nav {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.stb-slider-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.stb-slider-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* === Homepage: Content + Sidebar Grid === */
.stb-home-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    align-items: start;
}

/* === Popular Posts (sidebar widget) === */
.stb-popular-list {
    list-style: none;
}

.stb-popular-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}

.stb-popular-item:last-child {
    border-bottom: none;
}

.stb-popular-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
}

.stb-popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stb-popular-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

/* ===================================
   RESPONSIVE
   =================================== */

/* Tablet */
@media (max-width: 1024px) {
    .stb-layout-sidebar .stb-layout-inner {
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }

    .stb-home-layout {
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    /* Layout */
    .stb-layout-sidebar .stb-layout-inner {
        grid-template-columns: 1fr;
    }

    .stb-home-layout {
        grid-template-columns: 1fr;
    }

    .stb-post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stb-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Header / Nav */
    .stb-menu-toggle {
        display: flex;
    }

    .stb-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-header-bg);
        padding: 1rem;
        box-shadow: var(--shadow-hover);
    }

    .stb-nav.stb-nav-open {
        display: block;
    }

    .stb-nav .stb-menu {
        flex-direction: column;
    }

    .stb-nav .sub-menu {
        position: static;
        box-shadow: none;
        padding-left: 1rem;
    }

    .stb-nav .stb-menu li:hover > .sub-menu {
        display: block;
    }

    /* Typography */
    .stb-post-title {
        font-size: 1.6rem;
    }

    .stb-slide-title {
        font-size: 1.2rem;
    }

    /* Sidebar below content on mobile */
    .stb-sidebar {
        position: static;
    }
}

@media (max-width: 480px) {
    .stb-post-grid {
        grid-template-columns: 1fr;
    }

    .stb-related-grid {
        grid-template-columns: 1fr;
    }

    .stb-post-title {
        font-size: 1.4rem;
    }

    .stb-post-content {
        font-size: 1rem;
    }

    .stb-container {
        padding: 0 1rem;
    }
}
