Move all the root styles to fragment files

Create assets/styles/root to hold all the fragments of the root
stylesheet. This should make it easier to find and hack on style. Yay!
This commit is contained in:
Eryn Wells 2023-05-19 17:05:49 -07:00
parent 273c380fe6
commit 8029f97f9c
16 changed files with 692 additions and 665 deletions

View file

@ -0,0 +1,7 @@
@layer reset {
body, button, h1, h2, h3, h4, h5, h6, input, ol, ul, p, pre, textarea {
padding: 0; margin: 0;
}
figure, figure .youtube { line-height: 1; }
}

View file

@ -0,0 +1,57 @@
@layer root {
figcaption {
margin-block-start: 0.2em;
text-align: center;
}
figure {
border-radius: 6px;
margin: 0;
margin-inline: 0;
overflow: hidden;
max-width: var(--content-width);
width: 100%;
}
figure.bordered {
padding: 0.5rem;
border: 2px solid #eee;
}
figure a,
figure a:hover {
border: 0;
}
figure img {
display: block;
border-radius: 6px;
height: auto;
max-width: var(--content-width);
width: 100%;
}
figure svg {
width: 100%;
height: auto;
}
figure .youtube {
border-radius: 6px;
overflow: hidden;
max-width: var(--content-width);
width: 100%;
}
.p5-sketch {
display: block;
position: relative;
width: 100%;
}
.youtube iframe {
aspect-ratio: 16 / 9;
margin-bottom: -3px;
width: 100%;
}
}

View file

@ -0,0 +1,8 @@
@layer root {
main > :first-child,
main > article > :first-child { margin-block-start: 0; }
main > :not(:last-child),
main > article > :not(:last-child) { margin-block-end: var(--body-item-spacing); }
main > :last-child,
main > article > :last-child { margin-block-end: 0; }
}

View file

@ -0,0 +1,29 @@
@layer root {
body:has(fieldset#ruby-controls > input[value=NONE]:checked) rt { display: none; }
/* When ruby-controls is set to hidden, hide the ruby base and only show the <rt> */
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) ruby > span { display: none; }
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) rt {
color: inherit;
display: inline;
font-size: inherit;
white-space: inherit;
}
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) :is(h1, h2, h3, h4, h5, h6) rt {
font-family: var(--font-family-heading);
font-weight: bold;
}
fieldset#ruby-controls input[type=radio] {
margin-inline-end: calc(var(--body-item-spacing) / 6);
}
fieldset#ruby-controls label {
margin-inline-end: calc(var(--body-item-spacing));
}
rt { transition: color 0.3s; }
ruby:hover rt { transition: color 0.3s; }
}

View file

@ -0,0 +1,40 @@
@layer root {
footer.site {
align-items: center;
display: flex;
flex-direction: column;
margin-block: var(--body-item-spacing);
text-align: center;
}
footer.site > ul {
align-items: center;
display: flex;
flex-wrap: wrap;
justify-content: center;
list-style: none;
}
footer.site > .slogans {
margin-block-end: 0;
}
footer.site > .slogans > li {
margin-block-end: 0;
margin-inline-start: 0.5em;
}
footer.site > p {
margin: 0;
}
footer.site p + p {
margin-top: 0.25rem;
}
@media (max-width: 740px) {
footer.site .slogans span {
white-space: nowrap;
}
}
}

View file

@ -0,0 +1,87 @@
@layer root {
header.site h1 > a:hover { text-decoration: none; }
header.site {
display: flex;
width: 100%;
z-index: 10000;
}
header.site h1 {
margin: 0;
order: 1;
}
header.site > .grid {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: 0 0.5em;
margin: 0 auto;
max-width: var(--content-width);
padding: 1.5rem 3rem;
width: 100%;
}
header.site > .grid > nav {
align-items: center;
display: flex;
justify-content: start;
list-style: none;
}
header.site nav > li { display: block; }
header.site nav:first-of-type {
justify-content: start;
order: 2;
}
header.site nav:last-of-type {
justify-content: end;
order: 3;
}
@media (max-width: 516px) {
header.site > .platter {
border-left: none;
border-radius: 0;
border-right: none;
border-top: none;
}
header.site > .grid { max-width: none; }
}
@media (max-width: 435px) {
header.site nav:first-of-type { order: 5; }
}
nav.social > li { margin-inline-start: var(--nav-bulleted-spacing); }
nav.social > li:first-child { margin-inline-start: 0; }
.social {
display: block flex;
letter-spacing: 2px;
margin-left: auto;
order: 2;
}
.social > li > a {
background-image: var(--url);
background-repeat: no-repeat;
background-size: var(--menu-icon-size);
display: block;
height: var(--menu-icon-size);
width: var(--menu-icon-size);
}
.social > li > a > span {
display: none;
}
.social > li + li:before {
color: var(--dark);
padding: 0 0.5rem;
}
}

