/* Community + публичный профиль */

.community-page,
.public-profile,
.public-collection {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.community-banner {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent, #7b61ff) 12%, var(--bg-lower, var(--bg-elevated)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #7b61ff) 28%, transparent);
  font: 500 14px/1.45 var(--font);
  color: color-mix(in srgb, var(--text-primary) 88%, transparent);
}

.community-page__head {
  margin-bottom: 28px;
}

.community-page__head h1 {
  margin: 0 0 8px;
  font: 700 36px/1.15 var(--font);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.community-page__head p {
  margin: 0;
  color: var(--text-secondary);
  font: 400 16px/1.5 var(--font);
  max-width: 42rem;
}

.community-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.community-tabs__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-secondary, #969fa8);
  font: 400 14px/22px var(--font);
  background: var(--bg-secondary-elevated, rgba(98, 108, 119, 0.25));
  box-sizing: border-box;
}

.community-tabs__link:hover {
  color: var(--text-primary, #fafafa);
}

.community-tabs__link.is-active {
  font-weight: 500;
  color: #fff;
  background: #7177f8;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 20px;
}

.community-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.community-card__preview {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 6px;
  height: 220px;
  padding: 14px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.community-card__shot {
  position: relative;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--control-tertiary);
}

.community-card__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.community-card__shot--empty {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--control-tertiary) 70%, transparent), var(--bg-elevated));
}

.community-card__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.community-card__title {
  margin: 0;
  font: 600 16px/1.3 var(--font);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-card__owner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-secondary);
  font: 400 13px/1.3 var(--font);
  text-decoration: none;
}

.community-card__owner:hover {
  color: var(--text-primary);
}

.community-card__avatar,
.public-profile__avatar,
.public-collection__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--control-tertiary);
  flex: 0 0 auto;
}

.community-card__avatar--letter,
.public-profile__avatar--letter,
.public-collection__avatar--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 11px/1 var(--font);
  color: var(--text-secondary);
}

.community-empty {
  padding: 48px 24px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed var(--border-subtle);
  background: var(--bg-elevated);
}

.community-empty h2 {
  margin: 0 0 8px;
  font: 600 22px/1.3 var(--font);
}

.community-empty p {
  margin: 0 0 20px;
  color: var(--text-secondary);
}

.community-empty .btn--ghost,
.community-empty .btn--secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-secondary-elevated, rgba(98, 108, 119, 0.25));
  color: var(--text-primary, #fafafa);
  font: 500 14px/1 var(--font);
  text-decoration: none;
}

.community-empty .btn--ghost:hover,
.community-empty .btn--secondary:hover {
  filter: brightness(1.08);
}

.community-empty .btn--primary {
  background: var(--bg-secondary-elevated, rgba(98, 108, 119, 0.25));
  color: var(--text-primary, #fafafa);
  border: 0;
}

.community-empty .btn--primary:hover {
  filter: brightness(1.08);
}

/* Dribbble-like public profile */
.public-profile__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 20px 0 36px;
}

.public-profile__avatar-lg,
.public-profile__avatar-lg--letter {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--control-tertiary);
}

.public-profile__avatar-lg--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 36px/1 var(--font);
  color: var(--text-secondary);
}

.public-profile__hero h1 {
  margin: 4px 0 0;
  font: 700 34px/1.15 var(--font);
  letter-spacing: -0.02em;
}

.public-profile__username {
  margin: 0;
  color: var(--text-secondary);
  font: 500 15px/1.3 var(--font);
}

.public-profile__bio {
  margin: 4px 0 0;
  max-width: 36rem;
  color: var(--text-secondary);
  font: 400 15px/1.5 var(--font);
}

.public-profile__stats {
  display: flex;
  gap: 18px;
  margin-top: 4px;
  color: var(--text-secondary);
  font: 500 13px/1 var(--font);
}

.public-profile__role {
  margin: 0;
  color: var(--text-secondary);
  font: 500 14px/1.3 var(--font);
}

.public-profile__section-title {
  margin: 0 0 18px;
  font: 600 18px/1.3 var(--font);
  text-align: center;
}

.public-profile__feed,
.public-profile__collections {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
}

.public-profile__collections {
  max-width: 960px;
}

.public-collection__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.public-collection__head h1 {
  margin: 0 0 8px;
  font: 700 32px/1.15 var(--font);
  letter-spacing: -0.02em;
}

