/* /projects — the practice catalog as a typographic document: one section per
   profession, quiet list rows, a monochrome difficulty ladder instead of the
   old traffic-light pills. The profession axis is a native <select> (scales to
   any number of paths, real picker on mobile); difficulty + "saved" stay as
   chips. Server-rendered GET, the select auto-submits. */

.projects__stats {
  color: var(--color-subtle-dark);
  font-size: 0.9rem;
  margin-block: 0.75rem 0;
}

.project-filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  justify-content: center;
  margin-block-start: 2.5rem;
}

.project-filters__paths,
.project-filters__group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--block-space-half);
  justify-content: center;
}

.project-filters__paths {
  flex-wrap: nowrap;
}

/* The axes after the first get a hairline divider on wide screens so each reads as a separate control. */
@media (min-width: 640px) {
  .project-filters__paths + .project-filters__group,
  .project-filters__group + .project-filters__group {
    border-inline-start: 1px solid var(--color-subtle);
    padding-inline-start: 1.75rem;
  }
}

/* Profession picker — a pill matching the chip row, but with the native dropdown arrow (themed via color-scheme: dark) as its "more options" affordance. */
.filter-select {
  background-color: var(--color-subtle-light);
  border: 1px solid var(--color-subtle);
  border-radius: 2em;
  color: var(--color-ink);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  max-inline-size: 100%;
  padding: 0.4em 0.9em;
  transition: border-color 150ms ease, background-color 150ms ease;

  @media (any-hover: hover) {
    &:hover {
      border-color: var(--color-subtle-dark);
    }
  }
}

.filter-select option {
  background-color: var(--color-bg);
  color: var(--color-ink);
}

.filter-chip {
  align-items: center;
  border: 1px solid var(--color-subtle);
  border-radius: 2em;
  color: var(--color-subtle-dark);
  display: inline-flex;
  font-size: 0.85rem;
  gap: 0.45em;
  padding: 0.35em 1em;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;

  @media (any-hover: hover) {
    &:hover {
      border-color: var(--color-subtle-dark);
      color: var(--color-ink);
    }
  }
}

/* Selected filter — filled ink, same state language as the course sidebar's current row. */
.filter-chip[aria-current] {
  background-color: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-bg);
  font-weight: 600;
}

.filter-chip--saved .icon {
  block-size: 1em;
  inline-size: 1em;
}

.project-filters__count {
  color: var(--color-subtle-dark);
  flex-basis: 100%;
  font-size: 0.85rem;
  margin-block: 0;
  text-align: center;
}

/* ── Difficulty swatches (filter chips + list rows only) ───────────── */
/* Ski-trail convention: green / yellow / red, category colours from the same
   OKLCH primitives as the resource badges. Green is the var fallback. The
   tiles themselves stay colour-free — the chips carry the level. */
.difficulty-mark--intermediate {
  --difficulty-color: oklch(var(--lch-yellow));
}

.difficulty-mark--advanced {
  --difficulty-color: oklch(var(--lch-red));
}

.difficulty-mark {
  background-color: var(--difficulty-color, oklch(var(--lch-green)));
  block-size: 0.5rem;
  border-radius: 1px;
  display: inline-block;
  flex-shrink: 0;
  inline-size: 0.5rem;
}

/* ── Project groups ──────────────────────────────────────────────── */
.project-groups {
  display: grid;
  gap: 2.75rem;
  margin-block-start: 2.5rem;
}

.project-group__heading {
  align-items: baseline;
  border-block-end: 1px solid var(--color-subtle);
  display: flex;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.07em;
  margin-block: 0;
  padding-block-end: 0.6rem;
  text-transform: uppercase;
}

/* Ledger-style set counter — plain body type, not display caps; green fires only when the set closes. */
.project-group__count {
  color: var(--color-subtle-dark);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.project-group__count--complete {
  color: var(--color-positive);
}

.project-group__link {
  color: var(--color-ink);
  text-decoration: none;

  @media (any-hover: hover) {
    &:hover {
      color: var(--color-link);
    }
  }
}

/* Compact tiles: ladder + title, no description — the WHY lives on the lesson page; the catalog stays a scannable board. */
.project-tiles {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  list-style: none;
  margin: var(--block-space) 0 0;
  padding: 0;
}

/* The tile is one big <a>; the bookmark button is its SIBLING (a button can't live inside a link), absolutely positioned over the top-right corner. */
.project-tile-wrap {
  display: flex; /* the inner tile stretches to the grid row height */
  position: relative;
}

.project-tile {
  --panel-border-radius: 3px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: center;   /* rows read symmetric */
  min-block-size: 5.25rem;   /* short titles get the same card as two-liners */
  padding: 1.1em 1.2em;
}

.project-tile__title {
  color: var(--color-ink);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  /* stay clear of the corner bookmark */
  padding-inline-end: 1.4rem;
  text-wrap: balance;
}

/* Done tasks go dark («мёртвое тише живого») — no badge; the card itself reads
   as extinguished. Hover wakes it back up for review. */
.project-tile--done {
  --panel-background: transparent;
  --panel-border-color: oklch(var(--lch-gray) / 0.45);
}

.project-tile--done .project-tile__title {
  color: var(--color-disabled);
}

@media (any-hover: hover) {
  .project-tile--done:hover {
    --panel-background: var(--color-subtle-light);
  }

  .project-tile--done:hover .project-tile__title {
    color: var(--color-ink);
  }
}

.project-tile-wrap .bookmark-toggle {
  inset-block-start: 0.9em;
  inset-inline-end: 1em;
  position: absolute;
}

/* Tile corner: icon only — the label would collide with the title. */
.project-tile-wrap .bookmark-btn__label {
  display: none;
}

/* Corner bookmark: smaller than in lists — a quiet utility, not card content. */
.project-tile-wrap .bookmark-btn .icon {
  block-size: 0.95rem;
  inline-size: 0.95rem;
}
