Files
Blink/src/routes/_api/home/home.scss
T
1xDed 4c9dd86962 feat(hero): pick the best Jellyfin artwork for the home hero
Jellyfin stores several images per item. Ask /Items/{id}/Images for their real
sizes and use the biggest wide image (Backdrop, then Thumb) for the 16:9 hero.
Poster-only items are no longer stretched: the poster is blurred into an ambient
background with the sharp poster displayed beside the text. The slide element is
kept mounted across changes so the previous artwork stays until the next loads.
2026-11-27 09:20:26 +03:00

211 lines
4.1 KiB
SCSS

.hero-carousel {
position: relative;
overflow: visible;
isolation: isolate;
height: 100%;
width: 100%;
&-slide {
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
border: none;
border-radius: 20px;
grid-area: main;
border: 1.2px solid rgb(255 255 255 / 0.1);
box-shadow: 0 0 20px rgba(0,0,0,0.2);
}
&-background {
&-container {
position: absolute;
z-index: 0;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
// Gradient overlay to make text readable
&::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(
to top right,
rgba(0, 0, 0, 0.9) 0%,
rgba(0, 0, 0, 0.4) 50%,
transparent 100%
);
z-index: 2;
}
}
&-image {
position: absolute;
background-size: cover;
z-index: 1;
right: 0;
top: 0;
bottom: 0;
left: 0;
background-position: center;
object-fit: cover;
width: 100%;
height: 100%;
// Poster-only item: never stretch/crop a 2:3 poster across 16:9.
// Blur it into an ambient background and show the sharp poster on top.
&.is-poster {
filter: blur(36px) saturate(1.6) brightness(0.65);
transform: scale(1.25);
}
}
&-blurhash {
position: absolute;
inset: 0;
width: 100% !important;
height: 100% !important;
z-index: 0;
filter: blur(30px) saturate(1.4);
}
&-icon-container {
position: absolute;
background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3);
z-index: 0;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-blend-mode: overlay;
height: 100%;
.material-symbols-rounded {
position: absolute;
font-size: 15em !important;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50, "opsz" 60;
opacity: 0.5;
}
}
}
&-text {
display: -webkit-box;
overflow: hidden;
margin-bottom: 0.5em;
text-shadow: 0 0 10px rgba(0,0,0,0.5), 0 0 20px rgba(0,0,0,0.3);
&-logo {
max-width: 25vw;
max-height: 20vh;
object-fit: contain;
object-position: left bottom;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
// The logo is an <img> inside a line-clamped heading; as an inline image
// its box was clipped by the heading's line box (cut-off titles).
display: block;
}
}
&-poster {
position: absolute;
z-index: 3;
right: 7%;
top: 50%;
transform: translateY(-50%);
height: 66%;
max-width: 26%;
object-fit: contain;
border-radius: 14px;
box-shadow: 0 24px 60px rgb(0 0 0 / 0.65), 0 0 0 1px rgb(255 255 255 / 0.08);
pointer-events: none;
}
&-overview {
overflow: hidden;
margin-bottom: 0.5em;
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
white-space: nowrap;
text-overflow: ellipsis;
display: block;
font-size: 1.1rem;
opacity: 0.9;
max-width: 800px;
}
&-detail {
position: absolute;
z-index: 3;
display: flex;
gap: 1.5em;
height: 100%;
width: 100%;
max-width: 1400px;
padding: 4rem;
padding-bottom: 5rem;
padding-left: 5rem;
flex-direction: column;
justify-content: flex-end;
align-items: flex-start;
left: 0;
bottom: 0;
}
&-info {
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
}
.backdropContainer {
background: linear-gradient(
45deg,
$clr-background-default,
$clr-background-light
);
}
@media (max-width: 1140px) {
.carousel {
height: 60vh !important;
// Never squeeze the hero below the height its own content needs,
// otherwise the title/logo is clipped by the slide's overflow.
min-height: 430px;
}
.hero-carousel {
&-poster {
display: none;
}
&-detail {
width: 100%;
padding: 3rem;
padding-bottom: 4rem;
background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}
&-background-container::after {
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
&-text {
// Narrow layouts: the hero column is ~400px, a 3.75rem title wraps
// to two lines and overflows the slide, clipping the top line.
font-size: 2.5rem !important;
line-height: 1.15 !important;
&-logo {
max-width: 60vw;
max-height: 10vh;
}
}
}
}