phanpy/src/components/status.css
Lim Chee Aun 1439b22963 New feature: ALT badge in image carousel
Adjusted the layout and fix some styles as well
2023-01-22 16:27:00 +08:00

927 lines
19 KiB
CSS

/* REBLOG + REPLY-TO */
.status-reblog {
background: linear-gradient(
to bottom right,
var(--reblog-faded-color),
transparent 160px
);
}
.status-reply-to {
background: linear-gradient(
to bottom right,
var(--reply-to-faded-color),
transparent 160px
);
}
.status-reblog .status-reply-to {
background: linear-gradient(
to top left,
var(--reply-to-faded-color),
transparent 160px
);
}
.visibility-direct {
--yellow-stripes: repeating-linear-gradient(
-45deg,
var(--reply-to-faded-color),
var(--reply-to-faded-color) 10px,
var(--reply-to-faded-color) 10px,
transparent 10px,
transparent 20px
);
/* diagonal stripes of yellow */
background-image: var(--yellow-stripes);
}
/* STATUS PRE META */
.status-pre-meta {
line-height: 1.4;
padding: 8px 16px 0;
opacity: 0.75;
font-size: smaller;
vertical-align: middle;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
margin-bottom: -8px;
}
.status-pre-meta .name-text {
display: inline;
}
.status-pre-meta .icon {
color: var(--reblog-color);
vertical-align: middle;
margin-right: 4px;
}
/* STATUS */
.status {
display: flex;
padding: 16px 16px 20px;
line-height: 1.4;
align-items: flex-start;
position: relative;
}
.status.large {
--fade-in-out-bg: linear-gradient(
to bottom,
transparent,
var(--bg-color) 70px,
var(--bg-color) calc(100% - 50px),
transparent
);
padding-bottom: 8px;
background-image: var(--fade-in-out-bg);
}
.status.large.visibility-direct {
background-image: var(--fade-in-out-bg), var(--yellow-stripes);
}
.status.skeleton {
color: var(--outline-color);
user-select: none;
pointer-events: none;
}
.status.skeleton > .avatar {
background-color: var(--outline-color);
}
.status .container {
flex-grow: 1;
min-width: 0;
}
.status:not(.small) .container {
padding-left: 12px;
}
.status > .container > .meta {
display: flex;
gap: 8px;
justify-content: space-between;
white-space: nowrap;
}
.status.small > .container > .meta {
margin-bottom: 4px;
}
.status > .container > .meta > * {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.status.large > .container > .meta {
min-height: 50px;
}
.status > .container > .meta .arrow {
color: var(--reply-to-color);
vertical-align: middle;
}
.status > .container > .meta :is(.time, .edited) {
color: inherit;
text-align: end;
opacity: 0.5;
text-decoration: none;
flex-shrink: 0;
margin-left: 4px;
white-space: nowrap;
}
.status > .container > .meta a.time:is(:hover, :focus) {
text-decoration: underline;
}
.status > .container > .meta .reply-to {
opacity: 0.5;
font-size: smaller;
}
.status-reply-badge {
display: inline-flex;
margin-left: 4px;
gap: 4px;
align-items: center;
}
.status-reply-badge .icon {
color: var(--reply-to-color);
}
.status-thread-badge {
display: inline-flex;
margin: 4px 0 0 0;
gap: 4px;
align-items: center;
color: var(--reply-to-text-color);
background: var(--bg-color);
border: 1px solid var(--reply-to-color);
border-radius: 4px;
padding: 4px;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
opacity: 0.75;
background-image: repeating-linear-gradient(
-70deg,
transparent,
transparent 3px,
var(--reply-to-faded-color) 3px,
var(--reply-to-faded-color) 4px
);
font-weight: bold;
}
.status.large .content-container {
margin-left: calc(-50px - 16px);
padding-top: 10px;
padding-bottom: 10px;
}
.status .content-container.has-spoiler .spoiler {
margin: 4px 0;
font-size: 90%;
border: 1px dashed var(--button-bg-color);
display: flex;
gap: 8px;
align-items: center;
}
.status
.content-container.has-spoiler
.spoiler
~ *:not(.media-container, .card),
.status .content-container.has-spoiler .spoiler ~ .card .meta-container {
filter: blur(5px) invert(0.5);
/* filter: url(#spoiler); */
text-rendering: optimizeSpeed;
image-rendering: crisp-edges;
image-rendering: pixelated;
/* transform: translate3d(-5px, -5px, 0); */
pointer-events: none;
user-select: none;
contain: layout;
transform: scale(0.97);
transition: transform 0.1s ease-in-out;
}
.status .content-container.has-spoiler .spoiler ~ .media-container .media > *,
.status .content-container.has-spoiler .spoiler ~ .card > img {
filter: blur(32px);
image-rendering: crisp-edges;
image-rendering: pixelated;
animation: none !important;
}
/* @media (prefers-color-scheme: dark) {
.status
.content-container.has-spoiler
.spoiler
~ *:not(.media-container, .card),
.status .content-container.has-spoiler .spoiler ~ .card .meta-container {
filter: url(#spoiler-dark);
}
} */
.status .content-container.show-spoiler .spoiler {
border-style: dotted;
}
.status
.content-container.show-spoiler
.spoiler
~ *:not(.media-container, .card),
.status .content-container.show-spoiler .spoiler ~ .card .meta-container {
filter: none !important;
transform: none;
pointer-events: auto;
user-select: auto;
text-rendering: auto;
image-rendering: auto;
}
.status .content-container.show-spoiler .spoiler ~ .media-container .media > *,
.status .content-container.show-spoiler .spoiler ~ .card > img {
filter: none;
image-rendering: auto;
}
.timeline-deck .status .content {
max-height: 50vh;
max-height: 50dvh;
overflow: hidden;
position: relative;
}
.timeline-deck .status-reblog .status .content {
/* Deprioritise long-form boosts */
max-height: 40vh;
max-height: 40dvh;
}
.timeline-deck .status .content.truncated {
mask-image: linear-gradient(
to top,
transparent,
rgba(0, 0, 0, 0.5) 1em,
black 1.5em
);
}
.timeline-deck .status .content.truncated:after {
content: attr(data-read-more);
line-height: 1;
display: inline-block;
position: absolute;
inset-block-end: 1.5em;
left: 45%;
transform: translateX(-50%);
color: var(--text-color);
background-color: var(--bg-faded-color);
border: 1px dashed var(--link-color);
padding: 0.75em 1em;
border-radius: 10em;
font-size: 90%;
white-space: nowrap;
box-shadow: 0 0 0 1px var(--bg-color), 0 -5px 10px var(--bg-color),
0 -5px 15px var(--bg-color), 0 -5px 20px var(--bg-color);
transition: transform 0.5s ease-in-out;
}
.timeline-deck .status .content.truncated:hover:after {
color: var(--link-color);
transform: translateX(-50%) translateY(-2px) scale(1.01);
}
.timeline-deck .status .content.truncated ~ .card {
display: none;
}
.status .content p {
/* 12px = 75% of 16px */
margin-block: min(0.75em, 12px);
}
.status .content p:first-child {
margin-block-start: 0;
}
.status .content p:last-child {
margin-block-end: 0;
}
.status .content .invisible {
display: none;
}
.status .content .ellipsis::after {
content: '…';
}
.status.large .content {
font-size: 150%;
font-size: calc(100% + 50% / var(--content-text-weight));
}
.status.large .poll,
.status.large .actions {
font-size: 125%;
font-size: calc(100% + 25% / var(--content-text-weight));
}
/* MEDIA */
.status .media-container {
margin-top: 8px;
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 1fr;
gap: 2px;
height: 160px;
}
.status .media-container.media-gt2 {
height: 200px;
}
.status.large :is(.media-container, .media-container.media-gt2) {
height: auto;
min-height: 160px;
max-height: 60vh;
}
.status .media {
border-radius: 8px;
overflow: hidden;
min-height: 80px;
border: 1px solid var(--outline-color);
}
.status .media:only-child {
grid-area: span 2 / span 2;
}
.status:not(.large) .media:only-child {
max-width: 480px;
}
.status.large .media:only-child {
display: inline-block;
min-width: 160px;
min-height: 160px;
width: fit-content;
}
.status .media:first-child:nth-last-child(3) {
grid-area: span 2;
}
.status:not(.large) .media-container.media-gt4 .media:last-child {
position: relative;
}
.status:not(.large) .media-container.media-gt4 .media:last-child:after {
content: '4+';
position: absolute;
inset: 0;
display: flex;
place-content: center;
place-items: center;
background-color: var(--bg-faded-blur-color);
}
.status .media:is(:hover, :focus) {
border-color: var(--outline-hover-color);
}
.status .media:active {
filter: brightness(0.8);
}
.status .media :is(img, video) {
width: 100%;
height: 100%;
object-fit: cover;
}
.status .media {
cursor: pointer;
}
@keyframes position-object {
0% {
object-position: 50% 50%;
}
25% {
object-position: 0% 0%;
}
75% {
object-position: 100% 100%;
}
100% {
object-position: 50% 50%;
}
}
.status .media img:hover {
animation: position-object 5s ease-in-out 1s 5;
}
.status .media video {
width: 100%;
height: 100%;
object-fit: contain;
}
.status :is(.media-video, .media-audio, .media-gif) {
position: relative;
background-clip: padding-box;
}
.status :is(.media-video, .media-audio)[data-formatted-duration]:before {
pointer-events: none;
content: '⏵';
width: 70px;
height: 70px;
font-size: 50px;
position: absolute;
text-indent: 3px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: var(--text-insignificant-color);
background-color: var(--backdrop-color);
backdrop-filter: blur(6px) saturate(3) invert(0.2);
display: flex;
place-content: center;
place-items: center;
border-radius: 70px;
transition: all 0.2s ease-in-out;
}
.status :is(.media-video, .media-audio)[data-formatted-duration]:hover:before {
color: var(--text-color);
background-color: var(--bg-blur-color);
}
.status :is(.media-video, .media-audio)[data-formatted-duration]:after {
font-size: 12px;
pointer-events: none;
content: attr(data-formatted-duration);
position: absolute;
bottom: 8px;
right: 8px;
color: var(--bg-color);
background-color: var(--text-color);
backdrop-filter: blur(6px) saturate(3) invert(0.2);
border-radius: 4px;
padding: 0 4px;
}
.status .media-audio[data-formatted-duration]:after {
content: '♬ ' attr(data-formatted-duration);
}
.status .media-gif[data-label]:not(:hover):after {
font-size: 12px;
font-weight: bold;
pointer-events: none;
content: attr(data-label);
position: absolute;
bottom: 8px;
right: 8px;
color: var(--bg-faded-color);
background-color: var(--text-insignificant-color);
backdrop-filter: blur(6px) saturate(3) invert(0.2);
border-radius: 4px;
padding: 0 4px;
}
.status .media-gif video {
object-fit: cover;
pointer-events: none;
}
.status .media-contain {
min-width: 160px;
width: fit-content;
}
.status .media-contain video {
object-fit: contain !important;
}
/* .status .media-audio {
border: 0;
min-height: 0;
}
.status .media-audio audio {
width: 100%;
} */
.status .media-audio {
width: 100%;
height: 100%;
background-image: radial-gradient(
circle at center center,
var(--bg-color),
var(--bg-faded-color)
),
repeating-radial-gradient(
circle at center center,
transparent,
var(--bg-faded-color) 16px
);
background-blend-mode: multiply;
}
.carousel-item {
position: relative;
}
.carousel-item button.media-alt {
position: absolute;
bottom: 16px;
bottom: calc(16px + env(safe-area-inset-bottom));
left: 16px;
left: calc(16px + env(safe-area-inset-left));
text-align: left;
border-radius: 8px;
color: var(--text-color);
padding: 4px 8px 4px 4px;
border: 1px solid var(--outline-color);
box-shadow: 0 4px 16px var(--outline-color);
max-width: min(40em, calc(100% - 32px));
display: flex;
align-items: center;
gap: 4px;
font-size: 90%;
}
.carousel-item button.media-alt .media-alt-desc {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@media (min-width: 40em) {
.carousel-item button.media-alt .media-alt-desc {
white-space: normal;
display: -webkit-box;
display: box;
-webkit-box-orient: vertical;
box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
line-height: 1.4;
}
}
.carousel-item button.media-alt[hidden] {
opacity: 0;
}
@media (hover: hover) {
.carousel-item button.media-alt {
transform: translateY(200%);
transition: transform 0.2s ease-in-out;
}
.carousel-item:hover button.media-alt {
transform: translateY(0);
}
.carousel-item button.media-alt[hidden] {
opacity: 1;
}
}
/* CARD */
.card {
display: flex;
margin-top: 8px;
border-radius: 8px;
border: 1px solid var(--outline-color);
overflow: hidden;
color: inherit;
align-items: stretch;
background-color: var(--bg-color);
max-width: 480px;
/* max-height: 160px; */
}
.status.large .card.large {
border-radius: 16px;
flex-direction: column;
max-height: none;
}
.card .card-image {
flex-shrink: 0;
width: 35%;
position: relative;
border-inline-end: 1px solid var(--outline-color);
}
.card .card-image img {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
}
/* .card .image {
width: 35%;
height: auto;
flex-grow: 1;
border-inline-end: 1px solid var(--outline-color);
object-fit: cover;
aspect-ratio: 1 / 1;
} */
.status.large .card .card-image {
aspect-ratio: 1 / 1;
}
.status.large .card.large .card-image {
flex-grow: 1;
aspect-ratio: 1.91 / 1;
width: 100%;
max-height: 40vh;
border-inline-end: 0;
border-block-end: 1px solid var(--outline-color);
}
.card:is(:hover, :focus) img {
animation: position-object 5s ease-in-out 1s 5;
}
.card p {
margin: 0;
}
.card .meta-container {
padding: 8px;
min-width: 0;
flex-grow: 1;
align-self: center;
}
.status.large .card.large .meta-container {
align-self: flex-start;
flex-grow: 0;
}
.card .title {
line-height: 1.25;
font-weight: normal;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
display: box;
-webkit-box-orient: vertical;
box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
}
.card .meta {
font-size: smaller;
opacity: 0.75;
margin: 0;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
display: box;
-webkit-box-orient: vertical;
box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
}
.card .meta.domain {
opacity: 1;
color: var(--link-color);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
display: block;
}
a.card {
text-decoration: none;
transition: opacity 0.2s ease-in-out;
}
a.card:is(:hover, :focus) {
border: 1px solid var(--link-color);
box-shadow: 0 0 0 2px var(--link-faded-color);
}
.card.video {
max-width: 320px;
max-height: 320px;
}
.card.video iframe {
width: 100%;
height: 100%;
}
/* POLLS */
.poll {
transition: opacity 0.2s ease-in-out;
}
.poll.loading {
opacity: 0.5;
pointer-events: none;
}
.poll.read-only {
pointer-events: none;
}
.poll-option {
margin-top: 8px;
padding: 8px;
display: flex;
gap: 8px;
justify-content: space-between;
background-color: var(--bg-faded-color);
background-image: linear-gradient(
to right,
var(--link-faded-color),
var(--link-faded-color) var(--percentage),
transparent var(--percentage),
transparent
);
background-repeat: no-repeat;
border-radius: 8px;
border: 1px solid var(--outline-color);
align-items: center;
text-shadow: 0 1px var(--bg-blur-color);
}
.poll-label {
width: 100%;
display: flex;
gap: 8px;
cursor: pointer;
}
.poll-option-votes {
flex-shrink: 0;
font-size: 90%;
opacity: 0.75;
}
.poll-option-leading .poll-option-votes {
font-weight: bold;
opacity: 1;
}
.poll-vote-button {
margin-top: 8px;
}
.poll-meta {
margin: 8px 0;
font-size: 90%;
}
.poll-option-title .icon {
vertical-align: middle;
}
/* EXTRA META */
.status .extra-meta {
padding-top: 8px;
color: var(--text-insignificant-color);
font-size: 90%;
}
.status .extra-meta * {
vertical-align: middle;
}
.status .extra-meta a {
color: inherit;
text-decoration: none;
}
.status .extra-meta a:is(:hover, :focus) {
text-decoration: underline;
}
.status .extra-meta .edited:is(:hover, :focus) {
cursor: pointer;
color: var(--text-color);
}
.status.large .extra-meta {
padding-top: 0;
margin-left: calc(-50px - 16px);
}
/* ACTIONS */
.status .actions {
display: flex;
gap: 8px;
}
.status.large .actions {
padding-top: 4px;
padding-bottom: 16px;
margin-left: calc(-50px - 16px);
color: var(--text-insignificant-color);
border-top: var(--hairline-width) solid var(--outline-color);
margin-top: 8px;
}
.status .action.has-count {
flex: 1;
}
.status .action > button {
min-height: 40px;
min-width: 40px;
padding: 0 8px;
font-variant-numeric: tabular-nums;
}
.status .action > button.plain {
color: inherit;
border: 1.5px solid transparent;
}
.status .action > button.plain:is(:hover, :focus) {
color: var(--link-color);
background-color: var(--button-plain-bg-hover-color);
}
.status .action > button.plain.reblog-button:is(:hover, :focus) {
color: var(--reblog-color);
}
.status .action > button.plain.reblog-button.checked {
color: var(--reblog-color);
border-color: var(--reblog-color);
}
@keyframes reblogged {
5% {
transform: translate(-2px, -2px);
}
10% {
transform: translate(2px, 2px);
}
15% {
transform: translate(0, 0);
}
100% {
transform: translate(30px, -30px);
opacity: 0;
}
}
.status .action > button.plain.reblog-button.checked .icon {
animation: reblogged 1s ease-in-out;
}
.status .action > button.plain.favourite-button:is(:hover, :focus) {
color: var(--favourite-color);
}
.status .action > button.plain.favourite-button.checked {
color: var(--favourite-color);
border-color: var(--favourite-color);
}
@keyframes hearted {
15% {
transform: scale(1.25) translateY(-1px);
}
30% {
transform: scale(1);
}
45% {
transform: scale(1.5) translateY(-2px);
}
100% {
transform: scale(1);
}
}
.status .action > button.plain.favourite-button.checked .icon {
animation: hearted 1s ease-out;
}
.status .action > button.plain.bookmark-button.checked {
color: var(--link-color);
border-color: var(--link-color);
}
@keyframes bookmarked {
25% {
transform: translateY(-10px) rotate(10deg);
opacity: 0.5;
}
50% {
transform: translateY(0);
opacity: 1;
}
75% {
transform: translateY(-15px) rotate(-10deg);
opacity: 0.5;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
.status .action > button.plain.bookmark-button.checked .icon {
animation: bookmarked 1s ease-in-out;
}
/* ENHANCED CONTENT */
.status .content pre {
border-radius: 8px;
padding: 8px;
margin: 8px 0;
overflow: auto;
width: 100%;
border: 1px solid var(--outline-color);
background: linear-gradient(
to bottom right,
var(--bg-faded-color),
transparent 160px
);
white-space: pre-wrap;
}
.status .content p code {
color: var(--green-color);
}
/* BADGE */
.status-badge {
position: absolute;
top: 4px;
right: 4px;
line-height: 0;
pointer-events: none;
opacity: 0.75;
}
.status-badge .favourite {
color: var(--favourite-color);
}
.status-badge .reblog {
color: var(--reblog-color);
}
.status-badge .bookmark {
color: var(--link-color);
}
/* MISC */
.status-aside {
padding: 0 16px 16px 80px;
color: var(--text-insignificant-color);
}
.shortcode-emoji {
width: 1.2em;
height: 1.2em;
vertical-align: text-bottom;
object-fit: contain;
}
/* EDIT HISTORY */
#edit-history {
min-height: 50vh;
min-height: 50dvh;
}
#edit-history h2 {
margin: 0;
padding: 0;
}
#edit-history :is(ol, ol li) {
list-style: none;
margin: 0;
padding: 0;
}
#edit-history .history-item .status {
border: 1px solid var(--outline-color);
border-radius: 8px;
}