:root {
    --color-bg: #faf7f2;
    --color-text: #2b2822;
    --color-muted: #6b6053;
    --color-accent: #b5563a;
    --color-accent-dark: #954733;
    --color-border: #e4dccf;
    --font-heading: "Cormorant Garamond", Georgia, serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Locks the background page while the lightbox is open */
body.no-scroll {
    position: fixed;
    left: 0;
    right: 0;
    overflow: hidden;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

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

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 0.85rem 2rem;
    background-color: rgba(250, 247, 242, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header .logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.site-header nav a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.site-header nav a:hover,
.site-header nav a.is-active {
    color: var(--color-accent);
}

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    margin: 0 auto;
    background-color: var(--color-text);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 2rem 3rem;
}

.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
}

.hero-image {
    flex: 0 0 auto;
    width: 320px;
    order: 2;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 40px -20px rgba(43, 40, 34, 0.35);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
    transform-origin: center bottom;
}

.hero-content {
    flex: 0 1 480px;
    min-width: 0;
    order: 1;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 600;
    margin: 0 0 1rem;
    line-height: 1.1;
}

.hero-desc {
    color: var(--color-muted);
    font-size: 1.1rem;
    max-width: 40ch;
    margin: 0 0 2rem;
}

.btn-primary {
    display: inline-block;
    background-color: var(--color-accent);
    color: #fff;
    text-decoration: none;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--color-accent-dark);
    transform: translateY(-2px);
}

.hero-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.75rem;
}

.btn-secondary {
    display: inline-block;
    background-color: transparent;
    color: var(--color-text);
    text-decoration: none;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
}

/* Gallery */
.gallery {
    padding: 4rem 2rem 6rem;
}

.gallery-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.gallery h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 1.75rem;
}

/* Filter buttons */
.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0 0 2.5rem;
}

.filter-btn {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.filter-btn.is-active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

/* Sub-filter row: smoothly expands under the main filter when a category has its own events,
   gently pushing the gallery grid below down/up as it opens/closes. Uses the grid-template-rows
   0fr -> 1fr technique instead of max-height, so it animates to the content's *exact* height -
   this makes opening and closing genuine mirror images of each other (no "guessed" max value
   that makes one direction visually front-loaded and the other back-loaded). */
.subfilter-bar {
    display: grid;
    grid-template-rows: 0fr;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows 0.35s ease, opacity 0.3s ease, margin 0.35s ease, visibility 0s linear 0.35s;
}

.subfilter-bar.is-open {
    grid-template-rows: 1fr;
    margin: -1.5rem 0 2.5rem;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.subfilter-inner {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    overflow: hidden;
    min-height: 0;
}

.subfilter-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-muted);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.subfilter-btn:hover {
    color: var(--color-text);
}

.subfilter-btn.is-active {
    background-color: var(--color-border);
    color: var(--color-text);
}

.gallery-grid {
    column-count: 3;
    column-gap: 0.625rem;
}

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 0.625rem;
    padding: 0;
    border: none;
    background-color: var(--color-border);
    cursor: pointer;
    overflow: hidden;
    break-inside: avoid;
    aspect-ratio: 4 / 5;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

/* Skeleton-formatet er bare en gjetning på høyde/bredde-forhold; når bildet faktisk
   har lastet vet vi den ekte størrelsen, og lar boksen falle tilbake til den */
.gallery-item.is-loaded {
    aspect-ratio: auto;
}

.gallery-item[hidden] {
    display: none;
}

/* Shimmering skeleton shown until the image has actually finished loaded */
.gallery-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--color-border) 25%, #f5efe4 37%, var(--color-border) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}

.gallery-item.is-loaded::before {
    content: none;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gallery-item img {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item.is-loaded img {
    opacity: 1;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 30px -18px rgba(43, 40, 34, 0.45);
}

/* Contact */
.contact {
    padding: 5rem 2rem 6rem;
    background-color: #f1ebe1;
}

.contact-inner {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.contact h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.contact-desc {
    color: var(--color-muted);
    font-size: 1.05rem;
    margin: 0 0 2rem;
}

.contact-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    margin: 0 0 2.5rem;
}

.contact-details a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.contact-details a:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    background-color: var(--color-bg);
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.social-btn svg {
    width: 18px;
    height: 18px;
}

.social-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--color-border);
}

footer p {
    margin: 0;
}

.footer-dot {
    margin: 0 0.5rem;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 17, 12, 0.95);
    z-index: 100;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-scroll {
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2rem;
    padding: 16vh 1.5rem;
}

.lightbox-slide {
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    justify-content: center;
    opacity: 1;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

.lightbox-slide.is-dimmed {
    opacity: 0.3;
}

.lightbox-slide img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.75rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
    z-index: 102;
}

/* On wider screens, scrolling sideways through the photos feels more natural than up/down */
@media (min-width: 801px) {
    .lightbox-scroll {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        align-items: center;
        padding: 1.5rem 20vw;
    }

    .lightbox-slide img {
        max-width: 60vw;
        max-height: 82vh;
    }
}

/* Responsive */
@media (max-width: 800px) {
    .hero-inner {
        flex-direction: column;
        gap: 2rem;
    }

    .hero-content {
        flex: 0 0 auto;
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-image {
        width: 240px;
    }

    .hero-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .gallery-grid {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 0.65rem 2rem;
    }

    .gallery-grid {
        column-count: 1;
        column-gap: 0.375rem;
    }

    .gallery-item {
        margin-bottom: 0.375rem;
    }
}

/* Mobile nav */
@media (max-width: 700px) {
    .nav-toggle {
        display: flex;
    }

    .site-header nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: center;
        gap: 0;
        background-color: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.25s ease;
    }

    .site-header nav.is-open {
        max-height: 200px;
    }

    .site-header nav a {
        padding: 1rem 0;
        width: 100%;
        text-align: center;
    }
}
