.community-gallery-home {
  --community-bg: #f3f6f5;
  --community-card: #ffffff;
  --community-border: #e5e9e7;
  --community-text: #1f2422;
  --community-muted: #7a8580;
  --community-accent: #2f6f61;
  max-width: 1480px;
  margin: 0 auto 48px;
  padding: 8px 24px 48px;
  background: var(--community-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body:has(.community-gallery-home) {
  background: #eaf5f5;
}

body:has(.community-gallery-home) .crayons-header {
  max-width: 1480px;
  margin: 12px auto 0;
  border: 1px solid var(--community-border, #e5e9e7);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.community-gallery-home .articles-list {
  min-width: 0;
}

.community-gallery-home .crayons-article__cover,
.community-gallery-home .crayons-story__cover {
  overflow: hidden;
  background: #e8eeeb;
  border-radius: 8px 8px 0 0;
}

.community-gallery-home .crayons-article__cover .crayons-story__cover__image,
.community-gallery-home .crayons-story__cover .crayons-story__cover__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 220ms ease;
}

.community-gallery-home .crayons-story:hover .crayons-story__cover__image {
  transform: scale(1.025);
}

.community-gallery-home .crayons-story {
  overflow: hidden;
  border: 1px solid var(--community-border);
  border-radius: 8px;
  background: var(--community-card);
  box-shadow: 0 8px 24px rgba(29, 45, 39, 0.07);
}

.community-gallery-home .crayons-story__body {
  padding: 16px 18px 18px;
}

.community-gallery-home .crayons-story__title {
  color: var(--community-text);
  font-size: 1.05rem;
  line-height: 1.45;
  letter-spacing: 0;
}

.community-gallery-home .crayons-story:first-child .crayons-story__title {
  font-size: clamp(1.25rem, 1.8vw, 1.65rem);
}

.community-gallery-home .crayons-story__tags a,
.community-gallery-home .crayons-story__metadata,
.community-gallery-home .crayons-story__secondary {
  color: var(--community-muted);
}

.community-gallery-home .substories,
.community-gallery-home #homepage-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.community-gallery-home .substories > .paged-stories,
.community-gallery-home .substories > .placeholder-div {
  display: contents;
}

.community-gallery-home .substories > .crayons-story,
.community-gallery-home .substories > .paged-stories > .crayons-story,
.community-gallery-home #homepage-feed > .crayons-story,
.community-gallery-home #homepage-feed > .paged-stories > .crayons-story {
  grid-column: auto;
  min-width: 0;
}

.community-gallery-home .substories > .crayons-story:first-child .crayons-story__cover__image,
.community-gallery-home .substories > .paged-stories:first-of-type > .crayons-story .crayons-story__cover__image,
.community-gallery-home #homepage-feed > .crayons-story:first-child .crayons-story__cover__image,
.community-gallery-home #homepage-feed > .paged-stories:first-of-type > .crayons-story .crayons-story__cover__image {
  aspect-ratio: 16 / 9;
}

.community-gallery-home .crayons-layout__content {
  padding-top: 22px;
}

.community-gallery-home .crayons-navigation__item--current {
  color: var(--community-accent) !important;
  border-bottom-color: var(--community-accent) !important;
}

body .community-gallery-home .substories > .crayons-story .crayons-story__tags,
body .community-gallery-home #homepage-feed .crayons-story .crayons-story__tags {
  height: 29px;
  max-height: none;
  overflow: visible;
}

@media (max-width: 767px) {
  body:has(.community-gallery-home) .crayons-header {
    margin-top: 0;
    border-radius: 0;
    border-inline: 0;
  }
  .community-gallery-home {
    margin: 0;
    padding: 0 0 28px;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .community-gallery-home .substories,
  .community-gallery-home #homepage-feed {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .community-gallery-home .crayons-story__body {
    padding: 14px 16px 16px;
  }

  .community-gallery-home .articles-list > header > nav {
    margin-inline: 0;
  }
}

