mastodon-embed-timeline/src/mastodon-timeline.css
2025-03-01 13:06:28 +00:00

679 lines
14 KiB
CSS

/* Mastodon embed timeline v4.5.0 */
/* More info at: */
/* https://gitlab.com/idotj/mastodon-embed-timeline */
/* Variables */
.mt-container,
.mt-dialog,
.mt-container[data-theme="light"],
.mt-dialog[data-theme="light"] {
--mt-txt-max-lines: none;
--mt-preview-max-lines: none;
--mt-color-bg: #fff;
--mt-color-bg-hover: #d9e1e8;
--mt-color-line-gray: #c0cdd9;
--mt-color-contrast-gray: #606984;
--mt-color-content-txt: #000;
--mt-color-link: #3a3bff;
--mt-color-error-txt: #8b0000;
--mt-color-btn-bg: #6364ff;
--mt-color-btn-bg-hover: #563acc;
--mt-color-btn-txt: #fff;
--mt-color-backdrop: #00000090;
--mt-color-placeholder: #60698425;
}
.mt-container[data-theme="dark"],
.mt-dialog[data-theme="dark"] {
--mt-color-bg: #282c37;
--mt-color-bg-hover: #313543;
--mt-color-line-gray: #393f4f;
--mt-color-contrast-gray: #606984;
--mt-color-content-txt: #fff;
--mt-color-link: #8c8dff;
--mt-color-error-txt: #fe6c6c;
}
/* Reset CSS */
.mt-container button,
.mt-dialog button {
font: inherit;
}
.mt-container a,
.mt-container button,
.mt-dialog button {
cursor: pointer;
}
/* Main container */
.mt-container {
display: flex;
flex-direction: column;
height: 100%;
overflow-y: auto;
position: relative;
background-color: var(--mt-color-bg);
scrollbar-color: var(--mt-color-contrast-gray) var(--mt-color-bg);
scrollbar-width: auto;
container: mt-container / inline-size;
}
.mt-container::-webkit-scrollbar {
width: 0.25rem;
height: 0.25rem;
}
.mt-container::-webkit-scrollbar-thumb {
background-color: var(--mt-color-contrast-gray);
border: none;
border-radius: 3rem;
}
.mt-container::-webkit-scrollbar-thumb:hover,
.mt-container::-webkit-scrollbar-thumb:active {
background-color: var(--mt-color-contrast-gray);
}
.mt-container::-webkit-scrollbar-track {
background-color: var(--mt-color-bg);
border: none;
border-radius: 0;
}
.mt-container::-webkit-scrollbar-track:hover,
.mt-container::-webkit-scrollbar-track:active,
.mt-container::-webkit-scrollbar-corner {
background-color: var(--mt-color-bg);
}
.mt-container a:link,
.mt-container a:active,
.mt-container a {
text-decoration: none;
color: var(--mt-color-link);
}
.mt-container a:not(.mt-post-preview):hover {
text-decoration: underline;
}
.mt-body {
padding: 1rem;
white-space: pre-wrap;
word-wrap: break-word;
margin-bottom: 1rem;
}
.mt-body .invisible {
font-size: 0;
line-height: 0;
display: inline-block;
width: 0;
height: 0;
position: absolute;
}
/* Post container */
.mt-post {
margin: 0.25rem;
padding: 1rem 0.5rem;
position: relative;
min-height: 3.75rem;
background-color: transparent;
border-bottom: 1px solid var(--mt-color-line-gray);
}
.mt-post:hover,
.mt-post:focus {
cursor: pointer;
background-color: var(--mt-color-bg-hover);
}
.mt-post p:last-child {
margin-bottom: 0;
}
/* User avatar */
.mt-post-avatar {
margin-right: 0.75rem;
}
.mt-post-avatar-standard {
width: 2.25rem;
height: 2.25rem;
}
.mt-post-avatar-boosted {
width: 3rem;
height: 3rem;
position: relative;
}
.mt-post-avatar-image-big img {
aspect-ratio: 1/1;
width: 2.25rem;
height: 2.25rem;
border-radius: 0.25rem;
overflow: hidden;
}
.mt-post-avatar-image-small img {
aspect-ratio: 1/1;
width: 1.5rem;
height: 1.5rem;
top: 1.5rem;
left: 1.5rem;
position: absolute;
border-radius: 0.25rem;
overflow: hidden;
}
/* User name and date */
.mt-post-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 1rem;
}
.mt-post-header-user {
overflow: hidden;
padding-right: 0.75rem;
}
.mt-post-header-user .mt-custom-emoji {
height: 1rem;
min-width: 1rem;
width: auto;
}
.mt-post-header-user > a {
color: var(--mt-color-content-txt) !important;
overflow-wrap: anywhere;
}
.mt-container .mt-post-header-user > a:hover {
text-decoration: none;
}
.mt-post-header-user-name {
font-weight: 600;
}
.mt-container .mt-post-header-user:hover .mt-post-header-user-name {
text-decoration: underline;
}
.mt-post-header-user-account {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--mt-color-contrast-gray);
}
.mt-post-header-date {
display: flex;
font-size: 0.75rem;
text-align: right;
margin-left: auto;
}
.mt-post-header-date .mt-post-pinned {
width: 1.25rem;
margin-top: -0.25rem;
fill: var(--mt-color-contrast-gray);
}
.mt-container .mt-post-header-date > a {
white-space: nowrap;
color: var(--mt-color-contrast-gray) !important;
}
/* Text */
.mt-post-txt {
margin-bottom: 1rem;
color: var(--mt-color-content-txt);
}
.mt-post-txt .spoiler-txt-hidden {
display: none;
}
.mt-post-txt.truncate {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: var(--mt-txt-max-lines);
-webkit-box-orient: vertical;
}
.mt-post-txt:not(.truncate) .ellipsis::after {
content: "...";
}
.mt-post-txt blockquote {
border-left: 0.25rem solid var(--mt-color-line-gray);
margin-left: 0;
padding-left: 0.5rem;
}
.mt-post-txt .mt-custom-emoji {
height: 1.5rem;
min-width: 1.5rem;
margin-bottom: -0.25rem;
width: auto;
}
/* Poll */
.mt-post-poll {
margin-bottom: 1rem;
color: var(--mt-color-content-txt);
}
.mt-post-poll ul {
list-style: none;
padding: 0;
margin: 0;
}
.mt-post-poll ul li {
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
.mt-post-poll.mt-post-poll-expired ul li {
color: var(--mt-color-contrast-gray);
}
.mt-post-poll ul li:not(:last-child) {
margin-bottom: 0.25rem;
}
.mt-post-poll ul li:before {
content: "◯";
padding-right: 0.5rem;
}
.mt-post-poll.mt-post-poll-expired ul li:before {
content: "";
padding-right: 0;
}
/* Medias */
.mt-post-media-wrapper {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.5rem;
margin-bottom: 1rem;
}
.mt-post-media {
position: relative;
overflow: hidden;
width: 100%;
}
.mt-post-media-wrapper:has(> :last-child:nth-child(odd))
.mt-post-media:not(:only-child):first-child {
grid-column: 1 / 3;
}
.mt-post-media:only-child {
grid-column: 1 / 3;
}
.mt-post-media-spoiler > img,
.mt-post-media-spoiler > audio,
.mt-post-media-spoiler > video,
.mt-post-media-spoiler > .mt-btn-play {
filter: blur(2rem);
pointer-events: none;
}
.mt-post-media,
.mt-post-media-spoiler > img,
.mt-post-media-spoiler > audio,
.mt-post-media > img,
.mt-post-media > video {
border-radius: 0.5rem;
}
.mt-post-media > audio {
width: 100%;
position: relative;
z-index: 1;
}
.mt-post-media > img,
.mt-post-media > video {
width: 100%;
height: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
object-fit: cover;
text-align: center;
color: var(--mt-color-content-txt);
background-color: var(--mt-color-placeholder);
}
/* Dialog - modal */
body:has(dialog.mt-dialog[open]) {
overflow: hidden;
}
.mt-dialog {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
border: none;
color: var(--mt-color-content-txt);
background-color: transparent;
padding: 0;
margin: 1rem;
overflow: hidden;
}
.mt-dialog::backdrop {
background-color: var(--mt-color-backdrop);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
}
/* Carousel/lightbox */
.mt-carousel-header {
position: absolute;
top: 0;
right: 0;
z-index: 2;
}
.mt-carousel-body {
width: 100%;
height: 100%;
}
.mt-carousel-scroll {
display: flex;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
list-style: none;
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
scrollbar-width: none;
}
.mt-carousel-scroll::-webkit-scrollbar {
display: none;
-webkit-appearance: none;
}
.mt-carousel-item {
scroll-snap-align: center;
width: 100%;
height: 100%;
}
.mt-carousel-media-wrapper {
width: calc(100vw - 2.5rem);
height: 100%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.mt-carousel-media {
width: 100%;
height: 100%;
object-fit: contain;
padding: 2rem;
}
.mt-carousel-prev,
.mt-carousel-next {
position: absolute;
background-color: transparent;
border: none;
padding: 0.5rem;
z-index: 2;
}
.mt-carousel-prev {
left: 0;
padding-left: 0;
}
.mt-carousel-next {
right: 0;
padding-right: 0;
}
/* Preview link */
.mt-post-preview {
min-height: 4rem;
display: flex;
flex-direction: row;
border: 1px solid var(--mt-color-line-gray);
border-radius: 0.5rem;
color: var(--mt-color-link);
font-size: 0.8rem;
margin: 1rem 0;
overflow: hidden;
}
.mt-post-preview-image {
width: 40%;
align-self: stretch;
}
.mt-post-preview-image img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
color: var(--mt-color-content-txt);
}
.mt-post-preview-noImage {
width: 40%;
font-size: 1.5rem;
align-self: center;
text-align: center;
}
.mt-post-preview-content {
width: 60%;
display: flex;
align-self: center;
flex-direction: column;
padding: 0.5rem 1rem;
gap: 0.5rem;
}
.mt-post-preview-content:has(.mt-post-preview-description.truncate) {
align-self: unset;
}
.mt-post-preview-description {
display: block;
color: var(--mt-color-contrast-gray);
}
.mt-post-preview-description.truncate {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: var(--mt-preview-max-lines);
-webkit-box-orient: vertical;
}
.mt-post-preview-description:not(.truncate) .ellipsis::after {
content: "...";
}
.mt-post-preview-title {
font-weight: 600;
}
/* Counter bar */
.mt-post-counter-bar {
display: flex;
min-width: 6rem;
max-width: 40rem;
justify-content: space-between;
color: var(--mt-color-contrast-gray);
}
.mt-post-counter-bar-replies,
.mt-post-counter-bar-reblog,
.mt-post-counter-bar-favorites {
display: flex;
font-size: 0.75rem;
gap: 0.25rem;
align-items: center;
opacity: 0.5;
cursor: default;
}
.mt-post-counter-bar-replies > svg,
.mt-post-counter-bar-reblog > svg,
.mt-post-counter-bar-favorites > svg {
width: 1rem;
fill: var(--mt-color-contrast-gray);
}
/* Buttons */
.mt-btn-play {
display: flex;
position: absolute;
width: 3rem;
height: 3rem;
top: calc(50% - 1.5rem);
left: calc(50% - 1.5rem);
justify-content: center;
align-items: center;
background-color: transparent;
border: none;
cursor: pointer;
}
.mt-btn-play > svg {
width: 2.5rem;
height: 2.5rem;
fill: var(--mt-color-bg);
stroke: var(--mt-color-content-txt);
stroke-width: 1px;
}
.mt-post-media.mt-loading-spinner .mt-btn-play {
display: none;
}
.mt-container .mt-btn-dark,
.mt-dialog .mt-btn-dark {
display: flex;
border-radius: 0.25rem;
background-color: var(--mt-color-line-gray);
border: 0;
color: var(--mt-color-content-txt);
font-weight: 600;
font-size: 0.75rem;
text-align: center;
padding: 0.25rem 0.5rem;
line-height: 1.25rem;
vertical-align: top;
}
.mt-dialog .mt-btn-dark {
margin-left: auto;
}
.mt-dialog .mt-btn-violet,
.mt-dialog a.mt-btn-violet,
.mt-container .mt-btn-violet,
.mt-container a.mt-btn-violet {
display: flex;
align-items: center;
gap: 0.5rem;
border-radius: 0.25rem;
border: 0.5rem;
padding: 0.5rem 0.75rem;
font-size: 1rem;
font-weight: 600;
text-align: center;
background-color: var(--mt-color-btn-bg);
color: var(--mt-color-btn-txt);
}
.mt-dialog .mt-btn-violet:hover,
.mt-dialog a.mt-btn-violet:hover,
.mt-container .mt-btn-violet:hover,
.mt-container a.mt-btn-violet:hover {
background-color: var(--mt-color-btn-bg-hover);
text-decoration: none;
}
.mt-post-txt .mt-btn-spoiler-txt {
display: inline-block;
vertical-align: middle;
}
.mt-post-media.mt-loading-spinner > .mt-btn-spoiler-media {
display: none;
}
.mt-post-media > .mt-btn-spoiler-media-show {
position: absolute;
top: 50%;
left: 50%;
z-index: 2;
transform: translate(-50%, -50%);
}
.mt-post-media.mt-post-media-spoiler > .mt-btn-spoiler-media-hide,
.mt-post-media:not([data-media-width-hd]) > .mt-btn-spoiler-media-hide {
display: none;
}
.mt-post-media:not(.mt-post-media-spoiler) > .mt-btn-spoiler-media-show {
display: none;
}
.mt-post-media > .mt-btn-spoiler-media-hide {
position: absolute;
top: 0.5rem;
left: 0.5rem;
z-index: 2;
}
.mt-post-media > .mt-btn-spoiler-media-hide > svg {
fill: var(--mt-color-content-txt);
pointer-events: none;
}
/* Error */
.mt-error {
position: absolute;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
height: calc(100% - 3.5rem);
width: calc(100% - 4.5rem);
justify-content: center;
align-items: center;
color: var(--mt-color-error-txt);
padding: 0.75rem;
text-align: center;
}
.mt-error-icon {
font-size: 2rem;
margin-bottom: 1rem;
}
.mt-error-message {
width: 100%;
padding: 1rem 0;
}
.mt-error-message hr {
color: var(--mt-color-line-gray);
}
/* Loading spinner */
.mt-body > .mt-loading-spinner {
position: absolute;
width: 3rem;
height: 3rem;
margin: auto;
top: calc(50% - 1.5rem);
right: calc(50% - 1.5rem);
}
.mt-loading-spinner {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'%3E%3Cg%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 64 64' to='360 64 64' dur='1000ms' repeatCount='indefinite'/%3E%3Cpath d='M64 6.69a57.3 57.3 0 1 1 0 114.61A57.3 57.3 0 0 1 6.69 64' fill='none' stroke='%23404040' stroke-width='12'/%3E%3C/g%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: center center;
background-color: transparent;
background-size: min(2.5rem, calc(100% - 0.5rem));
}
/* Footer */
.mt-footer {
display: flex;
flex-flow: wrap;
margin: auto auto 2rem auto;
padding: 0 1rem;
gap: 1.5rem;
align-items: center;
justify-content: center;
}
/* Hidden elements */
.visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}
/* Responsive styles */
@supports (container-type: inline-size) {
@container mt-container (max-width: 20rem) {
.mt-body {
padding: 0 0.5rem;
}
.mt-container .mt-post-header-date > a {
white-space: normal;
}
.mt-post-media-wrapper .mt-post-media {
grid-column: 1 / 3;
}
}
}
@supports not (container-type: inline-size) {
@media screen and (max-width: clamp(20rem, 40rem, 60rem)) {
.mt-body {
padding: 0 0.5rem;
}
.mt-container .mt-post-header-date > a {
white-space: normal;
}
.mt-post-media-wrapper .mt-post-media {
grid-column: 1 / 3;
}
}
}