philomena/assets/css/elements/media.css
2024-06-12 20:50:46 +02:00

173 lines
3.3 KiB
CSS

.image-constrained {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.media-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--media-container-width), 1fr));
grid-auto-rows: 1fr;
grid-gap: var(--padding-small);
}
.media-list:before {
content: "";
width: 0;
padding-bottom: calc(100% + var(--media-header-height));
grid-row: 1 / 1;
grid-column: 1 / 1;
}
@mixin if-phone {
.media-list {
grid-template-columns: repeat(auto-fill, minmax(var(--media-small-container-width), 1fr));
}
}
.media-box {
background: var(--background-color);
border: 1px solid var(--secondary-muted-color);
border-radius: var(--border-radius-inner);
overflow: hidden;
}
.media-box:first-child {
grid-row: 1 / 1;
grid-column: 1 / 1;
}
.media-box__header {
display: flex;
line-height: var(--media-header-height);
padding: 0 var(--padding-small);
justify-content: center;
font-size: var(--font-tiny-size);
}
.media-box__header--link-row {
display: grid;
grid-template-columns: 1fr 1fr 1.5fr 1fr 1fr;
text-align: center;
width: fit-content;
}
.media-box__content {
width: 100%;
padding-top: 100%;
position: relative;
border-radius: 0 0 var(--border-radius-inner) var(--border-radius-inner);
overflow: hidden;
}
.media-box__image {
max-width: 100%;
height: auto;
}
.media-box__content--featured .media-box__image {
max-height: var(--media-featured-width);
}
.media-box__overlay {
display: block;
position: absolute;
z-index: 4;
min-width: 95%;
text-align: left;
font-weight: bold;
word-wrap: break-word;
color: var(--text-color);
background: var(--primary-color);
padding: 0 var(--padding-normal);
line-height: var(--media-header-height);
pointer-events: none;
top: 0;
}
.media-box__overlay:nth-child(2) {
top: var(--media-header-height);
}
.post-image-container,
.post-image-container img {
width: var(--media-tiny-container-width);
height: var(--media-tiny-container-width);
}
.media-tiny-container,
.media-tiny-container img {
width: var(--media-tiny-container-width);
height: var(--media-tiny-container-width);
}
.thumb-tiny,
.thumb-tiny img {
max-width: var(--media-tiny-container-width);
max-height: var(--media-tiny-container-width);
}
.image-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.image-container a {
display: flex;
max-height: 100%;
width: 100%;
height: auto;
}
/* For some reason tall images don't center properly within the container
without this hack. I blame CSS. */
.image-container a img {
max-height: 100%;
margin: auto;
}
.image-container picture {
display: inline-flex;
justify-content: center;
align-self: center;
width: 100%;
height: 100%;
}
.media-box__content .image-container {
position: absolute;
inset: 0;
}
.media__standalone {
position: relative;
}
.thumb-tiny .media-box__overlay {
width: 100%;
max-width: 100%;
padding: 0 var(--padding-tiny);
line-height: var(--media-small-header-height);
font-size: var(--font-micro-size);
}
.media-grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
grid-gap: var(--padding-small);
}
.image-scaled {
max-width: 100%;
}
@mixin if-phone {
.media-box__header--link-row {
grid-template-columns: 1fr 1fr 1.5fr 1fr 1fr;
}
}