/*
 * KeyResultObjectiveCardComponent: a compact card for one key result that is
 * itself an objective, on the page of the objective it is a key result of,
 * in an ol.key-result-objective-card-list.
 */
@layer components {
  .key-result-objective-card-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    list-style: none;
    padding: 0;

    & > li {
      max-inline-size: none;
    }

    & > li + li {
      margin-block-start: 0;
    }
  }

  .key-result-objective-card {
    display: grid;
    align-content: start;
    gap: var(--space-3);
    block-size: 100%;
    padding: var(--space-4) var(--space-5);
    border: var(--border);
    border-radius: var(--radius-m);
    background: var(--color-paper);

    & > * {
      margin: 0;
      max-inline-size: none;
    }
  }

  .key-result-objective-card__title {
    font: var(--text-body-strong);
  }

  /* The target ahead of the wording (2026-11-12). */
  .key-result-objective-card__target {
    font: var(--text-title);
    font-variant-numeric: tabular-nums;
    margin-inline-end: var(--space-1);
  }

  .key-result-objective-card__open {
    color: var(--color-ink);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
      text-underline-offset: 0.2em;
    }
  }

  .key-result-objective-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    font: var(--text-small);
    color: var(--color-muted);
  }

  .key-result-objective-card__progress {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font: var(--text-body-strong);
    white-space: nowrap;
  }

  .key-result-objective-card__empty {
    font: var(--text-small);
    color: var(--color-muted);
  }

  /* Archived: faded, still opens its page. */
  .key-result-objective-card--archived {
    background: var(--color-surface-2);

    & > :not(.key-result-objective-card__title) {
      opacity: 0.6;
    }

    & .key-result-objective-card__open {
      color: var(--color-muted);
    }
  }

  /* Completed (015): the positive surface and a positive start rule. */
  .key-result-objective-card--completed {
    border-inline-start: var(--space-1) solid var(--color-positive);
    background: var(--color-positive-surface);
  }
}
