315 lines
7.9 KiB
CSS
315 lines
7.9 KiB
CSS
|
/*
|
||
|
* design sizing
|
||
|
* Desktop: 1440x800
|
||
|
* Mobile: 375x667
|
||
|
*/
|
||
|
|
||
|
*,
|
||
|
::before,
|
||
|
::after {
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
box-sizing: border-box;
|
||
|
}
|
||
|
|
||
|
:root {
|
||
|
/* Colors */
|
||
|
/*I know style guide says dark cyan, but come on its dark green) */
|
||
|
--col-primary-dark-green: hsl(158, 36%, 37%);
|
||
|
--col-primary-darker-green: #1a4032;
|
||
|
--col-primary-cream: hsl(30, 38%, 92%);
|
||
|
|
||
|
--col-neutral-very-dark-blue: hsl(212, 21%, 14%);
|
||
|
--col-neutral-dark-grayish-blue: hsl(228, 12%, 48%);
|
||
|
--col-neutral-white: hsl(0, 0%, 100%);
|
||
|
|
||
|
--col-page-background: var(--col-primary-cream);
|
||
|
--col-card-background: var(--col-neutral-white);
|
||
|
--col-button-text: var(--col-neutral-white);
|
||
|
--col-button-background: var(--col-primary-dark-green);
|
||
|
--col-button-background-hover: var(--col-primary-darker-green);
|
||
|
--col-product-name: var(--col-neutral-very-dark-blue);
|
||
|
--col-product-description: var(--col-neutral-dark-grayish-blue);
|
||
|
--col-category-name: var(--col-neutral-dark-grayish-blue);
|
||
|
--col-price-current: var(--col-primary-dark-green);
|
||
|
--col-price-old: var(--col-neutral-dark-grayish-blue);
|
||
|
|
||
|
/* Typography */
|
||
|
--ff-category: "Montserrat", sans-serif;
|
||
|
--ff-product-name: "Fraunces", serif;
|
||
|
--ff-product-description: "Montserrat", sans-serif;
|
||
|
--ff-price-current: "Fraunces", serif;
|
||
|
--ff-price-old: "Montserrat", sans-serif;
|
||
|
--ff-button: "Montserrat", sans-serif;
|
||
|
|
||
|
--fs-category-name: 0.75rem;
|
||
|
--lh-category-name: 0.9375rem;
|
||
|
--ls-category-name: 5px;
|
||
|
--fw-category-name: 500;
|
||
|
|
||
|
--fs-product-name: 2rem;
|
||
|
--lh-product-name: 2rem;
|
||
|
--fw-product-name: 700;
|
||
|
|
||
|
--fs-product-description: 0.875rem;
|
||
|
--lh-product-description: 1.4375rem;
|
||
|
--fw-product-description: 500;
|
||
|
|
||
|
--fs-price-current: 2rem;
|
||
|
--lh-price-current: 2rem;
|
||
|
--fw-price-current: 700;
|
||
|
|
||
|
--fs-price-old: 0.8125rem;
|
||
|
--lh-price-old: 1.4375rem;
|
||
|
--fw-price-old: 500;
|
||
|
|
||
|
--fs-button: 0.875rem;
|
||
|
--lh-button: 1.0625rem;
|
||
|
--fw-button: 700;
|
||
|
|
||
|
/* Styling */
|
||
|
--border-radius-card: 0.625rem;
|
||
|
--border-radius-button: 0.5rem;
|
||
|
/* Positioning */
|
||
|
--padding-product-details: 1.5rem;
|
||
|
|
||
|
--width-product-card: 21.4375rem; /* 343px mobile */
|
||
|
|
||
|
--margin-bottom-product-card__details: 1.5rem;
|
||
|
--margin-bottom-product-card__category: 0.75rem;
|
||
|
--margin-bottom-product-card__name: 1rem;
|
||
|
--margin-bottom-product-card__description: 1.5rem;
|
||
|
--margin-bottom-product-card__price-block: 1.25rem;
|
||
|
|
||
|
/* Other */
|
||
|
--img-desktop: url(images/image-product-desktop.jpg);
|
||
|
--img-mobile: url(images/image-product-mobile.jpg);
|
||
|
--image-filter: none;
|
||
|
}
|
||
|
|
||
|
body {
|
||
|
min-height: 100vh;
|
||
|
|
||
|
display: grid;
|
||
|
place-content: center;
|
||
|
|
||
|
background-color: var(--col-page-background);
|
||
|
}
|
||
|
|
||
|
.product-card {
|
||
|
border-radius: var(--border-radius-card);
|
||
|
background-color: var(--col-card-background);
|
||
|
|
||
|
max-width: var(--width-product-card);
|
||
|
}
|
||
|
.product-card__image img {
|
||
|
border-radius: var(--border-radius-card) var(--border-radius-card) 0 0;
|
||
|
width: 100%;
|
||
|
filter: var(--image-filter);
|
||
|
/* filter: saturate(1.3); */
|
||
|
}
|
||
|
.product-card__details {
|
||
|
padding: var(--padding-product-details);
|
||
|
}
|
||
|
.product-card__category {
|
||
|
font-family: var(--ff-category);
|
||
|
font-size: var(--fs-category-name);
|
||
|
line-height: var(--lh-category-name);
|
||
|
font-weight: var(--fw-category-name);
|
||
|
letter-spacing: var(--ls-category-name);
|
||
|
|
||
|
text-transform: uppercase;
|
||
|
|
||
|
color: var(--col-category-name);
|
||
|
|
||
|
margin-bottom: var(--margin-bottom-product-card__category);
|
||
|
}
|
||
|
.product-card__name {
|
||
|
font-family: var(--ff-product-name);
|
||
|
font-size: var(--fs-product-name);
|
||
|
line-height: var(--lh-product-name);
|
||
|
font-weight: var(--fw-product-name);
|
||
|
|
||
|
color: var(--col-product-name);
|
||
|
|
||
|
margin-bottom: var(--margin-bottom-product-card__name);
|
||
|
}
|
||
|
.product-card__description {
|
||
|
font-family: var(--ff-product-description);
|
||
|
font-size: var(--fs-product-description);
|
||
|
line-height: var(--lh-product-description);
|
||
|
font-weight: var(--fw-product-description);
|
||
|
|
||
|
color: var(--col-product-description);
|
||
|
|
||
|
margin-bottom: var(--margin-bottom-product-card__description);
|
||
|
}
|
||
|
.product-card__price-block {
|
||
|
display: flex;
|
||
|
gap: 1.1875rem;
|
||
|
align-items: center;
|
||
|
|
||
|
margin-bottom: var(--margin-bottom-product-card__price-block);
|
||
|
}
|
||
|
.product-card__price-current {
|
||
|
font-family: var(--ff-price-current);
|
||
|
font-size: var(--fs-price-current);
|
||
|
line-height: var(--lh-price-current);
|
||
|
font-weight: var(--fw-price-current);
|
||
|
|
||
|
color: var(--col-price-current);
|
||
|
}
|
||
|
.product-card__price-old {
|
||
|
font-family: var(--ff-price-old);
|
||
|
font-size: var(--fs-price-old);
|
||
|
line-height: var(--lh-price-old);
|
||
|
font-weight: var(--fw-price-old);
|
||
|
|
||
|
text-decoration: line-through;
|
||
|
|
||
|
color: var(--col-price-old);
|
||
|
}
|
||
|
.product-card__button-buy {
|
||
|
font-family: var(--ff-button);
|
||
|
font-size: var(--fs-button);
|
||
|
line-height: var(--lh-button);
|
||
|
font-weight: var(--fw-button);
|
||
|
|
||
|
color: var(--col-button-text);
|
||
|
background-color: var(--col-button-background);
|
||
|
|
||
|
border-radius: var(--border-radius-button);
|
||
|
|
||
|
display: inline-flex;
|
||
|
justify-content: center;
|
||
|
gap: 0.75rem;
|
||
|
|
||
|
outline: none;
|
||
|
border: none;
|
||
|
padding: 0.9375rem 0;
|
||
|
width: 100%;
|
||
|
}
|
||
|
|
||
|
.product-card__button-buy:has(:focus, :hover) {
|
||
|
background-color: var(--col-button-background-hover);
|
||
|
}
|
||
|
|
||
|
@media screen and (min-width: 1000px) {
|
||
|
:root {
|
||
|
--padding-product-details: 2rem 2rem 1.875rem 2rem;
|
||
|
--width-product-card: 37.5rem;
|
||
|
|
||
|
--margin-bottom-product-card__details: 0;
|
||
|
--margin-bottom-product-card__category: 1.25rem;
|
||
|
--margin-bottom-product-card__name: 1.5rem;
|
||
|
--margin-bottom-product-card__description: 1.8125rem;
|
||
|
--margin-bottom-product-card__description: 1.875rem;
|
||
|
}
|
||
|
|
||
|
.product-card {
|
||
|
display: flex;
|
||
|
}
|
||
|
|
||
|
.product-card__image img {
|
||
|
border-radius: var(--border-radius-card) 0 0 var(--border-radius-card);
|
||
|
width: 18.75rem;
|
||
|
margin-bottom: unset;
|
||
|
height: 100%;
|
||
|
}
|
||
|
|
||
|
.product-card__button-buy {
|
||
|
padding: 0.9375rem 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* For Light / Dark button */
|
||
|
|
||
|
/* Update styling for checkbox */
|
||
|
html[data-theme="theme-dark"] {
|
||
|
--col-light-yellow: rgb(201, 175, 103);
|
||
|
--col-other-yellow: rgb(210, 169, 4);
|
||
|
--col-page-background: var(--col-neutral-very-dark-blue);
|
||
|
--col-card-background: rgb(97, 83, 83);
|
||
|
--col-button-text: rgb(40, 4, 4);
|
||
|
/* --col-button-background: rgb(48, 166, 48); */
|
||
|
--col-button-background: rgb(48, 166, 48);
|
||
|
|
||
|
--col-button-background-hover: rgba(7, 225, 7, 0.828);
|
||
|
--col-product-name: var(--col-other-yellow);
|
||
|
--col-product-description: var(--col-light-yellow);
|
||
|
--col-category-name: var(--col-light-yellow);
|
||
|
--col-price-current: var(--col-other-yellow);
|
||
|
--col-price-old: var(--col-light-yellow);
|
||
|
--image-filter: saturate(1.6);
|
||
|
}
|
||
|
|
||
|
.switch {
|
||
|
position: absolute;
|
||
|
display: inline-block;
|
||
|
width: 40px;
|
||
|
height: 40px;
|
||
|
|
||
|
top: 10px;
|
||
|
right: 10px;
|
||
|
|
||
|
z-index: 30;
|
||
|
}
|
||
|
|
||
|
/* Hide default HTML checkbox */
|
||
|
.switch input {
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
.slider {
|
||
|
position: absolute;
|
||
|
cursor: pointer;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
bottom: 0;
|
||
|
background-color: white;
|
||
|
-webkit-transition: 0.4s;
|
||
|
transition: 0.4s;
|
||
|
}
|
||
|
|
||
|
.slider:before {
|
||
|
position: absolute;
|
||
|
content: "";
|
||
|
height: 40px;
|
||
|
width: 40px;
|
||
|
left: 0px;
|
||
|
bottom: 4px;
|
||
|
top: 0;
|
||
|
bottom: 0;
|
||
|
margin: auto 0;
|
||
|
-webkit-transition: 0.4s;
|
||
|
transition: 0.4s;
|
||
|
box-shadow: 0 0px 15px #2020203d;
|
||
|
background-image: url("../images/bs-moon-stars-fill.svg");
|
||
|
background-repeat: no-repeat;
|
||
|
background-position: center;
|
||
|
}
|
||
|
|
||
|
/* input:checked + .slider {
|
||
|
background-color: #2196f3;
|
||
|
}
|
||
|
|
||
|
input:focus + .slider {
|
||
|
box-shadow: 0 0 1px #2196f3;
|
||
|
} */
|
||
|
|
||
|
input:checked + .slider:before {
|
||
|
color: green;
|
||
|
background-image: url("../images/bs-sun-fill.svg");
|
||
|
background-repeat: no-repeat;
|
||
|
background-position: center;
|
||
|
}
|
||
|
|
||
|
.slider.round {
|
||
|
border-radius: 34px;
|
||
|
}
|
||
|
|
||
|
.slider.round:before {
|
||
|
border-radius: 50%;
|
||
|
}
|