/* ============================================================
   DISCUSSIONS -- redesign 2026-09-30, `gx-` prefix.
   Group list and group page. Loaded after storefront.css + story.css,
   so section heads, buttons, rails and reveal come from the story
   system; the group card and the group page layout live here.
   Text on the accent is `--bg-main`. Motion: ease-out, UI under 300ms,
   hover only on fine pointers, reduced motion = final state.
   ============================================================ */

.gx-page .sh-greeting { flex-direction: column; align-items: flex-start; gap: 2px; }
.gx-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 0; font-size: .84rem; color: var(--text-muted); }
.gx-facts b { color: var(--text-main); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ── Search ── */
.gx-search { margin: 0 0 22px; }
.gx-search .mxs-field { margin: 0; }

/* ── Group card (one component everywhere) ── */
.gx-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border-radius: 16px; background: var(--card-bg); border: 1px solid var(--border-color);
  color: var(--text-main); text-decoration: none;
  transition: border-color .18s, box-shadow .2s var(--sx-ease), transform .16s var(--sx-ease);
}
.gx-card:active { transform: scale(.985); }
.gx-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.gx-cover { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--notif-bg); overflow: hidden; }
.gx-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--sx-ease); }
.gx-unread {
  position: absolute; top: 10px; right: 10px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--bg-main); font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .35);
}
.gx-joined {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px);
}
.gx-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; min-width: 0; }
.gx-label { font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.gx-gone { align-self: flex-start; padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 12%, transparent); }
.gx-title {
  font-size: .95rem; font-weight: 700; line-height: 1.32; max-height: 2.64em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.gx-by { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 8px; font-size: .78rem; color: var(--text-muted); }
.gx-stat { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.gx-price { margin-left: auto; font-weight: 800; color: var(--text-main); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gx-price.is-free { color: var(--primary); }
.gx-price s { font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.gx-price small { font-size: .68rem; font-weight: 700; color: var(--text-muted); margin-left: 2px; }
.gx-active { font-size: .74rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.gx-active.is-live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Rail cards keep one width; the grid lets them fill. */
.gx-page .sh-shelf-row > .gx-card { width: 264px; }
.gx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; }

/* ── All groups toolbar ── */
.gx-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gx-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-main);
  font: inherit; font-size: .82rem; font-weight: 700; text-decoration: none;
  transition: background-color .2s var(--sx-ease), border-color .15s, color .15s;
}
.gx-chip.on { background: var(--primary); border-color: var(--primary); color: var(--bg-main); }
.gx-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── States ── */
.gx-skel { border-radius: 16px; overflow: hidden; background: var(--card-bg); border: 1px solid var(--border-color); }
.gx-skel .a { aspect-ratio: 16 / 9; background: var(--notif-bg); }
.gx-skel .b { height: 84px; margin: 12px 14px; border-radius: 8px; background: linear-gradient(90deg, var(--notif-bg) 0%, color-mix(in srgb, var(--notif-bg) 55%, var(--card-bg)) 50%, var(--notif-bg) 100%); background-size: 200% 100%; animation: gx-shimmer 1.2s linear infinite; }
@keyframes gx-shimmer { to { background-position: -200% 0; } }
.gx-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 34px 20px; border-radius: 18px; border: 1px dashed var(--border-color); color: var(--text-muted);
}
.gx-state > i { font-size: 1.6rem; color: var(--primary); }
.gx-state b { color: var(--text-main); font-size: 1rem; }
.gx-state[hidden], .gx-err[hidden] { display: none; }
.gx-err {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--border-color);
  color: var(--text-muted); font-size: .86rem;
}
.gx-endline { display: flex; align-items: center; gap: 12px; margin: 26px 0 6px; color: var(--text-muted); font-size: .8rem; font-weight: 600; }
.gx-endline::before, .gx-endline::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.gx-endline[hidden] { display: none; }
.gx-signin {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: 18px; margin-bottom: 28px;
  background: color-mix(in srgb, var(--primary) 7%, var(--card-bg)); border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--border-color));
}
.gx-signin > i { font-size: 1.5rem; color: var(--primary); }
.gx-signin div { flex: 1 1 220px; min-width: 0; }
.gx-signin b { display: block; color: var(--text-main); }
.gx-signin span { font-size: .84rem; color: var(--text-muted); }

/* ============================================================
   GROUP PAGE
   ============================================================ */
.gd-gone { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 12px; font-size: .84rem; line-height: 1.5; color: var(--text-muted); background: var(--card-bg); }
.gd-gone .bi { margin-top: 2px; font-size: 1rem; color: var(--text-main); }
.gd-back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: .82rem; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.gd-hero { display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; gap: 18px 22px; align-items: center; margin: 6px 0 22px; }
.gd-cover { width: 148px; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: var(--notif-bg); border: 1px solid var(--border-color); }
.gd-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gd-info { min-width: 0; }
.gd-title {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.18;
  margin: 2px 0 6px; color: var(--text-main); overflow-wrap: anywhere;
}
.gd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: .84rem; color: var(--text-muted); }
.gd-meta b { color: var(--text-main); font-variant-numeric: tabular-nums; }
.gd-meta .bi-star-fill { color: var(--writing-color); }
.gd-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.gd-actions .sx-btn { min-height: 44px; }
.gd-icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-muted); text-decoration: none;
  transition: color .15s, border-color .15s;
}

