/**
 * Author Personal Blog - Dedicated Comments Stylesheet
 * File: assets/css/comments.css
 *
 * Scope: Article Discussion Section, Semantic Comment Cards, Gravatars,
 *        Moderation Notices, Reply Links, Threaded/Nested Indentation,
 *        Rich Typography inside .apb-comment-content (Headings, Tables,
 *        Syntax Code Blocks, Blockquotes, Lists, Definition Lists),
 *        and Accessible Comment Form Controls.
 * Loaded on: Singular views where comments are open or comments exist.
 */

/* ==========================================================================
   1. Comments Section Container & Title
   ========================================================================== */
.apb-comments-area {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--apb-color-border);
  width: 100%;
}

.apb-comments-title {
  font-family: var(--apb-font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  margin-bottom: var(--apb-space-6);
  padding-bottom: var(--apb-space-2);
  border-bottom: 2px solid var(--apb-color-bg-alt);
}

.apb-comments-title span {
  color: var(--apb-color-primary);
}

/* ==========================================================================
   2. Comment Listing & Card Structure
   ========================================================================== */
.apb-comment-list,
ol.comment-list,
ul.comment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--apb-space-8) 0;
  display: flex;
  flex-direction: column;
  gap: var(--apb-space-4);
}

.apb-comment-item,
li.comment {
  background-color: #ffffff;
  border: 1px solid var(--apb-color-border);
  border-radius: var(--apb-radius-md);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--apb-shadow-sm);
  transition: border-color var(--apb-transition-fast), box-shadow var(--apb-transition-fast);
  list-style: none;
}

.apb-comment-item:hover,
li.comment:hover {
  border-color: var(--apb-color-border-dark);
}

.apb-comment-body {
  width: 100%;
}

/* Header & Metadata */
.apb-comment-header,
.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--apb-space-3);
  margin-bottom: var(--apb-space-3);
  flex-wrap: wrap;
}

.apb-comment-author-wrap {
  display: flex;
  align-items: center;
  gap: var(--apb-space-3);
}

.apb-comment-avatar-wrap {
  flex-shrink: 0;
}

.apb-comment-avatar,
.avatar {
  border-radius: var(--apb-radius-full);
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 2px solid var(--apb-color-border);
}

.apb-comment-meta-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apb-comment-author-name,
.comment-author .fn {
  font-family: var(--apb-font-sans);
  font-size: var(--apb-font-size-sm);
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  font-style: normal;
}

.apb-comment-author-name a,
.comment-author .fn a {
  color: inherit;
  text-decoration: none;
}

.apb-comment-author-name a:hover,
.comment-author .fn a:hover {
  color: var(--apb-color-primary);
}

.apb-comment-date,
.comment-metadata a {
  font-size: var(--apb-font-size-xs);
  color: var(--apb-color-text-muted);
  text-decoration: none;
}

.apb-comment-date a:hover,
.comment-metadata a:hover {
  color: var(--apb-color-heading);
}

/* Moderation Notice */
.apb-comment-moderation-notice,
.comment-awaiting-moderation {
  font-size: var(--apb-font-size-xs);
  color: var(--apb-color-accent);
  background-color: var(--apb-color-accent-light);
  padding: 0.35rem 0.75rem;
  border-radius: var(--apb-radius-sm);
  margin-bottom: var(--apb-space-3);
  display: inline-block;
  font-style: italic;
}

/* Reply Link Button */
.comment-reply-link,
.apb-comment-reply-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--apb-font-size-xs);
  font-weight: var(--apb-font-weight-semibold);
  color: var(--apb-color-primary);
  background-color: var(--apb-color-primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: var(--apb-radius-full);
  text-decoration: none;
  transition: all var(--apb-transition-fast);
}

.comment-reply-link:hover,
.apb-comment-reply-link:hover {
  background-color: var(--apb-color-primary);
  color: #ffffff;
}

/* Threaded / Nested Replies */
.apb-comment-children,
.children {
  list-style: none;
  padding-left: clamp(1rem, 3vw, 2rem);
  border-left: 2px solid var(--apb-color-border);
  margin-top: var(--apb-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--apb-space-4);
}

.children .apb-comment-item,
.children li.comment {
  background-color: var(--apb-color-bg-alt);
  box-shadow: none;
}

/* ==========================================================================
   3. Rich Typography & Dynamic Content Inside .apb-comment-content
   ========================================================================== */
