website/assets/scss/extend.scss
Gabriel Arazas 321cb32369
Modularize site styles
The content is starting to use more and more custom Asciidoctor roles
so it is starting to be tedious to put it in one SCSS file.
2023-05-15 13:20:50 +08:00

143 lines
2.3 KiB
SCSS

// This is copied from https://stackoverflow.com/a/19721069.
$tooltip-size: 5em;
$line-height: 1.45;
@import "animations";
@import "asciidoctor";
:root {
--body-family: "Source Serif Pro", "IBM Plex Serif", "Noto Serif", serif;
--header-family: "Source Sans Pro", "IBM Plex Sans", "Noto Sans", sans-serif;
--mono-family: "Source Code Pro", "IBM Plex Mono", "Noto Mono", monospace;
overflow-wrap: break-word;
}
// Base styles.
table tr td > p {
margin-top: 1em;
}
ul,
ol {
margin: 1em 0 0;
}
pre {
margin-bottom: 0;
}
a:hover {
color: var(--base0B);
}
button {
border: var(--border-style);
}
hr {
border-color: var(--foreground);
}
kbd {
font-size: 0.9em;
}
main > article {
line-height: $line-height;
}
// Layouts
.site__title {
--size: 2rem;
margin-bottom: unset;
font-size: var(--size);
line-height: unset;
}
.site__socials {
list-style: none;
padding-left: 0;
}
.site__links--content,
.site__socials--content {
margin: 1em 0 0;
padding: 0;
gap: 1em;
display: flex;
width: 100%;
justify-content: space-around;
flex-flow: row wrap;
}
.site__links--content > * {
flex-basis: 20;
}
.site__socials--content > * {
flex-basis: 15%;
}
article.post {
padding: 0.5em;
background: var(--base01);
}
// Custom layouts
#logo {
--size: $tooltip-size;
display: flex;
align-items: center;
justify-content: center;
height: var(--size);
width: var(--size);
svg {
--size: 4em;
height: var(--size);
width: var(--size);
fill: var(--base0C);
position: relative;
animation: rainbow 3s infinite, pulse 2s alternate infinite,
bounce 0.6s ease-in-out alternate infinite;
}
}
[data-tooltip] {
&::before {
--scale: 0;
background: var(--base01);
content: attr(data-tooltip);
font-size: 0.8em;
padding: 0.5em;
position: absolute;
transform: translateY(var(--translate-y, -#{round($tooltip-size / 2)}))
scale(var(--scale));
transform-origin: bottom center;
width: max-content;
max-width: 100%;
}
&:hover::before {
--scale: 1;
}
}
// This setup will use asciidoctor-rouge.
.rouge.highlight,
code[data-lang] {
&::selection,
::selection {
background: var(--selection-color);
color: unset;
}
}
// Prefer reduced animations.
@media (prefers-reduced-motion) {
#logo svg {
animation: bounce 0.6s ease-in-out alternate infinite;
}
}