:root {
  --bg: #f5f5f3;
  --ink: #1a1a1a;
  --muted: #7a7a78;
  --line: #e6e6e3;
  --gap: 28px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-inline-size: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  background: rgba(245, 245, 243, 0.9);
  border-block-end: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.site-header__inner {
  max-inline-size: 1200px;
  margin-inline: auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 15px;
  text-decoration: none;
  color: var(--ink);
}
.site-nav {
  display: flex;
  gap: 28px;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.site-nav a:hover { color: var(--muted); }
.bag {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Shop ---------- */
.shop {
  max-inline-size: 1200px;
  margin-inline: auto;
  padding: 48px 24px 96px;
}
.shop__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-block-end: 36px;
}
.shop__head h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.shop__count {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

/* ---------- Product card ---------- */
.product-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.product-card__media {
  position: relative;          /* spec: image wrapper is the positioning context */
  aspect-ratio: 1 / 1;          /* spec: product card is 1:1 */
  overflow: hidden;
  background: #fff;
  border-radius: 4px;
}

.product-card__figure {
  position: absolute;
  inset: 0;
  margin: 0;
  /* ::before = "BG - With Halo" layer. Hidden by default, faded in on hover. */
}

/* ---- 1st img: solid BG (bottom layer) ---- */
.product-card__figure .bg {
  position: absolute;
  inset: 0;
  block-size: 100%;
  inline-size: 100%;
  object-fit: cover;
  opacity: 1;                   /* default: 1 -> 0 on hover */
  transition: opacity 0.3s var(--ease);
}

/* Halo layer (3rd visual, implemented as ::before so the DOM keeps exactly img + img).
   Same placement rules as the <img>s. Default: opacity 0 -> 1 on hover. */
.product-card__figure::before {
  content: "";
  position: absolute;
  inset: 0;
  block-size: 100%;
  inline-size: 100%;
  background-image: url("./SL Assets_BG- With Halo.webp");
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

/* ---- 2nd img: product cutout (on top) ---- */
.product-card__figure .product {
  position: absolute;
  inset: 0;
  block-size: 100%;
  inline-size: 100%;
  object-fit: cover;
  z-index: 1;
  transition: 0.3s ease;
}

/* ---- Hover: crossfade solid BG <-> halo ---- */
.product-card:hover .bg,
.product-card:focus-visible .bg {
  opacity: 0;
}
.product-card:hover .product-card__figure::before,
.product-card:focus-visible .product-card__figure::before {
  opacity: 1;
}
.product-card:hover img.product,
.product-card:focus-visible img.product {
  transform: scale(1.2);
}

/* ---------- Card text ---------- */
.product-card__info {
  padding-block-start: 16px;
}
.product-card__info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
}
.product-card__info p {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .site-nav { display: none; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  :root { --gap: 20px; }
  .shop { padding-block: 32px 64px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
