/* Community polish — Instagram-inspired composer + minimal post header */

/* Keep the app navigation physically attached to the bottom of the phone. */
.phone-frame {
  position: relative;
}

.bottom-nav,
body[data-theme="light"] .bottom-nav {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-left: 0 !important;
  border-radius: 1.05rem 1.05rem 0 0 !important;
  padding: 0.28rem 0.35rem max(0.2rem, env(safe-area-inset-bottom)) !important;
  box-shadow: 0 -0.35rem 1.4rem rgba(31, 24, 13, 0.08) !important;
  transform: none;
}

.mobile-menu-fab {
  bottom: calc(var(--mobile-nav-height) + 0.55rem + env(safe-area-inset-bottom)) !important;
}

.mobile-content {
  padding-bottom: calc(var(--mobile-nav-height) + 1rem + env(safe-area-inset-bottom)) !important;
}

/* Minimal publication cover. */
.community-post-hero--minimal {
  position: relative;
  min-height: 14.25rem;
  overflow: hidden;
  border-radius: 1.05rem;
  padding: 1rem 1rem 0.95rem;
  background-position: center;
  background-size: cover;
}

.community-post-hero--minimal::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 6, 7, 0.08) 22%, rgba(6, 6, 7, 0.78) 100%),
    linear-gradient(90deg, rgba(6, 6, 7, 0.26), transparent 65%);
}

.community-post-hero--minimal > * {
  position: relative;
  z-index: 1;
}

.community-post-hero--minimal .community-post-hero__badge {
  display: inline-flex;
  width: fit-content;
  min-height: 1.7rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(12, 12, 13, 0.34);
  padding: 0.3rem 0.58rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.community-post-hero--minimal .community-post-hero__content {
  position: absolute;
  right: 1rem;
  bottom: 0.95rem;
  left: 1rem;
  display: grid;
  gap: 0.42rem;
  padding-right: 2.8rem;
}

.community-post-hero--minimal .community-post-hero__content h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.45rem, 6vw, 1.9rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.22);
}

.community-post-hero--minimal .community-post-hero__author {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  min-width: 0;
}

.community-post-hero--minimal .community-post-hero__author .avatar {
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #5d3c0a;
  background: rgba(255, 248, 232, 0.94);
  font-size: 0.56rem;
  box-shadow: none;
}

.community-post-hero--minimal .community-post-hero__author strong {
  max-width: min(18rem, 75vw);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-post-hero__meta-minimal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.76);
}

.community-post-hero__meta-minimal small,
.community-post-hero__meta-minimal strong {
  margin: 0 !important;
  color: inherit !important;
  font-size: 0.64rem !important;
  font-weight: 600 !important;
  line-height: 1.2;
  text-transform: none !important;
}

.community-post-hero__meta-minimal > * + *::before {
  content: "·";
  margin-right: 0.35rem;
  color: rgba(255, 255, 255, 0.52);
}

.community-post-hero--minimal > .share-action,
.community-post-share-minimal {
  position: absolute !important;
  right: 0.85rem;
  bottom: 0.85rem;
  display: grid !important;
  width: 2.35rem !important;
  min-width: 2.35rem !important;
  height: 2.35rem !important;
  min-height: 2.35rem !important;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: rgba(10, 10, 11, 0.34) !important;
  padding: 0 !important;
  font-size: 0 !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
}

