mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 14:28:25 -04:00
also migrated SASS to latest syntax (via dart-sass) and vastly simplified light/dark theme logic
159 lines
3.5 KiB
SCSS
159 lines
3.5 KiB
SCSS
@use "sass:map";
|
|
|
|
@use "../abstracts/functions";
|
|
@use "../abstracts/settings";
|
|
@use "../abstracts/themes";
|
|
|
|
// Global Styles
|
|
body {
|
|
width: 100%;
|
|
height: 100%;
|
|
margin: 0 auto;
|
|
scroll-behavior: smooth;
|
|
|
|
font-family: settings.$font-stack-sans;
|
|
font-kerning: normal;
|
|
font-variant-ligatures: normal;
|
|
font-feature-settings: "kern", "liga", "calt", "clig", "ss01";
|
|
|
|
// global base font size:
|
|
font-size: 0.975em;
|
|
line-height: 1.5;
|
|
|
|
// set themed lightbulb icons manually
|
|
&.light button.dark-mode-toggle {
|
|
background-image: url(themes.$icon-bulb-on);
|
|
}
|
|
|
|
&.dark button.dark-mode-toggle {
|
|
background-image: url(themes.$icon-bulb-off);
|
|
}
|
|
}
|
|
|
|
code,
|
|
pre,
|
|
.monospace {
|
|
font-family: settings.$font-stack-mono;
|
|
letter-spacing: normal;
|
|
}
|
|
|
|
// need to set light/dark mode backgrounds outside of the body selector
|
|
@include themes.themed(background-color, "background-outer");
|
|
|
|
// override above font-family if browser supports variable fonts
|
|
// https://caniuse.com/#feat=variable-fonts
|
|
@supports (font-variation-settings: normal) {
|
|
body {
|
|
font-family: settings.$font-stack-variable;
|
|
font-optical-sizing: auto;
|
|
}
|
|
|
|
code,
|
|
pre,
|
|
.monospace {
|
|
font-family: settings.$font-stack-mono-variable;
|
|
}
|
|
}
|
|
|
|
// stretch background for entire width of content area
|
|
main {
|
|
width: 100%;
|
|
padding: 0 1.5em;
|
|
|
|
@include themes.themed(color, "text");
|
|
@include themes.themed(background-color, "background-inner");
|
|
}
|
|
|
|
// this is what's extended by different layouts (in ../pages)
|
|
div.layout {
|
|
max-width: settings.$max-width;
|
|
margin: 0 auto;
|
|
display: block; // https://stackoverflow.com/questions/28794718/max-width-not-working-for-ie-11
|
|
}
|
|
|
|
a {
|
|
text-decoration: none;
|
|
background-position: 0% 100%;
|
|
background-repeat: no-repeat;
|
|
background-size: 0% settings.$link-underline-size;
|
|
padding-bottom: settings.$link-underline-size;
|
|
transition: background-size 0.25s ease-in-out;
|
|
|
|
@include themes.themed(color, "links");
|
|
|
|
// cool link underlines (via messy SCSS hacking):
|
|
// https://www.dannyguo.com/blog/animated-multiline-link-underlines-with-css/
|
|
@each $theme, $map in themes.$themes {
|
|
@at-root body.#{$theme} #{&} {
|
|
background-image: functions.underline-hack(map-get($map, "links"));
|
|
}
|
|
}
|
|
|
|
&:hover {
|
|
background-size: 100% settings.$link-underline-size;
|
|
}
|
|
|
|
&.no-underline {
|
|
background: none !important;
|
|
padding-bottom: 0;
|
|
}
|
|
}
|
|
|
|
b,
|
|
strong {
|
|
letter-spacing: 0.008em; // not sure why the discrepancy between weights
|
|
}
|
|
|
|
blockquote {
|
|
margin-left: 0;
|
|
padding-left: 1.5em;
|
|
border-left: 3px solid;
|
|
|
|
@include themes.themed(color, "medium-dark");
|
|
@include themes.themed(border-color, "links");
|
|
}
|
|
|
|
hr {
|
|
margin: 1.5em auto;
|
|
height: 2px;
|
|
border: 0;
|
|
|
|
@include themes.themed(background-color, "light");
|
|
}
|
|
|
|
// make SVG twemojis relative to surrounding text
|
|
// https://github.com/twitter/twemoji#inline-styles
|
|
img.emoji {
|
|
height: 1.2em;
|
|
width: 1.2em;
|
|
margin: 0 0.05em;
|
|
vertical-align: -0.22em;
|
|
border: 0;
|
|
display: inline-block;
|
|
|
|
// have cursor act like it's hovering a regular unicode emoji, especially since twemojis can still be copied/pasted
|
|
cursor: text;
|
|
}
|
|
|
|
// need to manually unset text cursor above when emoji's within a link
|
|
a img.emoji {
|
|
cursor: inherit;
|
|
}
|
|
|
|
// Responsive
|
|
@mixin responsive() {
|
|
body {
|
|
// Safari iOS menu bar reappears below 44px:
|
|
// https://www.eventbrite.com/engineering/mobile-safari-why/
|
|
padding-bottom: 45px !important;
|
|
|
|
// Allows you to scroll below the viewport; default value is visible
|
|
overflow-y: scroll;
|
|
}
|
|
|
|
main {
|
|
padding-left: 1.25em;
|
|
padding-right: 1.25em;
|
|
}
|
|
}
|