/* Everything inside the listing page's main-area: carousel, grid cards,
   badges, heart button, and the per-dog contact panel below the carousel. */

/* ----- Carousel: horizontal scroll-snap, native mobile swipe ----- */
.carousel-wrap { position: relative; }
@media (max-width: 980px) {
  /* On phone/tablet (stacked layout) the carousel bleeds to viewport edges so
     cards can swipe edge-to-edge. On desktop with sidebar, it stays contained. */
  .carousel-wrap { margin-inline: calc(50% - 50vw); }
}

.cv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  padding: 0 0 0.15rem 0;
  transition: background 0.15s ease, transform 0.1s ease;
}
.cv-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.07); }
.cv-arrow:active { transform: translateY(-50%) scale(0.95); }
/* Card width is min(85vw, 340px), so half-width is min(42.5vw, 170px). */
.cv-prev { left:  calc(50% - min(42.5vw, 170px) - 50px); }
.cv-next { right: calc(50% - min(42.5vw, 170px) - 50px); }
@media (max-width: 680px) {
  /* On phones the swipe gesture is natural; the arrows just take up space. */
  .cv-arrow { display: none; }
}

.carousel {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 0.25rem 0 0.5rem;
  padding-inline: max(1rem, calc(50vw - 50%));
  scrollbar-width: thin;
}
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.cv-card {
  flex: 0 0 min(85vw, 340px);
  scroll-snap-align: center;
  scroll-snap-stop: always !important;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  aspect-ratio: 4/5;
  display: block;
  transform: scale(0.9);
  opacity: 0.55;
  filter: saturate(0.8);
  transition: transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
}
.cv-card.active {
  transform: scale(1);
  opacity: 1;
  filter: none;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
@media (max-width: 680px) {
  .cv-card { flex-basis: 88vw; }
}
.cv-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999; background: #2a2a2a; font-size: 0.9rem; }

.cv-top {
  position: absolute; top: 0.7rem; left: 0.7rem; right: 0.7rem;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.4rem;
  pointer-events: none;
}
.cv-top-left { display: flex; flex-wrap: wrap; gap: 0.4rem; pointer-events: none; }
.cv-top .heart-btn { pointer-events: auto; }
.cv-top .badge { background: rgba(255,255,255,0.95); color: var(--fg); backdrop-filter: blur(4px); }
.cv-top .badge.deadline { background: var(--bad); color: #fff; }
.cv-top .badge.at-risk { background: var(--bad); color: #fff; }
.cv-top .badge.stale { background: #fef3c7; color: var(--warn); }
.cv-top .badge.interested { background: rgba(22,101,52,0.95); color: #fff; }
.cv-top .badge.featured { background: rgba(194,65,12,0.96); color: #fff; font-weight: 700; }
.cv-top .badge.foster { background: rgba(22,101,52,0.92); color: #fff; font-weight: 700; }

/* Animal ID chip next to the dog name on the carousel card.
   Lighter weight than the name so it doesn't compete visually. */
.cv-overlay h2 .cv-id {
  font-size: 0.65em;
  font-weight: 500;
  opacity: 0.78;
  margin-left: 0.35rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
}

/* Recently-removed strip — sits below the main carousel/grid. Soft
   amber framing matches the detail-page interim banner. */
.pending-strip {
  margin: 2rem 0 1.5rem;
  padding: 1rem 1.1rem;
  background: #fef9eb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.pending-strip-head h2 {
  font-size: 1.05rem; margin: 0;
  color: #78350f;
}
.pending-strip-head h2 small {
  font-weight: 500; color: #92400e; font-size: 0.85rem;
}
.pending-strip-head p { margin: 0.25rem 0 0.75rem; font-size: 0.85rem; }
.pending-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
}
.pending-tile {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: var(--fg);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.pending-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  text-decoration: none;
}
.pending-tile img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  filter: grayscale(0.15) opacity(0.95);
}
.pending-tile-noimg {
  width: 100%; aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
  background: #f3eed8; color: var(--muted); font-size: 0.8rem;
}
.pending-tile-body {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.85rem;
}
.pending-tile-name { font-weight: 600; }
.pending-tile-body .muted { font-size: 0.75rem; }

.cv-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2rem 1rem 1.1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.65) 50%, transparent 100%);
  color: #fff;
}
.cv-overlay h2 { color: #fff; margin: 0 0 0.25rem; font-size: 1.5rem; line-height: 1.15; }
.cv-overlay .cv-meta { margin: 0.15rem 0; font-size: 0.92rem; opacity: 0.92; color: #fff; }
.cv-cta {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.5rem 0.95rem;
  background: rgba(255,255,255,0.95);
  color: var(--fg);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.cv-cta:hover { background: #fff; text-decoration: none; }

/* ----- Per-dog contact panel below the carousel ----- */
/* Updates dynamically via JS as the active carousel card changes — the email
   subjects get re-templated with the centered dog's name and ID. */
.dog-contact {
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.dog-contact header { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.dog-contact .dc-eyebrow { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.dog-contact .dc-dog-name { font-size: 0.92rem; }
.dog-contact .dc-helper { font-size: 0.75rem; }
.dog-contact .dc-helper em { font-style: italic; }
.dc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.dc-card { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 6px; background: #fafaf7; }
.dc-card.foster { border-color: var(--accent); background: var(--accent-soft); }
.dc-role { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.dc-link { font-size: 0.78rem; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-link.phone { color: var(--fg); }
@media (max-width: 680px) {
  /* Phone: single-column stack so each role's email/phone gets full width. */
  .dc-grid { grid-template-columns: 1fr; }
  .dog-contact { margin-top: 0.65rem; }
  .dog-contact header { gap: 0.3rem; }
  .dog-contact .dc-helper { flex: 1 1 100%; }
}

/* ----- Heart / favorite button ----- */
/* Reused across carousel, grid cards, and detail page. */
.heart-btn {
  background: rgba(255, 255, 255, 0.92);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  color: #999;
  transition: color 0.15s ease, transform 0.1s ease, background 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(4px);
}
.heart-btn:hover { color: #e11d48; transform: scale(1.08); }
.heart-btn:active { transform: scale(0.94); }
.heart-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.heart-btn.on { color: #e11d48; }
.heart-btn.on svg { fill: currentColor; stroke: currentColor; }

/* Position the heart on grid cards (top-right of image). */
.card { position: relative; }
.card-heart { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 1; }
.card-heart .heart-btn { width: 32px; height: 32px; }
.card-heart .heart-btn svg { width: 16px; height: 16px; }
.detail-heart { vertical-align: middle; margin-left: 0.4rem; background: #fff; box-shadow: none; border: 1px solid var(--line); }
@media (max-width: 680px) {
  /* 44px = Apple HIG minimum tap target. */
  .detail-heart { width: 44px; height: 44px; }
  .detail-heart svg { width: 22px; height: 22px; }
}

/* ----- Grid view (fallback alternative to the carousel) ----- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #ece6da; }
.card .body { padding: 0.7rem; flex: 1; display: flex; flex-direction: column; }
.card .name { font-weight: 600; font-size: 1.05rem; }
.card .meta { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.card .meta.interested { color: var(--good); font-weight: 500; margin-top: 0.3rem; }

/* "Available <date>" — only shown when a dog's adoption-available date is in the
   future (still on a hold). Inline pill on both grid + carousel cards. */
.avail-badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: #fef3c7;
  color: var(--warn);
}
.cv-overlay .avail-badge { background: rgba(255,255,255,0.92); color: var(--fg); }

/* ----- Badges (urgency, status, etc.) — used on both grid + carousel ----- */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.badge.available { background: #dcfce7; color: var(--good); }
.badge.removed   { background: #fee2e2; color: var(--bad); }
.badge.foster    { background: rgba(22,101,52,0.92); color: #fff; font-weight: 700; }
.badge.adopted   { background: #e0e7ff; color: #3730a3; }
.badge.new       { background: #fef9c3; color: #854d0e; }
.badge.at-risk   { background: #fee2e2; color: var(--bad); }
.badge.deadline  { background: var(--bad); color: #fff; }
.badge.stale     { background: #fef3c7; color: var(--warn); }
/* Future-hold dogs (status=coming_soon): amber, distinct from the green
   "available" badge — physically here but not yet adoptable. */
.badge.coming-soon { background: #fef3c7; color: var(--warn); }
.cv-top .badge.coming-soon { background: rgba(254,243,199,0.96); color: var(--warn); }
/* Moderator-only auto "watch" signal (api/risk.py). Purple reads as an
   internal/operator marker, distinct from the red public urgency badges. */
.badge.watch          { background: #ede9fe; color: #5b21b6; border: 1px dashed #8b5cf6; }
.badge.watch.elevated { background: #5b21b6; color: #fff; border: 1px solid #5b21b6; }
.cv-top .badge.watch          { background: rgba(237,233,254,0.96); color: #5b21b6; }
.cv-top .badge.watch.elevated { background: rgba(91,33,182,0.96); color: #fff; }

/* Social-platform icons on each listing card. Each icon is a circular
   bubble with the platform's official simpleicons.org SVG. On the
   carousel they sit next to "View full profile" and are real <a>
   links to the post. On the grid they're decorative <span>s inside
   the card link. */
.social-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  vertical-align: middle;
}
.social-icon {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60% 60%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.social-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.15);
}
/* Per-platform brand glyphs from simpleicons.org — same CDN already
   used for the platform pills in detail.html. Format:
   https://cdn.simpleicons.org/{slug}/{color-hex}. */
.social-icon-facebook  { background-image: url('https://cdn.simpleicons.org/facebook/1877F2'); }
.social-icon-instagram { background-image: url('https://cdn.simpleicons.org/instagram/E1306C'); }
.social-icon-tiktok    { background-image: url('https://cdn.simpleicons.org/tiktok/000000'); }
.social-icon-youtube   { background-image: url('https://cdn.simpleicons.org/youtube/FF0000'); }
.social-icon-twitter   { background-image: url('https://cdn.simpleicons.org/x/000000'); }
.social-icon-threads   { background-image: url('https://cdn.simpleicons.org/threads/000000'); }
.social-icon-nextdoor  { background-image: url('https://cdn.simpleicons.org/nextdoor/00BC4F'); }
.social-icon-reddit    { background-image: url('https://cdn.simpleicons.org/reddit/FF4500'); }

/* Carousel CTA row — "View full profile →" + social icons share a line. */
.cv-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
