/* The shop's shared language, loaded on the home page and on the shop page:
   the mat each piece hangs in, the picture or its stand-in, and the thread that ties itself
   when something is kept or sent. Then the home page's preview of the shop. */
/* Shop-only tokens, scoped so they never reach the rest of the home page (the hero has its own --glow).
   .sheet = the piece and basket dialogs, which sit outside #shop on the shop page. */
#shop, #boutique, .sheet {
  --shop-mat: color-mix(in srgb, var(--bg) 55%, #fff);
  --shop-mat-pad: clamp(.75rem, .5rem + 1.2vw, 1.5rem);
  --shop-glow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent),
               0 1.75rem 3.5rem -1.5rem color-mix(in srgb, var(--accent) 28%, transparent);
  --shop-gallery-gap: var(--gutter);
  --shop-dur-tie: 1100ms;
}

/* The mat: paper a little lighter than the page, a hairline, room around the piece */
.c-frame {
  display: block;
  padding: var(--shop-mat-pad);
  background: var(--shop-mat);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent);
  transition: box-shadow var(--dur-2) var(--ease-out);
}

/* A piece's picture, or its stand-in when there is no photo yet */
.piece-img {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 32% 24%, color-mix(in srgb, #fff 55%, transparent), transparent 60%),
    radial-gradient(ellipse at 70% 85%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 55%),
    color-mix(in srgb, var(--accent-2) 9%, var(--surface));
}
.piece-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-3) var(--ease-out); }
.piece-img .piece-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  color: color-mix(in srgb, var(--ink) 28%, transparent);
}
.piece-main { aspect-ratio: 4 / 5; }

/* The tie: a short red thread drawn in, then its knot pulled tight with a soft glow.
   Drawn and still by default, so nothing is lost without motion. */
.tie { display: block; width: 7.5rem; height: 2.5rem; overflow: visible; }
.tie-large { width: min(13.5rem, 100%); height: 4.5rem; }
.tie-large .tie-line { stroke-width: .95; }
.tie-line { fill: none; stroke: var(--accent); stroke-width: var(--thread-w); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.tie-dot { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .tie.is-tying .tie-line { animation: tie-draw var(--shop-dur-tie) var(--ease-in-out) both; }
  .tie.is-tying .tie-dot { animation: tie-knot var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--shop-dur-tie) * .7); }
  @keyframes tie-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes tie-knot {
    0% { opacity: 0; transform: scale(2.2); filter: drop-shadow(0 0 0 transparent); }
    55% { opacity: 1; transform: scale(.9); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent)); }
    100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  }
}

/* ------------------------------------------------------------------
   The shop, on the home page: three pieces in their mats, and the way in
   ------------------------------------------------------------------ */
#boutique .bq-list {
  display: grid;
  gap: var(--space-4);
  margin-top: clamp(3.5rem, 9vh, 6rem);
  max-width: 40rem;
}
#boutique .bq-list:empty { display: none; }
#boutique .bq-item a {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  color: inherit;
  text-decoration: none;
}
#boutique .bq-item a:focus-visible { outline: none; }
#boutique .bq-item a:focus-visible .c-frame { outline: 2px solid var(--accent); outline-offset: 4px; }
#boutique .bq-item a:hover .c-frame,
#boutique .bq-item a:focus-visible .c-frame { box-shadow: var(--shop-glow); }
#boutique .bq-item a:hover .piece-img img { transform: scale(1.02); }
#boutique .c-frame { --shop-mat-pad: .6rem; }
#boutique .bq-text { display: grid; gap: .3rem; }
#boutique .bq-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--t-minor);
  line-height: var(--lh-minor);
  text-decoration: underline 1px transparent;
  text-underline-offset: .2em;
  transition: text-decoration-color var(--dur-1) var(--ease-out);
}
#boutique .bq-item a:hover .bq-name,
#boutique .bq-item a:focus-visible .bq-name { text-decoration-color: var(--line); }
#boutique .bq-meta { font-size: var(--t-small); color: var(--muted); }
#boutique .bq-price { font-weight: 300; color: var(--ink); font-variant-numeric: tabular-nums; }
#boutique .bq-hand {
  margin-top: var(--space-3);
  font-family: var(--font-display); font-style: italic; font-size: var(--step-1); color: var(--muted);
}
#boutique .bq-more { margin-top: var(--space-5); justify-self: start; }

@media (min-width: 48rem) {
  #boutique .bq-list { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; gap: var(--shop-gallery-gap); }
  #boutique .bq-item a { grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--space-2); }
  #boutique .bq-item:nth-child(2) { margin-top: var(--space-5); }
  #boutique .c-frame { --shop-mat-pad: clamp(.75rem, .5rem + .8vw, 1.25rem); }
  #boutique .bq-text { padding-inline: .25rem; }
}
@media (min-width: 64rem) {
  #boutique .bq-list { grid-column: 3 / -2; }
  #boutique .bq-more { grid-column: 3 / 9; }
}
