/* V685: reversible, homepage-only presentation. No media or account changes. */
html body #listings .listing-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-content: start;
}

/* Keep the original link, URL, accessible name and event handlers intact.
   Its two visual children share the card grid; controls remain outside it. */
html body #listings .listing-card > a.listing-open {
  display: contents;
}

html body #listings .listing-card .listing-image {
  grid-column: 1;
  grid-row: 1;
  display: block;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f1f2f3;
}

html body #listings .listing-card .listing-image > img {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: #f1f2f3;
  transform: none;
}

html body #listings .listing-card .listing-body {
  grid-column: 1;
  grid-row: 3;
  min-width: 0;
}

/* Real controls already supplied by account-v684: always visible, under the
   photo. No duplicate buttons, extra listeners or changes to mirroring. */
html body #listings .listing-card > .nap-card-management {
  position: static;
  grid-column: 1;
  grid-row: 2;
  order: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px;
  align-items: stretch;
  align-self: stretch;
  box-sizing: border-box;
  padding: 12px;
  margin: 0;
  min-width: 0;
  width: auto;
  inset: auto;
  z-index: auto;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: none;
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
}

html body #listings .listing-card > .nap-card-management > * {
  min-width: 0;
  min-height: 44px;
  padding: 8px 6px;
  font-size: .875rem;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}

html body #listings .listing-card > .nap-card-management > .nap-card-edit {
  background: #fff;
  color: #111;
  border: 1px solid #cfcfcf;
}

html body #listings .listing-card > .nap-card-management > .nap-card-delete {
  background: #fff4f2;
  color: #a32c21;
  border: 1px solid #d6aaa4;
}

html body #listings .listing-card > .nap-card-management > .nap-card-top {
  background: #ffe45c;
  color: #111;
  border: 1px solid #dcc440;
}

/* A display:contents link has no own box, so show keyboard focus on its
   actual media and text boxes. The link itself remains keyboard reachable. */
html body #listings .listing-card > a.listing-open:focus-visible > .listing-image,
html body #listings .listing-card > a.listing-open:focus-visible > .listing-body {
  outline: 3px solid #397ee8;
  outline-offset: -3px;
}

html body #listings .listing-card > .nap-card-management > :focus-visible {
  outline: 3px solid #397ee8;
  outline-offset: 2px;
}
