/* ============================================================================
   American Jane — Fabric Wall (/fabric-wall)
   A dense, color-grouped swatch wall. Scoped under .aj-wall.
   ========================================================================== */

.aj-wall {
  --cream:    #FAF3E2;
  --paper:    #FFFDF8;
  --ink:      #3B2F28;
  --ink-soft: #6B5D50;
  --line:     #E7DCC4;
  --red:      #C1392B;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  padding-bottom: 3.5rem;
}

/* ---- Header -------------------------------------------------------------- */
.aj-wall .aj-wall-head { max-width: 46rem; margin: 1.75rem 0 1.25rem; }
.aj-wall .aj-wall-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 1.1rem + 2.6vw, 3rem);
  line-height: 1.08;
  margin: 0 0 0.5rem;
}
.aj-wall .aj-wall-lede {
  font-size: 1.08rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}

/* ---- Sticky color jump-nav ---------------------------------------------- */
.aj-wall .aj-wall-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.aj-wall .aj-wall-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 120ms ease, transform 120ms ease;
}
.aj-wall .aj-wall-chip:hover { border-color: var(--chip); transform: translateY(-1px); }
.aj-wall .aj-wall-chip .dot {
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.aj-wall .aj-wall-chip .n { color: var(--ink-soft); font-weight: 400; font-size: 0.85em; }

/* ---- Color sections ----------------------------------------------------- */
.aj-wall .aj-wall-section { scroll-margin-top: 4rem; margin-top: 2rem; }
.aj-wall .aj-wall-h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0 0 0.9rem;
  padding-left: 0.65rem;
  border-left: 5px solid var(--chip);
}
.aj-wall .aj-wall-h2 .n { color: var(--ink-soft); font-family: 'Nunito', sans-serif; font-weight: 400; font-size: 0.85rem; }

/* ---- The swatch grid ---------------------------------------------------- */
.aj-wall .aj-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 6px;
}
.aj-wall .aj-wall-swatch { position: relative; }
.aj-wall .aj-wall-swatch-link {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--paper);
  text-decoration: none;
  color: var(--paper);
}
.aj-wall .aj-wall-swatch-link img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 180ms ease;
}
.aj-wall .aj-wall-swatch:hover { z-index: 1; }
.aj-wall .aj-wall-swatch-link:hover img { transform: scale(1.06); }

/* Add-to-cart button (reuses the theme's buy_now_form → AJAX add via app.js) */
.aj-wall .aj-wall-add-form { position: absolute; top: 6px; right: 6px; margin: 0; z-index: 3; }
.aj-wall .aj-wall-add {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(28, 20, 16, 0.3);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, color 140ms ease;
}
.aj-wall .aj-wall-swatch:hover .aj-wall-add,
.aj-wall .aj-wall-add:focus-visible { opacity: 1; transform: scale(1); }
.aj-wall .aj-wall-add:hover { background: var(--red); color: #fff; }
/* touch devices can't hover — keep the button visible */
@media (hover: none) {
  .aj-wall .aj-wall-add { opacity: 1; transform: none; }
}

/* hover caption — name + price slide up from the bottom */
.aj-wall .aj-wall-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.9rem 0.5rem 0.4rem;
  background: linear-gradient(to top, rgba(28,20,16,0.82), rgba(28,20,16,0));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}
.aj-wall .aj-wall-swatch:hover .aj-wall-cap,
.aj-wall .aj-wall-swatch-link:focus-visible .aj-wall-cap { opacity: 1; transform: translateY(0); }
.aj-wall .aj-wall-cap .nm {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.aj-wall .aj-wall-cap .pr { display: block; font-size: 0.72rem; margin-top: 0.15rem; opacity: 0.9; }
.aj-wall .aj-wall-cap .pr .unit { font-weight: 400; opacity: 0.8; }

/* keyboard focus visibility */
.aj-wall .aj-wall-swatch-link:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 600px) {
  .aj-wall .aj-wall-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; }
  /* touch devices can't hover — keep captions off so swatches stay tidy */
  .aj-wall .aj-wall-cap { display: none; }
}