View file

@ -0,0 +1,20 @@
.highlight code {
background-color: inherit;
margin-block: 0.5em;
}
.highlight .line {
display: grid;
grid-template-columns: max-content auto;
}
.highlight .ln a {
-webkit-user-select: none;
-moz-use-select: none;
-ms-user-select: none;
user-select: none;
}
.highlight .cl {
white-space: pre-wrap;
}

View file

@ -0,0 +1,57 @@
ul.tags {
display: flex;
height: min-content;
margin-inline-start: 0;
padding-inline-start: 0;
}
ul.tags > li {
background-color: var(--tag-background-color);
color: var(--tag-foreground-color);
border-radius: 4px;
display: inline-block;
font-size: 75%;
letter-spacing: 1px;
}
ul.tags > li:first-child {
margin-inline-start: 0;
}
ul.tags > li:hover {
background-color: var(--tag-hover-background-color);
}
ul.tags > li > a {
color: inherit;
display: block;
height: 100%;
width: 100%;
padding: 0.6rem 1rem;
}
ul.tags > li > a:hover {
color: var(--tag-hover-foreground-color);
text-decoration: none;
}
ul.tags > li + li { margin-inline-start: 1rem; }
ul.tags > li.chevron + li { margin-inline-start: 0 }
ul.tags > .chevron {
align-items: center;
border: 0;
border-radius: 0;
color: var(--tag-spacer-foreground-color);
background-color: inherit;
display: flex;
justify-content: center;
margin-inline-start: 0;
padding-inline-start: 1px;
width: 2rem;
}
ul.tags > .chevron:hover {
color: var(--tag-spacer-foreground-color);
background-color: inherit;
}

View file