.apb-comment-content,
.comment-content {
  font-size: var(--apb-font-size-sm);
  color: var(--apb-color-text);
  line-height: var(--apb-line-height-relaxed);
  overflow-wrap: break-word;
  word-break: break-word;
}

.apb-comment-content > *:first-child {
  margin-top: 0;
}

.apb-comment-content > *:last-child {
  margin-bottom: 0;
}

.apb-comment-content p {
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

.apb-comment-content a {
  color: var(--apb-color-primary);
  text-decoration: underline;
  transition: color var(--apb-transition-fast);
}

.apb-comment-content a:hover {
  color: var(--apb-color-accent);
}

/* Proportional Headings Hierarchy */
.apb-comment-content h1 {
  font-family: var(--apb-font-serif);
  font-size: 1.25rem;
  font-weight: var(--apb-font-weight-semibold);
  color: var(--apb-color-heading);
  margin-block: 0.6rem 0.3rem;
  line-height: 1.3;
}

.apb-comment-content h2 {
  font-family: var(--apb-font-serif);
  font-size: 1.15rem;
  font-weight: var(--apb-font-weight-semibold);
  color: var(--apb-color-heading);
  margin-block: 0.55rem 0.3rem;
  line-height: 1.3;
}

.apb-comment-content h3 {
  font-family: var(--apb-font-serif);
  font-size: 1.05rem;
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  margin-block: 0.5rem 0.25rem;
  line-height: 1.35;
}

.apb-comment-content h4 {
  font-family: var(--apb-font-sans);
  font-size: 0.95rem;
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  margin-block: 0.45rem 0.2rem;
  line-height: 1.4;
}

.apb-comment-content h5 {
  font-family: var(--apb-font-sans);
  font-size: 0.875rem;
  font-weight: var(--apb-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--apb-color-heading);
  margin-block: 0.4rem 0.2rem;
  line-height: 1.4;
}

.apb-comment-content h6 {
  font-family: var(--apb-font-sans);
  font-size: 0.8125rem;
  font-weight: var(--apb-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--apb-color-text-muted);
  margin-block: 0.35rem 0.2rem;
  line-height: 1.4;
}

/* Tables in Comments */
.apb-comment-content table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 0.75rem;
  font-size: var(--apb-font-size-xs);
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.apb-comment-content th,
.apb-comment-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--apb-color-border);
}

.apb-comment-content th {
  background-color: var(--apb-color-bg-alt);
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  text-align: left;
}

.apb-comment-content tr:nth-child(even) td {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Code Blocks & Syntax */
.apb-comment-content code,
.apb-comment-content kbd,
.apb-comment-content var {
  font-family: var(--apb-font-mono);
  font-size: 0.85em;
  padding: 0.15rem 0.35rem;
  background-color: var(--apb-color-bg-alt);
  border: 1px solid var(--apb-color-border);
  border-radius: 4px;
  color: var(--apb-color-heading);
}

.apb-comment-content pre {
  padding: 0.85rem 1rem;
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--apb-font-mono);
  font-size: 0.85em;
  line-height: 1.45;
  margin-block: 0.75rem;
}

.apb-comment-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* Definition Lists */
.apb-comment-content dl {
  margin-block: 0.75rem;
}

.apb-comment-content dt {
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  margin-top: 0.5rem;
}

.apb-comment-content dd {
  margin-left: 1rem;
  color: var(--apb-color-text);
  margin-bottom: 0.5rem;
}

/* Blockquotes */
.apb-comment-content blockquote {
  border-left: 3px solid var(--apb-color-accent);
  padding-left: 0.85rem;
  margin-block: 0.75rem;
  font-style: italic;
  color: var(--apb-color-text-muted);
  background: transparent;
}

.apb-comment-content blockquote p {
  margin-bottom: 0.5rem;
}

.apb-comment-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Text Formatting */
.apb-comment-content del,
.apb-comment-content s,
.apb-comment-content strike {
  text-decoration: line-through;
  color: var(--apb-color-text-muted);
}

.apb-comment-content strong,
.apb-comment-content b {
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
}

.apb-comment-content em,
.apb-comment-content i {
  font-style: italic;
}

/* Restore Unordered & Ordered List Styles inside Comment Content */
.apb-comment-content ul,
.apb-comment-content ol {
  margin: 0.75rem 0 1rem 0;
  padding-left: 1.5rem;
}

/* Unordered Lists -> Bullets */
.apb-comment-content ul {
  list-style-type: disc;
}

