/* --- Reset i ogólne ustawienia --- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    /* Nowoczesny stos fontów systemowych: priorytetyzuje natywne fonty systemu (Segoe UI dla Windows, San Francisco dla Mac) */
    font-family: Verdana, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: #f8f5f7;
    /* Bardzo jasny szary, łagodniejszy dla oka niż czysta biel */
    color: #333333;
    /* Ciemny szary zamiast czarnego - lepszy kontrast */
    line-height: 1.6;
}

/* --- Nagłówek (Header) --- */
#header {
    background-color: #181818;
    /* Ciemny kolor w stylu GitHub */
    color: #ffffff;
    padding: .2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Inner header wrapper that matches the content width and centers on desktop */
.header-inner {
    width: 100%;
    max-width: 1200px;
    /* same as #content */
    margin: 0 auto;
    /* center the header inner block */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .2rem 2rem;
    /* match overall header padding visually */
    box-sizing: border-box;
}

/* Ensure heading (title + subtitle) is visually on the left and menu on the right.
   The HTML places #menu before #heading, so override ordering and cancel floats. */
#heading {
    display: flex;
    flex-direction: column;
    order: 0;
    align-items: flex-start;
}

#menu {
    order: 1;
    float: none !important;
    display: flex;
    gap: 12px;
    align-items: center;
}

#menu a {
    margin-left: 0
}

/* Nagłówek: w HTML używamy ID i wewnątrz niego są #title, #subtitle i #menu */
#title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

#subtitle {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: normal;
    display: block;
    margin-top: 4px;
}

/* Menu w nagłówku (linki w #menu) */
#menu a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.95rem;
    opacity: 0.9;
    transition: opacity 0.2s;
}

#menu a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* --- Główny układ strony (Layout) --- */
/* Strona używa #content z dwoma panelami: #left-panel oraz #right-panel */
#content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 40px;
    /* Odstęp między panelem bocznym a treścią */
    align-items: flex-start;
}

/* Mobilność: Na małych ekranach kolumny pod sobą */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    aside {
        width: 100%;
        order: 2;
        /* Panel boczny pod spodem na mobilkach */
    }

    main {
        width: 100%;
    }
}

/* Panel boczny: #left-panel zawiera wygenerowane <nav> z klasami .nav-title, .nav-post ... */
#left-panel {
    width: 250px;
    flex-shrink: 0;
    font-size: 0.9rem;
}

#left-panel .nav-title {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    color: #232323;
    border-bottom: 2px solid #e1e4e8;
    padding-bottom: 5px;
}

#left-panel ul {
    list-style: none;
    padding: 0;
    margin: 0
}

#left-panel li {
    margin-bottom: 8px
}

#left-panel .nav-tag {
    padding: 2px 4px 2px 0;
}

/* keep links inline so following <sup> count stays on the same line */
#left-panel a {
    color: #0366d6;
    text-decoration: none;
    display: inline-block;
}

#left-panel a:hover {
    text-decoration: underline;
    color: #0056b3
}

/* counts are often rendered as <sup>(n)>, ensure they sit inline after the link */
#left-panel sup,
#left-panel .count {
    color: #888;
    margin-left: 3px;
}

/* --- Główna treść (Main) --- */
#right-panel {
    flex-grow: 1;
    min-width: 0;
    /* Zapobiega rozpychaniu flexboxa przez szerokie obrazki */
}

/* Styl nagłówka głównej sekcji wygenerowanej wewnątrz #md-post */
#md-post>h1 {
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.5rem;
    margin-top: 0;
    font-size: 2rem;
}

/* Stylizacja postów */
article,
.post {
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

article h2,
.post h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #24292e;
}

/* Blok "cytatu" / kodu / metadanych (ten szary pasek na screenie) */
blockquote,
.meta-box {
    background-color: #f6f8fa;
    border-left: 4px solid #0366d6;
    margin: 1.5rem 0;
    padding: 1rem;
    font-style: normal;
    color: #444;
    border-radius: 0 4px 4px 0;
}

/* Stylizacja metadanych (data, tagi) */
.meta-info {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    /* Font monospaced dla kodu */
    font-size: 0.85rem;
    color: #586069;
    display: block;
    margin-bottom: 0.5rem;
}

/* Obrazki */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #eee;
    display: block;
    margin: 20px 0;
}

/* Tagi w treści */
a.tag {
    background-color: #f1f8ff;
    color: #0366d6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    text-decoration: none;
}

a.tag:hover {
    background-color: #def;
}

/* Utility: link base style (avoid aggressive global overrides) */
a {
    color: #0366d6;
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

/* Lightweight button/link reset inside #menu */
#menu button,
#menu a {
    font-family: Verdana, Arial;
    border: none;
    padding: 4px 8px;
    color: inherit;
    background: inherit;
}

#menu button:hover,
#menu a:hover {
    color: #222;
    background: #ffd700
}

/* Legacy absolute layout fallback (kept for compatibility but only where needed) */
#left-panel {
    position: relative
}

#right-panel {
    position: relative
}

.dark {
    background: #222;
    color: #ccc;

    #left-panel .nav-title{
        color: #ccc;
    }
    
    pre,
    code,
    blockquote {
        color: #ccc;
        background: #1a1a1a;
    }
}

.dark #header {
    background: #444
}

@media print {

    #header,
    #left-panel {
        display: none !important
    }

    #right-panel {
        position: relative;
        width: 100% !important;
        left: 0px !important;
        top: 0px;
        border: none;
        height: auto;
        overflow: hidden
    }
}

@media screen and (min-width: 600px) and (max-width: 900px) {
    #header {
        width: 100%;
        height: 80px;
    }

    #left-panel {
        display: none;
        position: absolute;
        left: 0px !important;
        width: 100% !important;
        top: 80px;
        padding: 4px 8px
    }

    #right-panel {
        position: absolute;
        left: 0px !important;
        width: 98%;
        top: 80px;
        overflow: auto;
        padding: 4px 0 4px 8px
    }
}

@media screen and (max-width: 600px) {
    #header {
        width: 100%;
        height: 100px;
    }

    #left-panel {
        display: none;
        position: absolute;
        left: 0px !important;
        width: 100% !important;
        top: 100px;
        padding: 4px 8px
    }

    #right-panel {
        position: absolute;
        left: 0px !important;
        width: 100%;
        top: 100px;
        overflow: auto;
        padding: 4px 8px
    }
}