:root {
  --clr-neutral-800: hsl(221, 39%, 11%);
  --clr-neutral-700: hsl(215, 14%, 34%);
  --clr-neutral-300: hsl(220, 13%, 91%);
  --clr-neutral-100: hsl(0, 0%, 100%);

  --clr-accent-500: hsl(199, 89%, 48%);

  --shadow-200: 0 4px 12px hsla(0, 0%, 0%, 0.18);
  --shadow-300: 0 6px 20px hsla(0, 0%, 0%, 0.24);
  --shadow-400: 0 6px 20px hsla(0, 0%, 0%, 0.271);

  --ff-primary: "Poppins", sans-serif;

  --ff-body: var(--ff-primary);
  --ff-heading: var(--ff-primary);

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semi-bold: 600;

  --clr-text-base: var(--clr-neutral-700);
  --clr-text-strong: var(--clr-neutral-800);
  --clr-text-inverse: var(--clr-neutral-100);
  --clr-border-muted: var(--clr-neutral-300);
  --clr-bg-page: var(--clr-neutral-100);
  --clr-bg-header: var(--clr-neutral-800);
  --clr-bg-accent: var(--clr-accent-500);
  --shadow-default: var(--shadow-200);
  --shadow-hover: var(--shadow-300);
  --shadow-focus: var(--shadow-400);
}

/* 1. Reset  */

/* ✅ Andy Bell's reset: https://piccalil.li/blog/a-modern-css...
✅ Josh Comeau's reset: https://www.joshwcomeau.com/css/custo...
✅ More on prefers-reduced-motion: https://web.dev/prefers-reduced-motion/ */

/* 1. Use a more intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Reset default margin, padding, and font inheritance */
* {
  margin: 0;
  padding: 0;
  font: inherit;
}

/* 3. Remove default list styles for elements with a list role */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* 4. Set core defaults */
html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  line-height: 1.5; /* Improve readability */
  text-rendering: optimizeSpeed; /* Enhance text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 5. Default styles for links without a class */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Ensure form elements inherit fonts */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Prevent text overflow */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve text wrapping */
p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/* 10. Create a root stacking context for frameworks */
#root,
#__next {
  isolation: isolate;
}

/* 11. Reduce motion for users with motion sensitivity */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  text-decoration: none;
}

/* General styling */

body {
  font-family: var(--ff-body), "Arial", sans-serif;
  color: var(--clr-text-base);
}

main {
  margin-top: 80px;
}
.container {
  width: 100%;
  margin-inline: auto;
  width: 90%;
  max-width: 1200px;
}

/* Header */
.primary-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--clr-bg-header);
  color: var(--clr-text-inverse);
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: var(--fw-semi-bold);
  color: inherit;
  transition: color 0.3s ease;
}

.search-bar {
  width: 60%;
  max-width: 300px;
  margin-block: 1em;
}

.search-input {
  width: 100%;
  text-align: center;
  color: var(--clr-text-strong);
  padding: 0.5em;
  border: none;
  border-radius: 20px;
  transition: 0.3s ease, border 0.3s ease;
}

.search-input::placeholder {
  color: var(--clr-text-base);
}

/* Left-align placeholder AND input text on larger screens */
@media (min-width: 768px) {
  .search-bar {
    max-width: 400px;
  }

  .search-input {
    text-align: left;
    padding-left: 2em;
    width: 100%;
  }
}

.cart-btn {
  position: relative;
  background: none;
  border: none;
  color: inherit;
}

.cart-count-badge {
  position: absolute;
  top: -1em;
  left: 1em;
  font-size: 0.8em;
  background: var(--clr-bg-accent);
  padding: 0.1em 0.5em;
  border-radius: 50%;
}

/* Product */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, auto));
  gap: 1.5em;
  padding: 2em 0;
}

@media (min-width: 768px) {
  .grid {
    padding: 3em 0;
  }
}

.product-card {
  box-shadow: var(--shadow-default);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.product-card__header {
  position: relative;
  overflow: hidden;
}

.add-to-cart-btn {
  position: absolute;
  top: 0.5em;
  right: 0.8em;
  z-index: 1;
  background-color: var(--clr-neutral-100);
  border: none;
  border-radius: 50%;
  padding: 1em;
  cursor: pointer;
  box-shadow: var(--shadow-default);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.add-to-cart-btn:hover {
  box-shadow: var(--shadow-hover);
}

.add-to-cart-btn:focus {
  box-shadow: var(--shadow-focus);
}

@media (min-width: 1024px) {
  .add-to-cart-btn {
    padding: 0.5em;
  }
}

.product-card__image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.product-card__footer {
  padding: 1em 1em 0.5em;
  color: var(--clr-text-strong);
  height: 5.5em;
}

@media (min-width: 1024px) {
  .product-card__footer {
    height: 6.5em;
  }
}

/* Utility classes */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.fw-bold {
  font-weight: var(--fw-bold);
}
.fw-semi-bold {
  font-weight: var(--fw-semi-bold);
}
