/*
 * community_picker.css — the community picker ("Tiles", founder's pick
 * 2026-09-22): five region tiles, the open one shows its areas as chips.
 * Used on /communities (signup step), the profile Change modal and the post
 * composer. Tokens from main.css; colour on this widget means ONE thing, the
 * part of the world, by tile position (rows are dynamic, names are not styled).
 */
.wg-cp { --cp-ink: var(--wg-color-ink); --cp-tint: var(--wg-tint); }
.wg-cp-tone-1 { --cp-ink: #0a7a3d; --cp-tint: #eaf7ee; }
.wg-cp-tone-2 { --cp-ink: #8a5a00; --cp-tint: #fff4dc; }
.wg-cp-tone-3 { --cp-ink: #22458f; --cp-tint: #e9eff9; }
.wg-cp-tone-4 { --cp-ink: #6b3fa0; --cp-tint: #f1ebfa; }
.wg-cp-tone-5 { --cp-ink: #0f6f74; --cp-tint: #e4f5f5; }
:root[data-theme="dark"] .wg-cp-tone-1 { --cp-ink: #84ecae; --cp-tint: #142b1e; }
:root[data-theme="dark"] .wg-cp-tone-2 { --cp-ink: #f0d99a; --cp-tint: #3a2f14; }
:root[data-theme="dark"] .wg-cp-tone-3 { --cp-ink: #cfe0ff; --cp-tint: #1d2c4a; }
:root[data-theme="dark"] .wg-cp-tone-4 { --cp-ink: #d9c6f5; --cp-tint: #2b1f45; }
:root[data-theme="dark"] .wg-cp-tone-5 { --cp-ink: #a8e6e8; --cp-tint: #143434; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wg-cp-tone-1 { --cp-ink: #84ecae; --cp-tint: #142b1e; }
  :root:not([data-theme="light"]) .wg-cp-tone-2 { --cp-ink: #f0d99a; --cp-tint: #3a2f14; }
  :root:not([data-theme="light"]) .wg-cp-tone-3 { --cp-ink: #cfe0ff; --cp-tint: #1d2c4a; }
  :root:not([data-theme="light"]) .wg-cp-tone-4 { --cp-ink: #d9c6f5; --cp-tint: #2b1f45; }
  :root:not([data-theme="light"]) .wg-cp-tone-5 { --cp-ink: #a8e6e8; --cp-tint: #143434; }
}

/* Select all (the composer only) */
.wg-cp-allrow { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.wg-cp-all { font-size: 0.82rem; }

/* tiles */
.wg-cp-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wg-cp-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 14px; min-height: 92px; text-align: left; font: inherit; cursor: pointer;
  background: var(--cp-tint); color: var(--cp-ink);
  border: 2px solid transparent; border-radius: var(--wg-radius-card);
  transition: transform var(--wg-dur) var(--wg-ease-spring), border-color .16s ease, box-shadow .16s ease;
}
.wg-cp-tile:hover { transform: translateY(-1px); box-shadow: var(--wg-shadow-hover); }
.wg-cp-tile:active { transform: scale(0.98); }
.wg-cp-tile:focus-visible { outline: none; box-shadow: var(--wg-focus-ring); }
.wg-cp-tile.is-on { border-color: var(--cp-ink); }
.wg-cp-tile.is-open { box-shadow: 0 0 0 2px var(--cp-ink) inset; }
.wg-cp-tile-ico { width: 26px; height: 26px; }
.wg-cp-tile-name { font-weight: 800; font-size: 1.05rem; color: var(--wg-text); }
.wg-cp-tile-n {
  position: absolute; top: 10px; right: 10px; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--cp-ink); color: var(--wg-bg);
  font-weight: 800; font-size: 0.82rem;
}
.wg-cp-tile-n[hidden] { display: none; }
.wg-cp-tiles .wg-cp-tile:nth-child(5):last-child { grid-column: 1 / -1; min-height: 64px; flex-direction: row; align-items: center; }

/* the open region's areas */
.wg-cp-panel {
  margin-top: 12px; padding: 12px 14px;
  background: var(--wg-raised); border: 1px solid var(--wg-border-soft); border-radius: var(--wg-radius-card);
  box-shadow: var(--wg-shadow-card);
  animation: wg-cp-in .22s var(--wg-ease-out) backwards;
}
.wg-cp-panel[hidden] { display: none; }
@keyframes wg-cp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.wg-cp-panel-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; color: var(--cp-ink); margin-bottom: 10px; }
.wg-cp-count { font-size: 0.82rem; font-weight: 600; color: var(--wg-muted); }
.wg-cp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wg-cp-chip {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; user-select: none;
  background: var(--wg-raised); color: var(--wg-text); border: 1px solid var(--wg-border);
  font-size: 0.86rem; font-weight: 600; line-height: 1.45; white-space: nowrap;
  transition: transform .14s var(--wg-ease-spring), background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
/* Inside a form field, the base `.wg-field label` block rules must not win. */
.wg-cp .wg-cp-chip { display: inline-flex; flex-direction: row; margin: 0; width: auto; }
.wg-cp-chip:hover { border-color: var(--wg-color); transform: translateY(-1px); }
.wg-cp-chip:active { transform: scale(0.93); }
.wg-cp-chip.is-on { background: var(--wg-color); border-color: var(--wg-color); color: var(--wg-on-brand); box-shadow: 0 2px 9px rgba(14, 175, 76, 0.30); }
.wg-cp-chip:has(.wg-cp-cb:focus-visible) { box-shadow: var(--wg-focus-ring); }
.wg-cp-cb { position: absolute; opacity: 0; width: 0; height: 0; }
.wg-cp-chip-ico { width: 14px; height: 14px; display: none; }
.wg-cp-chip.is-on .wg-cp-chip-ico { display: block; }
.wg-cp.is-shake .wg-cp-count { animation: wg-cp-shake .3s ease; }
@keyframes wg-cp-shake { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }

/* compact: inside a modal or a form block */
.wg-cp-compact .wg-cp-tiles { grid-template-columns: repeat(3, 1fr); }
.wg-cp-compact .wg-cp-tile { min-height: 74px; padding: 10px; }
.wg-cp-compact .wg-cp-tiles .wg-cp-tile:nth-child(5):last-child { grid-column: auto; min-height: 74px; flex-direction: column; align-items: flex-start; }

/* the signup step page */
.wg-cp-page { max-width: 420px; padding-bottom: 96px; }
.wg-cp-page h1 { margin-bottom: 14px; }
.wg-cp-foot {
  position: fixed; left: 0; right: 0; bottom: calc(56px + var(--wg-bottom-inset, 0px)); z-index: 5;
  display: flex; gap: 10px; align-items: center; padding: 10px 16px;
  background: var(--wg-nav-bg-solid); border-top: 1px solid var(--wg-border-soft);
}
.wg-cp-foot .wg-btn { flex: 1; }
.wg-cp-foot .wg-cp-count { font-size: 1rem; white-space: nowrap; }
.wg-cp-foot .wg-cp-n { font-size: 1.4rem; font-weight: 800; color: var(--wg-color-ink); }
@media (min-width: 720px) { .wg-cp-page { padding-bottom: 24px; } .wg-cp-foot { position: static; padding: 18px 0 0; border: 0; background: none; } }
.wg-cp-page ~ .wg-fab, body:has(.wg-cp-page) .wg-fab { display: none; }

/* profile: joined chips + Change */
.wg-cp-summary { display: flex; align-items: center; gap: 12px; }
.wg-cp-summary .wg-cp-chips { flex: 1; }
.wg-cp-summary .wg-cp-chip { cursor: default; }
.wg-cp-summary .wg-btn-sm { flex: 0 0 auto; width: auto; }
.wg-cp-modal-card { max-height: 86vh; overflow: auto; }
.wg-cp-modal-card .wg-cp-foot { position: static; padding: 14px 0 0; border: 0; background: none; }

@media (prefers-reduced-motion: reduce) {
  .wg-cp-tile, .wg-cp-chip { transition: none; }
  .wg-cp-panel, .wg-cp.is-shake .wg-cp-count { animation: none; }
}

/* single choice (the scope sheet): no count line, the tick is the state */
.wg-cp-single .wg-cp-count { display: none; }
