/* ==========================================================================
   pm.css — Press & Media page

   Card layer only. The page reuses cs.css for all shared chrome:
   banner/header, section shell, search box, result count, grid,
   skeletons, empty state and pagination. This file styles the
   press-specific card (.pm-card) which — unlike a case-study card —
   has no detail page: the whole card is an outbound link to the
   original coverage, so it surfaces outlet (where), publisher (by whom),
   publish date (when) and the summary.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Card

   Same perf treatment as .cs-card in cs.css:
   - `contain: layout paint` isolates repaints to the card.
   - `translateZ(0)` promotes it to its own compositor layer.
   - Hover effects are gated behind @media (hover: hover) below.
   -------------------------------------------------------------------------- */
.pm-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--cs-surface);
  border: 1px solid var(--cs-line);
  border-radius: var(--cs-radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  contain: layout paint;
  transform: translateZ(0);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.pm-card:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
}

/* Non-linkable variant (post without a source URL) — same shell, no cursor. */
div.pm-card {
  cursor: default;
}

/* --------------------------------------------------------------------------
   Cover — image, outlet badge (where published), external-link pip
   -------------------------------------------------------------------------- */
.pm-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #f1f3f5;
}

.pm-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pm-card-cover.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(135deg, #fdeceb 0%, #ffffff 100%),
    radial-gradient(rgba(10, 10, 11, 0.06) 1px, transparent 1px);
  background-size:
    cover,
    16px 16px;
}

.pm-card-monogram {
  font-weight: 700;
  font-size: 52px;
  letter-spacing: -0.03em;
  color: rgba(10, 10, 11, 0.16);
}

/* Outlet / publication badge — the "where published" signal. */
.pm-outlet-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  max-width: calc(100% - 76px);
  background: #ffffff;
  border: 1px solid var(--cs-line-soft);
  color: var(--cs-ink-soft);
  font-family: var(--cs-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Small round pip signalling the card opens the original article. */
.pm-external-pip {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--cs-line-soft);
  border-radius: 50%;
  color: var(--cs-ink-soft);
}

.pm-external-pip svg {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   Body — date (when published), title, summary
   -------------------------------------------------------------------------- */
.pm-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px 24px 20px;
}

.pm-card-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--cs-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cs-muted);
  margin-bottom: 12px;
}

.pm-card-meta-top .pm-kicker {
  color: var(--cs-accent);
  font-weight: 600;
}

.pm-card-title {
  font-size: 19px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--cs-ink);
  margin: 0 0 10px;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pm-card-excerpt {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--cs-muted);
  margin: 0 0 20px;
  flex: 1;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Footer — publisher (by whom) + read CTA
   -------------------------------------------------------------------------- */
.pm-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--cs-line-soft);
}

.pm-card-publisher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Initial-letter avatar for the publisher — keeps the footer visually
   anchored without needing publisher logo assets. */
.pm-publisher-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fdeceb 0%, #f9f2df 100%);
  border: 1px solid var(--cs-line-soft);
  color: var(--cs-ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.pm-card-publisher .who {
  min-width: 0;
}

.pm-card-publisher .name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cs-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-card-publisher .source {
  display: block;
  font-size: 12.5px;
  color: var(--cs-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-card-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cs-cta);
  white-space: nowrap;
}

.pm-card-cta svg {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   Grid centering — cs.css centers a lone last .cs-card; mirror the same
   treatment for .pm-card inside the shared .cs-grid.
   -------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .cs-grid > .pm-card:last-child:nth-child(2n + 1) {
    grid-column: 1 / -1;
    max-width: calc(50% - 14px);
    justify-self: center;
  }
}

@media (min-width: 1024px) {
  .cs-grid > .pm-card:last-child:nth-child(2n + 1) {
    grid-column: auto;
    max-width: none;
    justify-self: stretch;
  }

  .cs-grid > .pm-card:last-child:nth-child(3n + 1) {
    grid-column: 1 / -1;
    max-width: calc(33.333% - 19px);
    justify-self: center;
  }
}

/* --------------------------------------------------------------------------
   Hover effects — only on devices that actually hover (see cs.css note).
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .pm-card-cover img {
    transition: transform 0.45s ease;
  }

  .pm-card-cta svg,
  .pm-external-pip {
    transition:
      transform 0.15s ease,
      color 0.15s ease,
      border-color 0.15s ease;
  }

  a.pm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px -20px rgba(15, 17, 21, 0.18);
    border-color: #dcdcdc;
  }

  a.pm-card:hover .pm-card-cover img {
    transform: scale(1.04);
  }

  a.pm-card:hover .pm-card-cta svg {
    transform: translate(2px, -2px);
  }

  a.pm-card:hover .pm-external-pip {
    color: var(--cs-accent);
    border-color: var(--cs-accent-ring);
    transform: translate(1px, -1px);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .pm-card-body {
    padding: 20px 18px 18px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .pm-card,
  .pm-card-cover img,
  .pm-card-cta svg,
  .pm-external-pip {
    transition: none;
  }
}
