/* SGH feed controls and Diamond night palette. Loaded after the legacy theme. */
:root {
  --sgh-feed-border: #e3e7ec;
  --sgh-feed-control: #f1f3f5;
  --sgh-feed-control-hover: #e7eaee;
  --sgh-feed-icon: #66717e;
  --sgh-feed-text: #1d252e;
  --sgh-feed-muted: #75808d;
  --sgh-feed-accent: #ef4d43;
}

.post .post-actions,
.post-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 42px !important;
  margin-top: 6px !important;
  padding: 2px 12px !important;
  border-top: 1px solid var(--sgh-feed-border) !important;
  background: transparent !important;
}

.post .post-actions .action-btn,
.post-actions .action-btn {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: auto !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 7px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--sgh-feed-icon) !important;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease !important;
}

.post .post-actions .action-btn:hover,
.post-actions .action-btn:hover {
  background: var(--sgh-feed-control) !important;
  color: var(--sgh-feed-accent) !important;
}

.post .post-actions .action-btn:active,
.post-actions .action-btn:active {
  transform: scale(0.96) !important;
}

.post .post-actions .action-btn:focus-visible,
.post-actions .action-btn:focus-visible,
.post-actions-stats .pas-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--sgh-feed-accent) 62%, transparent) !important;
  outline-offset: 2px !important;
}

