/* =========================================================
   Shared styles for category cards + item grid pages.
   Plain CSS, no framework. Uses CSS Grid + clamp() for
   responsiveness instead of hand-rolled breakpoints.
   ========================================================= */

:root {
  --gap: 1.25rem;
  --card-radius: 10px;
  --card-border: #e0e0e0;
  --text-muted: #555;
  --accent: #0b5fff;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: #1a1a1a;
  line-height: 1.5;
}

.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
}

header.site-header {
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--card-border);
  background: var(--card-bg);
}

header.site-header h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

/* Spans the full page width (not capped at --max-width like
   .page-container) so "See something you like?" can sit as far
   right as the actual browser viewport, not just the edge of the
   centered content column.

   Uses an ID selector + !important on the layout-critical
   properties only (display/wrap/justify/width) because this block
   gets embedded into existing pages that may carry their own CSS
   (resets, frameworks, etc.) with rules that would otherwise
   override a plain class selector and collapse this back to
   normal block/inline flow. Colors and spacing are left as normal,
   overridable rules. */
#jewelry-page-nav-row {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  width: 100% !important;
  box-sizing: border-box !important;
  gap: 0.5rem 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--card-border);
  background: var(--card-bg);
}

#jewelry-page-nav-row > a.back-link,
#jewelry-page-nav-row > a.buy-link {
  display: inline-block !important;
  float: none !important;
}

a.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

a.back-link:hover,
a.back-link:focus-visible {
  text-decoration: underline;
}

a.buy-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

a.buy-link:hover,
a.buy-link:focus-visible {
  text-decoration: underline;
}

/* -------------------------------------------------
   Category cards (the repeatable, copy/paste block)
   ------------------------------------------------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.category-card {
  display: block;
  color: inherit;
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.category-card:hover,
.category-card:focus-visible {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.category-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.category-card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #eee;
}

.category-card__desc {
  margin: 0;
  padding: 0.85rem 1rem 1.1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.category-card__more {
  font-weight: 600;
  color: var(--accent);
}

/* -------------------------------------------------
   Item grid (the detail / category page)
   ------------------------------------------------- */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap);
}

.item-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 0.9rem;
}

.item-card__text {
  margin: 0;
  font-size: 0.9rem;
}

.item-card__text--top {
  font-weight: 600;
}

.item-card__text--bottom {
  color: var(--text-muted);
}

.item-card__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
  display: block;
}

/* Used only for items with more than one photo: two <img> layers are
   stacked in the same box and crossfaded between (see js/category.js),
   instead of animating a single <img>'s opacity down and back up. */
.item-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #eee;
}

.item-card__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
}

.item-card__photo img.is-hidden {
  opacity: 0;
}

.item-card__photo img.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .item-card__photo img {
    transition: none;
  }
}

.status-message {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.status-message--error {
  color: #b00020;
}

@media (max-width: 480px) {
  .category-card__desc,
  .item-card__text {
    font-size: 0.875rem;
  }
}
