sass-site/source/assets/sass/visual-design/_typography.scss

260 lines
4.3 KiB
SCSS
Raw Normal View History

2023-01-12 20:54:24 +01:00
@use 'sass:math';
2023-01-12 19:19:42 +01:00
2023-01-12 20:54:24 +01:00
@use '../breakpoints';
@use '../functions';
2023-01-12 19:19:42 +01:00
2023-01-09 20:10:02 +01:00
$sl-font-weight--light: 300 !default;
2023-01-06 22:40:29 +01:00
$sl-font-weight--regular: 400 !default;
2023-01-09 20:10:02 +01:00
$sl-font-weight--bold: 600 !default;
2023-01-06 22:40:29 +01:00
$sl-font-weights: (
2023-01-09 20:10:02 +01:00
light: $sl-font-weight--light,
2023-01-06 22:40:29 +01:00
regular: $sl-font-weight--regular,
2023-01-09 20:10:02 +01:00
bold: $sl-font-weight--bold,
2023-01-06 22:40:29 +01:00
);
2023-01-09 20:10:02 +01:00
@each $name, $value in $sl-font-weights {
.sl-font-weight--#{$name} {
font-weight: $value;
}
2023-01-06 22:40:29 +01:00
}
2023-01-12 19:19:42 +01:00
$sl-font-size--x-small: functions.sl-px-to-rem(14px) !default;
$sl-font-size--small: functions.sl-px-to-rem(16px) !default;
$sl-font-size--medium: functions.sl-px-to-rem(18px) !default;
$sl-font-size--large: functions.sl-px-to-rem(20px) !default;
$sl-font-size--x-large: functions.sl-px-to-rem(24px) !default;
$sl-font-size--xx-large: functions.sl-px-to-rem(28px) !default;
$sl-font-size--xxx-large: functions.sl-px-to-rem(32px) !default;
$sl-font-size--xxxx-large: functions.sl-px-to-rem(80px) !default;
2023-01-06 22:40:29 +01:00
$sl-font-sizes: (
2023-01-09 20:10:02 +01:00
small: $sl-font-size--small,
medium: $sl-font-size--medium,
large: $sl-font-size--large,
x-large: $sl-font-size--x-large,
xx-large: $sl-font-size--xx-large,
xxx-large: $sl-font-size--xxx-large,
2023-01-06 22:40:29 +01:00
xxxx-large: $sl-font-size--xxxx-large,
);
2023-01-09 20:10:02 +01:00
@each $name, $value in $sl-font-sizes {
.sl-font-size--#{$name} {
font-size: $value;
}
2023-01-06 22:40:29 +01:00
}
2023-01-09 20:10:02 +01:00
$sl-font-family--text: 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI',
2023-01-09 23:19:15 +01:00
roboto, ubuntu, cantarell, 'Noto Sans', sans-serif, 'Apple Color Emoji',
2023-01-09 20:10:02 +01:00
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
$sl-font-family--display: 'Source Serif Pro', 'Apple Garamond', 'Baskerville',
2023-01-09 23:19:15 +01:00
'Times New Roman', 'Droid Serif', times, serif, 'Apple Color Emoji',
2023-01-09 20:10:02 +01:00
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
2023-01-09 23:19:15 +01:00
$sl-font-family--code: 'Source Code Pro', 'SF Mono', monaco, inconsolata,
2023-01-09 20:10:02 +01:00
'Fira Mono', 'Droid Sans Mono', monospace, monospace !default;
2023-01-06 22:40:29 +01:00
$sl-font-families: (
2023-01-09 20:10:02 +01:00
text: $sl-font-family--text,
2023-01-06 22:40:29 +01:00
display: $sl-font-family--display,
2023-01-09 20:10:02 +01:00
code: $sl-font-family--code,
2023-01-06 22:40:29 +01:00
);
2023-01-09 20:10:02 +01:00
@each $name, $value in $sl-font-families {
.sl-font-family--#{$name} {
font-family: $value;
}
2023-01-06 22:40:29 +01:00
}
body,
h5,
2023-01-09 20:10:02 +01:00
h6 {
font-size: $sl-font-size--medium;
}
2023-01-06 22:40:29 +01:00
body {
line-height: 1.5;
font-family: $sl-font-family--text;
2023-01-09 23:19:15 +01:00
text-rendering: optimizelegibility;
2023-01-06 22:40:29 +01:00
}
2023-01-09 20:10:02 +01:00
* {
min-width: 0;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
a {
text-decoration: none;
}
2023-01-06 22:40:29 +01:00
strong,
b,
h5,
h6,
dt,
tbody th,
2023-01-09 20:10:02 +01:00
label {
font-weight: $sl-font-weight--bold;
}
2023-01-06 22:40:29 +01:00
h1,
h2,
caption,
h3,
h4,
h5,
h6,
p,
ul,
ol,
dl,
figure,
details {
margin: 1rem 0;
padding: 0;
}
h2,
h3,
h4,
h5,
h6 {
margin-top: 2.5rem;
2023-01-09 20:10:02 +01:00
aside &,
nav & {
margin-top: 1rem;
}
2023-01-06 22:40:29 +01:00
}
ul,
ol,
2023-01-09 20:10:02 +01:00
dd {
margin-left: 1.75rem;
}
2023-01-06 22:40:29 +01:00
h1,
h2,
caption,
h3,
h4,
h5,
h6 {
font-weight: $sl-font-weight--regular;
line-height: 1.25;
}
h1,
h2,
2023-01-09 20:10:02 +01:00
caption {
2023-01-12 19:19:42 +01:00
letter-spacing: -#{functions.sl-px-to-em(0.5px)};
2023-01-09 20:10:02 +01:00
}
2023-01-06 22:40:29 +01:00
h1,
2023-01-09 20:10:02 +01:00
h2 {
font-weight: $sl-font-weight--light;
}
2023-01-06 22:40:29 +01:00
h1 {
margin-top: 0;
font-size: $sl-font-size--xx-large;
line-height: 1;
text-align: center;
2023-01-12 19:19:42 +01:00
@include breakpoints.sl-breakpoint--medium {
2023-01-09 20:10:02 +01:00
font-size: $sl-font-size--xxx-large;
}
2023-01-06 22:40:29 +01:00
2023-01-12 19:19:42 +01:00
@include breakpoints.sl-breakpoint--large {
2023-01-09 20:10:02 +01:00
font-size: $sl-font-size--xxxx-large;
}
2023-01-06 22:40:29 +01:00
}
h2,
caption,
legend,
h3,
2023-01-09 20:10:02 +01:00
thead th {
font-family: $sl-font-family--display;
}
2023-01-06 22:40:29 +01:00
h2,
caption {
font-size: $sl-font-size--x-large;
2023-01-12 19:19:42 +01:00
@include breakpoints.sl-breakpoint--medium {
2023-01-09 20:10:02 +01:00
font-size: $sl-font-size--xx-large;
}
2023-01-06 22:40:29 +01:00
2023-01-12 19:19:42 +01:00
@include breakpoints.sl-breakpoint--large {
2023-01-09 20:10:02 +01:00
font-size: $sl-font-size--xxx-large;
}
2023-01-06 22:40:29 +01:00
}
h3,
2023-01-09 20:10:02 +01:00
h4 {
font-size: $sl-font-size--large;
}
2023-01-06 22:40:29 +01:00
nav,
2023-01-09 20:10:02 +01:00
footer {
font-size: $sl-font-size--small;
}
2023-01-06 22:40:29 +01:00
.caps {
2023-01-12 19:19:42 +01:00
font-size: functions.sl-px-to-em(14px);
2023-01-06 22:40:29 +01:00
text-transform: uppercase;
2023-01-12 19:19:42 +01:00
letter-spacing: functions.sl-px-to-em(1px);
2023-01-06 22:40:29 +01:00
line-height: 0;
}
code,
pre {
font-family: $sl-font-family--code;
}
code {
// Scale the code font size down, because the font itself is much larger.
2023-01-12 19:19:42 +01:00
font-size: math.div($sl-font-size--small, $sl-font-size--medium) * 1em;
2023-01-06 22:40:29 +01:00
line-height: 1;
2023-01-09 20:10:02 +01:00
nav & {
white-space: nowrap;
}
2023-01-09 23:19:15 +01:00
2023-01-06 22:40:29 +01:00
p & {
2023-01-12 19:19:42 +01:00
@include breakpoints.sl-breakpoint--x-large {
2023-01-09 20:10:02 +01:00
white-space: nowrap;
}
2023-01-06 22:40:29 +01:00
}
}
pre {
font-size: $sl-font-size--x-small;
2023-01-09 20:10:02 +01:00
padding: 0.75rem 1rem;
2023-01-06 22:40:29 +01:00
overflow: auto;
white-space: pre-wrap;
code {
font-size: 1em;
line-height: inherit;
}
}
img {
display: block;
margin: {
right: auto;
left: auto;
2023-01-09 20:10:02 +01:00
}
2023-01-09 23:19:15 +01:00
2023-01-06 22:40:29 +01:00
max-width: 100%;
height: auto;
}
hr {
margin: {
top: 3rem;
bottom: 3rem;
2023-01-09 20:10:02 +01:00
}
2023-01-06 22:40:29 +01:00
}
2023-01-09 20:10:02 +01:00
dd {
margin: 0;
}