/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Colors */
  --Very-dark-blue: hsl(220, 13%, 13%);
  --Dark-grayish-blue: hsl(219, 9%, 45%);
  --Grayish-blue: hsl(220, 14%, 75%);
  --Light-grayish-blue: hsl(223, 64%, 98%);
  --White: hsl(0, 0%, 100%);
  --Black: hsl(0, 0%, 0%); /* with 75% opacity for lightbox background*/
  --orange-500: hsl(26, 100%, 55%);
  --orange-300: hsl(25, 100%, 71%);

  /* Typography */
  --family-font: "Kumbh Sans", sans-serif;
  --text-preset-1: 700 2.75rem var(--family-font);
  --text-preset-1-line-height: 1.09;
  --text-preset-2: 700 1.75rem var(--family-font);
  --text-preset-2-line-height: 1.614;
  --text-preset-3-bold: 700 1rem var(--family-font);
  --text-preset-3-regular: 400 1rem / var(--family-font);
  --text-preset-3-line-height: 1.6;
  --text-preset-4: 400 0.9rem var(--family-font);
  --text-preset-4-line-height: 1.73;
  --text-preset-5: 700 0.8rem var(--family-font);
  --text-preset-5-line-height: 1.23;
  --text-preset-6: 700 0.8rem var(--family-font);
  --text-preset-6-line-height: 1.25;
}

/* ===== RESET AND BASE STYLES ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  font-family: var(--family-font);
  height: auto;
}

body {
  height: auto;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

main {
  padding-bottom: 2rem;
}

/* ===== ACCESSIBILITY STYLES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--orange-500);
  color: var(--White);
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
  font-weight: 700;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* ===== FOCUS INDICATORS ===== */
*:focus {
  outline: 2px solid var(--orange-500);
  outline-offset: 2px;
}

button:focus,
a:focus {
  outline: 2px solid var(--orange-500);
  outline-offset: 2px;
}

/* ===== LAYOUT COMPONENTS ===== */
header,
.product-description {
  padding-inline: 1.5rem;
  position: relative;
}

.main-container {
  z-index: 0;
}

/* ===== NAVIGATION ===== */
nav {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  align-items: center;
  padding-block: 1.4rem;
}

.logo-menu {
  display: flex;
  align-items: center;
}

.cart-avatar-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  cursor: pointer;
}

.menu-toggle,
#hamburger-menu {
  background: none;
  border: none;
  cursor: pointer;
  margin-right: 1rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle img,
#hamburger-menu img {
  width: 16px;
  height: 16px;
}

.cart-icon {
  display: flex;
  flex-direction: row;
  position: relative;
}

.cart-button {
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-button img {
  width: 16px;
}

.avatar-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-button img {
  height: 24px;
  width: 24px;
  border-radius: 50%;
}

/* ===== MENU STYLES ===== */
.menu {
  display: none;
  flex-direction: column;
  gap: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 65%;
  z-index: 10;
  background-color: var(--White);
  padding: 1.5rem;
}

.menu-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-close img {
  width: 13.5px;
  height: 13.5px;
}

ul {
  list-style-type: none;
}

li {
  margin-block: 1.5rem;
}

li > a {
  text-decoration: none;
  color: black;
  font-size: 1.1rem;
  font-weight: 700;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9;
  transition: opacity 0.3s ease;
}

.hidden {
  display: none;
}

/* ===== PRODUCT CAROUSEL ===== */
.carousel {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
}

.carousel-wrapper {
  width: 100%;
  height: auto;
  max-height: 300px;
  -webkit-overflow-scrolling: touch;
  overflow: hidden;
  position: relative;
}

.product-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center top;
  display: none;
}

.product-image.active {
  display: block;
}

.arrows {
  display: flex;
  justify-content: space-between;
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding-inline: 0.5rem;
  gap: 1rem;
}

.carousel-button,
#previous,
#next {
  background-color: var(--White);
  border: none;
  cursor: pointer;
  padding: 0.8rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.carousel-button img {
  width: 12px;
  height: 12px;
}

.thumbnails {
  display: none;
  cursor: pointer;
}

.thumbnail {
  background: none;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.thumbnail:hover {
  opacity: 0.7;
}

.thumbnail.active,
.thumbnail[aria-selected="true"] {
  border-color: var(--orange-500);
}

.thumbnail.active img,
.thumbnail[aria-selected="true"] img {
  opacity: 0.6;
}

/* ===== TYPOGRAPHY ===== */
h1 {
  margin-block: 1rem;
  margin-right: 1rem;
}

.cart-count {
  background-color: var(--orange-500);
  padding-inline: 0.4rem;
  padding-top: 0.05rem;
  border-radius: 20px;
  color: var(--White);
  font-size: 0.6rem;
  position: absolute;
  top: -0.4rem;
  right: -0.6rem;
  display: none;
  min-width: 1.2rem;
  text-align: center;
}

.text-container > h2 {
  font: var(--text-preset-6);
  line-height: var(--text-preset-6-line-height);
  color: var(--Dark-grayish-blue);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 1.5rem;
}

p {
  font: var(--text-preset-4);
  color: var(--Dark-grayish-blue);
}

/* ===== PRICING ===== */
.price,
.current-price {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.price {
  margin-block: 2rem;
}

#discount {
  padding: 0.2rem 0.5rem;
  background-color: var(--Black);
  color: var(--White);
  font: var(--text-preset-3-bold);
  border-radius: 5px;
}

#old-price {
  text-decoration: line-through;
  color: var(--Dark-grayish-blue);
  font-size: 1rem;
}

