/**
 * Forovanta Community Software
 * Copyright (c) 2026 Zovanta Software Co. <sales@zovanta.dev> - https://zovanta.dev
 * Licensed under the Forovanta Free License Agreement. See LICENSE for details.
 *
 * Groups add-on stylesheet.
 *
 * Loaded only while the add-on is enabled, and only ever against the classes the add-on's own
 * `pages.php` emits — every selector starts with `.cg-`, so a group directory cannot restyle the
 * board around it. The tokens it reads are the board's own (`--surface`, `--border`, `--text`,
 * `--muted`, `--accent`, `--radius`), so a group follows the theme it is installed into.
 *
 * A group's own colour arrives as `--cg-colour`, set inline from the group's row, and is used in
 * exactly two places — the band across a card and the hero behind a group's name — so a board can
 * tell its groups apart without the directory turning into a paint chart.
 */

.cg-shell {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.cg-shell--rail {
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
}

.cg-main {
  min-width: 0;
}

/* ------------------------------------------------------------------ headings */

.cg-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.cg-head h1 {
  margin: 0.15rem 0 0;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.cg-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cg-blurb {
  margin: 0.35rem 0 0;
  max-width: 46rem;
  color: var(--muted);
}

.cg-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.cg-section {
  margin-bottom: 1.75rem;
}

.cg-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

/* ------------------------------------------------------------------- buttons */

.cg-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 4px);
  background: var(--accent);
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.cg-button:hover {
  filter: brightness(1.08);
}

.cg-button--quiet {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.cg-button--danger {
  border-color: color-mix(in srgb, #ef4444 45%, transparent);
  background: transparent;
  color: #ef4444;
}

.cg-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.cg-link--danger {
  color: #ef4444;
}

.cg-chip {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.cg-chip--quiet {
  margin-right: 0.4rem;
}

.cg-badge {
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.cg-badge--open {
  background: color-mix(in srgb, #10b981 22%, transparent);
  color: #059669;
}

.cg-badge--closed {
  background: color-mix(in srgb, #f59e0b 24%, transparent);
  color: #b45309;
}

.cg-badge--private {
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  color: var(--muted);
}

/* --------------------------------------------------------------------- cards */

.cg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.9rem;
}

.cg-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.cg-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.cg-card__band {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 6.5rem;
  background: linear-gradient(135deg, var(--cg-colour, #4f5ee8), color-mix(in srgb, var(--cg-colour, #4f5ee8) 45%, #000));
}

.cg-card__band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cg-card__letter {
  font-size: 2rem;
  font-weight: 700;
  color: rgb(255 255 255 / 0.85);
}

.cg-card__body {
  display: block;
  padding: 0.75rem 0.85rem 0.9rem;
}

.cg-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cg-card__name {
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cg-card__tagline {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.cg-card__meta {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.cg-card__note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--muted);
}

/* ------------------------------------------------------------------ the hero */

.cg-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cg-colour, #4f5ee8) 14%, var(--surface));
  padding: 1.4rem 1.5rem;
  margin-bottom: 1rem;
}

.cg-hero__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
}

.cg-hero__body {
  position: relative;
}

.cg-hero h1 {
  margin: 0.2rem 0 0;
  font-size: 1.75rem;
  line-height: 1.15;
}

.cg-hero__meta {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.cg-hero__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ------------------------------------------------------------------- tabs */

.cg-tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.cg-tab {
  border-bottom: 2px solid transparent;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.cg-tab:hover {
  color: var(--text);
}

.cg-tab--on {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* ------------------------------------------------------------------ panels */

.cg-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.cg-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.cg-rail .cg-panel {
  padding: 0.9rem 1rem;
}

.cg-cats {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cg-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: calc(var(--radius) - 6px);
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
}

.cg-cat:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.cg-cat--on {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  font-weight: 600;
}

.cg-cat__count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.cg-facts {
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
}

.cg-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
}

.cg-facts > div:last-child {
  border-bottom: 0;
}

.cg-facts dt {
  color: var(--muted);
}

.cg-facts dd {
  margin: 0;
  text-align: right;
}

/* --------------------------------------------------------------- discussions */

.cg-topics {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cg-topics > li + li {
  border-top: 1px solid var(--border);
}

.cg-topic {
  display: block;
  padding: 0.6rem 0;
  color: inherit;
  text-decoration: none;
}

.cg-topic:hover .cg-topic__title {
  color: var(--accent);
}

.cg-topic__title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.cg-topic__meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.cg-pin {
  display: inline-block;
  margin-right: 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 0.05rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  vertical-align: 1px;
}

/* -------------------------------------------------------------------- posts */

.cg-crumbs {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.cg-crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.cg-crumbs a:hover {
  color: var(--text);
}

.cg-topic-head {
  margin-bottom: 1.25rem;
}

.cg-topic-head h1 {
  margin: 0.2rem 0 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.cg-posts {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.cg-post {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.15rem;
  margin-bottom: 0.75rem;
}

.cg-post__side {
  font-size: 0.85rem;
}

.cg-post__side .cg-person__name {
  display: block;
  font-weight: 600;
}

.cg-post__body {
  min-width: 0;
}

.cg-post__when {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.cg-prose {
  font-size: 0.9rem;
  line-height: 1.6;
}

.cg-prose p:first-child {
  margin-top: 0;
}

.cg-prose p:last-child {
  margin-bottom: 0;
}

.cg-inline-form {
  display: inline-block;
  margin-top: 0.5rem;
}

/* ------------------------------------------------------------------- people */

.cg-people,
.cg-requests {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cg-people > li,
.cg-requests > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.cg-people > li:last-child,
.cg-requests > li:last-child {
  border-bottom: 0;
}

.cg-person {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cg-person img,
.cg-person__initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 0.8rem;
  font-weight: 600;
  object-fit: cover;
}

.cg-person__name {
  font-size: 0.875rem;
  font-weight: 600;
}

.cg-person__role {
  font-size: 0.75rem;
  color: var(--muted);
}

.cg-requests form,
.cg-people form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* -------------------------------------------------------------------- forms */

.cg-form {
  display: grid;
  gap: 0.9rem;
}

.cg-form--wide {
  max-width: 44rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem 1.35rem;
}

.cg-form label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.cg-field {
  min-width: 0;
}

.cg-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem;
}

.cg-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
  background: var(--surface);
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
}

.cg-input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}

.cg-input--colour {
  height: 2.4rem;
  padding: 0.2rem;
}

.cg-alert {
  border: 1px solid color-mix(in srgb, #ef4444 45%, transparent);
  border-radius: calc(var(--radius) - 4px);
  background: color-mix(in srgb, #ef4444 10%, transparent);
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.cg-danger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ------------------------------------------------------------------- empty */

.cg-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.25rem;
  text-align: center;
}

.cg-empty h1,
.cg-empty h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.cg-empty p {
  margin: 0 0 1rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------ paging */

.cg-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.25rem;
}

.cg-page {
  min-width: 2rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text);
  text-decoration: none;
}

.cg-page--on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 60rem) {
  .cg-shell--rail {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 44rem) {
  .cg-post {
    grid-template-columns: minmax(0, 1fr);
  }

  .cg-cards {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }
}
