/* Community first screen: preserve the charcoal index / paper artwork pair.
   DESIGN_VARIANCE 4, MOTION_INTENSITY 2, VISUAL_DENSITY 5. Existing Manrope,
   brand tokens, imagery and controls stay unchanged. Load after layout-wide.
   Width belongs to the gallery; available viewport height budgets its hero. */
#typewriterWorkshop .cw-community-page {
  padding-top: var(--cw-community-space-6);
}
#typewriterWorkshop .cw-community-page .cd-intro {
  margin: 0 0 var(--cw-community-space-6);
  gap: var(--cw-community-space-4);
}
#typewriterWorkshop .cw-community-page .cd-intro h1 {
  margin-bottom: var(--cw-community-space-2);
}

@media (min-width: 981px) {
  #typewriterWorkshop .cw-community-page .cd-discover {
    --community-feature-height: clamp(464px, calc(100svh - 256px), 584px);
  }
  #typewriterWorkshop .cw-community-page .cd-ranking,
  #typewriterWorkshop .cw-community-page .cd-featured {
    height: var(--community-feature-height);
    /* Large text can extend the surface instead of clipping a real control. */
    min-height: min-content;
  }
  #typewriterWorkshop .cw-community-page .cd-ranking {
    padding: 20px 18px;
  }
  #typewriterWorkshop .cw-community-page .cd-ranking > header {
    gap: 8px;
  }
  #typewriterWorkshop .cw-community-page .cd-ranking header h2 {
    font-size: var(--cw-community-type-small-heading);
  }
  #typewriterWorkshop .cw-community-page #communityRankingList {
    margin-top: 12px;
  }
  #typewriterWorkshop .cw-community-page #communityRankingList button {
    min-height: 44px;
    padding: 8px;
  }
  #typewriterWorkshop .cw-community-page .cd-featured {
    display: grid;
    grid-template-rows: minmax(180px, 1fr) auto;
  }
  #typewriterWorkshop .cw-community-page .cd-featured-visual {
    height: 100%;
    min-height: 0;
  }
  #typewriterWorkshop .cw-community-page .cd-featured-art > img {
    padding: 12px 24px;
    object-fit: contain;
  }
  #typewriterWorkshop .cw-community-page .cd-featured-bottom {
    min-height: 112px;
    padding: 16px 24px;
    gap: 16px;
  }
}

/* Short laptop windows give space back to the eight readable ranking rows.
   Extremely short windows still scroll normally; nothing gets hidden. */
@media (min-width: 981px) and (max-height: 740px) {
  #typewriterWorkshop .cw-community-page { padding-top: 16px; }
  #typewriterWorkshop .cw-community-page .cd-intro { margin-bottom: 16px; }
  #typewriterWorkshop .cw-community-page .cd-intro h1 {
    font-size: 40px;
    margin-bottom: 6px;
  }
  #typewriterWorkshop .cw-community-page .cd-discover {
    --community-feature-height: clamp(448px, calc(100svh - 220px), 520px);
  }
  #typewriterWorkshop .cw-community-page .cd-ranking { padding-block: 16px; }
  #typewriterWorkshop .cw-community-page #communityRankingList { margin-top: 8px; }
}

/* Do not squeeze two full panels side by side on a phone-sized viewport. */
@media (max-width: 760px) {
  #typewriterWorkshop .cw-community-page .cd-discover {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 20px;
  }
}
