/* fonts */
@import url("https://fonts.googleapis.com/css2?family=Kumbh+Sans:wght@400;700&display=swap");

*,
::after,
::before {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
} /*16px*/

:root {
  /* primary */
  --primary-100: hsl(25, 100%, 94%);
  --primary-200: hsl(26, 100%, 55%);

  /* neutral */
  --neutral-100: hsl(223, 64%, 98%);
  --neutral-200: hsl(220, 14%, 75%);
  --neutral-300: hsl(219, 9%, 45%);
  --neutral-400: hsl(220, 13%, 13%);

  /* grey */
  --grey-50: #f8fafc;
  --grey-100: #f1f5f9;
  --grey-200: #e2e8f0;
  --grey-300: #cbd5e1;
  --grey-400: #94a3b8;
  --grey-500: #64748b;
  --grey-600: #475569;
  --grey-700: #334155;
  --grey-800: #1e293b;
  --grey-900: #0f172a;

  /* rest of the colors */
  --black: hsl(0, 0%, 0%);
  --white: hsl(0, 0%, 100%);
  --red-light: #f8d7da;
  --red-dark: #842029;
  --green-light: #d1e7dd;
  --green-dark: #0f5132;

  /* fonts  */
  --headingFont: "Kumbh Sans", sans-serif;
  --bodyFont: "Kumbh Sans", sans-serif;

  /* rest of the vars */
  --backgroundColor: var(--white);
  --borderRadius: 0.7rem;
  --letterSpacing: 1px;
  --transition: 0.3s ease-in-out all;
  --width: 90vw;
  --max-width: 1170px;
  --fixed-width: 600px;

  /* box shadow*/
  --shadow-1: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-2: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-3: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-4: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-5: 0 20px 25px -5px rgba(255, 125, 26, 0.25),
    0 10px 10px -5px rgba(255, 125, 26, 0.05);
}

body {
  background: var(--backgroundColor);
  font-family: var(--bodyFont);
}

a {
  text-decoration: none;
}
ul {
  list-style-type: none;
  padding: 0;
}

.img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* generals CTA buttons */

.btn {
  padding: 1rem 0;
  border-radius: var(--borderRadius);
  border: transparent;
  background: var(--primary-200);
  font-size: 1rem;
  font-family: inherit;
  text-transform: capitalize;
  font-weight: 700;
  color: var(--neutral-100);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  opacity: 0.7;
}

/*
============
Navbar
============
*/
.navbar {
  position: relative;
}

.nav-center {
  height: 4rem;
  width: var(--width);
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  column-gap: 1.5rem;
}

.avatar-btn {
  border-radius: 50%;
  width: 30px;
  border: 2px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  outline: transparent;
}

.avatar-btn:hover {
  border: 2px solid var(--primary-200);
}

.toggle-btn,
.cart-btn {
  background: transparent;
  border: transparent;
  outline: transparent;
  cursor: pointer;
}

.toggle-btn img {
  display: block;
}

.cart-btn {
  position: relative;
}

.cart-btn svg {
  fill: #69707d;
  transition: var(--transition);
}

.cart-btn:hover svg {
  fill: var(--neutral-400);
}

.amount-product-cart {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
  display: grid;
  place-content: center;
  min-width: 100%;
  padding: 0.1rem 0.4rem;
  background: var(--primary-200);
  border-radius: 0.55rem;
  color: var(--white);
  font-weight: 700;
  font-size: 0.7rem;
}

@media screen and (min-width: calc(1170px - 10vw)) {
  .avatar-btn {
    width: 50px;
  }
}

/*
============
Sidebar
============
*/

/* hide sidebar by default */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  background: var(--white);
  height: 100vh;
  width: 65vw;
  max-width: 500px;
  z-index: 2;
  transform: translate(-100%);
  transition: var(--transition);
}

.sidebar header {
  padding: 2rem 1.5rem 0 2rem;
}

/* show sidebar */
.sidebar.show {
  box-shadow: 0 0 0 10000px rgba(46, 44, 44, 0.7);
  transform: translate(0);
}

.close-btn {
  background: transparent;
  border: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.close-btn:hover {
  transform: rotate(360deg);
}

.nav-links {
  margin-top: 2.7rem;
}

.nav-link {
  font-size: 1.2rem;
  text-transform: capitalize;
  color: var(--black);
  font-weight: 700;
  display: block;
  padding: 0.6rem 2rem;
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--primary-200);
  padding: 0.6rem 2.5rem;
}

