.community-page {
  --community-gutter: clamp(1rem, 3vw, 2.5rem);
  background: #f2f3f1;
}

.community-page::-webkit-scrollbar,
.category-row::-webkit-scrollbar {
  width: 10px;
  height: 6px;
}

.community-page::-webkit-scrollbar-track,
.category-row::-webkit-scrollbar-track {
  background: #e4e6e3;
}

.community-page::-webkit-scrollbar-thumb,
.category-row::-webkit-scrollbar-thumb {
  border: 2px solid #e4e6e3;
  border-radius: var(--radius-pill);
  background: var(--system-green-strong);
}

.community-header {
  position: sticky;
  top: 0;
  z-index: 40;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.community-header .site-nav {
  justify-self: start;
  margin-left: var(--space-4);
}

.publish-top-button,
.publish-submit-button,
.empty-state button {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid #15882c;
  border-radius: var(--radius-sm);
  background: var(--system-green);
  color: var(--system-green-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.publish-top-button:hover,
.publish-submit-button:hover,
.empty-state button:hover {
  background: var(--system-green-hover);
}

.publish-top-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.community-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.6fr);
  min-height: 390px;
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
}

.community-title-block {
  display: flex;
  justify-content: flex-end;
  flex-direction: column;
  padding: clamp(3rem, 8vw, 7rem) var(--community-gutter) clamp(2.5rem, 5vw, 4.5rem);
}

.community-title-block h1 {
  max-width: 820px;
  margin: var(--space-4) 0 0;
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 8.8rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.community-title-block h1 span {
  color: var(--system-green);
}

.community-manifesto {
  display: flex;
  justify-content: flex-end;
  flex-direction: column;
  padding: var(--space-8) var(--community-gutter) clamp(2.5rem, 5vw, 4.5rem);
  border-left: 1px solid var(--ink);
  background: var(--system-green);
  color: var(--system-green-ink);
}

.manifesto-mark {
  margin-bottom: auto;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 1;
}

.community-manifesto p {
  max-width: 28rem;
  margin: 0;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.community-manifesto a {
  width: max-content;
  margin-top: var(--space-6);
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.discovery-tools {
  position: static;
  padding: var(--space-4) var(--community-gutter) var(--space-3);
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
}

.search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.community-search {
  display: grid;
  width: min(100%, 560px);
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--system-green);
  transition: box-shadow 160ms ease;
}

.community-search:focus-within {
  box-shadow: 3px 3px 0 var(--system-green), 0 0 0 3px var(--yellow);
}

.community-search svg {
  width: 25px;
  height: 25px;
  padding: 4px;
  border-radius: 50%;
  background: var(--system-green);
  fill: none;
  stroke: var(--system-green-ink);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.community-search input {
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
}

.community-search input:focus-visible {
  outline: 0;
}

.community-search input::placeholder {
  color: #777d76;
}

.community-search input::-webkit-search-cancel-button {
  display: none;
}

.community-search button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--system-green-surface);
  color: var(--system-green-strong);
  font-size: 0.7rem;
  font-weight: 800;
}

.session-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
  white-space: nowrap;
}

.session-note span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--system-green);
  box-shadow: 0 0 0 3px var(--system-green-surface);
}

.category-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-top: var(--space-3);
  scrollbar-color: var(--system-green-strong) #e4e6e3;
  scrollbar-width: thin;
}

.category-row button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.category-row button:hover {
  border-color: var(--system-green-strong);
  color: var(--system-green-strong);
}

.category-row button.is-active {
  border-color: var(--system-green-strong);
  background: var(--system-green-surface);
  color: var(--system-green-strong);
}

.feed-shell {
  padding: var(--space-8) var(--community-gutter) var(--space-12);
}

.feed-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  scroll-margin-top: 180px;
}

.feed-heading h2 {
  margin: var(--space-1) 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: -0.065em;
  line-height: 1;
}

.feed-heading > p {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-utility);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.community-loading {
  min-height: 45vh;
  margin: 0;
  padding: var(--space-12) 0;
  border-top: 1px solid var(--line-strong);
  color: var(--ink-soft);
  text-align: center;
}

.gallery-grid {
  column-count: 1;
  column-gap: var(--space-4);
}

.inspiration-card {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  overflow: hidden;
  margin: 0 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(20, 22, 26, 0.04);
  vertical-align: top;
  animation: pin-in 360ms ease both;
  animation-delay: min(calc(var(--pin-index, 0) * 35ms), 280ms);
}

