/* -- Social Post (website · Media) ----------------------------------------
   Displays one embedded or locally rendered social post - author, text with links, media, time and engagement, as a post, a photo post or a quote. */

@layer components {
  /* every box in the block measures border-box - the same on any page */
  :where(.mk-social-post, .mk-social-post *, .mk-social-post ::before, .mk-social-post ::after) { box-sizing: border-box; }

  .mk-social-post { display: grid; gap: 0.875rem; padding: 1.25rem; border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--card);
    color: var(--card-foreground); }
  .mk-social-post-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; }
  .mk-social-post-who { display: grid; min-width: 0; line-height: 1.3; }
  .mk-social-post-name { display: inline-flex; align-items: center; gap: 0.25rem; overflow: hidden; color: inherit; font-size: 0.9375rem; font-weight: 700; text-decoration: none; white-space: nowrap;
    &:hover { text-decoration: underline; }
    &:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
  }
  .mk-social-post-verified { flex: none; color: oklch(0.62 0.18 250); }
  .mk-social-post-handle { color: var(--muted-foreground); font-size: 0.875rem; }
  .mk-social-post-network { color: var(--foreground); }
  .mk-social-post-text p { margin: 0; font-size: 0.9375rem; line-height: 1.6; white-space: pre-line; text-wrap: pretty;
    & a { color: oklch(0.55 0.18 250); text-decoration: none; }
    & a:hover { text-decoration: underline; }
  }
  .mk-social-post-media { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .mk-social-post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding-block-start: 0.75rem; border-block-start: 1px solid var(--border); }
  .mk-social-post-time { color: var(--muted-foreground); font-size: 0.8125rem; text-decoration: none;
    &:hover { text-decoration: underline; }
  }
  .mk-social-post-stats { display: flex; gap: 1rem; margin: 0; padding: 0; list-style: none; color: var(--muted-foreground); font-size: 0.8125rem; font-variant-numeric: tabular-nums;
    & li { display: inline-flex; align-items: center; gap: 0.3125rem; }
    & svg { width: 1rem; height: 1rem; }
  }

  .mk-social-post[data-variant="photo"] {
    padding: 0 0 1rem;
    overflow: hidden;

    & > .mk-social-post-media { aspect-ratio: 1; border: 0; border-radius: 0; }
    & > :not(.mk-social-post-media) { margin-inline: 1rem; }
    & .mk-social-post-foot { border: 0; padding: 0; }
  }

  .mk-social-post[data-variant="quote"] {
    & .mk-social-post-text p { font-size: 1.1875rem; line-height: 1.5; }
    & .mk-social-post-head { order: 2; }
    & .mk-social-post-text { order: 1; }
    & .mk-social-post-foot { order: 3; }
  }

  /* -- Accessibility ------------------------------------------- */
  @media (forced-colors: active) {
    .mk-social-post { border-color: CanvasText; }
    .mk-social-post-verified { color: LinkText; }
  }
}