@media screen and (min-width: 1070px) {
  .nav-center {
    height: 8rem;
    border-bottom: 1px solid var(--neutral-200);
  }

  .nav-left {
    column-gap: 3rem;
  }

  .toggle-btn {
    display: none;
  }

  .sidebar {
    position: relative;
    height: auto;
    transform: translate(0);
    width: auto;
    background: var(--backgroundColor);
  }

  .sidebar-header {
    display: none;
  }

  .nav-links {
    display: flex;
    align-items: center;
    column-gap: 1.5rem;
    margin-top: 0;
  }

  .nav-link {
    padding: 0;
    color: var(--neutral-300);
    font-weight: 400;
    position: relative;
  }

  .nav-link:hover {
    padding: 0;
    background: var(--backgroundColor);
    color: var(--neutral-400);
  }

  .nav-link::after {
    content: "";
    position: absolute;
    bottom: calc(-4rem + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 4px;
    transition: var(--transition);
  }

  .nav-link:hover::after {
    background: var(--primary-200);
  }

  /* show sidebar */
  .sidebar.show {
    box-shadow: initial;
  }
}

/*
============
Cart
============
*/

/* hide cart by default */
.cart {
  transition: var(--transition);
  position: absolute;
  top: calc(4rem + 0.5rem);
  right: 0;
  transform: translateX(-0.5rem);
  width: calc(100% - 1rem);
  /* for screen > 425px, cart stays on the right side of the screen */
  max-width: 425px;
  border-radius: var(--borderRadius);
  box-shadow: var(--shadow-4);
  height: 0;
  overflow: hidden;
  background: var(--white);
  z-index: 1;
}

.cart.show {
  /* height content 183px */
  /* height header 69px */
  height: calc(69px + 183px);
}

.empty-alert {
  font-weight: 700;
  color: var(--neutral-300);
  height: 183px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart .cart-content {
  height: 0;
  overflow: hidden;
}

.cart header {
  padding: 1.5rem;
}

.cart header p {
  text-transform: capitalize;
  font-size: 1.1rem;
  font-weight: 700;
}

.separator {
  width: 100%;
  height: 1px;
  background: var(--neutral-200);
  opacity: 0.5;
}

.cart-products {
  padding: 0 1.5rem;
}

.cart-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.8rem;
  margin: 1.5rem 0;
}

.cart .product-image {
  width: 50px;
  border-radius: 0.3rem;
}

.cart .product-name {
  font-size: 1rem;
  text-transform: capitalize;
  color: var(--neutral-300);
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.cart .product-prices {
  color: var(--neutral-300);
}

.cart .product-total-price {
  color: var(--black);
  font-weight: 700;
}

.delete-product {
  background: transparent;
  border: transparent;
  cursor: pointer;
}

.delete-product svg {
  fill: #c3cad9;
  transition: var(--transition);
}

/* important in order to target the icon with event */
.delete-product svg use {
  pointer-events: none;
}

.delete-product:hover svg {
  fill: var(--neutral-400);
}

.checkout {
  display: block;
  margin: 0 auto;
  width: calc(100% - 3rem);
  margin-bottom: 2rem;
}

@media screen and (min-width: 1070px) {
  .cart {
    max-width: calc(375px - 1rem);
    top: calc(6rem + 0.5rem);
  }
}

@media screen and (min-width: calc(1170px + 10vw)) {
  .nav-center {
    position: relative;
  }

  .cart {
    right: calc(((-0.1 * 1170px) / 2) - 1rem);
  }
}

/*
============
Product Section
============
*/

@media screen and (min-width: 960px) {
  .section-center {
    width: var(--width);
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: calc(100vh - 5rem);
  }

  .product-component {
    display: flex;
    align-items: center;
    column-gap: 4rem;
    margin: 0 auto;
    margin-top: 1rem;
    margin-bottom: 2rem;
    width: 90%;
  }
}

@media screen and (min-width: 1070px) {
  .section-center {
    min-height: calc(100vh - 8rem - 4rem);
  }

  .product-component {
    column-gap: 6rem;
    margin-top: 4rem;
  }
}

/*
============
Product Section
  Image Gallery
============
*/

.main-image {
  position: relative;
  cursor: pointer;
}

.prev-btn,
.next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--backgroundColor);
  border: transparent;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  cursor: pointer;
}

.prev-btn {
  left: 1rem;
}

.next-btn {
  right: 1rem;
}

.prev-btn img,
.next-btn img {
  pointer-events: none;
}

/* only for desktop */
.images-thumbnails {
  display: none;
}

@media screen and (min-width: 960px) {
  .prev-btn,
  .next-btn {
    display: none;
  }

  .images-gallery {
    width: 100%;
  }

  /* generic style also used for modal */

  .main-image img,
  .images-thumbnails > figcaption > img {
    border-radius: var(--borderRadius);
  }

  /* only for desktop */
  .images-thumbnails {
    margin-top: 1.2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 1.2rem;
  }

  .thumbnails-image {
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--borderRadius);
    outline: 2px solid transparent;
  }

  .thumbnails-image::before {
    transition: var(--transition);
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: var(--backgroundColor);
    border-radius: var(--borderRadius);
    opacity: 0;
  }

  .thumbnails-image:hover::before {
    opacity: 0.45;
  }
  .thumbnails-image.selected::before {
    opacity: 0.65;
  }

  .thumbnails-image.selected {
    outline: 2px solid var(--primary-200);
  }

  /* end of generic style */
}

