/**
 * Projektkarte (Übersicht „Projekte“): Kopf, Aufgabenfortschritt, Entwicklungsstand, Link-Pillen,
 * Mitglieder. Der Titel ist der Hauptlink; weitere Links stehen eigenständig in der Karte.
 * Farbe nur als Signal (überfällig, Abruf fehlgeschlagen). Dazu „Karten anpassen“.
 */
@layer components {
  .card-grid--projects {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    align-items: start;
  }

  .project-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    min-inline-size: 0;
    padding: var(--theme-card-padding);
    border: var(--border-width-thin) solid var(--theme-card-border);
    border-radius: var(--theme-card-radius);
    background-color: var(--theme-card-bg);
  }

  .project-card__heading {
    min-inline-size: 0;
  }

  .project-card__heading .card__title {
    overflow-wrap: anywhere;
  }

  .project-card__description {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--theme-meta-color);
    font-size: var(--font-size-small);
    line-height: var(--line-height-small);
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .project-card--archived {
    gap: 0;
    padding: var(--space-3) var(--space-4);
    color: var(--theme-meta-color);
  }

  .project-card--archived .card__title {
    color: var(--theme-meta-color);
  }

  .project-card__block {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .project-card__figure {
    margin: 0;
    font-size: var(--font-size-label);
  }

  .project-card__figure--quiet {
    color: var(--theme-meta-color);
    font-size: var(--font-size-small);
  }

  .project-card__due {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 0;
  }

  .project-card__overdue {
    color: var(--theme-badge-overdue-text);
    font-weight: var(--font-weight-medium);
  }

  .progress {
    --progress-fill: var(--progress-fill-0);
    --progress-track: var(--border-default);
    inline-size: 100%;
    block-size: 0.375rem;
    border: 0;
    border-radius: var(--radius-sm);
    background-color: var(--progress-track);
    color: var(--progress-fill);
    appearance: none;
    overflow: hidden;
  }

  .progress--level-0 {
    --progress-fill: var(--progress-fill-0);
  }

  .progress--level-1 {
    --progress-fill: var(--progress-fill-1);
  }

  .progress--level-2 {
    --progress-fill: var(--progress-fill-2);
  }

  .progress--level-3 {
    --progress-fill: var(--progress-fill-3);
  }

  .progress--level-4 {
    --progress-fill: var(--progress-fill-4);
  }

  .progress::-webkit-progress-bar {
    background-color: var(--progress-track);
  }

  .progress::-webkit-progress-value {
    background-color: var(--progress-fill);
    border-radius: var(--radius-sm);
  }

  .progress::-moz-progress-bar {
    background-color: var(--progress-fill);
    border-radius: var(--radius-sm);
  }

  .project-card__dev {
    padding-block-start: var(--space-4);
    border-block-start: var(--border-width-thin) solid var(--theme-card-border);
  }

  .project-card__dev-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--theme-meta-color);
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
  }

  .project-card__epics {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-small);
  }

  .project-card__epic {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    color: var(--theme-meta-color);
  }

  .project-card__epic-name {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-card__repo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    margin: 0;
  }

  .project-card__stamp {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: 0;
  }

  .project-card__stamp:empty {
    display: none;
  }

  .project-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 0;
    font-size: var(--font-size-small);
  }

  .project-card__action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-block-size: 1.5rem;
  }

  .project-card__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .project-card__links > li {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  .pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-inline-size: 100%;
    min-block-size: 1.75rem;
    padding: 0.125rem var(--space-3);
    border: var(--border-width-thin) solid var(--border-default);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-small);
    text-decoration: none;
    transition:
      background-color var(--motion-duration-ui) var(--motion-ease),
      border-color var(--motion-duration-ui) var(--motion-ease),
      transform var(--press-duration, var(--motion-duration-ui)) var(--motion-ease);
  }

  @media (prefers-reduced-motion: no-preference) {
    .pill:active {
      --press-duration: var(--motion-duration-press);
      transform: scale(0.97);
    }
  }

  @media (hover: hover) and (pointer: fine) {
    .pill:hover {
      border-color: var(--border-strong);
      background-color: var(--surface-hover);
    }
  }

  .pill > span:not(.u-visually-hidden) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pill {
    min-inline-size: 0;
  }

  .pill__label {
    flex-shrink: 0;
    max-inline-size: 100%;
  }

  .pill__host {
    flex-shrink: 1;
  }

  .pill__host {
    min-inline-size: 0;
    color: var(--theme-meta-color);
    font-size: var(--font-size-caption);
  }

  .project-card__members {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
  }

  .project-card__avatars {
    display: inline-flex;
    gap: var(--space-1);
  }

  .card-grid--quiet {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    gap: var(--space-3);
  }

  .section-title--quiet {
    color: var(--theme-meta-color);
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
  }

  .card-prefs {
    display: grid;
    gap: var(--space-3);
    justify-items: start;
  }

  .card-prefs__toggle {
    list-style: none;
    cursor: pointer;
  }

  .card-prefs__toggle::-webkit-details-marker {
    display: none;
  }

  .card-prefs[open] > .card-prefs__toggle {
    background-color: var(--theme-btn-secondary-bg-hover);
  }

  .card-prefs__panel {
    inline-size: min(100%, 26rem);
  }

  .card-prefs__fields {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    border: 0;
  }

  .card-prefs__legend {
    margin-block-end: var(--space-2);
    padding: 0;
    font-size: var(--font-size-label);
    font-weight: var(--font-weight-medium);
  }

  .card-prefs__option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-block-size: 2rem;
  }

  .card-prefs__option input {
    inline-size: 1rem;
    block-size: 1rem;
    accent-color: var(--theme-heading-color);
  }

  @media (max-width: 48.75em) {
    .card-prefs__option {
      min-block-size: 2.75rem;
    }

    .project-card__action,
    .pill {
      min-block-size: 2.75rem;
    }

    .card-prefs__toggle {
      min-block-size: 2.75rem;
    }
  }
}