html.sub2api-community-embedded a[href^="/enter"] {
  display: none !important;
}

html.sub2api-community-embedded body {
  background: #f4f7f6;
}

html.sub2api-community-embedded .community-gallery-home {
  max-width: none;
  margin: 0;
  padding: 14px 20px 36px;
  background: transparent;
  border-radius: 0;
}

html.sub2api-community-embedded .crayons-header,
html.sub2api-community-embedded .community-gallery-home #main-status-form,
html.sub2api-community-embedded .community-gallery-home #followed-podcasts,
html.sub2api-community-embedded .community-gallery-home #loading-articles:empty {
  display: none !important;
}

html.sub2api-community-embedded .community-gallery-home > .crayons-layout__sidebar,
html.sub2api-community-embedded .community-gallery-home > .crayons-layout__aside,
html.sub2api-community-embedded .community-gallery-home .crayons-layout__sidebar,
html.sub2api-community-embedded .community-gallery-home .crayons-layout__aside,
html.sub2api-community-embedded .community-gallery-home .articles-list + * {
  display: none !important;
}

html.sub2api-community-embedded .community-gallery-home .crayons-layout__content {
  grid-column: 1 / -1;
  width: min(100%, 1320px);
  margin-inline: auto;
  padding-top: 0;
}

html.sub2api-community-embedded .community-gallery-home .articles-list > header {
  display: flex;
  min-height: 52px;
  margin: 0 0 14px;
  padding: 0 !important;
  align-items: center;
  border-bottom: 1px solid #dfe7e3;
}

html.sub2api-community-embedded .community-gallery-home .articles-list > header nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: #eaf0ed;
}

html.sub2api-community-embedded .community-gallery-home .articles-list > header .crayons-navigation__item {
  min-height: 36px;
  padding: 7px 16px;
  border: 0 !important;
  border-radius: 6px;
  color: #58645f;
  font-size: 0.925rem;
  font-weight: 600;
}

html.sub2api-community-embedded .community-gallery-home .articles-list > header .crayons-navigation__item--current {
  color: #173f35 !important;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(27, 53, 44, 0.1);
}

html.sub2api-community-embedded .community-gallery-home .substories,
html.sub2api-community-embedded .community-gallery-home #homepage-feed {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 18px;
}

html.sub2api-community-embedded .community-gallery-home .substories > .crayons-story:first-child,
html.sub2api-community-embedded .community-gallery-home .substories > .paged-stories:first-of-type > .crayons-story {
  grid-column: span 2;
}

html.sub2api-community-embedded .community-gallery-home .crayons-story__title {
  font-size: 1rem;
  line-height: 1.4;
}

html.sub2api-community-embedded .community-gallery-home .crayons-story__title a {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

html.sub2api-community-embedded .community-gallery-home .crayons-story__body {
  padding: 14px 16px 16px;
}

html.sub2api-community-embedded .community-gallery-home .crayons-story__bottom {
  margin-top: 8px;
}

html.sub2api-community-embedded .community-gallery-home .crayons-story:hover {
  border-color: #cbd9d3;
  box-shadow: 0 12px 30px rgba(26, 55, 45, 0.11);
}

html.sub2api-community-embedded .community-gallery-home .crayons-story:first-child .crayons-story__title {
  font-size: 1.25rem;
}

@media (max-width: 900px) {
  html.sub2api-community-embedded .community-gallery-home {
    margin: 0;
    padding: 12px 14px 24px;
  }

  html.sub2api-community-embedded .community-gallery-home .substories,
  html.sub2api-community-embedded .community-gallery-home #homepage-feed {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.sub2api-community-embedded .community-gallery-home .substories > .crayons-story:first-child,
  html.sub2api-community-embedded .community-gallery-home .substories > .paged-stories:first-of-type > .crayons-story {
    grid-column: span 2;
  }
}

/* Article pages use a dedicated single-rail layout inside SUB2API. */
html.sub2api-community-embedded #page-content {
  min-height: 100vh;
  padding: 0;
  background: #f4f7f6;
}

