/* «Лента»: announcement posts, tabs and notes (modules/feed.js, docs/FEED.md). */

/* ── Computer: «Чаты | Лента» switch at the bottom of the sidebar ─────────────────────── */
html:not(#_) .side-switch {
  display: flex;
  flex: none;
  gap: 2px;
  margin: 8px 12px 12px;
  padding: 3px;
  border: 1px solid var(--nav-border);
  border-radius: 20px;
  background: var(--tg-search);
}
html:not(#_) .side-switch-item {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--nav-label);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s, background-color 0.18s;
}
html:not(#_) .side-switch-item.active {
  background: var(--tg-card);
  color: var(--nav-selected);
  box-shadow: 0 1px 3px #0000001f;
}
html:not(#_) .side-switch-count {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--tg-accent);
  color: #fff;
  font-size: 11px;
  line-height: 19px;
  text-align: center;
}
html:not(#_) .side-switch-count[hidden] {
  display: none;
}
/* In feed mode the sidebar shows the feed tabs instead of the chats. */
html:not(#_) .app-shell.feed-mode .sidebar > .search-wrap,
html:not(#_) .app-shell.feed-mode .sidebar > .chat-tabs,
html:not(#_) .app-shell.feed-mode .sidebar > .resource-bar,
html:not(#_) .app-shell.feed-mode .sidebar > .chat-search-results,
html:not(#_) .app-shell.feed-mode .sidebar > .chat-list {
  display: none;
}
html:not(#_) .feed-sidebar {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
html:not(#_) .feed-sidebar[hidden] {
  display: none;
}
/* ── Posts (both layouts) ──────────────────────────────────────────────────────────── */
html:not(#_) .feed-body {
  max-width: 640px;
  margin: 0 auto;
}
html:not(#_) .feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
html:not(#_) .feed-day {
  align-self: center;
  margin: 0;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--tg-pill);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
html:not(#_) .feed-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--tg-card);
  color: var(--tg-text);
  box-shadow: var(--tg-shadow);
  cursor: pointer;
  outline-offset: 2px;
}
html:not(#_) .feed-card.fresh {
  box-shadow: inset 3px 0 0 var(--tg-accent), var(--tg-shadow);
}
html:not(#_) .feed-card.highlight {
  background: color-mix(in srgb, var(--tg-accent) 14%, var(--tg-card));
}
html:not(#_) .feed-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
html:not(#_) .feed-card-head .avatar {
  flex: none;
  width: 40px;
  height: 40px;
  font-size: 15px;
}
html:not(#_) .feed-card-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
html:not(#_) .feed-card-who strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
html:not(#_) .feed-card-who small,
html:not(#_) .feed-note-time {
  color: var(--tg-hint);
  font-size: 13px;
}
html:not(#_) .feed-card-menu {
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--tg-hint);
}
html:not(#_) .feed-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
html:not(#_) .feed-text a {
  color: var(--tg-link);
}
html:not(#_) .feed-photo {
  display: block;
  width: calc(100% + 28px);
  max-height: 520px;
  margin: 0 -14px;
  object-fit: cover;
  background: var(--tg-search);
  cursor: zoom-in;
}
html:not(#_) .feed-card.note .feed-photo {
  border-radius: 10px;
  width: 100%;
  margin: 0;
}
html:not(#_) .feed-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
html:not(#_) .feed-reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--tg-search);
  font-size: 14px;
}
html:not(#_) .feed-reaction > :first-child {
  font-size: 1.25em;
  line-height: 1;
}
html:not(#_) .feed-reaction.mine {
  background: color-mix(in srgb, var(--tg-accent) 20%, var(--tg-search));
}
html:not(#_) .feed-more {
  display: block;
  margin: 16px auto 0;
}
html:not(#_) .feed-more[hidden] {
  display: none;
}
html:not(#_) .feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 20px;
  border-radius: 16px;
  background: var(--tg-card);
  color: var(--tg-hint);
  text-align: center;
}
html:not(#_) .feed-empty strong {
  color: var(--tg-text);
  font-size: 16px;
}
html:not(#_) .feed-notes-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 2px;
}
html:not(#_) .feed-hint {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tg-accent) 12%, var(--tg-card));
  color: var(--tg-text);
  font-size: 14px;
  line-height: 1.4;
}
html:not(#_) .feed-hint svg {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--tg-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html:not(#_) .feed-new-note {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
html:not(#_) .feed-new-note svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
html:not(#_) .notes-avatar svg {
  width: 55%;
  height: 55%;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Tab dialog ────────────────────────────────────────────────────────────────────── */
html:not(#_) .feed-tab-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
html:not(#_) .feed-channel-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
}
html:not(#_) .feed-channel-picker legend {
  margin-bottom: 6px;
  color: var(--tg-hint);
  font-size: 13px;
}
html:not(#_) .feed-channel-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--tg-text);
  font-size: 15px;
  font-weight: 400;
  gap: 12px;
  min-height: 48px;
  padding: 4px 8px;
  border-radius: 10px;
  cursor: pointer;
}
html:not(#_) .feed-channel-option > span:not(.avatar) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html:not(#_) .feed-channel-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--tg-accent);
}
@media (hover: hover) {
  html:not(#_) .feed-channel-option:hover {
    background: var(--tg-hover);
  }
}
html:not(#_) .feed-placement {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

/* ── The pane: search, tabs, posts — laid out like the chat list ──────────────────── */
html:not(#_) .feed-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Chat search hides the chat folders, never the feed tabs. */
html:not(#_) .feed-pane .feed-tabs {
  display: flex;
}
/* The strip keeps the chat-folder margins; the box only holds the pinned notes button. */
html:not(#_) .feed-tabs-box {
  position: relative;
  flex: none;
}
/* Phone: «Заметки» open the strip as a bright bookmark. */
html:not(#_) .feed-tabs .feed-notes-tab {
  flex: 0 0 32px;
  width: 32px;
  padding: 0;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--tg-accent);
  color: #fff;
}
/* Open: the bookmark fills in and the button gets a ring, like the profile tab. */
html:not(#_) .feed-tabs .feed-notes-tab.active {
  background: var(--tg-accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--tg-bg), 0 0 0 3.5px var(--tg-accent);
}
html:not(#_) .feed-tabs .feed-notes-tab svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  fill-opacity: 0;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linejoin: round;
}
html:not(#_) .feed-tabs .feed-notes-tab.active svg {
  fill-opacity: 1;
}

/* ── Computer: tabs listed in the sidebar, posts in the main area ─────────────────── */
html:not(#_) .feed-side-tabs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}
html:not(#_) .feed-side-notes {
  flex: none;
  padding: 8px 12px 0;
  border-top: 1px solid var(--tg-sep);
  margin: 0 12px;
  padding-left: 0;
  padding-right: 0;
}
html:not(#_) .feed-side-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tg-text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
html:not(#_) .feed-side-tab svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--tg-hint);
}
@media (hover: hover) {
  html:not(#_) .feed-side-tab:hover {
    background: var(--tg-hover);
  }
}
html:not(#_) .feed-side-tab.active {
  background: var(--tg-active);
  color: #fff;
}
html:not(#_) .feed-side-tab.active svg {
  color: #fff;
}
html:not(#_) .feed-side-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html:not(#_) .feed-side-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--tg-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}
html:not(#_) .feed-side-tab.active .feed-side-count {
  background: #fff;
  color: var(--tg-accent);
}
html:not(#_) .feed-side-add,
html:not(#_) .feed-side-add svg {
  color: var(--tg-link);
}
/* «Заметки» at the bottom of the list: a bright bookmark on a tinted row. */
html:not(#_) .feed-side-notes .feed-side-tab:not(.active) {
  background: color-mix(in srgb, var(--tg-accent) 16%, transparent);
  font-weight: 600;
}
html:not(#_) .feed-side-notes .feed-side-tab svg {
  color: var(--tg-accent);
  fill: currentColor;
  fill-opacity: 0.25;
}
html:not(#_) .feed-side-notes .feed-side-tab.active svg {
  color: #fff;
  fill-opacity: 1;
}
html:not(#_) .feed-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}
html:not(#_) .feed-view[hidden] {
  display: none;
}
html:not(#_) .feed-view-header {
  flex: none;
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  background: var(--tg-head);
  border-bottom: 1px solid var(--tg-sep);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
html:not(#_) .feed-view-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--tg-text);
}
html:not(#_) .feed-view-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 40px;
}
html:not(#_) .feed-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  height: 36px;
  padding: 0 10px 0 4px;
  margin-left: 8px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--tg-link);
  font-size: 15px;
  cursor: pointer;
}
html:not(#_) .feed-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
@media (hover: hover) {
  html:not(#_) .feed-back:hover {
    background: var(--tg-hover);
  }
}
html:not(#_) .feed-back[hidden] {
  display: none;
}
html:not(#_) .feed-tabs .feed-tab-add {
  flex: 0 0 auto;
  color: var(--tg-link);
}
html:not(#_) .feed-tabs .feed-tab-add svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
html:not(#_) .feed-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 0 12px 16px;
}
html:not(#_) .feed-body.swiping {
  will-change: transform;
}
html:not(#_) .feed-pane .feed-day {
  background: var(--tg-search);
  color: var(--tg-hint);
}
html:not(#_) .feed-pane .feed-card {
  background: var(--tg-card);
  border: 1px solid var(--tg-sep);
  box-shadow: none;
}
html:not(#_) .feed-pane .feed-card.fresh {
  box-shadow: inset 3px 0 0 var(--tg-accent);
}

/* ── Tags when posting to a channel (composer) ─────────────────────────────────────── */
html:not(#_) .post-tags {
  /* Lined up with the message field under it, 8px above it; scrolls sideways. */
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}
html:not(#_) .post-tags::-webkit-scrollbar {
  display: none;
}
html:not(#_) .post-tags[hidden] {
  display: none;
}
html:not(#_) .post-tags-label {
  flex: none;
  color: var(--tg-hint);
  font-size: 13px;
}
html:not(#_) .post-tag {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--tg-sep);
  border-radius: 14px;
  background: var(--tg-card);
  color: var(--tg-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
html:not(#_) .post-tag-add {
  display: grid;
  place-items: center;
  width: 28px;
  padding: 0;
  border-style: dashed;
  color: var(--tg-link);
}
html:not(#_) .post-tag-add svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
html:not(#_) .post-tag[aria-pressed='true'] {
  border-color: var(--tg-accent);
  background: var(--tg-accent);
  color: #fff;
}
html:not(#_) .post-tag[aria-pressed='true']::before {
  content: '# ';
  opacity: 0.8;
}

/* ── Phone: «Лента» is the second screen of the bottom bar ─────────────────────────── */
@media (max-width: 700px) {
  html:not(#_) .side-switch,
  html:not(#_) .feed-sidebar,
  html:not(#_) .feed-view,
  html:not(#_) .feed-back {
    display: none;
  }
  .section-page.feed-page {
    background: var(--tg-bg);
  }
  html:not(#_) #section-feed {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
  }
  html:not(#_) .feed-scroll {
    touch-action: pan-y pinch-zoom;
    padding: 0 12px calc(var(--dock-height) + var(--dock-bottom) + 16px);
  }
}
