/**
 * Shared example/generator card + Like/Share popup styling, reused by
 * every grid (home-new-layout-with-ai.php, page-menus-for-category.php,
 * page-menus-withour-mansonry.php) and template-parts/example-card.php.
 * Pairs with assets/js/example-card.js.
 */

.ex-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: none;
  box-shadow:
    0 1px 2px rgba(20, 10, 40, 0.06),
    0 1px 1px rgba(20, 10, 40, 0.04);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.ex-card:hover,
.ex-card:focus-within {
  transform: translateY(-3px);
  box-shadow:
    0 24px 60px -20px rgba(117, 14, 247, 0.25),
    0 8px 24px -12px rgba(20, 10, 40, 0.18);
}

.ex-card-img-wrap {
  position: relative;
  width: 100%;
  margin: 0;
}

.ex-card-img-link {
  display: block;
  border-radius: 8px;
}
.ex-card-img-link img {
  border-radius: 8px;
}

.ex-card-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Like/Share icons and the Generate Similar/View Only CTA are hidden until
   hover (or keyboard focus), matching the Example Detail page's hover
   convention — they overlay the image rather than sitting as static
   always-visible chrome. */
.ex-card-actions,
.ex-card-overlay {
  position: absolute;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.mg-card:hover .ex-card-actions,
.mg-card:hover .ex-card-overlay,
.mg-card:focus-within .ex-card-actions,
.mg-card:focus-within .ex-card-overlay {
  opacity: 1;
  pointer-events: auto;
}

.ex-card-actions {
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  /* Must beat new-layout.min.css's legacy ".menu-grid-wrap .mg-card-img-wrap
     img { position: relative; z-index: 2; }" skeleton-loader rule, which
     still applies to this same <img> on page-menus-for-category.php —
     otherwise the raw image paints on top of these controls and they never
     become visible even though their own opacity/position is correct. */
  z-index: 4;
}

.ex-card-overlay {
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16px;
  background: linear-gradient(
    180deg,
    transparent 55%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

.ex-card-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #414651;
  cursor: pointer;
}

.ex-card-like-btn[aria-pressed="true"] {
  color: #e0245e;
}

.ex-card-meta {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ex-card-title {
  margin: 0;
  font:
    600 14px/1.35 "Inter",
    sans-serif;
  color: #181d27;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ex-card-cta {
  display: inline-block;
  text-align: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  color: #750ef7 !important;
  font:
    600 13px/1.3 "Inter",
    sans-serif;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.ex-card-cta.ex-card-cta-view-only {
  background: #e9eaeb;
  color: #181d27;
}

@media (prefers-reduced-motion: reduce) {
  .ex-card-actions,
  .ex-card-overlay {
    transition: none;
  }
}

/* Share popup — identical structure/behavior to the one built for
   template-parts/example-detail-landing.php, generalized here. */
.ex-share-popup {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(20, 10, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ex-share-popup[hidden] {
  display: none;
}

.ex-share-popup-inner {
  background: #fff;
  border-radius: 16px;
  width: 340px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 8px 0;
}

.ex-share-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f2;
}

.ex-share-popup-header h4 {
  margin: 0;
  font-size: 18px;
}

.ex-share-popup-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e9eaeb;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.ex-share-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 20px;
  border: none;
  background: none;
  text-align: left;
  text-decoration: none;
  color: #181d27;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f7;
}

.ex-share-row:last-child {
  border-bottom: none;
}

.ex-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.ex-share-icon-copy {
  background: #f3eaff;
  color: #750ef7;
}

.ex-share-icon-whatsapp {
  background: #25d366;
}

.ex-share-icon-x {
  background: #000;
}

.ex-share-icon-pinterest {
  background: #e60023;
}

.ex-share-icon-facebook {
  background: #1877f2;
}

.ex-share-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ex-share-row-text small {
  color: #717680;
}
