:root {
    --dark-background: #1a1818;
    --beige-card: #fcf8f4;
    --text-color-dark: #222;
    --text-color-light: #666;
    --text-on-image: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background-color: var(--dark-background); font-family: 'Inter', sans-serif; min-height: 100vh; }

.main-menu { position: fixed; top: 0; right: 0; width: 300px; height: 100%; background-color: var(--beige-card); box-shadow: -10px 0 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 100; transform: translateX(100%); transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); }
.main-menu.active { transform: translateX(0); }
.menu-link { color: var(--text-color-dark); text-decoration: none; font-size: 2rem; font-family: 'Jost', sans-serif; margin: 1rem 0; }

.page-container { width: 90%; max-width: 1200px; margin: 5rem auto; }

.info-card {
    background-color: var(--beige-card);
    padding: 4rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    position: relative;
    display: flex;
}

.panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.menu-toggle {
    position: absolute;
    top: 2.5rem;
    right: 2rem;
    width: 30px;
    height: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 101;
}
.menu-toggle .line { width: 100%; height: 3px; background-color: var(--text-color-dark); transition: transform 0.3s ease; }
.menu-toggle.active .line:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
.menu-toggle.active .line:nth-child(2) { transform: translateY(-9.5px) rotate(-45deg); }

.card-grid {
    display: grid;
    grid-template-columns: 3fr 5fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

.text-content { display: flex; flex-direction: column; height: 100%; position: relative; }
.brand-logo { 
    width: clamp(80px, 12vw, 120px); 
    margin-bottom: 0.2rem; 
    position: absolute;
    top: 0;
}

.brand-name { 
    font-family: 'Jost', sans-serif; 
    font-size: clamp(3rem, 12vw, 4.5rem); 
    font-weight: 600; 
    color: var(--text-color-dark); 
    line-height: 1; 
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.brand-name span { }

.intro-text-container { 
    font-family: 'Inter', sans-serif; 
    font-size: 0.9rem; 
    line-height: 1.6; 
    color: var(--text-color-light); 
    padding-left: 7.5rem; 
    max-width: 42ch; 
    margin-top: 2rem; 
    margin-bottom: 2rem; 
}
.signature-block { margin-top: auto; padding-left: 7.5rem; }
.signature-image { width: 150px; margin-bottom: 0.5rem; }

.signature-name { 
    font-size: 0.9rem; 
    font-weight: 400; 
    font-style: italic;
    color: var(--text-color-dark); 
}

.image-content { 
    display: flex; 
    flex-direction: column;
    align-items: left; 
    justify-content: center; 
    /* ÄNDRING: height: 100%; är borttagen för att låta containern anpassa sig efter innehållet */
    min-width: 0;
}
.image-content img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.image-caption {
    font-size: 0.75rem;
    color: var(--text-color-light);
    font-style: italic;
    margin-top: 0.75rem;
}

/* --- GALLERI-SYSTEM --- */

.accordion-gallery {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.gallery-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
    align-items: stretch;
    aspect-ratio: 100 / 78.75;
    min-height: 0; /* Prevent flex container from expanding unnecessarily */
}

.gallery-item {
    border: 1px solid #222;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: flex 0.7s cubic-bezier(0.645, 0.045, 0.355, 1);
    flex: 2;
    min-width: 0; /* Prevent flex items from overflowing */
}

.gallery-item.active {
    flex: 9;
}

.gallery-item .panel {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    width: 100%;
    flex: 0 0 calc(9 / 21 * 100%);
    min-height: 0; /* Allow panel to shrink */
}

.gallery-item .item-content {
    background-color: var(--beige-card);
    padding: 0.75rem;
    text-align: center;
    transition: padding 0.5s ease;
    flex: 0 0 calc(3 / 21 * 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    container-type: inline-size;
    min-width: 0; /* Prevent content from overflowing */
    min-height: 0; /* Allow content to shrink */
}

.gallery-item.active .item-content {
    padding: 1rem;
    overflow: hidden;
}

.item-content h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color-dark);
    margin: 0;
    font-size: 1.1rem;
}

.item-content .flex-text {
    color: var(--text-color-light);
    line-height: 1.6;
    font-size: 0.7rem;
    margin: 0;
    opacity: 0;
    max-height: 0;
    transition: opacity 0.2s ease-out, max-height 0.4s ease-out;
    min-height: 0; /* Prevent flex item from expanding unnecessarily */
    overflow: hidden; /* Ensure content doesn't overflow during transitions */
}

.flex-text .sub-heading {
    color: var(--text-color-dark);
    font-weight: 300;
    font-style: italic;
    margin-bottom: 0.5rem;
    font-size: 0.75rem; 
}

.flex-text p {
    margin: 0;
}

.gallery-item.active .item-content .flex-text {
    max-height: 10em;
    overflow-y: auto;
    opacity: 1;
    margin-top: 0.5rem;
    padding-right: 8px;
    transition: opacity 0.5s ease-in-out 0.7s, max-height 0.5s ease-in-out 0.7s;
    min-height: 0; /* Ensure consistent sizing */
}

.flex-text::-webkit-scrollbar {
  width: 5px;
}

.flex-text::-webkit-scrollbar-track {
  background: transparent;
}

.flex-text::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 10px;
  border: 3px solid transparent;
}

