/* Community gallery and project detail — responsive web + iPad */
.community-screen {
  --community-ink: #14213d;
  --community-muted: #65758b;
  --community-line: #e5e9ef;
  --community-accent: #1769e0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 20px 72px;
  color: var(--community-ink);
}

.community-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 10px 0 26px;
}

.community-back {
  grid-column: 1 / -1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #42526a;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.community-back:hover { color: var(--community-accent); }
.community-back:focus-visible,
.community-tile:focus-visible,
.community-like:focus-visible { outline: 3px solid rgba(23, 105, 224, .32); outline-offset: 3px; }

.community-eyebrow,
.community-card-label {
  color: var(--community-accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .12em;
}

.community-title {
  margin: 7px 0 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.community-subtitle {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--community-muted);
  font-size: 15px;
  line-height: 1.6;
}

.community-header-action { min-width: 160px; }
.community-content { min-height: 320px; }

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

.community-tile {
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--community-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(24, 39, 75, .055);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.community-tile:hover {
  transform: translateY(-3px);
  border-color: #ced9e8;
  box-shadow: 0 12px 30px rgba(24, 39, 75, .12);
}

.community-tile-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #edf1f5;
}

.community-tile-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .3s ease;
}

.community-tile:hover .community-tile-image img { transform: scale(1.025); }

.community-tile-price {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  background: rgba(15, 27, 47, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.community-tile-body { display: flex; flex-direction: column; min-height: 164px; padding: 15px; }
.community-tile-title { font-size: 17px; font-weight: 820; line-height: 1.3; }
.community-tile-summary {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 6px;
  color: var(--community-muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-tile-author { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 14px; }
.community-tile-author-name { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.community-tile-date { margin-left: auto; color: var(--community-muted); font-size: 11px; white-space: nowrap; }
.community-tile-stats { display: flex; gap: 13px; margin-top: 11px; color: #52647a; font-size: 12px; }

.community-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dbe7f8;
  color: #315d97;
  font-size: 12px;
  font-weight: 850;
}

.community-avatar img { width: 100%; height: 100%; object-fit: cover; }
.community-avatar-sm { width: 28px; height: 28px; font-size: 9px; }
.community-avatar-lg { width: 46px; height: 46px; font-size: 14px; }

.community-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 300px;
  padding: 32px;
  border: 1px dashed #d6dee9;
  border-radius: 18px;
  background: #f8fafc;
  text-align: center;
}

.community-state p { max-width: 500px; margin: 0 0 8px; color: var(--community-muted); line-height: 1.55; }
.community-state-error strong { color: #9d2833; }
.community-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d9e2ee;
  border-top-color: var(--community-accent);
  border-radius: 50%;
  animation: community-spin .75s linear infinite;
}

@keyframes community-spin { to { transform: rotate(360deg); } }
.community-load-more { display: block; min-width: 180px; margin: 26px auto 0; }

.community-detail-screen .community-header { padding-bottom: 18px; }
.community-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr);
  overflow: hidden;
  border: 1px solid var(--community-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(24,39,75,.08);
}

.community-detail-visual { min-height: 430px; background: #e8edf3; }
.community-detail-visual img { width: 100%; height: 100%; min-height: 430px; display: block; object-fit: cover; }
.community-detail-info { display: flex; flex-direction: column; padding: 28px; }
.community-detail-author { display: flex; align-items: center; gap: 11px; }
.community-detail-author > div { display: flex; flex-direction: column; gap: 3px; }
.community-detail-author strong { font-size: 13px; }
.community-detail-author span { color: var(--community-muted); font-size: 11px; }
.community-detail-info h1 { margin: 34px 0 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.08; letter-spacing: -.035em; }
.community-detail-summary { margin: 13px 0 0; color: var(--community-muted); line-height: 1.6; }
.community-detail-actions { display: flex; align-items: center; gap: 14px; margin-top: auto; padding-top: 32px; }
.community-like {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #d7deea;
  border-radius: 999px;
  background: #fff;
  color: #3e5068;
  font: inherit;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}

.community-like.is-liked { border-color: #f5b4bf; background: #fff3f5; color: #ce354c; }
.community-comment-count { color: var(--community-muted); font-size: 12px; }

.community-detail-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.community-detail-card {
  padding: 24px;
  border: 1px solid var(--community-line);
  border-radius: 18px;
  background: #fff;
}

.community-detail-card h2 { margin: 5px 0 18px; font-size: 21px; letter-spacing: -.02em; }
.community-quote-card { background: linear-gradient(145deg, #0d2946, #174d78); color: #fff; }
.community-quote-card .community-card-label { color: #9dd6ff; }
.community-quote-total { font-size: clamp(30px, 4vw, 44px); font-weight: 880; letter-spacing: -.04em; }
.community-quote-range { margin-top: 7px; color: #cae7ff; font-size: 13px; }
.community-disclaimer { margin: 14px 0 0; color: var(--community-muted); font-size: 11px; line-height: 1.55; }
.community-quote-card .community-disclaimer { color: rgba(255,255,255,.68); }
.community-quote-breakdown { margin-top: 18px; border-top: 1px solid rgba(255,255,255,.2); padding-top: 13px; }
.community-quote-breakdown summary { color: #fff; font-size: 12px; font-weight: 750; cursor: pointer; }
.community-quote-lines { margin-top: 10px; }
.community-quote-line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; color: rgba(255,255,255,.78); font-size: 12px; }
.community-quote-line strong { color: #fff; }

.community-products { display: flex; flex-direction: column; gap: 2px; }
.community-product { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid #edf0f4; }
.community-product:first-child { border-top: 0; padding-top: 0; }
.community-product > div { min-width: 0; }
.community-product > div strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.community-product > div span { display: block; margin-top: 3px; color: var(--community-muted); font-size: 10px; }
.community-product > strong { flex: 0 0 auto; font-size: 12px; }
.community-muted { color: var(--community-muted); font-size: 12px; }

.community-comments { margin-top: 18px; }
.community-comment-form label,
.community-publish-form label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 780; }
.community-comment-form textarea,
.community-publish-form input,
.community-publish-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #ced7e3;
  border-radius: 11px;
  background: #fff;
  color: #18263a;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.community-comment-form textarea:focus,
.community-publish-form input:focus,
.community-publish-form textarea:focus { border-color: var(--community-accent); outline: 3px solid rgba(23,105,224,.12); }
.community-comment-submit { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.community-comment-submit .btn { width: auto; min-width: 130px; }
.community-comment-list { margin-top: 22px; }
.community-comment { display: flex; gap: 11px; padding: 15px 0; border-top: 1px solid #edf0f4; }
.community-comment-copy { min-width: 0; }
.community-comment-meta { display: flex; align-items: baseline; gap: 8px; }
.community-comment-meta strong { font-size: 12px; }
.community-comment-meta time { color: var(--community-muted); font-size: 10px; }
.community-comment-copy p { margin: 5px 0 0; color: #3e4c60; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.community-publish-form {
  --community-muted: #65758b;
  --community-accent: #1769e0;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}
.community-publish-preview { width: 100%; max-height: 260px; display: block; object-fit: cover; border-radius: 13px; background: #e8edf3; }
.community-publish-status { display: flex; align-items: center; gap: 8px; min-height: 25px; margin-top: 10px; color: var(--community-muted); font-size: 11px; }
.community-publish-status .community-spinner { width: 15px; height: 15px; border-width: 2px; }
.community-publish-status.is-ready { color: #087a55; }
.community-publish-status.is-error { color: #ae2d3a; }
.community-publish-summary-card { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; margin-top: 14px; padding: 12px; border-radius: 11px; background: #f3f6f9; font-size: 12px; }
.community-publish-summary-card span { color: var(--community-muted); }
.community-publish-form > .btn { margin-top: 14px; }

@media (max-width: 880px) {
  .community-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .community-detail-layout { grid-template-columns: 1fr; }
  .community-detail-visual,
  .community-detail-visual img { min-height: 0; aspect-ratio: 4 / 3; }
  .community-detail-actions { margin-top: 24px; }
}

@media (max-width: 620px) {
  .community-screen { padding: 10px 14px 56px; }
  .community-header { grid-template-columns: 1fr; gap: 14px; }
  .community-header-action { width: 100%; }
  .community-grid { grid-template-columns: 1fr; gap: 14px; }
  .community-tile-body { min-height: 150px; }
  .community-detail-info { padding: 20px; }
  .community-detail-info h1 { margin-top: 24px; }
  .community-detail-cards { grid-template-columns: 1fr; }
  .community-detail-card { padding: 19px; }
  .community-comment-submit { align-items: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .community-tile,
  .community-tile-image img { transition: none; }
  .community-spinner { animation-duration: 1.5s; }
}