html.sub2api-community-embedded .crayons-layout--article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px 40px;
}

html.sub2api-community-embedded .crayons-layout--article > .crayons-layout__sidebar-left {
  position: sticky;
  z-index: 20;
  top: 0;
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: auto;
  padding: 7px 12px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(29, 45, 39, 0.07);
  backdrop-filter: blur(10px);
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions,
html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions__inner {
  position: static;
  display: flex;
  width: 100%;
  min-height: 42px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions__inner > * {
  margin: 0 !important;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions button {
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions button:hover {
  color: #245c4f;
  background: #e7f1ed;
  transform: translateY(-1px);
}

html.sub2api-community-embedded .crayons-layout--article > .crayons-layout__content {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  min-width: 0;
}

html.sub2api-community-embedded .crayons-layout--article > .crayons-layout__sidebar-right {
  display: none !important;
}

html.sub2api-community-embedded .crayons-layout--article .article-wrapper {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article {
  overflow: hidden;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(29, 45, 39, 0.07);
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article__cover,
html.sub2api-community-embedded .crayons-layout--article .crayons-article__cover__image {
  display: block;
  width: 100%;
  max-height: 680px;
  object-fit: cover;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article__header__meta {
  padding: 28px 36px 18px;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article__header h1 {
  max-width: 900px;
  margin-top: 18px;
  font-size: 2.25rem;
  line-height: 1.2;
  letter-spacing: 0;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article__main,
html.sub2api-community-embedded .crayons-layout--article .comments-container {
  padding-inline: 36px;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-article__body {
  max-width: 850px;
  margin-inline: auto;
  font-size: 1.05rem;
  line-height: 1.8;
}

html.sub2api-community-embedded .crayons-layout--article .spec__tags a {
  border-radius: 6px;
  background: #edf3f0;
}

html.sub2api-community-embedded .crayons-layout--article .crayons-btn--primary,
html.sub2api-community-embedded .crayons-layout--article .comment-form .crayons-btn {
  border-color: #2f6f61;
  background: #2f6f61;
  box-shadow: 0 4px 12px rgba(47, 111, 97, 0.2);
}

@media (max-width: 767px) {
  html.sub2api-community-embedded .crayons-layout--article {
    gap: 8px;
    padding: 8px 8px 28px;
  }

  html.sub2api-community-embedded .crayons-layout--article > .crayons-layout__sidebar-left {
    padding: 5px 8px;
  }

  html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions,
  html.sub2api-community-embedded .crayons-layout--article .crayons-article-actions__inner {
    min-height: 40px;
    gap: 4px;
  }

  html.sub2api-community-embedded .crayons-layout--article .crayons-article__header__meta {
    padding: 20px 18px 12px;
  }

  html.sub2api-community-embedded .crayons-layout--article .crayons-article__header h1 {
    margin-top: 14px;
    font-size: 1.75rem;
  }

  html.sub2api-community-embedded .crayons-layout--article .crayons-article__main,
  html.sub2api-community-embedded .crayons-layout--article .comments-container {
    padding-inline: 18px;
  }

  html.sub2api-community-embedded .crayons-layout--article .crayons-article__body {
    font-size: 1rem;
    line-height: 1.72;
  }
}

@media (max-width: 600px) {
  html.sub2api-community-embedded .community-gallery-home {
    margin: 0;
    padding: 10px 8px 20px;
    border-radius: 0;
  }

  html.sub2api-community-embedded .community-gallery-home .substories,
  html.sub2api-community-embedded .community-gallery-home #homepage-feed {
    grid-template-columns: minmax(0, 1fr);
  }

  html.sub2api-community-embedded .community-gallery-home .substories > .crayons-story:first-child,
  html.sub2api-community-embedded .community-gallery-home .substories > .paged-stories:first-of-type > .crayons-story {
    grid-column: auto;
  }
}
