/* Scoped to artwork pages. Never modify /oeuvres or artwork aura.
   Preserve manual title breaks and nonbreaking spaces in the existing fiche. */
.mak-artwork-page .mak-work-title,
.mak-artwork-page .mak-dialog-artwork__title {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Other works: image-only exhibition wall, centred like the /oeuvres catalogue.
   Independent physical scaling applies ONLY to the works inside this section. */
.mak-related-works {
    max-width: 1600px;
    margin-inline: auto;
    border-top: 1px solid var(--mak-rule, #dedede);
    padding: clamp(65px, 7vw, 112px) var(--mak-sidepad) clamp(94px, 10vw, 160px);
    min-width: 0;
}

.mak-related-works__grid {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: clamp(58px, 7vw, 110px) clamp(24px, 4vw, 62px);
}

.mak-related-works__card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    text-decoration: none;
    color: inherit;
}

.mak-related-works__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 50%; /* no-JS fallback: half-size reproductions, centred */
    min-width: 0;
    padding: 0;
    margin: 0;
}

.mak-related-works__visual img {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
    object-position: center;
    transition: opacity .25s ease;
}

.mak-related-works__card:hover img { opacity: .84; }

.mak-related-works__placeholder {
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 5;
    place-items: center;
    border: 1px solid #e9e9e9;
    color: #aaa;
    font-size: 13px;
    letter-spacing: .1em;
}

/* Enhanced layout: each row is mathematically scaled and centred. */
.mak-related-works__grid[data-layout="rows"] {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(68px, 7vw, 112px);
}

.mak-related-works__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: var(--mak-related-gap, 40px);
    width: 100%;
    min-width: 0;
    min-height: var(--mak-related-row-height, 1px);
}

.mak-related-works__row > .mak-related-works__card {
    width: var(--mak-related-art-width, auto);
    flex: 0 0 var(--mak-related-art-width, auto);
    min-width: 0;
}

.mak-related-works__row .mak-related-works__visual {
    max-width: none; /* the JS already halves its calculated physical size */
    width: var(--mak-related-art-width, 100%);
    height: var(--mak-related-art-height, auto);
    flex: 0 0 auto;
}

.mak-related-works__row .mak-related-works__visual img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.mak-related-works__row .mak-related-works__placeholder {
    height: 100%;
    aspect-ratio: auto;
}

@media (max-width: 1020px) {
    .mak-related-works__grid:not([data-layout="rows"]) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 760px) {
    .mak-related-works__grid:not([data-layout="rows"]) {
        grid-template-columns: minmax(0, 1fr);
    }
    .mak-related-works__grid[data-layout="rows"] {
        gap: 56px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .mak-related-works__visual img { transition: none; }
}
