/*
Theme Name: Mój pierwszy szablon 
Theme URI: https://preissstudio.pl
Author: Wojciech Preiss
Description: Mój pierwszy motyw WordPress tworzony od podstaw
Version: 1.0
*/

/* ================= ZMIENNE GLOBALNE ================= */

:root {
    --color-bg: #f4f4f4;
    --color-text: #333;
    --color-light: #777;
    --color-border: #ddd;
    --color-accent: #b11919;
    --header-height: 100px;
}

/* ================= RESET ================= */

body, h1, h2, h3, p {
    margin: 0;
    padding: 0;
}

/* ================= TYPOGRAFIA / PODSTAWA ================= */

body {
    font-family: Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    padding: 20px;
    padding-top: calc(var(--header-height) + 50px);
}

h1 {
    font-size: 32px;
    transition: .3s;
}

/* ================= UKŁAD STRONY ================= */

.container {
   display: flex;
    flex-direction: column; /* To wymusi układ pionowy */
    gap: 20px;
    max-width: 1200px; /* Dobra praktyka, by strona nie rozjechała się na bardzo szerokich ekranach */
    margin: 0 auto;   /* Wyśrodkowanie kontenera */
}

.content { flex: 3; }
.sidebar { flex: 1; }

/* ================= ARCHIVE ================= */
.archive-header {
    margin-bottom: 30px;
}

.archive-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

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

/* ================= PAGINATION ================= */
.pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    padding: 8px 12px;
    background: #eee;
    border-radius: 6px;
    text-decoration: none;
}

.pagination .current {
    background: #333;
    color: #fff;
}
.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}


/* ================= KARTY POSTÓW ================= */

.post-card {
    outline: none;
	display: flex;
	cursor: pointer;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
    transform: translateY(-4px);
}
.post-card:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}
.post-thumbnail {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================= METADANE POSTA ================= */

.post-meta {
    font-size: 0.85rem;
    color: #777;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ================= ELEMENTY OGÓLNE ================= */

article {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,.05);
}

footer {
    margin-top: 40px;
    text-align: center;
    color: var(--color-light);
}

/* ================= NAWIGACJA (DESKTOP) ================= */

.main-nav {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 0;
    margin-bottom: 30px;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    text-decoration: none;
    color: var(--color-text);
    font-weight: bold;
    padding: 8px 12px;
    display: block;
}

/* ================= MENU ROZWIJANE ================= */

.main-nav li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 180px;
    padding: 10px 0;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
    opacity: 0;
    transform: translateY(10px);
    transition: .25s;
}

.main-nav li:hover > ul,
.main-nav li.open > ul {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ================= STRZAŁKA MENU ================= */

.main-nav .menu-item-has-children > a {
    position: relative;
    padding-right: 28px;
}

.main-nav .menu-item-has-children > a::after {
    content: "▾";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .7em;
}

/* ================= HAMBURGER (MOBILE MENU) ================= */

.hamburger {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.hamburger span {
    height: 3px;
    background: var(--color-text);
    border-radius: 2px;
    transition: .3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px,6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px,-6px);
}

/* ================= PRZYKLEJONY HEADER ================= */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: white;
    z-index: 200;
    transition: .3s;
}

header.scrolled {
    background: #ececec;
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
}

header.scrolled h1 {
    color: var(--color-accent);
}

/* ================= STRONA GŁÓWNA ================= */

/* HERO */
.hero {
    background: linear-gradient(120deg, #111, #444);
    color: white;
    padding: 120px 20px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 50px;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.hero p {
    font-size: 20px;
    margin-bottom: 30px;
}

.btn {
    display: inline-block;
    background: #b11919;
    color: white;
    padding: 12px 26px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
}

/* ================= SIATKA POSTÓW ================= */

.home-posts {
    margin-top: 40px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.post-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

/* ================= WERSJA MOBILNA ================= */

@media (max-width:768px){

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 32px;
    }

    .container {
        flex-direction: column;
    }

    .hamburger {
        display: flex;
    }

    .main-nav ul {
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        display: none;
        border-top: 1px solid var(--color-border);
    }

    .main-nav ul.show {
        display: flex;
    }

    .main-nav ul a {
        padding: 6px 10px;
        font-size: 14px;
    }

    .main-nav li ul {
        position: static;
        box-shadow: none;
        border-left: 8px solid #eee;
        margin-left: 4px;
        transform: none;
        opacity: 1;
    }

    .main-nav .menu-item-has-children > a::after {
        content: "▸";
        transition: .25s;
    }

    .main-nav li.open > a::after {
        transform: rotate(90deg);
    }
}