sass-site/source/assets/sass/visual-design/_typography.scss
2023-02-20 14:54:31 -06:00

237 lines
3.6 KiB
SCSS

@use 'sass:math';
@use '../breakpoints';
@use '../functions';
$sl-font-weight--light: 300 !default;
$sl-font-weight--regular: 400 !default;
$sl-font-weight--bold: 600 !default;
$sl-font-weights: (
light: $sl-font-weight--light,
regular: $sl-font-weight--regular,
bold: $sl-font-weight--bold,
);
@each $name, $value in $sl-font-weights {
.sl-font-weight--#{$name} {
font-weight: $value;
}
}
$sl-font-family--text: 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI',
roboto, ubuntu, cantarell, 'Noto Sans', sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
$sl-font-family--display: 'Source Serif Pro', 'Apple Garamond', 'Baskerville',
'Times New Roman', 'Droid Serif', times, serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
$sl-font-family--code: 'Source Code Pro', 'SF Mono', monaco, inconsolata,
'Fira Mono', 'Droid Sans Mono', monospace, monospace !default;
$sl-font-families: (
text: $sl-font-family--text,
display: $sl-font-family--display,
code: $sl-font-family--code,
);
@each $name, $value in $sl-font-families {
.sl-font-family--#{$name} {
font-family: $value;
}
}
body,
h5,
h6 {
font-size: var(--sl-font-size--medium);
}
body {
line-height: 1.5;
font-family: $sl-font-family--text;
text-rendering: optimizelegibility;
}
* {
min-width: 0;
}
a {
text-decoration: none;
}
strong,
b,
h5,
h6,
dt,
tbody th,
label {
font-weight: $sl-font-weight--bold;
}
h1,
h2,
caption,
h3,
h4,
h5,
h6,
p,
ul,
ol,
dl,
figure,
details {
margin: var(--gutter) 0;
padding: 0;
}
h2,
h3,
h4,
h5,
h6 {
margin-top: var(--gutter-double-sesqui);
aside &,
nav & {
margin-top: var(--gutter);
}
}
ul,
ol,
dd {
margin-left: 1.75rem;
}
h1,
h2,
caption,
h3,
h4,
h5,
h6 {
font-weight: $sl-font-weight--regular;
line-height: 1.25;
}
h1,
h2,
caption {
letter-spacing: -0.03125em;
}
h1,
h2 {
font-weight: $sl-font-weight--light;
}
h1 {
margin-top: 0;
font-size: var(--h1-size, var(--sl-font-size--xx-large));
line-height: 1;
text-align: center;
@include breakpoints.sl-breakpoint--medium {
--h1-size: var(--sl-font-size--xxx-large);
}
@include breakpoints.sl-breakpoint--large {
--h1-size: var(--sl-font-size--xxxx-large);
}
}
h2,
caption,
legend,
h3,
thead th {
font-family: $sl-font-family--display;
}
h2,
caption {
font-size: var(--h2-size, var(--sl-font-size--x-large));
@include breakpoints.sl-breakpoint--medium {
--h2-size: var(--sl-font-size--xx-large);
}
@include breakpoints.sl-breakpoint--large {
--h2-size: var(--sl-font-size--xxx-large);
}
}
h3,
h4 {
font-size: var(--sl-font-size--large);
}
nav,
footer {
font-size: var(--sl-font-size--small);
}
.caps {
font-size: 0.875em;
text-transform: uppercase;
letter-spacing: 0.0625em;
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.
font-size: 0.88889em;
line-height: 1;
nav & {
white-space: nowrap;
}
p & {
@include breakpoints.sl-breakpoint--x-large {
white-space: nowrap;
}
}
}
pre {
font-size: var(--sl-font-size--x-small);
padding: var(--gutter-minus) var(--gutter);
overflow: auto;
white-space: pre-wrap;
code {
font-size: var(--sl-font-size--x-small);
line-height: inherit;
}
}
img {
display: block;
margin: {
right: auto;
left: auto;
}
max-width: 100%;
height: auto;
}
hr {
margin: {
top: var(--gutter-triple);
bottom: var(--gutter-triple);
}
}
dd {
margin: 0;
}