/* ============================================================================
   American Jane — custom homepage styles
   Scoped under .aj-home so nothing leaks to other pages. Loaded only by
   pages/index.inc.php via a head tag. Fonts: Fraunces (display) + Nunito (body).
   ========================================================================== */

.aj-home {
  --cream:     var(--site-background-color); /* match the rest of the site, not a cream canvas */
  --paper:     var(--whitespace-color);      /* white panels/cards, like the rest of the site */
  --ink:       #3B2F28;
  --ink-soft:  #6B5D50;
  --red:       #C1392B;
  --mustard:   #E0A23B;
  --teal:      #4A7C82;
  --sage:      #8A9A5B;
  --line:      #E7DCC4;

  /* Colours sampled from the American Jane Pindots used as the tile backgrounds,
     so the category blocks are coloured straight from the pindots collection. */
  --pindot-red:    #CB2A33; /* Brick Red (1584) */
  --pindot-ocean:  #5E9BB6; /* Ocean (1576) */
  --pindot-orange: #E08B44; /* Orange (1575) */
  --pindot-green:  #5F9669; /* Grass Green (1582) */

  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--cream); /* matches the site/footer background for a seamless page */
  padding-bottom: 3.5rem;
}

.aj-home .aj-h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(1.6rem, 1rem + 2.1vw, 2.5rem);
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

.aj-home .aj-section { margin-top: clamp(2.5rem, 5vw, 4.5rem); }

.aj-home .aj-section-head { max-width: 46rem; margin-bottom: 1.75rem; }
.aj-home .aj-lede {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}
.aj-home .aj-lede em { font-style: italic; color: var(--red); }

/* ---- Buttons ------------------------------------------------------------- */
.aj-home .aj-btn {
  display: inline-block;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--paper);
  background: var(--red);
  padding: 0.85rem 1.9rem;
  border-radius: 2px;
  text-decoration: none;
  box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 4px var(--paper);
  transition: background 120ms linear, transform 120ms linear;
}
.aj-home .aj-btn:hover { background: #a62f23; transform: translateY(-1px); }

/* ---- Hero ---------------------------------------------------------------- */
.aj-home .aj-hero {
  background: var(--paper);
  border: 1px solid var(--line);
  margin-top: 1.75rem;
  overflow: hidden;
}
.aj-home .aj-hero-binding {
  display: flex;
  height: 14px;
}
.aj-home .aj-hero-binding .s { flex: 1 1 auto; }
.aj-home .aj-hero-binding .s-red     { background: var(--red); }
.aj-home .aj-hero-binding .s-mustard { background: var(--mustard); }
.aj-home .aj-hero-binding .s-teal    { background: var(--teal); }
.aj-home .aj-hero-binding .s-sage    { background: var(--sage); }

.aj-home .aj-hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3.25rem);
}
.aj-home .aj-hero-copy { max-width: 32rem; }

/* 4x4 patchwork of clickable fabric swatches */
.aj-home .aj-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  background: var(--line);
  padding: 5px;
  box-shadow: 0 10px 28px rgba(59, 47, 40, 0.14);
}
.aj-home .aj-swatch {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--paper);
}
.aj-home .aj-swatch img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 160ms ease;
}
.aj-home .aj-swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 0 var(--red);
  transition: box-shadow 120ms ease;
  pointer-events: none;
}
.aj-home .aj-swatch:hover { z-index: 1; }
.aj-home .aj-swatch:hover img { transform: scale(1.08); }
.aj-home .aj-swatch:hover::after { box-shadow: inset 0 0 0 3px var(--paper); }

.aj-home .aj-hero-figure { margin: 0; }
.aj-home .aj-hero-caption {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: center;
}
.aj-home .aj-hero-caption a {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid rgba(193, 57, 43, 0.35);
}
.aj-home .aj-hero-caption a:hover { border-bottom-color: var(--red); }

.aj-home .aj-hero-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 1.1rem + 3.3vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
  color: var(--ink);
}
.aj-home .aj-hero-subhead {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  max-width: 38rem;
}

/* ---- Category quilt block ------------------------------------------------ */
.aj-home .aj-quilt {
  display: grid;
  grid-template-columns: 1.25fr 1.25fr 1.1fr 0.9fr;
  grid-template-rows: 215px 215px;
  grid-template-areas:
    "fabric fabric patterns kits"
    "fabric fabric precuts  kits";
  gap: 14px;
}
.aj-area-fabric   { grid-area: fabric; }
.aj-area-patterns { grid-area: patterns; }
.aj-area-precuts  { grid-area: precuts; }
.aj-area-kits     { grid-area: kits; }

.aj-home .aj-block {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.4rem;
  text-decoration: none;
  color: var(--paper);
  overflow: hidden;
  background-color: var(--accent, var(--ink));  /* fallback if an image is missing */
  background-size: cover;
  background-position: center;
  isolation: isolate;                            /* contain the colour-tint blend */
  transition: transform 140ms ease;
}
/* accent wash over the fabric photo — keeps the approved colour coding */
.aj-home .aj-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent, var(--ink));
  opacity: 0.5;
  mix-blend-mode: multiply;
  z-index: 1;
}
/* bottom scrim so the label stays readable over a busy print */
.aj-home .aj-block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(28, 20, 16, 0.62), rgba(28, 20, 16, 0) 58%);
  z-index: 1;
}
.aj-home .aj-block:hover { transform: translateY(-2px); }
.aj-home .aj-block:hover::before { opacity: 0.4; }

