/* Hark's photo cards: cards that open with a photo, for items a reader picks between. They use hark.css's tokens, so link this after hark.css. style-gates: data */

/* @component photo cards */
/* The cards wrap into rows of as many as fit at 300px or wider. Every card in a row is as tall as the
   tallest, so the links at their feet line up. */
.photo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.photo-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--r-l);
  background: var(--fill-tertiary);
  scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 72px);
}
.photo-card__stage {
  position: relative;
  display: grid;
  /* A wide photo must not widen the card past the screen. */
  grid-template-columns: minmax(0, 1fr);
  border-radius: var(--r-l) var(--r-l) 0 0;
}
.photo-card__rank {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  max-width: calc(100% - 28px);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  background: var(--mat-agent);
  border: 1px solid var(--stroke-secondary);
  -webkit-backdrop-filter: var(--hark-blur);
  backdrop-filter: var(--hark-blur);
  font: var(--type-label);
}
/* A card without a photo puts its tag above the name, where it covers nothing. */
.photo-card__stage:not(:has(.photo-card__photos)) .photo-card__rank {
  position: static;
  justify-self: start;
  max-width: calc(100% - 40px);
  margin: 20px 20px 0;
}
/* The photos share one cell sized by the card's width, never by a photo. Before hark-cards.js runs
   only the first shows. */
.photo-card__photos {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
}
.photo-card__photos img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 240ms ease;
}
.photo-card__photos img + img,
.photo-card__photos[data-turn] img {
  opacity: 0;
}
.photo-card__photos[data-turn] {
  cursor: pointer;
}
.photo-card__photos[data-turn] img.is-on {
  opacity: 1;
}
.photo-card__dots {
  position: absolute;
  inset: auto 0 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.photo-card__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hero-text);
  opacity: 0.5;
  box-shadow: 0 1px 2px var(--hero-scrim-strong);
  transition: opacity var(--dur-quick) ease;
}
.photo-card__dots i.is-on {
  opacity: 1;
}
.photo-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 20px 20px;
}
/* The Hark button spans the card's foot, so a row's buttons line up and the
   store link under it wraps instead of squeezing the label. */
.photo-card__body > .btn {
  align-self: stretch;
  margin-top: auto;
}
/* A phone link's tap target takes its full height here, not overlapping the button. */
.photo-card__body > .btn + .link {
  margin-block: 0;
}
.photo-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.photo-card__head h3,
.photo-card__price {
  font: var(--type-heading);
}
.photo-card__price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.photo-card__price s {
  margin-right: 6px;
  font: var(--type-small);
  color: var(--text-secondary);
}
.photo-card__meta {
  margin-top: -6px;
  font: var(--type-small);
  color: var(--text-secondary);
}
.photo-card__note {
  font: var(--type-body);
}
.photo-card .dot {
  margin-top: 0;
}
/* A full-width capsule at the card's foot. */
.photo-card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 48px;
  margin-top: auto;
  padding: 0 20px;
  border-radius: 24px;
  background: var(--fill-primary);
  color: var(--text-primary-on);
  font: var(--type-body-strong);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease-out;
}
@media (hover: hover) {
  .photo-card__link:hover {
    box-shadow: inset 0 0 0 100px var(--hover-wash-primary-on);
  }
}
.photo-card__link:active {
  transform: scale(0.97);
}
.photo-card__link:focus-visible {
  border-radius: 24px;
}
.photo-card__link[target='_blank']::after {
  content: '\2197';
  font-size: 12px;
  color: var(--text-secondary-on);
}
@media (prefers-reduced-motion: reduce) {
  .photo-card__photos img,
  .photo-card__dots i,
  .photo-card__link {
    transition: none;
  }
}