/* ===== BUTTONS ===== */
.button-section {
  display: grid;
  gap: 1rem;
}

button {
  width: 100%;
  position: relative;
  padding-block: 1rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}

#quantity-button {
  background-color: var(--Light-grayish-blue);
  color: var(--Black);
  cursor: pointer;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 1rem;
  border-radius: 10px;
}

#quantity-button button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#quantity-button button img {
  width: 12px;
  height: 12px;
}

#quantity {
  font-weight: 700;
  color: var(--Black);
  min-width: 2rem;
  text-align: center;
}

#add-to-cart-button {
  background-color: var(--orange-500);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--White);
}

#add-to-cart-button > img {
  width: 16px;
  filter: brightness(0) saturate(100%) invert(1);
}

#add-to-cart-button:hover {
  background-color: var(--orange-300);
}

/* ===== CART/BASKET ===== */
.basket-card {
  display: none;
  width: 360px;
  height: 256px;
  border-radius: 10px;
  z-index: 3;
  position: absolute;
  background-color: var(--White);
  left: 50%;
  transform: translate(-50%, -50%);
  top: 290%;
  box-shadow: 0 15px 15px rgba(0, 0, 0, 0.2);
}

.basket-card.show {
  display: block;
}

.basket-card > h3 {
  margin-block: 1.5rem;
  margin-inline: 0.7rem;
}

.basket-full {
  margin: 1.5rem;
  display: none;
}

.basket-full > button {
  background-color: var(--orange-500);
  cursor: pointer;
  color: var(--White);
}

.basket-products {
  display: flex;
  flex-direction: row;
  margin-bottom: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.basket-products > img {
  width: 50px;
  height: 50px;
  border-radius: 5px;
}

.basket-products-info > p {
  font: var(--text-preset-4);
  line-height: var(--text-preset-4-line-height);
}

#total-price {
  font: var(--text-preset-3-bold);
  color: black;
}

.delete-button,
#bin-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: auto;
  height: auto;
}

.delete-button img,
#bin-icon img {
  width: 14px;
  height: 16px;
}

.basket-empty {
  display: none;
  justify-content: center;
  height: 100%;
  align-items: center;
}

.basket-empty > h4 {
  color: var(--Dark-grayish-blue);
  margin-bottom: 20%;
  text-align: center;
}

/* ===== HOVER STATES ===== */
.avatar-button:hover img {
  border: 2px solid var(--orange-500);
}

/* ===== MEDIA QUERIES ===== */

/* Tablet Styles */
@media screen and (min-width: 758px) and (max-width: 1024px) {
  main {
    padding-block: 2rem;
  }

  .main-container {
    max-width: 608px;
    margin: 0 auto;
  }

  .avatar-button img {
    height: 50px;
    width: 50px;
  }

  .cart-button img {
    width: 22px;
  }

  header,
  .product-description,
  .button-section {
    padding-inline: 0.2rem;
  }

  header {
    border-bottom: 1px solid var(--Grayish-blue);
  }

  nav {
    padding-bottom: 2rem;
  }

  .menu {
    padding-top: 3rem;
    padding-left: 5rem;
  }

  .product-image {
    width: 100%;
    object-fit: cover;
    border-radius: 15px;
    object-position: center top;
  }

  #image-1 {
    object-position: center;
  }

  .carousel {
    height: 100%;
    width: 100%;
    display: flex;
  }

  .carousel-wrapper {
    width: 100%;
    max-width: 100vw;
    height: 290px;
    overflow: hidden;
    position: relative;
    margin-top: 3rem;
  }

  h1 {
    font: var(--text-preset-1);
    line-height: var(--text-preset-1-line-height);
    margin-right: 0;
  }

  .text-container > p {
    line-height: 26px;
    font-size: 1rem;
  }

  .price {
    flex-direction: column;
    align-items: start;
  }

  .current-price > h3 {
    font: var(--text-preset-2);
    line-height: var(--text-preset-2-line-height);
  }

  .button-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .thumbnails {
    display: none;
  }

  .basket-card {
    display: none;
    top: 220%;
    left: 75%;
  }
}

