paulnicoue/assets/styles/main.scss

317 lines
8.1 KiB
SCSS
Raw Normal View History

2023-01-20 18:08:51 +01:00
// --------------------------------------------------
// VARIABLES
// --------------------------------------------------
:root {
// Fonts
--text-font-family: 'Karla', sans-serif;
--title-font-family: 'Cairo', sans-serif;
--extra-light-font-weight: 200;
--light-font-weight: 300;
--regular-font-weight: 400;
--medium-font-weight: 500;
--semi-bold-font-weight: 600;
--bold-font-weight: 700;
--extra-bold-font-weight: 800;
--black-font-weight: 900;
--h1-font-size: 2rem;
2023-03-03 12:00:04 +01:00
--h2-font-size: 1.8rem;
--h3-font-size: 1.4rem;
2023-01-20 18:08:51 +01:00
--text-font-size: 1.2rem;
--caption-font-size: 1.1rem;
--footnote-font-size: 1rem;
--line-height: 1.2;
--h1-font-height: calc(var(--h1-font-size) * var(--line-height));
--h2-font-height: calc(var(--h2-font-size) * var(--line-height));
--h3-font-height: calc(var(--h3-font-size) * var(--line-height));
--text-font-height: calc(var(--text-font-size) * var(--line-height));
--caption-font-height: calc(var(--caption-font-size) * var(--line-height));
--footnote-font-height: calc(var(--footnote-font-size) * var(--line-height));
2023-01-20 18:08:51 +01:00
// Dimensions
2023-02-21 11:52:22 +01:00
--large-content-width: Min(100%, 100rem);
2023-02-15 12:26:30 +01:00
--medium-content-width: Min(100%, 80rem);
2023-03-03 12:00:04 +01:00
--small-content-width: Min(100%, 60rem);
2023-01-20 18:08:51 +01:00
--regular-icon-size: 2rem;
2023-02-13 17:23:36 +01:00
--regular-icon-wrapper-size: calc(var(--regular-icon-size) + 1rem);
2023-03-03 12:12:57 +01:00
--button-icon-size: var(--text-font-height);
2023-02-14 17:50:36 +01:00
--button-with-icon-gap: 0.5rem;
2023-01-20 18:08:51 +01:00
// Colors
--eerie-black: #212121;
2023-02-13 17:23:36 +01:00
--gray: #7A7A7A;
2023-03-03 12:00:04 +01:00
--night: #141414;
2023-02-13 17:23:36 +01:00
--white-smoke: #F5F5F5;
2023-03-03 12:00:04 +01:00
--emerald: #72C080; // hsl(131, 38%, 60%)
--granny-smith-apple: #A3F3B0; // hsl(130, 77%, 80%)
2023-01-20 18:08:51 +01:00
--middle-green: #428F53;
2023-03-03 12:00:04 +01:00
--earth-yellow: #F9B262; // hsl(32, 93%, 68%)
--fawn: #F9BC76; // hsl(32, 92%, 72%)
2023-01-20 18:08:51 +01:00
--primary-color: var(--eerie-black);
2023-02-13 17:23:36 +01:00
--primary-color-light: var(--gray);
2023-03-03 12:00:04 +01:00
--primary-color-dark: var(--night);
--secondary-color: var(--white-smoke);
--primary-accent-color: var(--emerald);
--primary-accent-color-light: var(--granny-smith-apple);
--primary-accent-color-dark: var(--middle-green);
--primary-accent-gradient: linear-gradient(
2023-01-20 18:08:51 +01:00
45deg,
hsl(131deg 38% 60%) 1%,
hsl(131deg 40% 62%) 34%,
hsl(130deg 43% 64%) 46%,
hsl(130deg 46% 66%) 54%,
hsl(130deg 49% 69%) 60%,
hsl(130deg 53% 71%) 66%,
hsl(130deg 58% 73%) 71%,
hsl(130deg 63% 75%) 76%,
hsl(130deg 69% 77%) 83%,
hsl(130deg 77% 80%) 100%
);
2023-03-03 12:00:04 +01:00
--secondary-accent-color: var(--earth-yellow);
--secondary-accent-light: var(--fawn);
--secondary-accent-gradient: linear-gradient(
5deg,
hsl(32deg 93% 68%) 7%,
hsl(32deg 92% 69%) 65%,
hsl(32deg 92% 70%) 77%,
hsl(32deg 92% 71%) 83%,
hsl(32deg 92% 72%) 100%
);
2023-01-20 18:08:51 +01:00
}
// Media queries
2023-01-27 16:12:44 +01:00
$tablet-media-query: 48rem; // 768px
$desktop-media-query: 62rem; // 992px
2023-01-20 18:08:51 +01:00
// --------------------------------------------------
// FONTS AND COLORS
// --------------------------------------------------
body {
font-family: var(--text-font-family);
font-size: var(--text-font-size);
font-weight: var(--regular-font-weight);
line-height: var(--line-height);
color: var(--secondary-color);
background-color: var(--primary-color);
}
h1 {
font-family: var(--title-font-family);
font-size: var(--h1-font-size);
font-weight: var(--medium-font-weight);
}
h2 {
font-family: var(--title-font-family);
font-size: var(--h2-font-size);
2023-03-03 12:00:04 +01:00
font-weight: var(--medium-font-weight);
2023-01-20 18:08:51 +01:00
}
h3 {
2023-02-14 17:11:09 +01:00
font-family: var(--title-font-family);
2023-01-20 18:08:51 +01:00
font-size: var(--h3-font-size);
}
p {
font-weight: var(--light-font-weight);
}
strong {
2023-03-03 12:00:04 +01:00
font-weight: var(--medium-font-weight);
2023-01-20 18:08:51 +01:00
}
em {
font-style: italic;
}
// --------------------------------------------------
// LINK STYLE
// --------------------------------------------------
a {
color: var(--secondary-color);
2023-03-03 12:00:04 +01:00
text-decoration: underline var(--primary-accent-color);
2023-01-20 18:08:51 +01:00
border-radius: 2px;
transition: color 200ms ease-in-out;
&:hover,
&:focus,
&:active {
2023-03-03 12:00:04 +01:00
color: var(--primary-accent-color);
2023-01-20 18:08:51 +01:00
}
&:focus-visible {
2023-03-03 12:00:04 +01:00
outline: 1px dashed var(--primary-accent-color-light);
2023-01-20 18:08:51 +01:00
outline-offset: 2px;
2023-02-02 17:31:30 +01:00
animation: expand-outline-2px 200ms ease-in-out;
2023-01-20 18:08:51 +01:00
}
}
2023-02-13 17:23:36 +01:00
// --------------------------------------------------
// LIST STYLE
// --------------------------------------------------
ul {
list-style: disc outside;
}
2023-01-20 18:08:51 +01:00
// --------------------------------------------------
// BUTTON STYLE
// --------------------------------------------------
button {
padding: 1rem 1.5rem;
color: var(--primary-color);
2023-03-03 12:00:04 +01:00
background-image: var(--primary-accent-gradient);
2023-01-20 18:08:51 +01:00
background-size: 100%;
background-position: right center;
border: none;
border-radius: 40px;
cursor: pointer;
font-family: var(--title-font-family);
font-size: var(--text-font-size);
font-weight: var(--semi-bold-font-weight);
line-height: var(--line-height);
text-align: center;
transition: background-size 200ms ease-in-out;
&:hover,
&:focus,
&:active {
background-size: 300%;
}
&:focus-visible {
2023-03-03 12:00:04 +01:00
outline: 1px dashed var(--primary-accent-color-light);
2023-01-20 18:08:51 +01:00
outline-offset: 4px;
2023-02-02 17:31:30 +01:00
animation: expand-outline-4px 200ms ease-in-out;
2023-01-20 18:08:51 +01:00
}
}
@mixin button-with-icon {
display: flex;
justify-content: center;
align-items: center;
2023-02-14 17:50:36 +01:00
gap: var(--button-with-icon-gap);
2023-01-20 18:08:51 +01:00
2023-03-03 12:00:04 +01:00
span {
2023-03-03 12:12:57 +01:00
transform: translateX(calc((var(--button-with-icon-gap) + var(--button-icon-size)) / 2));
2023-01-20 18:08:51 +01:00
transition: transform 200ms ease-in-out;
}
2023-03-03 12:00:04 +01:00
svg {
2023-01-20 18:08:51 +01:00
flex-shrink: 0;
opacity: 0;
2023-03-03 12:12:57 +01:00
width: var(--button-icon-size);
height: var(--button-icon-size);
transform: translateX(calc((var(--button-with-icon-gap) + var(--button-icon-size)) / 2));
2023-01-20 18:08:51 +01:00
transition:
opacity 200ms ease-in-out,
transform 200ms ease-in-out;
}
2023-03-03 12:00:04 +01:00
&:hover span,
&:focus span,
&:active span {
2023-01-20 18:08:51 +01:00
transform: translateX(0);
}
2023-03-03 12:00:04 +01:00
&:hover svg,
&:focus svg,
&:active svg {
2023-01-20 18:08:51 +01:00
opacity: 1;
transform: translateX(0);
}
}
// --------------------------------------------------
// FORM STYLE
// --------------------------------------------------
2023-01-27 16:12:44 +01:00
form {
div {
position: relative;
label {
position: absolute;
top: calc(-1 * (var(--text-font-size) / 2));
left: 1rem;
display: inline-block;
padding: 0 0.5rem;
font-family: var(--title-font-family);
background-color: var(--primary-color);
}
input,
textarea {
font-family: var(--text-font-family);
font-size: var(--text-font-size);
font-weight: var(--light-font-weight);
line-height: var(--line-height);
width: 100%;
padding: 1rem;
color: var(--secondary-color);
background-color: var(--primary-color);
border: 1px solid var( --primary-color-light);
border-radius: 10px;
transition: border 200ms ease-in-out;
&:hover,
&:focus,
&:active {
2023-03-03 12:00:04 +01:00
border: 1px solid var(--primary-accent-color);
2023-01-27 16:12:44 +01:00
outline: none;
}
}
textarea {
resize: vertical;
min-height: 15rem;
}
2023-01-27 16:12:44 +01:00
p {
font-size: var(--caption-font-size);
2023-03-03 12:00:04 +01:00
color: var(--primary-accent-color);
2023-01-27 16:12:44 +01:00
}
}
2023-01-20 18:08:51 +01:00
}
2023-02-13 17:23:36 +01:00
// --------------------------------------------------
// SECTION STYLE
// --------------------------------------------------
section {
2023-02-15 12:26:30 +01:00
width: var(--medium-content-width);
2023-02-13 17:23:36 +01:00
padding: 4rem 2rem;
@media screen and (min-width: $tablet-media-query) {
2023-03-03 12:00:04 +01:00
padding: 6rem 4rem;
2023-02-15 12:26:30 +01:00
}
2023-02-13 17:23:36 +01:00
@media screen and (min-width: $desktop-media-query) {
padding: 6rem;
}
}
2023-02-15 12:26:30 +01:00
@mixin large-section {
width: var(--large-content-width);
2023-02-13 17:23:36 +01:00
}
// --------------------------------------------------
// SMOOTH SCROLLING
// --------------------------------------------------
2023-01-20 18:08:51 +01:00
html {
scroll-behavior: smooth;
2023-01-20 18:08:51 +01:00
}