/**
 * AE Comments Section Styles
 * Wrapper for Hyvor Talk embed on guide and post pages.
 */

.ae-comments-section {
  max-width: 860px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}

/* Hide entirely in presentation mode */
body.present .ae-comments-section {
  display: none;
}

/* ── Header with collapse toggle ── */

.ae-comments-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.ae-comments-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.ae-comments-header .ae-comments-icon {
  width: 22px;
  height: 22px;
  color: var(--teal-light);
  flex-shrink: 0;
}

.ae-comments-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.3s ease;
  margin-left: auto;
}

.ae-comments-header:hover .ae-comments-chevron {
  color: var(--text-primary);
}

/* Collapsed state */
.ae-comments-section.is-collapsed .ae-comments-chevron {
  transform: rotate(-90deg);
}

.ae-comments-body {
  overflow: hidden;
  max-height: 4000px;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 1;
}

.ae-comments-section.is-collapsed .ae-comments-body {
  max-height: 0;
  opacity: 0;
}

.ae-comments-body-inner {
  padding-top: 1.5rem;
}

/* Loading placeholder while embed initialises */
.ae-comments-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: var(--card-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ae-comments-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: ae-spin 0.8s linear infinite;
}

@keyframes ae-spin {
  to { transform: rotate(360deg); }
}

/* Light mode adjustments */
[data-theme="light"] .ae-comments-section {
  --border: #e0e0ec;
}

[data-theme="light"] .ae-comments-loading {
  background: #ffffff;
}

/* Mobile */
@media (max-width: 768px) {
  .ae-comments-section {
    padding: 0 1rem;
  }
}