.community-post-share-minimal::before,
.community-post-hero--minimal > .share-action::before {
  content: "↗";
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

/* When a topic is commentable, reserve room for the always-visible composer. */
body.community-detail-with-dock .mobile-content {
  padding-bottom: calc(var(--mobile-nav-height) + 8.25rem + env(safe-area-inset-bottom)) !important;
}

.community-comment-dock {
  position: absolute;
  right: 0;
  bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  left: 0;
  z-index: 35;
  display: grid;
  gap: 0.35rem;
  border-top: 1px solid rgba(22, 20, 17, 0.09);
  background: rgba(255, 255, 255, 0.98);
  padding: 0.42rem 0.72rem 0.52rem;
  box-shadow: 0 -0.5rem 1.5rem rgba(31, 24, 13, 0.07);
  backdrop-filter: blur(18px);
}

.community-comment-dock .comment-emoji-row {
  display: flex;
  width: 100%;
  gap: 0;
  justify-content: space-between;
  margin: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  padding: 0 0.05rem;
}

.community-comment-dock .comment-emoji-row button {
  display: grid;
  min-width: 2.1rem;
  min-height: 2rem;
  place-items: center;
  border: 0;
  color: #111;
  background: transparent;
  padding: 0.15rem;
  font-size: 1.18rem;
  line-height: 1;
}

.community-comment-dock .comment-emoji-row button:last-child {
  width: auto;
  min-width: 3.4rem;
  color: #a46a0e;
  font-size: 0.62rem;
  font-weight: 800;
}

.community-comment-dock__form,
body[data-theme="light"] .community-comment-dock__form {
  display: block;
  margin: 0;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}

.community-comment-dock__row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto auto;
  gap: 0.42rem;
  align-items: center;
}

.community-comment-dock__avatar {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(22, 20, 17, 0.11);
  border-radius: 50%;
  color: #4d4030;
  background: #f2eee6;
  font-size: 0.63rem;
  font-weight: 800;
}

.community-comment-dock__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-comment-dock__form textarea,
body[data-theme="light"] .community-comment-dock__form textarea {
  width: 100%;
  min-width: 0;
  height: 2.45rem;
  min-height: 2.45rem;
  max-height: 5.4rem;
  resize: none;
  overflow-y: auto;
  border: 1px solid rgba(22, 20, 17, 0.14) !important;
  border-radius: 999px !important;
  color: #111 !important;
  background: #fff !important;
  padding: 0.62rem 0.9rem !important;
  font-size: 0.78rem !important;
  line-height: 1.15;
  box-shadow: none !important;
}

.community-comment-dock__form textarea::placeholder {
  color: #8b8780;
}

.community-comment-dock__image {
  display: grid !important;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(22, 20, 17, 0.15) !important;
  border-radius: 0.62rem !important;
  color: #111 !important;
  background: #fff !important;
  padding: 0 !important;
  font-size: 0 !important;
  cursor: pointer;
}

.community-comment-dock__image::before {
  content: "▧";
  font-size: 1rem;
  line-height: 1;
}

.community-comment-dock__image input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
}

.community-comment-dock__submit,
body[data-theme="light"] .community-comment-dock__submit {
  min-width: 0;
  min-height: 2.2rem;
  border: 0 !important;
  border-radius: 0 !important;
  color: #a66c10 !important;
  background: transparent !important;
  padding: 0 0.12rem !important;
  font-size: 0.68rem !important;
  font-weight: 850 !important;
  box-shadow: none !important;
  text-transform: none;
}

/* The original form is moved into the dock, so no duplicate composer remains in the thread. */
.post-comments > .post-comment-form.community-comment-dock__form {
  display: none;
}

/* Keyboard mode: the navigation disappears, so attach the composer to the visual bottom. */
body.keyboard-open .community-comment-dock,
body.ios-keyboard-open .community-comment-dock {
  bottom: env(safe-area-inset-bottom);
}

body.keyboard-open.community-detail-with-dock .mobile-content,
body.ios-keyboard-open.community-detail-with-dock .mobile-content {
  padding-bottom: calc(7rem + env(safe-area-inset-bottom)) !important;
}

@media (max-width: 720px) {
  .bottom-nav,
  body[data-theme="light"] .bottom-nav {
    position: absolute !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
  }

  .community-post-hero--minimal {
    min-height: 13.4rem;
  }

  .community-comment-dock {
    padding-right: calc(0.65rem + env(safe-area-inset-right));
    padding-left: calc(0.65rem + env(safe-area-inset-left));
  }

  .community-comment-dock__row {
    grid-template-columns: 2.15rem minmax(0, 1fr) 2.15rem auto;
    gap: 0.34rem;
  }
}
