/**
 * Webmentions styles for nightdogs.xyz
 * Enhanced display with better organization and accessibility
 */

/* Main webmentions section */
.webmentions {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 2px solid var(--color-border, #e9ecef);
}

.webmentions-header {
  margin-bottom: 2rem;
}

.webmentions-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  color: var(--color-text-primary, #333);
}

.webmentions-icon {
  font-size: 1.25rem;
}

.webmentions-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary, #666);
  font-style: italic;
}

/* Quick actions (likes and shares) */
.webmentions-quick-actions {
  margin-bottom: 2rem;
}

.facepile-section {
  margin-bottom: 1.5rem;
}

.facepile-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: var(--color-text-primary, #333);
}

.facepile-icon {
  font-size: 1rem;
}

.facepile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.facepile-item {
  display: block;
  transition: transform 0.2s ease;
}

.facepile-item:hover,
.facepile-item:focus {
  transform: scale(1.1);
  outline: 2px solid var(--color-primary, #007bff);
  outline-offset: 2px;
}

.facepile-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-border, #e9ecef);
  display: block;
  object-fit: cover;
}

/* Detailed webmentions (replies and mentions) */
.webmentions-detailed {
  margin-bottom: 1.5rem;
}

.webmentions-detailed h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--color-text-primary, #333);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border, #e9ecef);
}

/* Webmention list */
.webmention-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.webmention {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--color-bg-secondary, #f8f9fa);
  border: 1px solid var(--color-border, #e9ecef);
  border-radius: 0.5rem;
  border-left: 4px solid var(--color-primary, #007bff);
}

.webmention-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.webmention-author img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--color-border, #e9ecef);
  object-fit: cover;
  flex-shrink: 0;
}

.webmention-author a {
  text-decoration: none;
  color: var(--color-text-primary, #333);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.webmention-author a:hover,
.webmention-author a:focus {
  color: var(--color-primary, #007bff);
  text-decoration: underline;
}

.webmention-author time {
  font-size: 0.875rem;
  color: var(--color-text-secondary, #666);
  font-weight: normal;
}

.webmention-author time::before {
  content: "•";
  margin: 0 0.5rem;
}

/* Webmention content */
.webmention-content {
  line-height: 1.6;
  color: var(--color-text-primary, #333);
}

.webmention-content p {
  margin: 0 0 1rem 0;
}

.webmention-content p:last-child {
  margin-bottom: 0;
}

.webmention-content blockquote {
  margin: 1rem 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--color-border-accent, #ccc);
  font-style: italic;
  color: var(--color-text-secondary, #666);
}

.webmention-content a {
  color: var(--color-primary, #007bff);
  text-decoration: underline;
}

.webmention-content a:hover,
.webmention-content a:focus {
  color: var(--color-primary-dark, #0056b3);
}

/* Empty state */
.webmentions-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-secondary, #666);
}

.webmentions-empty h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
}

.webmentions-empty p {
  margin: 0 0 1.5rem 0;
}

.webmentions-empty a {
  color: var(--color-primary, #007bff);
  text-decoration: none;
  font-weight: 500;
}

.webmentions-empty a:hover,
.webmentions-empty a:focus {
  text-decoration: underline;
}

/* Author theme integration */
[data-author="jane"] .webmention {
  border-left-color: var(--jane-primary, #b8002e);
}

[data-author="orionlw"] .webmention {
  border-left-color: var(--orionlw-primary, #6e4b1f);
}

[data-author="adesse"] .webmention {
  border-left-color: var(--adesse-primary, #deb8c4);
}

[data-author="nic"] .webmention {
  border-left-color: var(--nic-primary, #2563eb);
}

[data-author="amelia"] .webmention {
  border-left-color: var(--amelia-primary, #8b2d9e);
}

[data-author="ewan"] .webmention {
  border-left-color: var(--ewan-primary, #2563eb);
}

[data-author="abby"] .webmention {
  border-left-color: var(--abby-primary, #1e7e1e);
}

/* Responsive design */
@media (max-width: 768px) {
  .webmentions {
    padding: 1.5rem 0;
  }

  .webmention {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .webmention-author {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .webmention-author img {
    width: 40px;
    height: 40px;
  }

  .facepile-item img {
    width: 36px;
    height: 36px;
  }

  .webmentions-header h3 {
    font-size: 1.25rem;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .webmention {
    background: var(--color-bg-secondary-dark, #2d3748);
    border-color: var(--color-border-dark, #4a5568);
  }

  .webmention-author img,
  .facepile-item img {
    border-color: var(--color-border-dark, #4a5568);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .webmention {
    border-width: 3px;
  }

  .webmention-author img,
  .facepile-item img {
    border-width: 3px;
  }

  .facepile-item:hover,
  .facepile-item:focus {
    outline-width: 3px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .facepile-item {
    transition: none;
  }

  .facepile-item:hover,
  .facepile-item:focus {
    transform: none;
  }
}

/* Print styles */
@media print {
  .webmentions {
    break-before: page;
  }

  .webmention {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .facepile-item img,
  .webmention-author img {
    border: 1px solid #ccc;
  }
}