.flex-text::-webkit-scrollbar-thumb:hover {
  background-color: #444;
}

/* --- SLUT PÅ GALLERI-SYSTEM --- */


/* --- KONTAKTSEKTION --- */
.contact-section { padding: 5rem 0; }
.contact-content { 
    max-width: 1200px; 
    margin: 0 auto; 
    color: var(--beige-card); 
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    text-align: left; 
}
.contact-content h2 { 
    font-size: 1.2rem;
    margin-bottom: 0.5rem; 
}
.contact-content .contact-name { 
    font-size: 1rem;
    margin-bottom: 0.5rem; 
}
.contact-content p { 
    font-size: 1rem;
    margin-bottom: 1.5rem; 
}

.contact-content a {
    color: var(--beige-card);
    text-decoration: underline;
    transition: opacity 0.3s;
}

.contact-content a:hover {
    opacity: 0.7; 
}

.instagram-icon { width: 32px; height: 32px; fill: var(--beige-card); }

/* --- RESPONSIV DESIGN --- */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .info-card { padding: 2rem; }
    .menu-toggle { top: 2rem; right: 2rem; }
    
    .image-content {
        align-items: flex-start;
    }

    .brand-logo {
    }

    .intro-text-container, .signature-block {
        padding-left: 2.5rem;
    }
    
    .item-content h3 {
        writing-mode: vertical-rl;
        font-size: 0.7rem; 
        letter-spacing: 2px;
        transition: all 0.4s ease;
    }
    
    .gallery-item.active .item-content h3 {
        writing-mode: horizontal-tb;
        font-size: 0.8rem;
        letter-spacing: normal;
    }

    .gallery-row {
        aspect-ratio: auto;
        height: 480px; 
        gap: 0.5rem; 
    }

    .gallery-item .panel,
    .gallery-item .item-content {
        flex: none;
    }

    .gallery-item .panel {
        height: 160px;
        overflow: hidden; /* Prevent image overflow during transitions */
    }
    
    .gallery-item .panel img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transition: none; /* Disable transitions on images to prevent zoom effect */
    }

    .gallery-item .item-content {
        height: 160px;
        justify-content: center;
        align-items: center;
        text-align: left;
        padding: 1rem;
    }
    
    .gallery-item.active .item-content {
        justify-content: flex-start;
        align-items: flex-start;
    }

    .gallery-item.active .item-content .flex-text {
        max-height: 120px; 
        overflow-y: auto;
    }
    
    .flex-text::-webkit-scrollbar-track {
      background: #e9e2dc;
      border-radius: 10px;
    }
}