.gd-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.gd-main { min-width: 0; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--border-color); overflow: hidden; }
.gd-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: calc(var(--navbar-h, 56px) + 16px); }

/* Tabs: underline slides to the active one. */
.gd-tabs { position: relative; display: flex; border-bottom: 1px solid var(--border-color); padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.gd-tabs::-webkit-scrollbar { display: none; }
.gd-tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 50px; padding: 0 14px; flex-shrink: 0;
  border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  transition: color .15s;
}
.gd-tab[aria-selected="true"] { color: var(--text-main); }
.gd-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; border-radius: 10px; }
.gd-count { font-size: .74rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gd-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--bg-main); font-size: .7rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.gd-badge[hidden], .gd-online[hidden] { display: none; }
.gd-online { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--primary); }
.gd-online::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gd-ink { position: absolute; bottom: 0; left: 0; height: 2px; width: 0; background: var(--primary); border-radius: 2px; transition: transform .25s var(--sx-ease), width .25s var(--sx-ease); }
.gd-panel[hidden], #chat-section[hidden] { display: none; }
.gd-panel { padding: 16px; }
#chat-section { padding: 0; display: flex; flex-direction: column; height: clamp(460px, calc(100dvh - 190px), 780px); min-height: 0; }
#chat-section > .zc { flex: 1; height: auto; min-height: 0; border: 0; border-radius: 0; }

/* Side: the test and more groups */
.gd-box { border-radius: 18px; background: var(--card-bg); border: 1px solid var(--border-color); padding: 16px; }
.gd-box-title { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.gd-facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: .86rem; }
.gd-facts dt { color: var(--text-muted); font-weight: 600; }
.gd-facts dd { margin: 0; color: var(--text-main); font-weight: 700; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.gd-facts .gd-old { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.gd-desc { margin-top: 12px; font-size: .86rem; line-height: 1.55; color: var(--text-main); white-space: pre-line; overflow-wrap: anywhere; }
.gd-desc summary { cursor: pointer; font-weight: 700; color: var(--text-muted); list-style: none; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.gd-desc summary::-webkit-details-marker { display: none; }
.gd-desc summary i { transition: transform .2s var(--sx-ease); }
.gd-desc[open] summary i { transform: rotate(180deg); }
.gd-more { display: flex; flex-direction: column; gap: 10px; }
.gd-row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px; border-radius: 14px;
  color: var(--text-main); text-decoration: none; transition: background-color .15s;
}
.gd-row img { width: 64px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--notif-bg); }
.gd-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gd-row-title { font-size: .86rem; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-row-sub { font-size: .74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-row .gx-unread { position: static; }

/* Posts and reviews use the older `dg-`/`pm-` components below; only their
   size and touch rules change here. */
.gx-page .dg-post-card, .gx-page .dg-rv-card, .gx-page .dg-rv-write, .gx-page .dg-rv-summary { border-radius: 14px; }
.gx-page .post-action-btn { min-height: 36px; padding: 0 6px; }
.gx-page .comment-send-btn { width: 40px; height: 40px; }

@media (hover: hover) and (pointer: fine) {
  .gx-card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border-color)); box-shadow: var(--sx-shadow-hover); transform: translateY(-2px); }
  .gx-card:hover .gx-cover img { transform: scale(1.03); }
  .gx-chip:not(.on):hover { border-color: var(--primary); color: var(--primary); }
  .gd-back:hover { color: var(--primary); }
  .gd-icon-btn:hover { color: var(--primary); border-color: var(--primary); }
  .gd-tab:hover { color: var(--text-main); }
  .gd-row:hover { background: var(--notif-bg); }
}

@media (pointer: coarse) {
  .gx-page input, .gx-page textarea, .gx-page select { font-size: 16px !important; }
}

@media (max-width: 1080px) {
  .gd-body { grid-template-columns: minmax(0, 1fr); }
  .gd-side { position: static; }
}
@media (max-width: 720px) {
  .gd-hero { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .gd-cover { width: 96px; border-radius: 12px; }
  .gd-title { font-size: 1.22rem; }
  .gd-actions { grid-column: 1 / -1; justify-content: stretch; }
  .gd-actions .sx-btn { flex: 1 1 0; min-width: 0; justify-content: center; }
  .gd-actions .sx-btn-primary { flex-basis: 100%; }
  .gd-panel { padding: 12px; }
  .gd-main { border-radius: 16px; }
  /* On phones the chat is a compact card that opens full screen (zx-chat.css). */
  #chat-section { height: auto; }
  .gx-page .sh-shelf-row > .gx-card { width: 232px; }
  .gx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gx-grid .gx-body { padding: 10px 11px 12px; }
  .gx-grid .gx-title { font-size: .86rem; }
  .gx-grid .gx-by { display: none; }
  .gx-grid .gx-foot { gap: 8px; flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .gx-grid { grid-template-columns: minmax(0, 1fr); }
  .gx-grid .gx-by { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .gx-card, .gx-cover img, .gd-ink, .gd-desc summary i { transition: none; }
  .gx-card:active { transform: none; }
  .gx-skel .b { animation: none; }
}
