/* Content Block: Mosaic – Frontend */

.mosaic {
    --mosaic-unit: clamp(30px, 4.4vw, 56px);
    display: flex;
    gap: 16px;
    height: calc(var(--mosaic-weight) * var(--mosaic-unit) - 16px);
}

.mosaic__col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mosaic__tile {
    flex-grow: var(--w);
    flex-shrink: 1;
    flex-basis: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: #ccc;
    margin: 0;
}

/* --ar mirrors the selectedRatio of the matching crop variant, so a crop set
   in the backend is shown unchanged in the single-column layout. */
.mosaic__tile--small  { --w: 5; --ar: 3 / 2; }
.mosaic__tile--normal { --w: 6; --ar: 4 / 3; }
.mosaic__tile--large  { --w: 7; --ar: 1 / 1; }

/* Image */
.mosaic__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform .5s ease;
}
.mosaic__tile:hover .mosaic__media,
.mosaic__tile:focus-within .mosaic__media {
    transform: scale(1.04);
}

/* Turquoise tint over the whole image */
.mosaic__tint {
    position: absolute;
    inset: 0;
    background-color: rgb(180, 220, 218);
    opacity: 0;
    transition: opacity .35s ease;
    mix-blend-mode: multiply;
}
.mosaic__tile:hover .mosaic__tint,
.mosaic__tile:focus-within .mosaic__tint {
    opacity: .95;
}

/* Overlay with name + role – centered */
.mosaic__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    padding: 24px;
    color: #fff;
    opacity: 0;
    transition: opacity .35s ease;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}
.mosaic__tile:hover .mosaic__overlay,
.mosaic__tile:focus-within .mosaic__overlay {
    opacity: 1;
}
.mosaic__name { font-weight: 600; font-size: 1.1rem; line-height: 1.2; }
.mosaic__role { font-size: .9rem; opacity: .95; margin-top: 4px; }

/* Link below subtitle – ::after stretches it over the whole tile */
.mosaic__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}
/* Keep it white in every state – no underline, no blue link colour */
.mosaic__link,
.mosaic__link:link,
.mosaic__link:visited,
.mosaic__link:hover,
.mosaic__link:focus,
.mosaic__link:focus-visible,
.mosaic__link:active {
    color: #fff;
    text-decoration: none;
}
.mosaic__link-icon {
    width: 1em;
    height: 1em;
    flex: none;
    align-self: center;
    display: block;
    transition: transform .25s ease;
}
.mosaic__link:hover .mosaic__link-icon,
.mosaic__link:focus-visible .mosaic__link-icon {
    transform: translateX(3px);
}
.mosaic__link::after {
    content: '';
    position: absolute;
    inset: 0;
}

/* Touch devices cannot hover, so the title stays up and Frontend.js reveals
   the rest on the first tap. Keyed on the input capability, not on width - a
   landscape tablet is wider than 768px. Hiding is gated on .mosaic-js so the
   caption stays complete if the script never runs. */
@media (hover: none) {
    .mosaic__overlay {
        opacity: 1;
        background: linear-gradient(rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .75));
    }
    .mosaic-js .mosaic__role,
    .mosaic-js .mosaic__link {
        display: none;
    }
    .mosaic-js .mosaic__tile--open .mosaic__overlay {
        background: linear-gradient(rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, .55) 65%, rgba(0, 0, 0, .88));
    }
    .mosaic-js .mosaic__tile--open .mosaic__role { display: block; }
    .mosaic-js .mosaic__tile--open .mosaic__link { display: inline-flex; }
    .mosaic__tint { opacity: 0; }
    .mosaic__media { transform: none; }
}

@media (max-width: 767.98px) {
    .mosaic {
        flex-direction: column;
        height: auto;
    }
    /* dissolves the column wrappers so order can restore the editor sorting */
    .mosaic__col { display: contents; }
    .mosaic__tile {
        order: var(--order);
        flex: none;
        aspect-ratio: var(--ar);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mosaic__media,
    .mosaic__tint,
    .mosaic__overlay {
        transition: none;
    }
}