.apb-comment-content ul ul {
  list-style-type: circle;
  margin: 0.35rem 0 0.5rem 0;
  padding-left: 1.25rem;
}

.apb-comment-content ul ul ul {
  list-style-type: square;
}

/* Ordered Lists -> Numbers */
.apb-comment-content ol {
  list-style-type: decimal;
}

.apb-comment-content ol ol {
  list-style-type: lower-alpha;
  margin: 0.35rem 0 0.5rem 0;
  padding-left: 1.25rem;
}

.apb-comment-content ol ol ol {
  list-style-type: lower-roman;
}

/* List Items */
.apb-comment-content li {
  margin-bottom: 0.35rem;
  line-height: var(--apb-line-height-base);
}

.apb-comment-content li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   4. Comment Form Controls (.apb-comment-respond)
   ========================================================================== */
.apb-comment-respond,
.comment-respond {
  background-color: var(--apb-color-bg-alt);
  border: 1px solid var(--apb-color-border);
  border-radius: var(--apb-radius-md);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-top: var(--apb-space-8);
}

.apb-reply-title,
.comment-reply-title {
  font-size: var(--apb-font-size-lg);
  font-family: var(--apb-font-serif);
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
  margin-bottom: var(--apb-space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.comment-reply-title small a {
  font-family: var(--apb-font-sans);
  font-size: var(--apb-font-size-xs);
  font-weight: var(--apb-font-weight-semibold);
  color: var(--apb-color-accent);
  text-decoration: none;
}

.comment-reply-title small a:hover {
  text-decoration: underline;
}

/* Comment Form Status Notices & Logged-in Links */
.apb-comment-respond .logged-in-as,
.apb-comment-respond .comment-notes {
  font-size: var(--apb-font-size-sm);
  color: var(--apb-color-text-muted);
  margin-bottom: var(--apb-space-4);
  line-height: 1.5;
}

.apb-comment-respond .logged-in-as a,
.apb-comment-respond .comment-notes a {
  color: var(--apb-color-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color var(--apb-transition-fast), text-decoration-color var(--apb-transition-fast);
}

.apb-comment-respond .logged-in-as a:hover,
.apb-comment-respond .logged-in-as a:focus,
.apb-comment-respond .comment-notes a:hover,
.apb-comment-respond .comment-notes a:focus {
  color: var(--apb-color-accent);
  text-decoration-color: var(--apb-color-accent);
}

.apb-comment-form,
.comment-form {
  display: flex;
  flex-direction: column;
  gap: var(--apb-space-4);
}

.apb-form-group,
.comment-form p {
  display: flex;
  flex-direction: column;
  gap: var(--apb-space-1);
  margin: 0;
}

.apb-form-group label,
.comment-form label {
  font-size: var(--apb-font-size-xs);
  font-weight: var(--apb-font-weight-bold);
  color: var(--apb-color-heading);
}

.apb-form-group .required,
.comment-form .required {
  color: var(--apb-color-accent);
}

.apb-form-group-cookies,
.comment-form-cookies-consent {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.apb-form-group-cookies input[type="checkbox"],
.comment-form-cookies-consent input[type="checkbox"] {
  margin-top: 0.25rem;
}

.apb-form-group-cookies label,
.comment-form-cookies-consent label {
  font-size: var(--apb-font-size-xs);
  font-weight: var(--apb-font-weight-normal);
  color: var(--apb-color-text-muted);
  line-height: 1.4;
}

.apb-form-control,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--apb-color-border-dark);
  border-radius: var(--apb-radius-sm);
  background-color: #ffffff;
  color: var(--apb-color-heading);
  font-size: var(--apb-font-size-sm);
  font-family: var(--apb-font-sans);
  transition: border-color var(--apb-transition-fast), box-shadow var(--apb-transition-fast);
}

.apb-form-control:focus,
.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--apb-color-primary);
  box-shadow: 0 0 0 3px rgba(13, 92, 99, 0.2);
}

textarea.apb-form-control,
.comment-form textarea {
  resize: vertical;
  min-height: 120px;
}

.no-comments {
  text-align: center;
  color: var(--apb-color-text-muted);
  font-size: var(--apb-font-size-sm);
  padding: var(--apb-space-4);
  background-color: var(--apb-color-bg-alt);
  border-radius: var(--apb-radius-sm);
  margin-bottom: var(--apb-space-6);
}
