/* ============================================================
   FONTS
   Self-hosted (no third-party font CDN) so the site stays
   privacy-clean. Both files are "variable fonts" — one file
   covers every weight in the range, so the browser only has to
   download it once no matter how many weights we use below.
   ============================================================ */
@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/unbounded-variable.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-variable.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   COLOURS, FONTS, SPACING
   Change the values below and the whole site restyles.
   ============================================================ */
:root {
  --color-bg: #f3f1ea;
  --color-text: #10142b;
  --color-muted: #54577a; /* softer text — taglines, descriptions */
  --color-primary: #3352ff; /* header, links, buttons */
  --color-primary-dark: #2440e0; /* hover state, stays readable */
  --color-card-bg: #ffffff;
  --color-border: #dcdaee;

  --color-accent-coral: #ff6b5b; /* highlights, featured badges */
  --color-accent-chartreuse: #c8fa3e; /* nav markers, category tiles */

  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Unbounded", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  --radius: 0px; /* square corners — part of the bold, geometric look */
}

/* ============================================================
   RESET
   Small, boring reset. Browsers add odd default spacing;
   this removes it so the rules above are the only source of truth.
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* The image shortcode wraps <img> in <picture>. This makes <picture> size
   itself exactly like the <img> inside it, so product-card__image and
   product__image still work without repeating them on <picture> too. */
picture {
  display: contents;
}

/* ============================================================
   BASE
   ============================================================ */
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.15;
  text-wrap: balance;
}

p {
  color: var(--color-muted);
}

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--color-primary-dark);
}

/* A visible focus ring everywhere keyboard users tab to. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Off-screen until focused, then it jumps into view for keyboard users. */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

/* A highlighted word inside a heading, e.g. <mark>this</mark> — used
   sparingly, just for the homepage tagline. */
mark {
  background: var(--color-accent-coral);
  color: #fff;
  padding: 0 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ============================================================
   LAYOUT
   ============================================================ */
main {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* Bullet lists in product descriptions and category copy (rendered
   from Markdown) — the reset above strips their spacing, so give
   them some back and swap the marker for the chartreuse accent. */
main :is(ul, ol):not([class]) {
  padding-left: 1.2rem;
}

main li::marker {
  color: var(--color-accent-chartreuse);
  font-size: 1.2em;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--color-text);
}

.site-header__row {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--space-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-header__name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
}

.site-nav {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

/* A small square marker in front of every nav link — a nod to the
   colour-block cards used everywhere else on the site. */
.site-nav a::before {
  content: "";
  width: 0.4em;
  height: 0.4em;
  background: var(--color-accent-chartreuse);
  flex: none;
}

.site-nav a:hover {
  color: var(--color-accent-chartreuse);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  background: var(--color-text);
  color: #fff;
  margin-top: var(--space-xl);
}

.site-footer a {
  color: var(--color-accent-chartreuse);
}

/* ============================================================
   PRODUCT GRID + CARD
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-lg);
  list-style: none;
  margin: var(--space-lg) 0;
  padding: 0;
}

.product-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(16, 20, 43, 0.12);
}

/* A 6px colour bar across the top of every card, cycling through the
   three accent colours so the grid reads as a set, not a repeat. */
.product-card::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--color-primary);
}

.product-card:nth-child(3n + 2)::before {
  background: var(--color-accent-coral);
}

.product-card:nth-child(3n + 3)::before {
  background: var(--color-accent-chartreuse);
}

.product-card__link {
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card__link:hover .product-card__title {
  color: var(--color-primary);
}

.product-card__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--color-card-bg);
}

.product-card__title {
  margin: 0;
  padding: var(--space-md) var(--space-md) 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
}

.product-card__price {
  font-weight: 800;
  color: var(--color-text);
  margin: 0;
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

.product-card__badge {
  display: inline-block;
  align-self: flex-start;
  background: var(--color-text);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
}

.button {
  display: inline-block;
  background: var(--color-text);
  color: #fff;
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-weight: 700;
  margin-top: auto;
  transition: background 0.15s ease;
}

.button:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ============================================================
   PRODUCT PAGE
   ============================================================ */
.product__image {
  display: block;
  width: 100%;
  max-width: 28rem;
  height: auto;
  margin: 0 auto var(--space-md);
}

.product__price {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--color-primary);
  margin: 0 0 var(--space-md);
}

/* ============================================================
   CATEGORY TILES
   ============================================================ */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-md);
  list-style: none;
  margin: var(--space-lg) 0;
  padding: 0;
}

.category-tile {
  display: block;
  background: var(--color-accent-chartreuse);
  border-radius: var(--radius);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}

/* The three colour-block category tiles cycle the same accent set as
   the product-card top bars, so the two grids feel like one system. */
.category-grid li:nth-child(3n + 2) .category-tile {
  background: #ffb8a8; /* light coral */
}

.category-grid li:nth-child(3n + 3) .category-tile {
  background: #b9c4ff; /* light cobalt */
}

.category-tile:hover {
  color: var(--color-primary-dark);
}

/* ============================================================
   RESPONSIVE
   Mobile styles are the defaults above; this widens things
   on bigger screens.
   ============================================================ */
@media (min-width: 40rem) {
  .site-header__name {
    font-size: 1.3rem;
  }
}