.post-actions .action-btn .reaction-btn-name,
.post-actions .action-btn > span.d-none {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.post-actions .action-btn .reaction-btn {
  gap: 0 !important;
}

.post-actions .action-btn .action-icon,
.post-actions .action-btn i,
.post-actions .action-btn .action-icon * {
  color: currentColor !important;
  fill: currentColor !important;
  font-size: 20px !important;
}

.post-actions .action-btn .action-icon {
  width: 21px !important;
  height: 21px !important;
  margin: 0 !important;
}

.post-actions .reactions-wrapper.js_unreact-post,
.post-actions .reactions-wrapper.js_unreact-post i {
  color: var(--sgh-feed-accent) !important;
}

.post-actions .inline-emoji,
.post-actions .inline-emoji img {
  width: 23px !important;
  height: 23px !important;
}

.post-actions .action-btn-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 16px !important;
  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--sgh-feed-muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.post .post-actions .post-actions-stats,
.post-actions .post-actions-stats {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;
  width: auto !important;
  min-width: 0 !important;
  margin-left: auto !important;
  padding-left: 14px !important;
  color: var(--sgh-feed-muted) !important;
}

.post-actions .sgh-reaction-count {
  min-width: 12px;
  color: var(--sgh-feed-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.post-actions .sgh-reaction-count[hidden] {
  display: none !important;
}

.post-actions .reactions-wrapper.sgh-reactions-open .reactions-container {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.post .post-actions .post-actions-stats .pas-item,
.post-actions .post-actions-stats .pas-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 0 !important;
  color: inherit !important;
  font-size: 12px !important;
  white-space: nowrap !important;
}

.post .post-actions .post-actions-stats .pas-item i,
.post-actions .post-actions-stats .pas-item i {
  font-size: 17px !important;
}

.post-actions-stats .pas-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

@media (max-width: 575.98px) {
  .post .post-actions,
  .post-actions {
    padding-inline: 8px !important;
  }

  .post-actions-stats {
    gap: 8px !important;
    padding-left: 2px !important;
  }
}

/* Night mode: one coherent surface system instead of isolated white cards. */
body.night-mode {
  --sgh-night-canvas: #14171b;
  --sgh-night-surface: #20242a;
  --sgh-night-surface-raised: #272c33;
  --sgh-night-surface-hover: #30363e;
  --sgh-night-border: #353b44;
  --sgh-night-text: #edf1f5;
  --sgh-night-muted: #a1aab5;
  --sgh-night-subtle: #7f8995;
  --sgh-feed-border: var(--sgh-night-border);
  --sgh-feed-control: var(--sgh-night-surface-raised);
  --sgh-feed-control-hover: var(--sgh-night-surface-hover);
  --sgh-feed-icon: var(--sgh-night-muted);
  --sgh-feed-text: var(--sgh-night-text);
  --sgh-feed-muted: var(--sgh-night-muted);
  background-color: var(--sgh-night-canvas) !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .card,
body.night-mode .main-side-nav-card,
body.night-mode .stories-wrapper-container,
body.night-mode .ftabs-wrapper,
body.night-mode .suggestion-card,
body.night-mode .online-users-card,
body.night-mode .publisher,
body.night-mode .publisher-box,
body.night-mode .modal-content,
body.night-mode .dropdown-menu,
body.night-mode .offcanvas,
body.night-mode .popover {
  background-color: var(--sgh-night-surface) !important;
  border-color: var(--sgh-night-border) !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .card-header,
body.night-mode .card-footer,
body.night-mode .modal-header,
body.night-mode .modal-footer,
body.night-mode .publisher-tabs,
body.night-mode .comments-filter {
  background-color: transparent !important;
  border-color: var(--sgh-night-border) !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .form-control,
body.night-mode .form-select,
body.night-mode .form-control-plaintext,
body.night-mode .input-group-text,
body.night-mode textarea,
body.night-mode select,
body.night-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background-color: var(--sgh-night-surface-raised) !important;
  border-color: var(--sgh-night-border) !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .form-control::placeholder,
body.night-mode textarea::placeholder,
body.night-mode input::placeholder {
  color: var(--sgh-night-subtle) !important;
  opacity: 1 !important;
}

body.night-mode .dropdown-item,
body.night-mode .main-side-nav-card a,
body.night-mode .main-side-nav-card .side-nav-item,
body.night-mode .suggestion-card a,
body.night-mode .online-users-card a,
body.night-mode .comment,
body.night-mode .comment-data {
  color: var(--sgh-night-text) !important;
}

body.night-mode .dropdown-item:hover,
body.night-mode .dropdown-item:focus,
body.night-mode .main-side-nav-card a:hover,
body.night-mode .main-side-nav-card .side-nav-item:hover {
  background-color: var(--sgh-night-surface-hover) !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .text-dark,
body.night-mode .card-title,
body.night-mode .modal-title,
body.night-mode h1,
body.night-mode h2,
body.night-mode h3,
body.night-mode h4,
body.night-mode h5,
body.night-mode h6 {
  color: var(--sgh-night-text) !important;
}

body.night-mode .text-muted,
body.night-mode .form-text,
body.night-mode small,
body.night-mode .post-time,
body.night-mode .comment-time {
  color: var(--sgh-night-muted) !important;
}

body.night-mode hr,
body.night-mode .dropdown-divider,
body.night-mode .list-group-item,
body.night-mode .border,
body.night-mode .border-top,
body.night-mode .border-bottom {
  border-color: var(--sgh-night-border) !important;
}

body.night-mode .list-group-item {
  background-color: transparent !important;
  color: var(--sgh-night-text) !important;
}

body.night-mode .main-side-nav-card .side-nav-section,
body.night-mode .main-side-nav-card .side-nav-group,
body.night-mode .main-side-nav-card .side-nav-submenu,
body.night-mode .main-side-nav-card .collapse.show,
body.night-mode .main-side-nav-card .collapsing {
  background-color: var(--sgh-night-surface-raised) !important;
  border-color: var(--sgh-night-border) !important;
}

body.night-mode .stories-wrapper-container {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18) !important;
}

body.night-mode .post-share-dropdown {
  background: var(--sgh-night-surface-raised) !important;
  border-color: var(--sgh-night-border) !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35) !important;
}

.post .post-footer:not(.x-hidden) {
  padding: 0 14px 10px !important;
  border-top: 1px solid var(--sgh-feed-border) !important;
}

.post .post-footer .post-comments > .comments-filter {
  padding: 6px 0 2px !important;
}

.post .post-footer .js_comments {
  margin: 0 !important;
  padding-top: 5px !important;
}

.post .post-footer .sgh-more-comments {
  display: block !important;
  width: 100% !important;
  padding: 5px 0 7px !important;
  border: 0 !important;
  background: transparent !important;
  text-align: left !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.post .post-footer .js_comment-form {
  margin-top: 5px !important;
  padding-top: 7px !important;
  border-top: 1px solid var(--sgh-feed-border) !important;
}

body.night-mode .post .post-footer {
  background: var(--sgh-night-surface) !important;
  color: var(--sgh-night-text) !important;
}

@media (prefers-reduced-motion: reduce) {
  .post .post-actions .action-btn,
  .post-actions .action-btn {
    transition: none !important;
  }
}