.public-collection__owner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  font: 500 14px/1.3 var(--font);
}

.public-collection__owner:hover {
  color: var(--text-primary);
}

.public-collection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 200px));
  justify-content: start;
  align-items: start;
  gap: 24px 20px;
}

.public-collection__item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  color: inherit;
}

.public-collection__shot {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}

.public-collection__item-media {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 19.5;
  border-radius: 16px;
  overflow: hidden;
  background: var(--control-tertiary);
  border: 1px solid var(--border-subtle);
}

.public-collection__item-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.public-collection__app {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 0;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.public-collection__app:hover .public-collection__app-name {
  color: var(--text-primary);
}

.public-collection__app-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--control-tertiary);
  color: #fff;
  font: 600 14px/1 var(--font);
  display: grid;
  place-items: center;
}

.public-collection__app-icon.is-fallback {
  background: var(--accent-red);
}

.public-collection__app-icon img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
}

.public-collection__app-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.public-collection__app-name,
.public-collection__app-cat {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-collection__app-name {
  font: 600 14px/20px var(--font);
  color: var(--text-primary);
}

.public-collection__app-cat {
  font: 400 13px/18px var(--font);
  color: var(--text-secondary);
}

.public-collection__item-title {
  margin: 8px 0 0;
  font: 500 13px/1.3 var(--font);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cabinet-collection-group__public {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cabinet-collection-group__public label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 13px/1.3 var(--font);
  color: var(--text-secondary);
  cursor: pointer;
}

.cabinet-collection-group__public a {
  font: 500 13px/1.3 var(--font);
}

@media (max-width: 960px) {
  .community-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Лента по Figma 740:2545 — страница #16171c / #eef1f5, карточки #1a1b21 / #fff */
html:has(body[data-page="community"]),
html:has(body[data-page="profile"]),
html:has(body[data-page="profile_collection"]),
body[data-page="community"],
body[data-page="profile"],
body[data-page="profile_collection"] {
  background: var(--bg-primary, #16171c);
}

[data-theme="light"] html:has(body[data-page="community"]),
[data-theme="light"] html:has(body[data-page="profile"]),
[data-theme="light"] html:has(body[data-page="profile_collection"]),
[data-theme="light"] body[data-page="community"],
[data-theme="light"] body[data-page="profile"],
[data-theme="light"] body[data-page="profile_collection"] {
  background: var(--bg-lower, #eef1f5);
}

[data-theme="dark"] html:has(body[data-page="community"]),
[data-theme="dark"] html:has(body[data-page="profile"]),
[data-theme="dark"] html:has(body[data-page="profile_collection"]),
[data-theme="dark"] body[data-page="community"],
[data-theme="dark"] body[data-page="profile"],
[data-theme="dark"] body[data-page="profile_collection"] {
  background: #16171c;
}

body[data-page="community"] #app.app,
body[data-page="profile"] #app.app,
body[data-page="profile_collection"] #app.app {
  background: transparent;
}

/* Лента по Figma 740:2545 — не ломает .community-card профилей */
.feed-page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px var(--page-padding, 24px) 64px;
  box-sizing: border-box;
}

.feed-page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.feed-page__head h1 {
  margin: 0 0 4px;
  font: 700 36px/54px var(--font);
  letter-spacing: -0.02em;
  color: var(--text-primary, #fafafa);
}

.feed-page__head p {
  margin: 0;
  font: 400 16px/24px var(--font);
  color: var(--text-tertiary, #626c77);
}

.feed-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 1140px; /* 840 + 20 + 280 — как .feed-layout */
  box-sizing: border-box;
}

.feed-filters__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-filters__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 8px 16px;
  border-radius: 12px;
  text-decoration: none;
  font: 400 14px/22px var(--font);
  color: var(--text-secondary, #969fa8);
  background: var(--bg-secondary-elevated, rgba(98, 108, 119, 0.25));
}

.feed-filters__pill:hover {
  color: var(--text-primary, #fafafa);
}

.feed-filters__pill.is-active {
  font-weight: 500;
  color: #fff;
  background: #7177f8;
}

.feed-filters__write {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  font: 500 14px/1 var(--font);
  color: #fff;
  background: #7177f8;
}

.feed-filters__write:hover {
  color: #fff;
  filter: brightness(1.08);
}

.feed-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 1140px;
  box-sizing: border-box;
}

.feed-layout__main {
  flex: 0 1 840px;
  width: 100%;
  max-width: 840px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed-card {
  background: #1a1b21;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
}

[data-theme="light"] .feed-card,
:root:not([data-theme="dark"]) .feed-card {
  background: #fff;
}

.feed-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
}

.feed-card__author {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.feed-card__author:hover .feed-card__name {
  color: #7177f8;
}

.feed-card__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-lower, #16171c);
  font: 700 14px/21px var(--font);
  color: var(--text-primary, #fafafa);
}

.feed-card__who {
  min-width: 0;
}

.feed-card__name {
  margin: 0;
  font: 500 13px/19.5px var(--font);
  color: var(--text-primary, #fafafa);
}

.feed-card__meta {
  margin: 0;
  font: 400 12px/16px var(--font);
  color: #666670;
}

.feed-card__copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px 12px;
}

.feed-card__title {
  margin: 0;
  font: 500 16px/22px var(--font);
  color: var(--text-primary, #fafafa);
}

.feed-card__text {
  margin: 0;
  font: 400 14px/22px var(--font);
  color: var(--text-tertiary, #626c77);
}

.feed-card__shots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 24px 20px;
}

.feed-card__shot {
  flex: 0 0 108px;
  width: 108px;
  height: 189px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.feed-card__shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-theme="light"] .feed-card__shot img,
:root:not([data-theme="dark"]) .feed-card__shot img {
  transform: none;
}

.feed-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 12px;
}

.feed-card__tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 2px 8px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  color: #666670;
  font: 400 10px/15px ui-monospace, "JetBrains Mono", monospace;
}

.feed-card__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.feed-card__stat,
.feed-card__share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #666670;
  font: 500 13px/19.5px var(--font);
  cursor: pointer;
}

.feed-card__stat.is-on {
  color: #7177f8;
}

.feed-card__stat[data-feed-react="like"].is-on {
  color: #e11d48;
}

.feed-card__stat[data-feed-react="like"].is-on .feed-card__icon path {
  fill: currentColor;
  stroke: currentColor;
}

.feed-card__stat img,
.feed-card__stat .feed-card__icon,
.feed-card__share img {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.feed-card__share {
  margin-left: auto;
  font-weight: 400;
}

.feed-card__share.is-copied span::after {
  content: " · скопировано";
}

.feed-side {
  flex: 0 0 280px;
  width: 280px;
}

.feed-side__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 16px;
  background: #1a1b21;
  isolation: isolate;
}

[data-theme="light"] .feed-side__card,
:root:not([data-theme="dark"]) .feed-side__card {
  background: #fff;
}

[data-theme="light"] .feed-card__foot,
:root:not([data-theme="dark"]) .feed-card__foot {
  border-top-color: rgba(18, 19, 26, 0.06);
}

[data-theme="light"] .feed-card__tag,
:root:not([data-theme="dark"]) .feed-card__tag {
  background: rgba(98, 108, 119, 0.12);
}

.feed-side__card h3 {
  margin: 0;
  font: 700 14px/21px var(--font);
  color: #f0f0f1;
}

[data-theme="light"] .feed-side__card h3,
:root:not([data-theme="dark"]) .feed-side__card h3 {
  color: var(--text-primary, #12131a);
}

.feed-side__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-side__tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
  font: 400 12px/16px var(--font);
  color: var(--text-secondary, #969fa8);
  background: var(--bg-secondary-elevated, rgba(98, 108, 119, 0.25));
}

.feed-side__tag.is-active,
.feed-side__tag:hover {
  color: #fff;
  background: #7177f8;
}

@media (max-width: 960px) {
  .feed-layout {
    flex-direction: column;
  }

  .feed-side {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .community-page,
  .public-profile,
  .public-collection {
    padding: 20px 16px 48px;
  }

  .feed-page {
    padding: 20px 16px 48px;
  }

  .feed-page__head h1 {
    font-size: 28px;
    line-height: 1.2;
  }

  .community-page__head h1,
  .public-profile__hero h1,
  .public-collection__head h1 {
    font-size: 28px;
  }

  .community-grid {
    grid-template-columns: 1fr;
  }

  .community-card__preview {
    height: 200px;
  }

  .public-collection__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }
}
