/* ======= Pamatstils ======= */
html, body {
    margin: 0;
    overflow-x: hidden; /* novērš staigāšanu pa labi/pa kreisi */
}

body {
    background: url("background.png") no-repeat center center fixed;
    background-size: cover;
    color: black;
    font-family: "Climate Crisis", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "YEAR" 1979;
}

/* ======= Navigācija ======= */
nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch; /* ļauj <a> aizņemt visu joslas augstumu */
    height: 90px; /* fiksēts joslas augstums */
    background: rgba(29, 72, 174, 0.75);
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

/* ======= Navigācijas linki ======= */
nav a {
    display: flex;
    align-items: center;      /* centrē tekstu vertikāli */
    justify-content: center;  /* centrē horizontāli */
    padding: 0 40px;          /* attālums starp izvēlnēm */
    height: 100%;             /* aizņem visu joslas augstumu */
    text-decoration: none;
    font-size: 35px;
    color: black;
    font-weight: 400;
    letter-spacing: 2px;
    box-shadow: inset 0 -6px 0 0 transparent; /* underline vieta */
    transition: color 0.25s ease, box-shadow 0.4s ease-in-out, transform 0.2s ease;
    will-change: color, box-shadow, transform;
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
}

/* ======= Hover un Active ======= */
nav a:hover,
nav a.active {
    box-shadow: inset 0 -10px 0 0 rgba(255, 255, 255, 0.822); /* underline virs joslas apakšas */
    color: rgba(255, 255, 255, 0.822);
    transform: translateY(-3px);
}

nav a:focus {
    outline: none;
    box-shadow: inset 0 -10px 0 0 rgba(255, 255, 255, 0.822); /* underline virs joslas apakšas */
    color: rgba(255, 255, 255, 0.822);
    transform: translateY(-3px);
}

/* ======= Saturs ======= */
.content {
    text-align: center; /* default: center project sections */
    margin-top: 120px;
    margin-left: 0;
    margin-inline: auto;
    max-width: 900px;
}

.section-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 30px 30px;
    border: 2px solid rgba(0, 0, 0, 0.18);
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    background: rgba(255, 255, 255, 0.822);
    max-width: 100%;
}

.section-card:hover,
.section-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.14);
    border-color: rgba(0, 0, 0, 0.28);
}

.section-card h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.1;
}

/* About page: left-align only the About content */
.content.about {
    text-align: left;
    margin-left: 1cm; /* ensure at least 1cm from left edge */
    margin-right: 2cm; /* keep the section 2cm from the right edge */
    max-width: calc(100% - 3cm);
}

.about-grid {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
    width: 100%;
    flex-wrap: wrap;
}

.about-text {
    flex: 1 1 520px;
    min-width: 280px;
    max-width: 1000px;
}

.about-image {
    flex: 0 0 360px;
    margin-left: auto;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    object-fit: contain;
    box-shadow: none;
    border: 4px solid rgba(29, 72, 174, 0.75);
}

.content h1 {
    font-size: 60px;
    letter-spacing: 6px;
    color: #000000;
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
    margin: 5;
}

.other-page .content > h1 {
    font-size: 60px;
    letter-spacing: 6px;
}

.other-page .section-card h1 {
    font-size: 28px;
    letter-spacing: 2px;
}

.mywork-page .content > h1 {
    font-size: 60px;
    letter-spacing: 6px;
}

.mywork-page .section-card h1 {
    font-size: 28px;
    letter-spacing: 2px;
}

.name {
    margin-top: 40px;
    font-size: 32px;
    letter-spacing: 2px;
    font-weight: 400;
    color: #000000;
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
}

.bio {
    margin-top: 16px;
    font-size: 22px;
    line-height: 1.6;
    max-width: 60ch;
    color: rgba(0,0,0,0.9);
    font-weight: 300;
}

.righteous-regular {
    font-family: "Righteous", sans-serif;
    font-weight: 400;
    font-style: normal;
}

/* Gallery Grid Section */
.gallery-section {
    margin-top: 60px;
    margin-bottom: 3cm;
    padding: 0 2cm;
}

.pdf-bar {
    margin-bottom: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.pdf-item-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    background: rgba(200, 200, 200, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    text-decoration: none;
    color: #000;
    transition: all 0.2s ease;
}

.pdf-item-bar:hover {
    background: rgba(200, 200, 200, 0.35);
    border-color: rgba(0, 0, 0, 0.4);
    transform: translateX(4px);
}

.pdf-item-bar .pdf-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.pdf-item-bar .pdf-desc {
    font-size: 16px;
    font-weight: 500;
    color: #000;
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.gallery-caption {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.7);
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.6);
    font-family: "Righteous", sans-serif;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox-image {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.822);
    border: none;
    padding: 12px 16px;
    font-size: 28px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.822);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.lightbox-next {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

/* Code Layout Section */
.content.code-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: calc(100% - 40px);
    margin-top: 30px;
    margin-left: 20px;
    margin-right: 20px;
    align-items: flex-start;
    text-align: left;
}

.code-panel {
    flex: 1 1 320px;
    max-width: 45%;
    min-width: 280px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(29, 72, 174, 0.3);
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    max-height: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.code-panel h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
    color: rgba(29, 72, 174, 0.75);
    font-family: "Climate Crisis", sans-serif;
    font-variation-settings: "YEAR" 1979;
    letter-spacing: 2px;
}

.code-panel pre {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    overflow-x: auto;
}

.code-panel code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #333;
}

.canvas-panel {
    flex: 1 1 320px;
    max-width: 55%;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.save-button {
    margin-top: 18px;
    padding: 12px 20px;
    border: 2px solid rgba(29, 72, 174, 0.8);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    font-family: "Climate Crisis", sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
}

.save-button:hover {
    transform: translateY(-2px);
    background: rgba(29, 72, 174, 0.14);
}

.canvas-panel canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

#p5-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 1024px) {
    .content.code-layout {
        flex-direction: column;
    }

    .code-panel,
    .canvas-panel {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    nav {
        flex-wrap: wrap;
        justify-content: center;
        height: auto;
        padding: 10px 0;
        gap: 8px;
    }

    nav a {
        padding: 10px 18px;
        font-size: 24px;
    }

    .content {
        margin-top: 90px;
        margin-left: 16px;
        margin-right: 16px;
        max-width: none;
    }

    .content.about {
        margin-left: 16px;
        margin-right: 16px;
        max-width: none;
    }

    .about-grid {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }

    .about-text,
    .about-image {
        width: 100%;
        max-width: 100%;
    }

    .about-image {
        margin-left: 0;
    }

    .content h1 {
        font-size: 48px;
    }

    .name {
        font-size: 28px;
    }

    .bio {
        font-size: 18px;
        max-width: 100%;
    }
}

