/* Feed and lineage: feed view bar, feed cards, lineage tags/chips, post menus, reader-adjacent feed pieces. Loads after shared-editor-panels.css. */

.feed-view-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.feed-view-bar[hidden] {
  display: none;
}

.feed-view-trigger {
  min-width: 48px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 7px 9px;
}

.feed-view-trigger:hover,
.feed-view-trigger:focus-visible {
  border-color: var(--line-strong);
  background: var(--soft);
  outline: none;
}

.feed-view-trigger .app-icon {
  --icon-size: 20px;
}

.feed {
  display: grid;
}

.lineage-feed {
  display: grid;
  overflow: visible;
}

.lineage-tag-shell {
  position: relative;
  border-bottom: 0;
  background: var(--panel);
  padding: 10px 0;
  overflow: visible;
}

.lineage-tag-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  border-left: 0;
  overflow: hidden;
}

.lineage-tag-cell {
  min-width: 0;
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  color: #536471;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.lineage-tag-cell:hover,
.lineage-tag-cell:focus-visible {
  border-color: rgba(0, 122, 85, 0.32);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.lineage-tag-cell.is-active {
  border-color: rgba(0, 122, 85, 0.52);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: none;
}

.lineage-tag-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 18;
  width: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.lineage-tag-nav.is-previous {
  left: -44px;
  border-radius: 8px 0 0 8px;
  transform: translateX(8px);
}

.lineage-tag-nav.is-next {
  right: -44px;
  border-radius: 0 8px 8px 0;
  transform: translateX(-8px);
}

.lineage-tag-shell:hover .lineage-tag-nav:not(:disabled),
.lineage-tag-shell:focus-within .lineage-tag-nav:not(:disabled),
.lineage-tag-nav:not(:disabled):hover,
.lineage-tag-nav:not(:disabled):focus-visible {
  opacity: 1;
  transform: translateX(0);
}

.lineage-tag-nav:not(:disabled):hover,
.lineage-tag-nav:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.lineage-tag-nav:disabled {
  color: var(--line-strong);
  cursor: default;
  pointer-events: none;
}

.lineage-source-shell {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow: visible;
}

.lineage-parent-section {
  width: 120%;
  margin-left: -10%;
  margin-right: -10%;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: #f8fbfd;
  box-shadow: 0 10px 26px rgba(15, 20, 25, 0.08);
}

.lineage-source-label {
  min-height: 30px;
  display: flex;
  align-items: center;
  border-bottom: 0;
  background: #ffffff;
  color: var(--ink);
  padding: 0 16px 0 20px;
  box-shadow: inset 4px 0 0 var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lineage-parent-section .lineage-source-label {
  border-bottom: 0;
  background: #ffffff;
}

.lineage-source-node {
  position: relative;
  overflow: visible;
}

.lineage-source-node .feed-card {
  border-bottom: 0;
  background: #ffffff;
  box-shadow: inset 4px 0 0 var(--accent);
  min-height: 142px;
}

.lineage-children-section {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.lineage-list {
  display: grid;
  overflow: visible;
}

.lineage-feed[data-lineage-direction="children"] .lineage-children-section {
  animation: lineage-slide-from-right 220ms ease-out both;
}

.lineage-feed[data-lineage-direction="children"] .lineage-source-shell {
  animation: lineage-slide-from-right 220ms ease-out both;
}

.lineage-feed[data-lineage-direction="parents"] .lineage-children-section {
  animation: lineage-slide-from-left 220ms ease-out both;
}

.lineage-feed[data-lineage-direction="parents"] .lineage-source-shell {
  animation: lineage-slide-from-left 220ms ease-out both;
}

.lineage-card-shell {
  position: relative;
  overflow: visible;
}

.lineage-card-shell.is-tag-preview-match .feed-card {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.lineage-card-shell .feed-card {
  min-height: 142px;
}

.feed-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.feed-card:hover {
  background: var(--soft);
}

.feed-card-main {
  position: relative;
  min-width: 0;
  padding-right: 36px;
}

.feed-card-top {
  min-width: 0;
  min-height: 43px;
  display: grid;
  align-content: start;
  border-radius: 6px;
  padding: 3px 6px;
  margin: -3px -6px 0;
  transition: background-color 120ms ease;
}

.feed-card-top:hover,
.feed-card-top:focus-within {
  background: #edf3f7;
  cursor: pointer;
}

.post-more-button {
  position: absolute;
  top: -4px;
  right: 0;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.post-more-button .app-icon {
  --icon-size: 20px;
}

.post-more-button:hover,
.post-more-button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.post-menu {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 25;
  width: min(280px, calc(100vw - 92px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.post-menu-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
}

.post-menu-item:hover,
.post-menu-item:focus-visible {
  background: var(--soft);
  outline: none;
}

.post-menu-item:disabled {
  color: var(--muted);
  cursor: wait;
  opacity: 0.72;
}

.post-menu-item.is-danger {
  color: #f4212e;
}

.post-menu-item.is-danger:disabled {
  color: var(--muted);
}

.item-actions-anchor {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 24;
}

.item-actions-anchor .post-more-button {
  position: static;
}

.item-action-menu {
  top: 34px;
  right: 0;
}

.post-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
}

.post-menu-icon.app-icon {
  --icon-size: 18px;
}

.trash-icon {
  position: relative;
}

.trash-icon::before {
  content: "";
  width: 10px;
  height: 11px;
  border: 1.8px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}

.trash-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 4px;
  width: 10px;
  height: 1.8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 3px -3px 0 -1px currentColor;
}

.feed-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  min-height: 20px;
  margin-bottom: 2px;
}

.feed-author {
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.feed-title {
  min-height: 21px;
  margin: 0;
  font-size: 15px;
  line-height: 1.38;
  font-weight: 800;
}

.feed-title-button {
  display: inline-block;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: hidden;
  padding: 0;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-title-button:hover,
.feed-title-button:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.feed-lineage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.lineage-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.lineage-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.lineage-chip.is-parent {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.lineage-chip.is-parent.is-missing {
  background: var(--soft);
  color: var(--muted);
}

button.lineage-chip.is-parent:hover,
button.lineage-chip.is-parent:focus-visible,
a.lineage-chip.is-parent:hover,
a.lineage-chip.is-parent:focus-visible {
  background: #d3ecfb;
  outline: none;
}

.lineage-chip.is-captivated {
  background: var(--captivated-soft);
  color: var(--captivated);
}

.lineage-chip.is-emotion {
  font-weight: 800;
}

.lineage-chip.is-emotion strong {
  font-weight: 900;
}

.lineage-chip.is-emotion.is-captivated {
  background: var(--captivated-soft);
  color: var(--captivated);
}

.lineage-chip.is-emotion.is-cool {
  background: #e6f6ef;
  color: #007a55;
}

.lineage-chip.is-emotion.is-bored {
  background: #f1f3f5;
  color: #5b6470;
}

.lineage-chip.is-emotion.is-repelled {
  background: #fff0e5;
  color: #a84f10;
}

.lineage-chip.is-emotion.is-intolerable {
  background: #ffe8eb;
  color: #b4232f;
}

button.lineage-chip.is-captivated:hover,
button.lineage-chip.is-captivated:focus-visible,
a.lineage-chip.is-captivated:hover,
a.lineage-chip.is-captivated:focus-visible {
  background: #f8e8b8;
  outline: none;
}

.lineage-mark {
  font-weight: 800;
}

.feed-body {
  min-width: 0;
  max-width: 100%;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feed-card.is-card-view .feed-body {
  min-height: calc(1.58em * 5);
  max-height: calc(1.58em * 5);
  overflow: hidden;
}

.feed-body.structured-content {
  white-space: normal;
}

.structured-content,
.structured-content p,
.structured-content blockquote,
.structured-content .ticy-details,
.structured-content .ticy-details-body,
.structured-content .ticy-todo-item,
.structured-content .ticy-todo-text,
.structured-content .ticy-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feed-body.structured-content p {
  margin: 0 0 12px;
}

.structured-content .rt-inline-image-frame {
  display: block;
  width: fit-content;
  max-width: 90%;
  margin: 14px auto;
}

.structured-content .rt-inline-image-frame > .rt-inline-image {
  display: block;
  max-width: 100% !important;
  height: auto !important;
  margin: 0;
  border-radius: 8px;
  object-fit: contain;
}

.structured-content .rt-inline-image-frame[data-width] > .rt-inline-image {
  width: 100%;
}

.structured-content .rt-inline-image-resize {
  display: none;
}

.structured-content img:not(.rt-inline-image) {
  display: block;
  max-width: 90% !important;
  height: auto !important;
  margin: 14px auto;
  border-radius: 8px;
  object-fit: contain;
}

.structured-content .ticy-heading {
  margin: 28px 0 12px;
  color: var(--ink);
  line-height: 1.34;
  font-weight: 900;
  letter-spacing: 0;
}

.structured-content .ticy-heading:first-child {
  margin-top: 0;
}

.structured-content .ticy-heading-1 {
  font-size: 1.42em;
}

.structured-content .ticy-heading-2 {
  font-size: 1.26em;
}

.structured-content .ticy-heading-3 {
  font-size: 1.12em;
}

.structured-content .ticy-heading-4,
.structured-content .ticy-heading-5,
.structured-content .ticy-heading-6 {
  color: #384955;
  font-size: 1em;
}

.structured-content .ticy-heading + p {
  margin-top: 0;
}

.feed-body.structured-content > :last-child {
  margin-bottom: 0;
}

.feed-body.is-plan-content {
  display: block;
}

.feed-body.is-plan-content .plan-content {
  gap: 1px;
}

.feed-body.is-plan-content .plan-level-0 {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.4;
}

.feed-body.is-plan-content .plan-level-1 {
  margin-top: 5px;
  padding-left: 14px;
  font-size: 14px;
}

.feed-body.is-plan-content .plan-level-2 {
  padding-left: 26px;
  font-size: 13px;
}

.feed-body.is-plan-content .plan-level-3 {
  padding-left: 38px;
  font-size: 13px;
}

.feed-body.is-plan-content .plan-level-3::before {
  left: 27px;
}

.feed-body.is-plan-content .plan-level-4 {
  padding-left: 50px;
  font-size: 12.5px;
}

.feed-body.is-plan-content .plan-level-4::before {
  left: 39px;
}

.feed-body.is-plan-content .plan-level-5 {
  padding-left: 62px;
  font-size: 12px;
}

.feed-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.feed-attachments-marker.app-icon {
  --icon-size: 17px;
  opacity: 0.7;
}

.feed-card.is-card-view .feed-attachments {
  display: none;
}

.feed-attachment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  text-decoration: none;
}

a.feed-attachment:hover,
a.feed-attachment:focus-visible {
  border-color: rgba(0, 122, 85, 0.38);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.feed-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 330px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.feed-card.is-list-view .feed-actions {
  max-width: 330px;
  margin-top: 8px;
}

.feed-card.is-card-view .feed-actions {
  margin-top: 10px;
}

.feed-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feed-action .app-icon {
  --icon-size: 15px;
}

.comment-panel {
  margin: 30px 28px 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.comment-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.comment-panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
}

.comment-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.comment-panel-head .comment-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.comment-panel-head .comment-count .app-icon {
  --icon-size: 16px;
  opacity: 0.68;
}

.comment-list {
  display: grid;
  gap: 14px;
}

.comment-item {
  position: relative;
  display: grid;
  gap: 5px;
  padding-right: 44px;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.comment-meta strong {
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-meta span,
.comment-empty {
  color: var(--muted);
  font-size: 12px;
}

.comment-item p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.comment-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
}

.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
}

.comment-submit,
.comment-login {
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.comment-submit:hover,
.comment-submit:focus-visible,
.comment-login:hover,
.comment-login:focus-visible {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  outline: none;
}

.comment-submit:disabled {
  cursor: default;
  opacity: 0.62;
}

.reader-empty {
  min-height: 220px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.reader-empty strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
}

.reader-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
