:root{
    --bg: #fafafa;
    --text: #1a1a1a;
    --muted: #666666;
    --link: #1a1a1a;
    --link-hover: #0b66d1;
    --border: #e0e0e0;
    --card: #ffffff;
    --accent: #1a1a1a;
}

/* dark theme variables applied when .dark is on html */
html.dark{
    --bg: #0b0b0d;
    --text: #eaeaea;
    --muted: #bdbdbd;
    --border: #1f1f1f;
    --card: #111214;
    --accent: #f5f5f5;
    --link: #9dc6ff;
    --link-hover: #dbeeff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background .2s ease, color .2s ease;
}

/* Pasek nawigacji */
nav {
    position: sticky;
    top: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.nav-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

.nav-inner .brand {
    font-weight: 600;
    color: var(--accent);
}

.nav-inner .nav-links {
    display: flex;
    gap: 1rem;
}

.nav-inner a { color: var(--link); text-decoration: none; }

/* Theme toggle button */
#theme-toggle{
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

#theme-toggle:hover{ background: rgba(0,0,0,0.04); }

header {
    padding: 4rem 2rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Avatar / wycinek zdjęcia w nagłówku */
.header-row{ display:flex; align-items:center; gap:1rem; }
.avatar {
    width:200px;
    height:200px;
    border-radius:12px;
    overflow:hidden;
    flex:0 0 200px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}
.avatar img{
    width:150%;
    height:150%;
    object-fit:cover;
    transform: translate(-15%,-15%);
    display:block;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

section {
    margin-bottom: 2.25rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.about-text {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1rem;
}

/* Paragraph and list spacing */
p { margin-bottom: 1rem; }
li { margin-bottom: 0.45rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.25rem; }
/* nested lists */
ul ul, ol ol, ul ol, ol ul { margin-top: .5rem; margin-bottom: .75rem; padding-left: 1rem; }


.projects {
    display: grid;
    gap: 2rem;
}

.project {
    border-left: 3px solid var(--accent);
    padding-left: 1.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.project h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-type {
    display: inline-block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-desc {
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    background: rgba(0,0,0,0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.skill-category h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.skill-list {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.8;
}

footer {
    border-top: 2px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1rem;
}

a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid rgba(153,153,153,0.35);
    transition: border-color 0.2s, color 0.15s;
}

a:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-hover);
}

@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    header {
        padding: 2rem 1rem;
    }

    main {
        padding: 0 1rem 2rem;
    }

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

/* Dropdown for projects */
.nav-item { position: relative; }
.nav-item .dropdown-toggle { cursor: pointer; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    min-width: 180px;
    display: none;
    flex-direction: column;
    padding: 0.5rem 0;
    z-index: 2000;
}
.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
}
.dropdown-menu a:hover { background: #f6f6f6; }
.nav-item:hover .dropdown-menu { display: flex; }

@media (max-width: 800px) {
    .nav-inner { padding: 0.5rem; }
    .dropdown-menu { left: auto; right: 0; }
}

/* Mobile navigation behavior */
@media (max-width: 720px) {
    .nav-inner { gap: .5rem; }
    .nav-inner .brand { font-size: 1rem; }
    .nav-inner .nav-links { display: none; }
    .nav-inner .nav-links a { padding: .65rem 1rem; }
    .nav-inner .nav-links .nav-item { width:100%; }
    .nav-inner .nav-links .dropdown-menu { position: static; border: none; box-shadow: none; padding:0; display:none; }
    .nav-inner .nav-links .dropdown-menu a{ padding:.65rem 1rem; }
    .nav-inner .nav-links .nav-item.open .dropdown-menu{ display:flex; flex-direction:column; }
    .nav-inner .nav-links { flex-direction: column; }
    .nav-inner .nav-links a, .nav-inner .nav-links span { display:block; }
    .nav-inner button#nav-toggle{ display:inline-flex; }
    html.nav-open .nav-inner .nav-links{ display:flex; }
}

/* Hide nav-toggle on larger screens */
.nav-inner button#nav-toggle{ display:none; background:transparent; border:1px solid var(--border); padding:6px 8px; border-radius:6px; color:var(--text); }

/* Header spacing for mobile */
@media (max-width:600px){
    header{ padding:2rem 1rem 1rem; }
    .avatar{ width:64px; height:64px; border-radius:10px; }
    .avatar img{ width:200%; height:200%; transform: translate(-30%,-30%); }
}

/* Gallery styles */
.gallery-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.gallery-item{ overflow: hidden; border-radius:6px; background: var(--card); border:1px solid var(--border); }
.gallery-item img{ display:block; width:100%; height:120px; object-fit:cover; transition: transform .25s ease; }
.gallery-item:hover img{ transform: scale(1.05); }

/* Lightbox */
.lightbox{ position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(0,0,0,0.65); z-index:3000; }
.lightbox.active{ display:flex; }
.lightbox .lb-image{ max-width:90%; max-height:75%; box-shadow:0 10px 40px rgba(0,0,0,0.6); border-radius:6px; }
.lightbox .lb-caption{ margin-top:0.75rem; color:#fff; text-align:center; }
.lightbox button{ position: absolute; background:transparent; border: none; color:#fff; font-size:2rem; cursor:pointer; padding:.5rem; }
.lightbox .lb-close{ top:1rem; right:1rem; font-size:1.25rem; }
.lightbox .lb-prev{ left:1rem; top:50%; transform:translateY(-50%); }
.lightbox .lb-next{ right:1rem; top:50%; transform:translateY(-50%); }

@media (max-width:600px){ .gallery-item img{ height:100px; } .lightbox .lb-image{ max-width:95%; max-height:70%; } }
