personal_site/_sass/base.scss
2024-07-20 17:37:00 +02:00

226 lines
4.6 KiB
SCSS

@import "vars";
@import "normalise"; // normalise CSS across browsers
@import "nav"; //the side navbar
@import "header"; // the header
@import "footer"; // the footer
@import "article"; // individual blog articles
@import "projects"; //Styles for the projects page
@import "cv"; // the CV page
@import "blogroll"; // the summaries of the blogposts
@import "comments"; //the mastodon comments
@import "model_viewer"; //Styles for the 3D model viewer
@import "mastodon_timeline";
// The syntax highlighting css
// generated with rougify style bw > code_style_bw.scss
// @import "code_style_bw";
@import "code_style_github";
@import "d2";
* {
box-sizing: border-box;
font-family: $font_stack;
text-rendering: geometricPrecision;
}
html {
width: 100vw;
scroll-behavior: smooth;
}
body {
--theme-text-color: #222;
--theme-bg-color: #fcfcfc;
--theme-model-line-color: #222;
--theme-model-bg-color: #fcfcfc;
--theme-subtle-outline: oklch(90% 0.0 50);
--theme-highlight-color: hsl(338, 75%, 60%);
--theme-highlight-color-transparent: hsla(338, 75%, 60%, 33%);
background: var(--theme-bg-color);
color: var(--theme-text-color);
// constrain width and center
max-width: 900px;
margin: auto;
}
// Padding to keep the keep the content to the right of the header
main {
container: main / inline-size;
max-width: 560px;
margin-left: 240px;
padding-left: 30px;
padding-right: 30px;
padding-top: 10vh;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
h1 {
font-size: 2em;
}
// img that are direct children of p are usually img tags in markdown
p > img {
margin-top: 2em;
margin-bottom: 1em;
width: 90%;
//hack to center images in p tags
display: block;
margin-left: auto;
margin-right: auto;
}
}
:is(h1, h2, h3, h4, .text-balance) {
text-wrap: balance;
}
p, figcaption {
font-size: 1em;
line-height: 1.3em;
}
main :is(p,h1,h2,h3,h4,h5,h6) {
margin-block-end: 0.2em;
}
a {
text-decoration: underline;
text-underline-offset: 0.25em;
text-decoration-thickness: 0.5px;
color: var(--theme-text-color);
}
header a, nav a {
text-decoration: none;
color: var(--theme-text-color);
}
div.highlight {
max-width: 100%;
overflow: auto;
}
p {
margin-top: 0.7em;
margin-bottom: 0.7em;
padding-right: 0;
vertical-align: baseline;
}
figure {
container: fig / inline-size;
width: 100%;
padding-bottom: 1em;
margin-left: auto;
margin-right: auto;
figcaption {
margin-top: 1em;
text-align: center;
}
}
figure > img, figure > svg, figure > canvas {
width: 100%;
margin-bottom: 1em;
border-radius: 10px;
}
figure.centered {
display: flex;
justify-content: center;
}
section.image-grid-4x4 {
aspect-ratio: 1 / 1;
display: grid;
grid-template-columns: auto auto;
grid-template-rows: auto auto;
gap: 2px;
margin-bottom: 1em;
place-items: stretch stretch;
* {
margin: 0;
padding: 0;
width: 100%;
aspect-ratio: auto;
}
}
section.note {
a {color: purple;}
p {margin: 0;}
padding: 1em;
margin-top: 1em;
margin-bottom: 1em;
background-color: var(--theme-highlight-color-transparent);
border-radius: 10px;
color: black;
}
// If the browser doesn't support web components, hide anything with has-wc class
body.has-wc .no-wc {
display: none;
}
// If the browser does support web components, hide anything with no-wc class
body:not(.has-wc) .has-wc {
display: none;
}
@media
only screen and (max-width: $horizontal_breakpoint),
only screen and (max-height: $vertical_breakpoint)
{
main {
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
margin: auto;
justify-content: flex-start;
}
article {
margin-left: 0px; }
h1 {font-size: 1.5em !important;}
.MathJax {
font-size: 0.8em !important;
overflow-x: auto;
overflow-y: hidden;
}
}
// For the 3D model viewer
model-viewer {
width: 100%;
height: 300px;
}
@media (prefers-color-scheme: dark) {
body {
--theme-text-color: #fcfcfc;
--theme-bg-color: #222;
--theme-subtle-outline: oklch(50% 0.0 50);
}
img {
opacity: .75;
transition: opacity .5s ease-in-out;
}
svg.invertable, img.invertable{
opacity: 1;
filter: invert(1);
}
}