/* dashed "quilting stitches" framing each patch */
.aj-home .aj-block-stitch {
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(255, 253, 248, 0.7);
  z-index: 2;
  pointer-events: none;
}
.aj-home .aj-block-name {
  position: relative;
  z-index: 2;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.05;
  text-shadow: 0 1px 3px rgba(28, 20, 16, 0.4);
}
.aj-home .aj-block-blurb {
  position: relative;
  z-index: 2;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-top: 0.35rem;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(28, 20, 16, 0.45);
}
/* Fabric is the headline patch — make it read bigger */
.aj-home .aj-area-fabric .aj-block-name { font-size: 2.4rem; }
.aj-home .aj-area-fabric .aj-block-blurb { font-size: 1.02rem; max-width: 20rem; }

.aj-home .aj-block--red     { --accent: var(--pindot-red); }
.aj-home .aj-block--teal    { --accent: var(--pindot-ocean); }
.aj-home .aj-block--sage    { --accent: var(--pindot-green); }
.aj-home .aj-block--mustard { --accent: var(--pindot-orange); }

/* ---- Bestsellers (reuses the catalog product component, restyled flat) --- */
.aj-home .aj-bestsellers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 6 items → tidy 2×3 */
  gap: 18px;
}
.aj-home .aj-bestsellers-row .product {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;                 /* no uniform rounded card */
  border-top: 3px solid var(--red); /* a single hand-placed accent */
  overflow: hidden;
}
.aj-home .aj-bestsellers-row .product:hover {
  box-shadow: 0 6px 16px rgba(59, 47, 40, 0.12);
  transform: translateY(-2px);
}
.aj-home .aj-bestsellers-row .product .info { padding: 0.85rem 0.9rem 1.1rem; }
.aj-home .aj-bestsellers-row .product .name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.02rem;
  height: auto;
  min-height: 2.6em;
}
.aj-home .aj-bestsellers-row .product .manufacturer-name { display: none; }
.aj-home .aj-bestsellers-row .product .price-wrapper { font-size: 1.15rem; margin-top: 0.35rem; }
.aj-home .aj-bestsellers-row .product .price-wrapper .price { color: var(--red); }

/* ---- Shop the whole quilt (cross-sell band with stitch connector) -------- */
.aj-home .aj-shopquilt {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(1.75rem, 4vw, 3rem);
}
.aj-home .aj-chain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  position: relative;
}
/* the running line of quilting stitches linking the three steps */
.aj-home .aj-chain::before {
  content: "";
  position: absolute;
  top: 118px;                 /* through the vertical centre of the thumbs */
  left: 16%;
  right: 16%;
  border-top: 3px dashed var(--teal);
  z-index: 0;
}
.aj-home .aj-step { flex: 1 1 0; position: relative; z-index: 1; }
.aj-home .aj-step-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  padding: 0 1rem;
  height: 100%;
}
.aj-home .aj-step-role {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}
.aj-home .aj-step-thumb {
  width: 150px;
  height: 150px;
  border-radius: 50%;           /* thumbs sit on the stitch line like buttons */
  background: var(--paper);
  padding: 8px;
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--line);
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.aj-home .aj-step-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.aj-home .aj-step-lead {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.aj-home .aj-step-name { font-weight: 700; font-size: 0.98rem; line-height: 1.3; }
.aj-home .aj-step-note {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-top: 0.25rem;
  max-width: 15rem;
}
.aj-home .aj-step-price { color: var(--red); font-weight: 700; font-size: 1.1rem; margin-top: 0.6rem; }
.aj-home .aj-step-link:hover .aj-step-thumb { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--teal); }
.aj-home .aj-step-link:hover .aj-step-lead { color: var(--red); }

/* ============================= Responsive ================================= */
@media (max-width: 980px) {
  .aj-home .aj-quilt {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "fabric   fabric"
      "patterns precuts"
      "kits     kits";
  }
  .aj-home .aj-area-fabric { min-height: 200px; }
  .aj-home .aj-area-patterns,
  .aj-home .aj-area-precuts { min-height: 160px; }
  .aj-home .aj-area-kits    { min-height: 150px; }
  .aj-home .aj-bestsellers-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  /* Hero stacks: copy on top, fabric patchwork below */
  .aj-home .aj-hero-inner { grid-template-columns: 1fr; }
  .aj-home .aj-hero-copy { max-width: none; }
}

@media (max-width: 860px) {
  /* Shop-the-quilt stacks; the stitch line runs vertically down the side */
  .aj-home .aj-chain { flex-direction: column; gap: 2.25rem; }
  .aj-home .aj-chain::before {
    top: 2rem;
    bottom: 2rem;
    left: calc(1rem + 75px);
    right: auto;
    border-top: 0;
    border-left: 3px dashed var(--teal);
  }
  .aj-home .aj-step-link {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 1.25rem;
    padding: 0;
  }
  .aj-home .aj-step-role { position: absolute; left: 0; top: -1.4rem; margin: 0; }
  .aj-home .aj-step-thumb { width: 110px; height: 110px; flex: 0 0 110px; margin: 0; }
  .aj-home .aj-step-note { max-width: none; }
}

@media (max-width: 560px) {
  .aj-home .aj-quilt {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "fabric" "patterns" "precuts" "kits";
  }
  .aj-home .aj-block { min-height: 130px; }
  .aj-home .aj-area-fabric { min-height: 170px; }
  .aj-home .aj-area-fabric .aj-block-name { font-size: 2rem; }
}
