/* ===== Design system ===== */
:root {
    --bg: #fff8f0;
    --surface: #ffffff;
    --text: #2d2a4a;
    --muted: #6b6789;
    --primary: #ff6b9d;
    --primary-dark: #e8528a;
    --secondary: #4ecdc4;
    --secondary-dark: #38b2a8;
    --accent: #ffd93d;
    --purple: #a78bfa;
    --shadow: 0 6px 20px rgba(45, 42, 74, 0.08);
    --shadow-lg: 0 16px 40px rgba(45, 42, 74, 0.18);
    --radius: 18px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Header ===== */
.site-header {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    text-align: center;
}
.logo {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.logo-emoji { font-size: 2.4rem; }
.logo strong { color: var(--accent); }
.tagline { opacity: .95; font-size: 1rem; }

/* ===== Categories nav ===== */
.categories-nav {
    background: var(--surface);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.categories-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .9rem 0;
    justify-content: center;
}
.category-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    border-radius: 999px;
    font-weight: bold;
    font-size: .95rem;
    border: 2px solid transparent;
    transition: transform .15s, background .15s, border-color .15s;
}
.category-link:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}
.category-link.active {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
}
.category-link.active .badge { background: rgba(255,255,255,.25); color: white; }
.badge {
    background: var(--accent);
    color: var(--text);
    border-radius: 999px;
    padding: 1px 9px;
    font-size: .8rem;
    min-width: 22px;
    text-align: center;
}
.empty-nav { color: var(--muted); padding: .5rem; }

/* ===== Main ===== */
.main-content { padding: 2rem 1rem 3rem; }

.category-header {
    text-align: center;
    margin-bottom: 2rem;
}
.category-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    color: var(--primary-dark);
}
.muted { color: var(--muted); margin-top: .35rem; }

.empty-state {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    color: var(--muted);
    max-width: 640px;
    margin: 2rem auto;
}
.empty-state code {
    background: var(--bg);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--primary-dark);
}

/* ===== Gallery grid ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.card-image {
    aspect-ratio: 1 / 1;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 2px dashed var(--bg);
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: .5rem;
}
.card-body {
    padding: .9rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    flex: 1;
}
.card-title {
    font-size: 1.05rem;
    color: var(--text);
    text-align: center;
}
.card-actions {
    display: flex;
    gap: .5rem;
    margin-top: auto;
}

/* ===== Buttons ===== */
.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .55rem .8rem;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-weight: bold;
    font-size: .9rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-dark); }

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal.is-open { display: flex; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 42, 74, .75);
    backdrop-filter: blur(4px);
}
.modal-dialog {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 900px;
    width: 100%;
    max-height: 95vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-close {
    position: absolute;
    top: .5rem;
    right: .8rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: 50%;
}
.modal-close:hover { color: var(--primary); background: var(--bg); }
.modal-title {
    text-align: center;
    color: var(--primary-dark);
    padding-right: 2rem;
}
.modal-image-wrap {
    background: #fafafa;
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}
.modal-image-wrap img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}
.modal-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.modal-actions .btn { flex: 0 1 200px; padding: .8rem 1.2rem; font-size: 1rem; }

/* ===== Footer ===== */
.site-footer {
    background: var(--text);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 3rem;
}
.site-footer p { opacity: .85; font-size: .9rem; }

/* ===== Responsywność ===== */
@media (min-width: 600px) {
    .header-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}
@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
    .card-actions { flex-direction: column; }
    .btn { width: 100%; }
}

/* ===== Print: tylko obrazek ===== */
@media print {
    body * { visibility: hidden !important; }
    #print-area, #print-area * { visibility: visible !important; }
    #print-area {
        position: fixed !important;
        inset: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: white;
        padding: 0;
        margin: 0;
    }
    #print-area img {
        max-width: 100%;
        max-height: 100vh;
        object-fit: contain;
    }
    @page { margin: 1cm; }
}
