*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
}

/* Fælles top: samme h1-, nav- og kategori-række på alle sider */
.site-header {
    width: 100%;
    max-width: 900px;
    padding: 2rem 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.site-header h1 {
    margin: 0 0 1rem;
    text-align: center;
}

.site-header nav {
    margin: 0;
}

/* Samme vertikale rum som kategori-rækken på Projekter (tom på andre sider) */
.header-kategori-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    min-height: 2.75rem;
    box-sizing: border-box;
}

.header-kategori-row .kategori-filter {
    margin-top: 0;
    margin-bottom: 0;
}

h1 {
    font-family: 'Signika Negative', sans-serif;
}

.portrait {
    max-width: 160px;
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 1rem;
}

nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: white;
    color: black;
    border: 2px solid black;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 5px 5px 0 0 black;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

nav a:hover {
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0 0 black;
}

nav a[aria-current="page"] {
    background: #f0f0f0;
}

.intro-tekst {
    font-family: 'Playfair Display', serif;
    max-width: 42ch;
    text-align: center;
    margin-top: 1.5rem;
    padding: 0 1rem;
}

nav a::after {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M12 2l10 10-10 10L2 12 12 2z'/%3E%3Cpath fill='black' d='M10 8l4 4-4 4V8z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.kategori-filter {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.kategori-filter button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: white;
    color: black;
    border: 1.5px solid black;
    font: inherit;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 3px 3px 0 0 black;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.kategori-filter button:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 0 black;
}

.kategori-filter button::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M12 2l10 10-10 10L2 12 12 2z'/%3E%3Cpath fill='black' d='M10 8l4 4-4 4V8z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.projects-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem 1.5rem;
    align-items: stretch;
}

.project {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    max-width: 100%;
    margin: 0;
    min-width: 0;
    height: 100%;
}

.project-media {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-media img {
    max-width: 100%;
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.project-media-link {
    width: 100%;
    max-width: 200px;
    height: 160px;
    flex: 0 0 auto;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.project-media-link a {
    font-size: 2.5rem;
    text-decoration: none;
}

.project-media-link a:has(img) {
    font-size: inherit;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.35rem;
    box-sizing: border-box;
}

.project-media-link img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.project-text h2 a {
    color: inherit;
    text-decoration: underline;
}

.project-text h2 a:hover {
    text-decoration-thickness: 3px;
}

.project-text {
    flex: 1 1 auto;
    min-width: 0;
}

.project-media img {
    cursor: pointer;
}

/* Lightbox – forstørret billede */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.lightbox-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    font-size: 2rem;
    line-height: 1;
    color: #fff;
    background: transparent;
    border: 2px solid #fff;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 3px 3px 0 0 #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lightbox-close:hover {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 0 #fff;
}

/* ========== Responsivt layout – tablet og mobil ========== */

@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
        justify-content: flex-start;
        padding-top: 1rem;
    }

    .site-header {
        padding: 1.25rem 0.75rem 0;
    }

    h1 {
        font-size: clamp(1.5rem, 6vw, 2.25rem);
        text-align: center;
        line-height: 1.2;
        padding: 0 0.5rem;
    }

    .site-header h1 {
        padding: 0 0.5rem;
    }

    .portrait {
        max-width: 140px;
        margin-bottom: 0.75rem;
    }

    nav {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    nav a {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
        box-shadow: 3px 3px 0 0 black;
    }

    .intro-tekst {
        font-size: 0.95rem;
        padding: 0 0.75rem;
        margin-top: 1rem;
    }

    .header-kategori-row {
        margin-top: 1.25rem;
        margin-bottom: 1rem;
        gap: 0.5rem;
        min-height: 2.5rem;
    }

    .kategori-filter {
        gap: 0.5rem;
    }

    .kategori-filter button {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    .projects-container {
        padding: 0 0.75rem;
    }

    .project {
        gap: 1rem;
        align-items: stretch;
    }

    .project-media,
    .project-media img {
        flex: none;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }

    .project-media {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .project-media-link {
        width: 100%;
        max-width: 200px;
        height: 120px;
        margin: 0 auto;
        flex: none;
    }

    .project-text {
        text-align: center;
    }

    .project-text h2 {
        font-size: 1.1rem;
    }

    .project-text p {
        font-size: 0.9rem;
    }

    .lightbox {
        padding: 1rem;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 2rem;
        height: 2rem;
        font-size: 1.5rem;
    }

    /* Kontakt-siden */
    body p,
    body ul {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        text-align: center;
    }

    body ul {
        list-style-position: inside;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem 0.5rem;
        padding-top: 0.75rem;
    }

    .site-header {
        padding: 1rem 0.5rem 0;
    }

    h1 {
        font-size: clamp(1.25rem, 7vw, 1.75rem);
    }

    .portrait {
        max-width: 120px;
    }

    nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    nav a {
        justify-content: center;
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
    }

    .intro-tekst {
        font-size: 0.9rem;
    }

    .header-kategori-row {
        gap: 0.4rem;
        min-height: 2.35rem;
    }

    .kategori-filter {
        gap: 0.4rem;
    }

    .kategori-filter button {
        padding: 0.3rem 0.5rem;
        font-size: 0.65rem;
    }

    .project-media-link {
        max-width: 160px;
        height: 100px;
    }

    .project-media-link a {
        font-size: 2rem;
    }
}