/* Desktop Styles */
@media screen and (min-width: 1025px) {
  .main-container {
    max-width: 1110px;
    margin-inline: auto;
    margin-top: 0;
  }

  /* Navigation adjustments */
  .menu-toggle,
  #hamburger-menu {
    display: none;
  }

  .menu-close,
  #closing-icon {
    display: none;
  }

  .menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: static;
    background-color: transparent;
    height: auto;
    width: auto;
    margin-left: -18rem;
    z-index: 0;
  }

  #menu-links {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-left: 1rem;
  }

  li > a {
    color: var(--Dark-grayish-blue);
    font-weight: 400;
  }

  li {
    position: relative;
  }

  li > a:hover::after {
    transform: scaleX(1);
    transition: transform 0.3s ease;
  }

  li > a::after {
    content: "";
    position: absolute;
    height: 4px;
    background-color: var(--orange-500);
    transform-origin: center;
    left: 0;
    transform: scaleX(0);
    bottom: -82px;
    width: 100%;
  }

  /* Header and avatar styles */
  .avatar-button img {
    height: 50px;
    width: 50px;
  }

  .cart-button img {
    width: 22px;
  }

  header {
    border-bottom: 1px solid var(--Grayish-blue);
    padding: 0;
  }

  nav {
    padding-bottom: 2rem;
  }

  /* Main page layout */
  .main-page-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
  }

  .product-description {
    margin-top: 3rem;
  }

  /* Typography adjustments */
  h1 {
    font: var(--text-preset-1);
    line-height: var(--text-preset-1-line-height);
    margin-right: 0;
    margin-block: 1.5rem;
  }

  .text-container > p {
    line-height: 26px;
    font-size: 1rem;
    margin-top: 1rem;
  }

  /* Pricing adjustments */
  .price {
    flex-direction: column;
    align-items: start;
  }

  .current-price > h3 {
    font: var(--text-preset-2);
    line-height: var(--text-preset-2-line-height);
  }

  /* Button section */
  .button-section {
    padding-inline: 0;
    display: grid;
    gap: 2rem;
    grid-template-columns: 35% 55%;
    margin-top: 2rem;
  }

  /* Product images */
  .product-image {
    display: none;
  }

  .product-image.active {
    display: block;
  }

  .carousel-wrapper {
    max-height: 445px;
    margin-top: 6rem;
  }

  .carousel .product-image {
    width: 100%;
    border-radius: 10px;
    object-fit: cover;
  }

  .product-images {
    display: grid;
    gap: 2rem;
    width: 448px;
  }

  #image-1 {
    height: 445px;
    border-radius: 10px;
  }

  .arrows {
    display: none;
  }

  /* Thumbnails */
  .thumbnails {
    display: flex;
    height: 88px;
    gap: 2rem;
  }

  .thumbnails .thumbnail {
    position: relative;
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: opacity 0.3s ease, border 0.3s ease;
  }

  .thumbnails .thumbnail:hover {
    opacity: 0.5;
  }

  .thumbnails .thumbnail.active,
  .thumbnails .thumbnail[aria-selected="true"] {
    opacity: 0.6;
    border-color: var(--orange-500);
  }

  /* Cart adjustments */
  .cart-avatar-container {
    position: relative;
  }

  .basket-card {
    display: none;
    flex-direction: column;
    position: absolute;
    z-index: 3;
    background-color: var(--White);
    top: 14rem;
    left: 0;
  }

  /* Modal styles */
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }

  .modal.hidden {
    display: none;
  }

  .modal-main-image {
    position: relative;
    display: flex;
    flex-direction: column;
  }

  .modal-main-image img {
    height: 550px;
    width: 550px;
    object-fit: cover;
    border-radius: 10px;
  }

  .close-button {
    color: var(--White);
    font-size: 35px;
    width: 35px;
    margin-bottom: 1rem;
    cursor: pointer;
    align-self: flex-end;
    background: none;
    border: none;
    padding: 0;
    height: auto;
  }

  .modal-arrows {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    padding-inline: 0.5rem;
    gap: 1rem;
  }

  .modal-previous,
  .modal-next {
    position: absolute;
    max-width: 40px;
    max-height: 40px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    border: none;
    font-size: 2rem;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    width: 40px;
    height: 40px;
  }

  .modal-previous {
    left: -1.5rem;
  }

  .modal-next {
    right: -1.5rem;
  }

  .modal-thumbnails {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
  }

  .modal-thumbnails .thumb {
    border-radius: 10px;
    height: 88px;
    width: 88px;
    background: none;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
  }

  .modal-thumbnails .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
  }

  .modal-thumbnails .thumb.active,
  .modal-thumbnails .thumb[aria-selected="true"] {
    opacity: 0.6;
    border-color: var(--orange-500);
  }

  .modal-thumbnails .thumb.active img,
  .modal-thumbnails .thumb[aria-selected="true"] img {
    opacity: 0.6;
  }
}

@media screen and (min-width: 1024px) {
  main {
    padding-bottom: 2rem;
    padding-inline: 2rem;
  }
}

@media screen and (min-width: 1440px) {
  main {
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: 100vh;
  }
}
