body {
    scroll-behavior: smooth;
    background: white;
    background-color: #0b1c2f;
    font-family: Inter, sans-serif;
    color: #47bec7;
}

body.expanded-open {
    overflow: hidden;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #0b1c2f;
    z-index: 100;
    transition: all 0.3s ease;
    padding: 2rem;
}

header.scrolled {
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity:75%;
}


.header-title {
    font-size: 2.5rem;
    font-weight: 400;  /* Belleza ha solo peso regular */
    letter-spacing: -1px;
    transition: font-size 0.3s ease;
    color: #ddd;
    font-family: 'Belleza', sans-serif;
  	text-transform: uppercase;
}

.header-subtitle {
    color: #848d96;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
    transition: opacity 0.3s ease;
    font-family: 'Cormorant Garamond', serif;
}

header.scrolled .header-title {
    font-size: 1.5rem;
}


header.scrolled .header-subtitle {
    opacity: 0;
    font-size: 0;
}

#logo {
    position: fixed;
    width: 64px;
    right: 12px;
    top: 12px;
    z-index: 1000;
}

header.scrolled #logo {
    width: 32px;
}

main {
    margin-top: 150px;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem;
}

.sidebar {
    position: sticky;
    top: 200px;
    height: fit-content;
    z-index: 2; /* Sopra la gallery ma sotto expanded */
}

.sidebar-bio, .sidebar p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #848d96;
    margin-bottom: 2rem;
    font-weight: 300;
    /*font-family: Lora, sans-serif;*/
}

.bio-more {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.4s ease-out;
    margin-top: 0;
}

.bio-more:not([hidden]) {
    max-height: 500px; /* Regola se il testo è più lungo */
    opacity: 1;
    transform: translateY(0);
    margin-top: 1rem;
}

.bio-more[hidden] {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    margin-top: 0;
}

.bio-more p {
    transition: opacity 0.4s ease-out 0.2s;
}

.bio-more-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: #848d96;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    transition: all 0.3s;
    font-family: Inter, sans-serif;
    position: relative;
    z-index: 3; /* Evita conflitti con altre hover */
}

.bio-more-toggle:hover {
    color: #fff;
}

.bio-more-toggle svg {
    transition: transform 0.3s;
}

.bio-more-toggle[aria-expanded="true"] svg {
    transform: rotate(0deg);
}

.exhibition {
    margin-bottom: 2rem;
}

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

.exhibition-location {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.exhibition-dates {
    font-size: 0.85rem;
    color: #848d96;
    margin-bottom: 0.5rem;
}

.exhibition-link {
    display: inline-block;
    color: #47bec7;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.exhibition-link:hover {
    color: #fff;
}

.contacts-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.contacts-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contacts-list li a::before {
    text-align: right;
    content: "-";
    font-size: 1em;
    font-weight: bold;
    color: #848d96;
    padding-right: 12px;
}

.contacts-list a, footer li a {
    color: #848d96;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: inline-block;
    position: relative;
    padding-bottom: 2px;
}

.contacts-list a:hover, footer li a:hover {
    color: #fff;
    border-bottom-color: #000;
}

.gallery-container {
    background-color: #0b1c2f;
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    auto-rows: max-content;
    position: relative;
}

.masonry-item {
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    cursor: pointer;
}

.masonry-item.expanded {
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
}

.masonry-item:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    display: block;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

/* Portrait - alto e stretto */
.portrait {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 400px;
}

/* Landscape - largo e basso */
.landscape {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 250px;
}

/* Square - quadrato */
.square {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 300px;
}

.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.4));
    color: white;
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
}

.masonry-item.expanded .overlay {
    z-index: -1;
    pointer-events: none;
}

.masonry-item:not(.expanded):hover .overlay {
    transform: translateY(0);
}

/* Expand button */
.expand-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

.masonry-item:hover .expand-button {
    opacity: 1;
    pointer-events: all;
}

.expand-button:hover {
    background: white;
    transform: scale(1.1);
}

.overlay-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.overlay-info {
    font-size: 0.85rem;
    opacity: 0.9;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    opacity: 0.7;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 500;
}

.overlay-button {
    background: white;
    color: #1f2937;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 0.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    align-self: flex-start;
}

.overlay-button:hover:not(.sold) {
    background: #f3f4f6;
    transform: translateX(4px);
}

.overlay-button.sold {
    background: #dc2626;
    color: white;
    cursor: not-allowed;
}

.overlay-button.sold:hover {
    background: #dc2626;
    transform: none;
}

/* Expanded state - clone posizionato fisso */
.expanded-clone {
    position: fixed;
    max-width: 900px;
    height: auto;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    z-index: 102;  /* SOPRA il backdrop */
    animation: expandInGrid 0.4s ease-out;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.expanded-clone img {
    object-fit: contain;
    height: auto;
    max-height: calc(100vh - 200px);
    width: 100%;
}

.expanded-clone .overlay {
    display: none;
}

@keyframes expandInGrid {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes collapseOutGrid {
    from {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
}

.masonry-item.collapsing {
    animation: collapseOutGrid 0.4s ease-out forwards;
}

/* Backdrop */
.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 101;  /* SOPRA l'header */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-out;
}

.backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* Close button - dentro l'immagine */
.close-expanded {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s;
    z-index: 103;  /* SOPRA expanded-clone */
    opacity: 0;
    pointer-events: none;
}

.expanded-clone .close-expanded {
    opacity: 1;
    pointer-events: all;
}

.close-expanded:hover {
    background: white;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        margin-top: 140px;
        padding: 1rem;
    }
    header {
        padding-left: 1rem;
    }
    header #logo {
        width: 32px;
        padding-top: 2rem;
    }
    header.scrolled #logo {
        padding-top: 0;
    }

    .sidebar {
        position: static;
        top: auto;
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }
.sidebar::after {
  content: "";
  display: block;
  width: 100%;
  height: 24px; /* altezza visiva del separatore */
  margin-top: 1.5rem;

  background-image: url("/user/themes/fabioart/images/divider.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
    .gallery-container {
        background: #0b1c2f;
        padding: 0;
        position: relative;
        z-index: 1;
        clear: both;
    }
    .sidebar-bio {
        margin-top: 20px;
    }
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .portrait, .landscape, .square {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 200px;
    }

    /* Disable expand on mobile */
    .masonry-item.expanded {
        position: static;
        width: auto;
        height: auto;
        transform: none !important;
        z-index: 1;
    }
    .expand-button {
        display:none;
    }
}