chore: add css layers

finxol.io e2461898 5c7b4ff6

verified
Changed files
+178 -161
src
assets
+52 -43
src/assets/styles/index.css
···
}
&.content-projects {
-
--container-color: var(--fuchsia-400);
-
grid-area: content-projects;
}
}
-
section.container.layout {
-
display: grid;
-
grid-template-columns: auto auto 1fr;
-
grid-template-areas:
-
"aside h3 intro"
-
". body body";
-
align-items: center;
-
justify-content: start;
-
padding: calc(var(--spacing) * 2) var(--spacing) calc(var(--spacing) * 3);
-
grid-column-gap: var(--spacing);
-
@media screen and (max-width: 768px) {
-
grid-template-areas:
-
"aside h3"
-
". intro"
-
". body";
}
-
& > aside {
-
grid-area: aside;
-
margin-inline: 1.5rem;
-
font-size: 3rem;
-
font-weight: bold;
@media screen and (max-width: 768px) {
font-size: 2rem;
-
margin-inline: 0.5rem;
}
-
}
-
& > h3 {
-
grid-area: h3;
-
margin: 0;
-
margin-inline-end: 2rem;
-
font-family: "Spagetty";
-
font-size: 2rem;
-
font-weight: bold;
-
}
-
& > p {
-
grid-area: intro;
-
margin: 0;
-
font-size: 1.2rem;
-
}
-
-
& > div {
-
grid-area: body;
-
display: flex;
-
flex-direction: column;
-
gap: var(--spacing);
}
}
···
}
&.content-projects {
grid-area: content-projects;
}
}
+
section.container.content-projects {
+
--container-color: var(--rose-100);
+
& > div {
+
display: grid;
}
+
}
+
@layer components {
+
section.container.layout {
+
display: grid;
+
grid-template-columns: auto auto 1fr;
+
grid-template-areas:
+
"aside h3 intro"
+
". body body";
+
align-items: center;
+
justify-content: start;
+
padding: calc(var(--spacing) * 2) var(--spacing)
+
calc(var(--spacing) * 3);
+
grid-column-gap: var(--spacing);
@media screen and (max-width: 768px) {
+
grid-template-areas:
+
"aside h3"
+
". intro"
+
". body";
+
}
+
+
& > aside {
+
grid-area: aside;
+
margin-inline: 1.5rem;
+
font-size: 3rem;
+
font-weight: bold;
+
+
@media screen and (max-width: 768px) {
+
font-size: 2rem;
+
margin-inline: 0.5rem;
+
}
+
}
+
+
& > h3 {
+
grid-area: h3;
+
margin: 0;
+
margin-inline-end: 2rem;
+
font-family: "Spagetty";
font-size: 2rem;
+
font-weight: bold;
}
+
& > p {
+
grid-area: intro;
+
margin: 0;
+
font-size: 1.2rem;
+
}
+
& > div {
+
grid-area: body;
+
display: flex;
+
flex-direction: column;
+
gap: var(--spacing);
+
}
}
}
+45 -39
src/assets/styles/main.css
···
@import url("@/assets/fonts/easycoast.css");
@import url("@/assets/fonts/scorekard.css");
:root {
--radius: 0.75rem;
--spacing: 0.75rem;
}
-
.container {
-
padding: var(--spacing);
-
width: calc(100% - 2rem * var(--spacing));
-
border-radius: var(--radius);
-
color: var(--container-text-color, var(--emerald-950, black));
-
background-color: var(--container-color, var(--emerald-500, red));
-
}
-
svg[data-icon] {
-
--size: 1.5rem;
-
-
width: var(--size);
-
height: var(--size);
}
-
@media (max-width: 768px) {
-
.desktop-only {
-
display: none;
}
-
}
-
.content-grid {
-
--padding-inline: min(2%, 1.5rem);
-
display: grid;
-
grid-template-columns:
-
[full-width-start] var(--padding-inline)
-
[breakout-start] var(--padding-inline)
-
[content-start] 1fr
-
[content-end]
-
var(--padding-inline) [breakout-end]
-
var(--padding-inline) [full-width-end];
-
justify-content: start;
-
align-content: start;
-
row-gap: calc(var(--spacing) * 4);
-
}
-
.content-grid > :not(.breakout, .full-width),
-
.full-width > :not(.breakout, .full-width) {
-
grid-column: content;
-
}
-
.content-grid > .breakout {
-
grid-column: breakout;
-
}
-
.content-grid > .full-width {
-
grid-column: full-width;
}
···
@import url("@/assets/fonts/easycoast.css");
@import url("@/assets/fonts/scorekard.css");
+
@layer base, layout, components, utilities;
+
:root {
--radius: 0.75rem;
--spacing: 0.75rem;
}
+
@layer components {
+
svg[data-icon] {
+
--size: 1.5rem;
+
width: var(--size);
+
height: var(--size);
+
}
}
+
@layer utilities {
+
.container {
+
padding: var(--spacing);
+
width: calc(100% - 2rem * var(--spacing));
+
border-radius: var(--radius);
+
color: var(--container-text-color, var(--emerald-950, black));
+
background-color: var(--container-color, var(--emerald-500, red));
}
+
@media (max-width: 768px) {
+
.desktop-only {
+
display: none;
+
}
+
}
+
.content-grid {
+
--padding-inline: min(2%, 1.5rem);
+
display: grid;
+
grid-template-columns:
+
[full-width-start] var(--padding-inline)
+
[breakout-start] var(--padding-inline)
+
[content-start] 1fr
+
[content-end]
+
var(--padding-inline) [breakout-end]
+
var(--padding-inline) [full-width-end];
+
justify-content: start;
+
align-content: start;
+
row-gap: calc(var(--spacing) * 4);
+
}
+
.content-grid > :not(.breakout, .full-width),
+
.full-width > :not(.breakout, .full-width) {
+
grid-column: content;
+
}
+
+
.content-grid > .breakout {
+
grid-column: breakout;
+
}
+
.content-grid > .full-width {
+
grid-column: full-width;
+
}
}
+81 -79
src/assets/styles/reset.css
···
/* CSS Reset by Andy Bell : https://piccalil.li/blog/a-more-modern-css-reset/ */
-
/* Box sizing rules */
-
*,
-
*::before,
-
*::after {
-
box-sizing: border-box;
-
}
-
/* Prevent font size inflation */
-
html {
-
-moz-text-size-adjust: none;
-
-webkit-text-size-adjust: none;
-
text-size-adjust: none;
-
}
-
/* Remove default margin in favour of better control in authored CSS */
-
body,
-
h1,
-
h2,
-
h3,
-
h4,
-
p,
-
figure,
-
blockquote,
-
dl,
-
dd {
-
margin-block-end: 0;
-
}
-
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
-
ul[role="list"],
-
ol[role="list"] {
-
list-style: none;
-
}
-
/* Set core body defaults */
-
body {
-
line-height: 1.3;
-
padding: 0;
-
margin: 0;
-
}
-
/* Set shorter line heights on headings and interactive elements */
-
h1,
-
h2,
-
h3,
-
h4,
-
button,
-
input,
-
label {
-
line-height: 1.1;
-
}
-
/* Balance text wrapping on headings */
-
h1,
-
h2,
-
h3,
-
h4 {
-
text-wrap: balance;
-
}
-
/* A elements that don't have a class get default styles */
-
a:not([class]) {
-
text-decoration-skip-ink: auto;
-
color: currentColor;
-
}
-
/* Make images easier to work with */
-
img,
-
picture {
-
max-width: 100%;
-
display: block;
-
}
-
/* Inherit fonts for inputs and buttons */
-
input,
-
button,
-
textarea,
-
select {
-
font-family: inherit;
-
font-size: inherit;
-
}
-
/* Make sure textareas without a rows attribute are not tiny */
-
textarea:not([rows]) {
-
min-height: 10em;
-
}
-
/* Anything that has been anchored to should have extra scroll margin */
-
:target {
-
scroll-margin-block: 5ex;
}
···
/* CSS Reset by Andy Bell : https://piccalil.li/blog/a-more-modern-css-reset/ */
+
@layer base {
+
/* Box sizing rules */
+
*,
+
*::before,
+
*::after {
+
box-sizing: border-box;
+
}
+
/* Prevent font size inflation */
+
html {
+
-moz-text-size-adjust: none;
+
-webkit-text-size-adjust: none;
+
text-size-adjust: none;
+
}
+
/* Remove default margin in favour of better control in authored CSS */
+
body,
+
h1,
+
h2,
+
h3,
+
h4,
+
p,
+
figure,
+
blockquote,
+
dl,
+
dd {
+
margin-block-end: 0;
+
}
+
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
+
ul[role="list"],
+
ol[role="list"] {
+
list-style: none;
+
}
+
/* Set core body defaults */
+
body {
+
line-height: 1.3;
+
padding: 0;
+
margin: 0;
+
}
+
/* Set shorter line heights on headings and interactive elements */
+
h1,
+
h2,
+
h3,
+
h4,
+
button,
+
input,
+
label {
+
line-height: 1.1;
+
}
+
/* Balance text wrapping on headings */
+
h1,
+
h2,
+
h3,
+
h4 {
+
text-wrap: balance;
+
}
+
/* A elements that don't have a class get default styles */
+
a:not([class]) {
+
text-decoration-skip-ink: auto;
+
color: currentColor;
+
}
+
/* Make images easier to work with */
+
img,
+
picture {
+
max-width: 100%;
+
display: block;
+
}
+
/* Inherit fonts for inputs and buttons */
+
input,
+
button,
+
textarea,
+
select {
+
font-family: inherit;
+
font-size: inherit;
+
}
+
/* Make sure textareas without a rows attribute are not tiny */
+
textarea:not([rows]) {
+
min-height: 10em;
+
}
+
/* Anything that has been anchored to should have extra scroll margin */
+
:target {
+
scroll-margin-block: 5ex;
+
}
}