@ -0,0 +1,173 @@
@font-face {
font-family: "Museo_Slab";
src: url("{{ `/fonts/Museo_Slab_500.woff2` | relURL }}") format("woff2"),
url("{{ `/fonts/Museo_Slab_500.woff` | relURL }}") format("woff");
font-weight: normal;
font-style: normal;
}
@layer typography {
:root {
--font-family: Verdana, Helvetica, sans-serif;
--font-family-heading: Museo_Slab, Tahoma, "Hiragino Mincho ProN", serif;
--font-family-monospace: "Courier New", Courier, monospace;
--font-family-site-heading: Museo_Slab, Tahoma, sans-serif;
--font-size: 2rem;
--font-size-max: 8px;
--font-size-min: 6px;
--font-size-scale-factor: 1vmax;
--site-header-font-size: 200%;
--line-height: 2;
--heading-line-height: 1;
/* A little extra line height so the descenders don't get clipped */
--site-heading-line-height: 1.1;
--landing-line-height: 1.85;
--color: rgba(var(--black), 0.8);
--a-color: rgb(var(--mid-blue));
--a-ruby-color: var(--color);
--heading-color: rgb(var(--black));
--site-nav-link-color: var(--a-color);
}
@media (prefers-color-scheme: dark) {
:root {
--color: rgba(var(--white), 0.8);
--heading-color: rgb(var(--white));
}
}
a { color: var(--a-color); }
a:visited { color: var(--a-color); }
a.hover-only { color: var(--color); }
a.hover-only:hover { color: var(--a-color); }
a rt, a:hover rt { color: var(--a-ruby-color); }
body {
font-size: var(--font-size);
line-height: var(--line-height);
}
code { font-family: var(--font-family-monospace); }
figcaption {
font-size: 80%;
line-height: var(--line-height);
}
footer.site {
font-size: 80%;
line-height: 1;
}
h1 { font-size: 305%; }
h2 { font-size: 244%; }
h3 { font-size: 195%; }
h4 { font-size: 156%; }
h5 { font-size: 125%; }
h6 { font-size: 100%; }
h5, h6 { font-family: var(--font-family-body); }
header.site nav > .active { font-weight: bold; }
header.site nav > li { color: var(--site-nav-link-color); }
main:has(header > .post-title > h1) h1 { font-size: 244%; }
main:has(header > .post-title > h1) h2 { font-size: 195%; }
main:has(header > .post-title > h1) h3 { font-size: 156%; }
main:has(header > .post-title > h1) h4 { font-size: 125%; }
main:has(header > .post-title > h1) h5 { font-size: 100%; }
main:has(header > .post-title > h1) h6 { font-size: 100%; }
main:has(header > .post-title > h1) :is(h5, h6) { font-family: var(--font-family-body); }
h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
font-family: var(--font-family-heading);
font-weight: 600;
letter-spacing: 1pt;
line-height: var(--heading-line-height);
}
header.site h1 {
--site-title-color1: rgb(103, 128, 229);
--site-title-color2: rgb(130, 90, 227);
--site-title-color3: rgb(135, 101, 228);
--site-title-color4: rgb(125, 115, 229);
--site-title-color5: rgb(107, 130, 230);
--site-title-color6: rgb(77, 153, 232);
--site-title-color7: rgb(74, 136, 230);
--site-title-color8: rgb(71, 128, 228);
--site-title-color9: rgb(65, 80, 224);
--site-title-color10: rgb(61, 58, 223);
color: rgb(var(--mid-blue));
font-family: var(--font-family-site-heading);
font-size: var(--site-header-font-size);
line-height: var(--site-heading-line-height);
white-space: nowrap;
}
header.site h1 > a { color: inherit; }
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
header.site h1 span:nth-child(10n + 1) { color: var(--site-title-color1); }
header.site h1 span:nth-child(10n + 2) { color: var(--site-title-color2); }
header.site h1 span:nth-child(10n + 3) { color: var(--site-title-color3); }
header.site h1 span:nth-child(10n + 4) { color: var(--site-title-color4); }
header.site h1 span:nth-child(10n + 5) { color: var(--site-title-color5); }
header.site h1 span:nth-child(10n + 6) { color: var(--site-title-color6); }
header.site h1 span:nth-child(10n + 7) { color: var(--site-title-color7); }
header.site h1 span:nth-child(10n + 8) { color: var(--site-title-color8); }
header.site h1 span:nth-child(10n + 9) { color: var(--site-title-color9); }
header.site h1 span:nth-child(10n) { color: var(--site-title-color10); }
}
@supports (background-clip: text) or (-webkit-background-clip: text) {
header.site h1 {
background:
radial-gradient(circle at 20% 70%, rgb(var(--purple)), transparent 40%),
radial-gradient(circle at 30% 30%, rgb(var(--lt-blue)), rgb(var(--mid-blue)) 20%, transparent 80%),
radial-gradient(ellipse at 95% 20%, rgb(var(--dk-blue)), rgb(var(--mid-blue)) 70%, transparent 80%),
radial-gradient(circle at 100% 100%, rgb(var(--purple)), rgb(var(--lilac)) 100%),
radial-gradient(circle at 45% 100%, rgb(var(--lilac)), rgb(var(--purple)) 60%),
radial-gradient(ellipse at 50% 50%, rgb(var(--dk-blue)), transparent 80%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
}
header.site nav {
font-size: max(1.5rem, 80%);
letter-spacing: 0.10em;
text-transform: lowercase;
}
header.site nav > li {
color: var(--site-nav-link-color);
}
:is(h1, h2, h3, h4, h5, h6) rt {
font-family: var(--font-family);
font-weight: normal;
letter-spacing: 0;
}
html {
color: var(--color);
font-family: var(--font-family);
font-size: clamp(var(--font-size-min), var(--font-size-scale-factor), var(--font-size-max));
}
main#landing p { line-height: var(--landing-line-height); }
nav.bulleted > li:first-child::before { color: var(--color); }
nav.bulleted > li::before { color: var(--heading-color); }
p { line-height: var(--line-height); }
ruby:hover rt { color: var(--color); }
@media (prefers-color-scheme: dark) {
rt { color: rgba(var(--white), 0.5); }
}
}

View file

@ -0,0 +1,26 @@
@layer utility {
.centered { text-align: center; }
.float-right { float: right; }
.nobreak { white-space: nowrap; }
.noselect {
cursor: default;
-webkit-user-select: none;
-moz-use-select: none;
-ms-user-select: none;
user-select: none;
}
.platter {
-webkit-backdrop-filter: var(--platter-backdrop-filter);
backdrop-filter: var(--platter-backdrop-filter);
background-color: var(--platter-background-color);
border: 1px solid var(--header-border-color);
border-radius: 12px;
box-shadow: 3px 4px 4px var(--header-box-shadow-color);
}
.visible { visibility: visible; }
article.two-column { columns: 2; }
}