/* Self-hosted comments — Baran styling. Uses Quartz theme vars so it adapts to light/dark. */

.sc-wrap {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--lightgray);
}
.sc-wrap * {
  box-sizing: border-box; /* keep inputs/textarea from overflowing their container */
}

.sc-title,
.sc-form-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
  margin: 0 0 1rem;
}
.sc-form-title {
  margin-top: 2.5rem;
}

/* ---- comment list ---- */
.sc-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sc-comment {
  background: rgba(47, 168, 224, 0.07);
  border: 1px solid rgba(47, 168, 224, 0.22);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

/* nested replies: lighter, no card, indented with a rail */
.sc-reply {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.25rem 0;
}

.sc-children {
  margin-top: 0.85rem;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--lightgray);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sc-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.sc-author {
  font-weight: 600;
  color: var(--secondary);
}

.sc-date {
  font-size: 0.78rem;
  color: var(--gray);
}

.sc-body {
  color: var(--darkgray);
  line-height: 1.75;
  word-break: break-word;
}

.sc-actions {
  margin-top: 0.5rem;
}

.sc-reply-btn {
  background: none;
  border: none;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}
.sc-reply-btn:hover {
  color: var(--secondary);
}

.sc-empty {
  color: var(--gray);
  padding: 0.5rem 0;
}

/* ---- form (shared) ---- */
.sc-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.5rem;
  width: 100%;
}

/* reply form: a clearly distinct block so it's obvious you're replying */
.sc-form-reply {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  background: rgba(47, 168, 224, 0.14);
  border: 1px solid rgba(47, 168, 224, 0.32);
  border-inline-start: 3px solid var(--secondary);
  border-radius: 10px;
}

.sc-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 0.2rem;
}
.sc-reply-to {
  color: var(--secondary);
  font-weight: 600;
}
.sc-cancel {
  background: none;
  border: none;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.sc-cancel:hover {
  color: var(--dark);
}

/* name + email row: truly equal halves */
.sc-field-row {
  display: flex;
  gap: 0.7rem;
}

.sc-name,
.sc-email,
.sc-textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--dark);
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  width: 100%;
}

.sc-name,
.sc-email {
  flex: 1 1 0;
  min-width: 0; /* let flex items shrink equally instead of overflowing */
}

.sc-textarea {
  display: block;
  min-height: 6rem;
  resize: vertical;
}

.sc-name:focus,
.sc-email:focus,
.sc-textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--highlight);
}

/* honeypot: hide from humans without display:none */
.sc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sc-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sc-submit {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--light);
  background: var(--secondary);
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sc-submit:hover {
  background: var(--tertiary);
}
.sc-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.sc-msg {
  font-size: 0.85rem;
}
.sc-ok {
  color: #0a6b3a;
}
.sc-err {
  color: #b3261e;
}

/* stack name/email on narrow screens */
@media (max-width: 480px) {
  .sc-field-row {
    flex-direction: column;
  }
}

/* ---- recent comments widget ("آخرین دیدگاه‌ها", in the "مطالب" sidebar) ---- */
.sc-recent-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  margin: 0 0 0.6rem;
}
.sc-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sc-recent-item {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
}
.sc-recent-link {
  text-decoration: none;
  color: var(--darkgray);
  transition: color 0.15s ease;
}
.sc-recent-link:hover {
  color: var(--secondary);
}
.sc-recent-author {
  font-weight: 600;
  color: var(--secondary);
}
.sc-recent-post {
  color: var(--darkgray);
}

/* Deep-linked comment (arrived via "آخرین دیدگاه‌ها"): keep it clear of any
   sticky header when scrolled to, then flash a brand-blue highlight. The tint is
   semi-transparent so it works on both light and dark themes. */
.sc-comment {
  scroll-margin-top: 90px;
}
.sc-comment.sc-highlight {
  animation: sc-flash 2.6s ease-out;
}
@keyframes sc-flash {
  0%,
  25% {
    background: rgba(47, 168, 224, 0.3);
    border-color: rgba(47, 168, 224, 0.75);
    box-shadow: 0 0 0 3px rgba(47, 168, 224, 0.22);
  }
  100% {
    background: rgba(47, 168, 224, 0.07);
    border-color: rgba(47, 168, 224, 0.22);
    box-shadow: 0 0 0 0 rgba(47, 168, 224, 0);
  }
}
