/* Fediverse Comments Styling */

.fediverse-comments-panel {
  display: grid;
  gap: 1rem;
}

.fediverse-comments-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.fediverse-comments-head h5 {
  margin: 0 0 0.45rem 0;
  color: var(--masto-avies);
  font-size: 1rem;
}

.fediverse-comments-list {
  display: grid;
  gap: 0.9rem;
}

.fediverse-comment {
  padding: 1rem;
  border-left-color: var(--feed-text);
  border-radius: 0;
}

.fediverse-comment.comment {
  transition: none;
}

.fediverse-comment.comment:hover {
  transform: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.light-mode .fediverse-comment {
  background: #ffffff;
  border-color: #e0e0e0;
}

.light-mode .fediverse-comment.comment:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.comment__content-wrapper {
  display: block;
}

.comment__author {
  display: flex;
  align-items: center;
  margin: 0;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
}

.light-mode .comment__author {
  background-color: #ffffff;
}

.comment__author a {
  color: var(--link-color, #58a6ff);
  text-decoration: none;
  transition: color 0.2s ease;
}

.comment__author a:hover {
  color: var(--link-hover-color, #79c0ff);
}

.light-mode .comment__author a {
  color: #0969da;
}

.light-mode .comment__author a:hover {
  color: #0550ae;
}

.comment__avatar {
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(200, 255, 0, 0.38);
  width: 54px;
  height: 54px;
  object-fit: cover;
  margin: 0;
}

.light-mode .comment__avatar {
  border-color: #e0e0e0;
}

.comment__instance {
  display: inline-block;
  color: var(--text-muted, #8b949e);
  font-size: 0.85em;
  margin: 0 0 0.5rem 0;
  text-align: left;
}

.light-mode .comment__instance {
  color: #0a0a0a;
  background-color: #ffffff !important;
}

.comment__date {
  margin: 0 0 0.75rem 0;
  font-size: 0.85em;
  color: var(--text-muted, #8b949e);
}

.fediverse-comment-meta {
  margin: 0.3rem 0 0.8rem 4.25rem;
}

.light-mode .comment__date {
  color: #656d76;
  background-color: #ffffff;
}

.comment__date a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.comment__date a:hover {
  color: var(--link-color, #58a6ff);
  text-decoration: underline;
}

.light-mode .comment__date a:hover {
  color: #0969da;
}

.status {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--divider-color, #2a2a2a);
  color: var(--text-muted, #8b949e);
  font-size: 0.9em;
}

.light-mode .status {
  border-top-color: #e0e0e0;
  color: #656d76;
}

.reply-child {
  margin-left: 2rem;
  margin-top: 1rem;
  border-left-color: rgba(83, 216, 240, 0.45);
}

.webmention-info-btn {
  font: inherit;
  cursor: pointer;
}

.webmention-modal-content--guide {
  text-align: left;
  max-width: 560px;
}

.webmention-modal-content--guide h5 {
  margin: 0 0 0.75rem 0;
  color: var(--masto-avies);
  font-size: 1.1rem;
}

.light-mode .reply-child {
  border-left-color: #d0d7de;
}

  /* Fediverse Comments Mobile Fixes */
  @media (max-width: 768px) {
    .comment {
      margin: 0.5em 0;
      padding: 0.75em;
    }

    .reply-child {
      margin-left: 1em;
      position: relative;
    }

    .reply-child::before {
      left: -0.8em;
      font-size: 1.2em;
    }

    .comment__avatar-wrapper {
      float: none;
      display: inline-block;
      width: auto;
      height: auto;
      margin-bottom: 0.5em;
    }

    .comment__avatar {
      width: 40px;
      height: 40px;
    }

    .comment__content-wrapper {
      width: 100%;
      margin-bottom: 1em;
      padding: 0;
      overflow: hidden;
      text-align: left;
    }

    .fediverse-comments-head {
      display: grid;
    }

    .fediverse-comment-meta {
      margin-left: 0;
    }

    .comment__author {
      font-size: 0.95em;
    }

    .comment__instance {
      font-size: 0.8em;
    }

    .comment__date {
      font-size: 0.8em;
    }
  }
  
  .comment__media {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 4px;
  }
  
  /* Ensure long words don't break layout */
  .page__comments * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  /* Handle long URLs and content */
  .page__comments a {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 100%;
    display: inline-block;
  }

  .light-mode .page__comments a {
    color: #000000;
  }
  
  /* Stack comment elements vertically on very small screens */
  @media (max-width: 480px) {
    .reply-child {
      margin-left: 0.5em;
    }

    .comment__avatar {
      width: 36px;
      height: 36px;
    }

    .comment__author {
      font-size: 0.9em;
    }

    .comment__instance,
    .comment__date {
      font-size: 0.75em;
    }
  }
