.community-page {
  margin: 0;
  overflow-x: hidden;
}

.community-shell {
  width: min(1120px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2.5rem 0 1.5rem;
}

.community-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.community-header,
.community-brand,
.community-back,
.community-text-link,
.community-section-heading,
.community-footer {
  display: flex;
  align-items: center;
}

.community-header {
  justify-content: space-between;
  margin-bottom: 2.5rem;
}

.community-brand {
  gap: 0.65rem;
  color: var(--ia-ink);
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
}

.community-brand img {
  display: block;
  border-radius: 50%;
}

.community-back {
  gap: 0.45rem;
  color: var(--ia-muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.community-back svg,
.community-text-link svg,
.community-icon-button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.community-back:hover {
  color: var(--ia-primary-deep);
}

.community-resources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  max-width: 720px;
  margin: 0 auto;
}

.community-panel {
  min-width: 0;
  border: 1px solid var(--ia-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.community-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 1.65rem 1.25rem;
  text-align: center;
}

.community-group-tag {
  padding: 0.35rem 0.65rem;
  color: var(--ia-primary-deep);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 4px;
  background: rgba(111, 143, 146, 0.09);
}

.community-share-page .community-resources {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: none;
}

.community-share-file-meta {
  display: flex;
  width: min(100%, 176px);
  aspect-ratio: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--ia-muted);
  font-size: 0.78rem;
  border: 1px solid rgba(109, 125, 128, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.community-share-file-size {
  color: var(--ia-ink);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.community-qr {
  display: block;
  width: min(100%, 176px);
  flex-shrink: 0;
  padding: 0.5rem;
  border: 1px solid rgba(109, 125, 128, 0.14);
  border-radius: 10px;
  background: #fff;
  transition: border-color 180ms ease, transform 180ms ease;
}

.community-qr img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.community-qr:hover {
  border-color: var(--ia-primary);
  transform: translateY(-2px);
}

.community-text-link {
  width: fit-content;
  gap: 0.45rem;
  padding: 0.35rem 0;
  color: var(--ia-primary-deep);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  border: 0;
  background: none;
  cursor: pointer;
}

.community-text-link:hover {
  color: var(--ia-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.community-group > .community-text-link {
  margin-top: auto;
  white-space: nowrap;
}

.community-discussions {
  margin-top: 3rem;
}

.community-section-heading {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.community-section-heading h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.5;
}

.community-discussion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.community-discussion {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.community-discussion-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 138px;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--ia-line);
  background: #fff;
  cursor: pointer;
}

.community-discussion-preview::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(transparent 30%, rgba(246, 244, 239, 0.8));
}

.community-discussion-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  opacity: 0.76;
  transition: opacity 180ms ease;
}

.community-discussion-preview:hover img {
  opacity: 1;
}

.community-discussion-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.5rem 1.7rem;
}

.community-discussion-copy h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.6;
}

.community-discussion-copy > .community-text-link {
  margin-top: auto;
}

.community-continuation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
  color: var(--ia-muted);
}

.community-continuation-dots {
  display: flex;
  gap: 0.65rem;
}

.community-continuation-dots > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ia-primary-deep);
  opacity: 0.4;
  animation: community-dot-pulse 2.4s ease-in-out infinite;
}

.community-continuation-dots > span:nth-child(2) {
  animation-delay: 0.2s;
}

.community-continuation-dots > span:nth-child(3) {
  animation-delay: 0.4s;
}

.community-continuation p {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  line-height: 1.5;
}

@keyframes community-dot-pulse {
  0%, 80%, 100% { opacity: 0.35; }
  40% { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .community-continuation-dots > span {
    animation: none;
  }
}

.community-footer {
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding: 1.2rem 0 0;
  color: var(--ia-muted);
  font-size: 0.7rem;
  line-height: 1.6;
  border-top: 1px solid var(--ia-line);
}

.community-dialog {
  width: min(1120px, calc(100% - 2rem));
  max-height: 92vh;
  max-height: 92svh;
  padding: 0;
  color: var(--ia-ink);
  border: 1px solid var(--ia-line);
  border-radius: 12px;
  background: var(--ia-bg);
  box-shadow: var(--ia-shadow);
}

.community-dialog::backdrop {
  background: rgba(28, 40, 43, 0.58);
  backdrop-filter: blur(4px);
}

.community-dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem 0.5rem;
}

.community-dialog-toolbar h2 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.community-icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  place-items: center;
  color: var(--ia-ink);
  border: 1px solid var(--ia-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.community-dialog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0 1.2rem 0.8rem;
}

.community-dialog-image-area {
  max-height: calc(92vh - 140px);
  max-height: calc(92svh - 140px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
}

.community-dialog-image-area img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}

.community-dialog-image-area.is-zoomed img {
  width: max(100%, var(--discussion-natural-width, 1280px));
}

.community-page :is(a, button):focus-visible {
  outline: 3px solid rgba(77, 111, 115, 0.5);
  outline-offset: 4px;
}

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

  .community-share-page .community-share-download {
    grid-column: 1 / -1;
    gap: 0.75rem;
    padding: 1.2rem;
  }

  .community-share-file-meta {
    width: auto;
    aspect-ratio: auto;
    flex-direction: row;
    border: 0;
    background: none;
  }

  .community-share-file-size {
    font-size: 1rem;
  }
}

@media (max-width: 540px) {
  .community-shell {
    width: calc(100% - 2rem);
    padding-top: 1.35rem;
  }

  .community-header {
    margin-bottom: 1.5rem;
  }

  .community-resources {
    gap: 0.75rem;
  }

  .community-discussion-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-group {
    gap: 0.95rem;
    padding: 1.2rem 0.65rem;
  }

  .community-qr {
    padding: 0.3rem;
  }

  .community-group > .community-text-link {
    gap: 0.3rem;
    font-size: 0.72rem;
  }

  .community-discussions {
    margin-top: 2.25rem;
  }

  .community-section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .community-section-heading h2 {
    font-size: 1.18rem;
  }

  .community-discussion-copy {
    padding: 1.4rem;
  }

  .community-footer {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .community-dialog-toolbar {
    gap: 0.5rem;
    padding-right: 0.8rem;
    padding-left: 0.8rem;
  }

  .community-dialog-toolbar h2 {
    font-size: 0.82rem;
  }
}
