/*
 * A group's own page (groups/show): a banner in the app's colour with the
 * group's icon, name and facts, its description below on paper; the people
 * as a list (the contact rows of friends.css) and, beside them, the invites
 * waiting, the secret friend (an extra) and the members' news. Also the
 * group icons (group_icons/_<key>) wherever they show, and their picker in
 * the group form.
 */
.app {
  /* The icon on its tile. Colours: .mark main, .light softer, .gold the
     ribbon colour, .cut and .line cut out in the tile's colour. */
  .group-emblem { --tile: var(--accent); --mark: var(--paper); flex: none; width: 88px; height: 88px; border-radius: 24px; display: inline-grid; place-items: center;
    background: var(--tile); box-shadow: 0 14px 26px -18px var(--accent); }
  .group-emblem .group-icon { width: 64%; height: 64%; }
  .group-emblem.small { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; vertical-align: -7px; margin-right: 10px; }
  .group-icon .mark { fill: var(--mark); }
  .group-icon .light { fill: color-mix(in srgb, var(--mark) 62%, var(--tile)); }
  .group-icon .gold { fill: var(--ribbon); }
  .group-icon .cut { fill: var(--tile); }
  .group-icon .line { fill: none; stroke: var(--tile); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

  /* The banner and the description */
  .group-cover .crumb { margin-bottom: 12px; }
  .cover-strip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px 22px; align-items: center; padding: 26px;
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
    background: color-mix(in srgb, var(--accent) 12%, var(--paper)); }
  .group-cover.no-description .cover-strip { border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: var(--radius); }
  .cover-title { min-width: 0; }
  .cover-title h1 { font-size: clamp(30px, 4vw, 44px); overflow-wrap: anywhere; }
  .facts-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
  .facts-row .faces { display: inline-flex; }
  .facts-row .faces .avatar { margin-right: -8px; box-shadow: 0 0 0 2px var(--paper); }
  .cover-actions { flex-wrap: nowrap; }
  .cover-description { padding: 18px 26px 20px; background: var(--paper); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
  .cover-description p { max-width: 68ch; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
  .cover-description .add-description { font-weight: 700; font-size: 14px; }
  .group-cover + .people-below { margin-top: 22px; }

  /* The people: friends.css's contact rows, with one detail column */
  .group-people .contact { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1.4fr) auto; }
  .group-people .who { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-width: 0; }
  .group-people .who .name { font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
  .mini-chip { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--soft-bg); color: var(--muted); }
  .group-people .state { font-size: 13px; font-weight: 700; color: var(--muted); }
  .group-people .btn-row { justify-content: flex-end; flex-wrap: nowrap; }

  /* Beside them */
  .group-side { display: grid; gap: 14px; }
  .pending-invites ul.people li { display: grid; grid-template-columns: 36px minmax(0, 1fr); }
  .pending-invites .name { display: grid; min-width: 0; }
  .pending-invites .btn-row { grid-column: 2; }
  .secret-friend h3 { font-size: 20px; }
  .secret-friend h3 a { color: var(--ink); }
  .secret-friend .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .secret-friend .stage { padding: 8px; }
  .secret-friend .stage b { font-size: 13px; }
  .past-draws ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
  .secret-friend-offer { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: var(--radius); border: 1.5px dashed var(--line); }
  .secret-friend-offer p { font-size: 14px; color: var(--muted); }
  .activity { list-style: none; margin: 0; padding: 0; display: grid; }
  .activity li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
  .activity li:first-child { border-top: 0; padding-top: 0; }
  .activity small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

  /* The icon picker in the group form: radio tiles */
  .icon-choices { border: 0; padding: 0; margin: 0; }
  .icon-choices legend { font-weight: 700; margin-bottom: 6px; }
  .icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .icon-choice { --tile: var(--soft-bg); --mark: var(--accent); position: relative; display: grid; gap: 4px; justify-items: center; padding: 10px 4px 8px; border-radius: var(--radius-sm);
    background: var(--tile); border: 1.5px solid transparent; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
  .icon-choice input { position: absolute; opacity: 0; pointer-events: none; }
  .icon-choice .group-icon { width: 40px; height: 40px; }
  .icon-choice:has(input:checked) { --tile: color-mix(in srgb, var(--accent) 10%, var(--paper)); border-color: var(--accent); color: var(--ink); }
  .icon-choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

  /* Settings: deleting, inside the form's fields; leaving */
  .danger-zone { display: grid; gap: 8px; justify-items: start; padding: 14px; border-radius: var(--radius-sm); border: 1.5px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
  .danger-zone .danger-title { color: var(--danger); }
}

@media (max-width: 900px) {
  /* Unlike Friends' tabs, the people come first here, the side after them */
  .app .group-side { order: 0; }
}

@media (max-width: 700px) {
  .app {
    .cover-strip { grid-template-columns: auto minmax(0, 1fr); padding: 18px 16px; }
    .cover-actions { grid-column: 1 / -1; }
    .group-emblem:not(.small) { width: 64px; height: 64px; border-radius: 18px; }
    .cover-description { padding: 14px 16px 16px; }
  }
}

@media (max-width: 600px) {
  .app {
    .group-people .contact { grid-template-columns: 40px minmax(0, 1fr); }
    .group-people .contact .detail { grid-column: 2; display: block; }
    .group-people .btn-row { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  }
}