@keyframes pin-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.card-visual {
  position: relative;
  display: grid;
  min-height: 0;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: var(--stage-color, #e8eae7);
}

.card-visual::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 22, 26, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 22, 26, 0.055) 1px, transparent 1px);
  background-size: 20px 20px;
  content: "";
}

.card-visual.stage-paper { --stage-color: #e8eae7; }
.card-visual.stage-sand { --stage-color: #eee8dc; }
.card-visual.stage-blush { --stage-color: #f0e1df; }
.card-visual.stage-moss { --stage-color: #dfe7dc; }
.card-visual.stage-charcoal { --stage-color: #30332f; }

.card-index,
.card-category-stamp {
  position: absolute;
  z-index: 2;
  top: var(--space-3);
  color: #5f655d;
  font-family: var(--font-utility);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.stage-charcoal .card-index,
.stage-charcoal .card-category-stamp {
  color: #d4d8d1;
}

.card-index { left: var(--space-3); }
.card-category-stamp { right: var(--space-3); }

.card-save-button {
  position: relative;
  z-index: 4;
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.card-save-button:hover {
  background: var(--system-green-surface);
  transform: translateY(-2px);
}

.card-save-button.is-active {
  background: var(--system-green);
  color: var(--system-green-ink);
}

.card-save-button svg,
.like-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.card-save-button.is-active svg,
.like-button.is-active svg {
  fill: currentColor;
}

.card-shirt {
  position: relative;
  z-index: 1;
  width: 86%;
  aspect-ratio: 640 / 560;
  filter: drop-shadow(0 17px 13px rgba(20, 22, 26, 0.2));
  transition: transform 220ms ease;
}

.format-square .card-shirt { width: 82%; }
.format-tall .card-shirt { width: 94%; }

.inspiration-card:hover .card-shirt {
  transform: translateY(-3px) rotate(-0.6deg);
}

.card-shirt svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card-shirt-body {
  fill: var(--card-shirt-color, #1b1d22);
  stroke: rgba(17, 18, 20, 0.45);
  stroke-width: 2;
}

.card-shirt-detail {
  fill: none;
  stroke: var(--card-seam-color, rgba(255, 255, 255, 0.22));
  stroke-linecap: round;
  stroke-width: 2;
}

.card-artwork {
  position: absolute;
  top: 25%;
  left: 37%;
  width: 26%;
  height: 44%;
  object-fit: contain;
}

.card-local-label {
  position: absolute;
  z-index: 3;
  bottom: var(--space-3);
  left: var(--space-3);
  padding: 0.22rem 0.4rem;
  border: 1px solid var(--system-green-strong);
  border-radius: var(--radius-xs);
  background: var(--system-green-surface);
  color: var(--system-green-strong);
  font-family: var(--font-utility);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.card-copy {
  padding: var(--space-3);
}

.card-copy h3 {
  margin: 0;
  font-size: 0.88rem;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.card-author-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.author-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--avatar-color, #e2e5df);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.62rem;
}

.author-meta {
  min-width: 0;
  flex: 1;
}

.author-meta strong,
.author-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-meta strong {
  font-size: 0.69rem;
}

.author-meta small {
  color: var(--ink-soft);
  font-size: 0.6rem;
}

.like-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.3rem;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-1);
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-utility);
  font-size: 0.65rem;
  font-weight: 800;
}

.like-button:hover,
.like-button.is-active {
  color: var(--system-green-strong);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.card-tags span {
  color: var(--ink-soft);
  font-size: 0.6rem;
}

.card-tags span::before {
  color: var(--system-green-strong);
  content: "#";
}

.empty-state {
  min-height: 45vh;
  padding: clamp(4rem, 12vw, 8rem) var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.empty-state > span {
  display: block;
  color: var(--system-green-strong);
  font-family: var(--font-display);
  font-size: 2rem;
}

.empty-state h3 {
  margin: var(--space-3) 0 var(--space-1);
}

.empty-state p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.empty-state button {
  margin-top: var(--space-5);
}

.community-footer {
  border-top: 1px solid var(--ink);
}

.publish-dialog {
  width: min(94vw, 960px);
  max-height: min(92vh, 760px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(10, 12, 16, 0.3);
}

.publish-dialog::backdrop {
  background: rgba(10, 12, 16, 0.65);
  backdrop-filter: blur(4px);
}

.publish-dialog-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
}

.publish-preview-panel,
.publish-form-panel {
  padding: var(--space-6);
}

.publish-preview-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ink);
  background: #e7e9e5;
}

.publish-preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--ink-soft);
  font-family: var(--font-utility);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.publish-preview-heading small {
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
}

.publish-shirt-stage {
  position: relative;
  display: grid;
  min-height: 390px;
  flex: 1;
  place-items: center;
  overflow: hidden;
  margin-top: var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: #f4f5f2;
  background-image: radial-gradient(#c4c8c0 0.75px, transparent 0.75px);
  background-size: 14px 14px;
}

.preview-empty-copy {
  position: absolute;
  z-index: 2;
  top: var(--space-4);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.publish-shirt {
  position: relative;
  width: min(92%, 390px);
  aspect-ratio: 640 / 560;
  filter: drop-shadow(0 18px 14px rgba(20, 22, 26, 0.18));
}

.publish-shirt svg {
  width: 100%;
  height: 100%;
}

.publish-shirt svg path:first-child {
  fill: #1b1d22;
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 2;
}

.publish-shirt .shirt-detail {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-linecap: round;
  stroke-width: 2;
}

.publish-shirt img {
  position: absolute;
  top: 25%;
  left: 37%;
  width: 26%;
  height: 44%;
  object-fit: contain;
}

.publish-session-warning {
  margin: var(--space-4) 0 0;
  color: var(--ink-soft);
  font-size: 0.67rem;
  text-align: center;
}

.publish-form-panel .dialog-header {
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}

#publishForm {
  margin-top: var(--space-5);
}

.publish-upload {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: #fafbf9;
}

.publish-upload:hover {
  border-color: var(--system-green-strong);
  background: var(--system-green-surface);
}

.publish-upload:has(input:focus-visible) {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.publish-upload svg {
  width: 26px;
  fill: none;
  stroke: var(--system-green-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.publish-upload strong,
.publish-upload small {
  display: block;
}

.publish-upload strong {
  font-size: 0.78rem;
}

.publish-upload small,
.selected-file {
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.selected-file {
  margin: var(--space-2) 0 0;
}

.publish-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.publish-field-grid label > span,
.publish-category > span {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.72rem;
  font-weight: 700;
}

.publish-field-grid input,
.publish-category select {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
}

.publish-category {
  display: block;
  margin-top: var(--space-4);
}

.publish-message {
  min-height: 1.2em;
  margin: var(--space-3) 0 0;
  color: #a1281b;
  font-size: 0.7rem;
  font-weight: 700;
}

.publish-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.secondary-button,
.publish-submit-button {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.publish-dialog .icon-button {
  width: 44px;
  height: 44px;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--ink);
}

@media (min-width: 480px) {
  .gallery-grid { column-count: 2; }
}

@media (min-width: 760px) {
  .gallery-grid { column-count: 3; }
}

@media (min-width: 1040px) {
  .gallery-grid { column-count: 4; }
}

@media (min-width: 1360px) {
  .gallery-grid { column-count: 5; }
}

@media (max-width: 860px) {
  .community-hero {
    grid-template-columns: 1fr;
  }

  .community-manifesto {
    min-height: 260px;
    border-top: 1px solid var(--ink);
    border-left: 0;
  }

  .manifesto-mark {
    margin-bottom: var(--space-8);
  }

  .publish-dialog-layout {
    grid-template-columns: 1fr;
  }

  .publish-preview-panel {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .publish-shirt-stage {
    min-height: 330px;
  }
}

@media (max-width: 620px) {
  .community-header {
    top: 0;
  }

  .community-header .site-nav {
    margin-left: var(--space-2);
  }

  .publish-top-button {
    width: 44px;
    padding: 0;
  }

  .publish-top-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .community-title-block h1 {
    font-size: clamp(3.8rem, 22vw, 6rem);
  }

  .search-row {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-2);
  }

  .session-note {
    order: -1;
  }

  .feed-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .publish-field-grid {
    grid-template-columns: 1fr;
  }

  .publish-preview-panel,
  .publish-form-panel {
    padding: var(--space-4);
  }
}

@media (max-width: 380px) {
  .community-header {
    gap: var(--space-1);
    padding-inline: var(--space-3);
  }

  .community-header .site-nav {
    margin-left: 0;
  }

  .community-header .account-trigger {
    max-width: 4.5rem;
  }

  .site-nav a {
    padding-inline: 0.45rem;
  }

  .publish-actions {
    grid-template-columns: 1fr;
  }
}