/*
============
Product Section
  Product Description
============
*/

.product-description {
  width: var(--width);
  max-width: var(--max-width);
  margin: 0 auto;
  margin-top: 1rem;
  margin-bottom: 3rem;
}

.product-description .company {
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--primary-200);
  margin-bottom: 1rem;
}

.product-description .product-name {
  color: var(--black);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
  text-transform: capitalize;
}

.product-description .description {
  padding: 1.2rem 0;
  color: var(--neutral-300);
  line-height: 1.5;
}

.product-description .product-offer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-description .price {
  color: var(--black);
  font-weight: 700;
  font-size: 1.7rem;
  display: inline-flex;
  column-gap: 1rem;
}

.product-description .promotion {
  font-size: 1rem;
  background: var(--primary-100);
  color: var(--primary-200);
  padding: 0.2rem 0.3rem;
  border-radius: 0.3rem;
  align-self: center;
}

.product-description .crossed-out-price {
  color: var(--neutral-200);
  text-decoration: line-through;
  font-weight: 700;
}

@media screen and (min-width: 960px) {
  .product-description {
    margin-top: 0;
    margin-bottom: 0;
    max-width: 496px;
  }
  .product-description .product-offer {
    flex-direction: column;
    align-items: flex-start;
    row-gap: 0.6rem;
  }

  .product-description .product-name {
    font-size: 2.3rem;
  }

  .product-description .description {
    padding: 1.5rem 0;
  }
}

@media screen and (min-width: 1070px) {
  .product-description .product-name {
    font-size: 2.8rem;
  }

  .product-description .description {
    padding: 2rem 0 1.5rem 0;
  }
}

/*
============
Product Section
  Product Description
    Call To Action
============
*/

.call-to-action {
  margin-top: 1.2rem;
}

.quantity-button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
}

.quantity-button :is(.amount, .minus, .plus) {
  height: 52px;
  border: transparent;
  font-weight: 700;
  font-family: inherit;
  background: var(--neutral-100);
  outline: transparent;
  display: inline-flex;
  align-items: center;
}

.quantity-button .amount {
  font-size: 1rem;
  flex-grow: 1;
  justify-content: center;
}

.quantity-button .minus,
.quantity-button .plus {
  cursor: pointer;
  transition: var(--transition);
  padding: 0 1.2rem;
}

.quantity-button .minus:hover,
.quantity-button .plus:hover {
  opacity: 0.7;
}

.quantity-button .minus {
  border-top-left-radius: var(--borderRadius);
  border-bottom-left-radius: var(--borderRadius);
}

.quantity-button .plus {
  border-top-right-radius: var(--borderRadius);
  border-bottom-right-radius: var(--borderRadius);
}

.btn[type="submit"] {
  display: inline-flex;
  justify-content: center;
  column-gap: 0.5rem;
  width: 100%;
  box-shadow: var(--shadow-5);
  outline: transparent;
}

.btn[type="submit"] svg {
  fill: #ffffff;
}

@media screen and (min-width: 960px) {
  .call-to-action {
    display: flex;
    align-items: center;
    column-gap: 1rem;
    margin-top: 2.5rem;
  }

  .quantity-button {
    margin-bottom: 0;
  }

  .quantity-button .amount {
    width: 55px;
  }
}

/*
============
Modal Lightbox
============
*/

/* disable modal on mobile */
.modal {
  display: none;
}

@media screen and (min-width: 960px) {
  .modal.open {
    display: grid;
  }

  .modal {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: rgba(0, 0, 0, 0.75);
    place-items: center;
    z-index: 2;
  }

  .close-modal {
    background: transparent;
    position: absolute;
    top: -2rem;
    right: 0;
    border: transparent;
    cursor: pointer;
  }

  .close-modal svg {
    transition: var(--transition);
    fill: #69707d;
  }

  .close-modal:hover svg {
    fill: var(--primary-200);
  }

  .modal .prev-btn,
  .modal .next-btn {
    display: grid;
  }

  .modal .next-btn svg,
  .modal .prev-btn svg {
    transition: var(--transition);
    stroke: #1d2026;
    pointer-events: none;
  }

  .modal .close-modal svg {
    pointer-events: none;
  }

  .modal .next-btn svg path,
  .modal .prev-btn svg path,
  .modal .close-modal svg path {
    pointer-events: none;
  }

  .modal .next-btn:hover svg,
  .modal .prev-btn:hover svg {
    stroke: var(--primary-200);
  }

  .modal .images-thumbnails {
    margin: 0 auto;
    margin-top: 1.5rem;
    width: 80%;
    column-gap: 1.5rem;
  }

  .modal .images-gallery {
    width: 38vw;
    max-width: 550px;
  }

  .modal .prev-btn {
    left: 0;
    transform: translate(-50%, -50%);
  }

  .modal .next-btn {
    right: 0;
    transform: translate(50%, -50%);
  }
}
