/* Each card owns its height, including its disclosure. */
.projects__grid { align-items: start; grid-auto-rows: auto; }

/* Hidden wheel choices must never set the visible card's height. */
.projects[data-view='wheel'] .project-card { grid-area: 1 / 1; }
.projects[data-view='wheel'] .project-card[hidden] { display: none !important; }

.project-card__details { margin-top: 0; border-top: 0; }
.project-card__details summary { min-height: 52px; }
.project-card__details summary h3 { margin: 0; }
.project-card__details summary::after { transition: transform 200ms ease; }
.project-card__content > .project-card__links { margin-top: .5rem; gap: .25rem 1rem; align-content: start; }

/* Keep the closed cards aligned while each disclosure remains independent. */
@media (min-width: 701px) {
  .project-card__type { min-height: 3.3em; }
  .project-card__details summary { min-height: 58px; }
  .projects:not([data-view='wheel']) .project-card__content > .project-card__links { min-height: 100px; }
  .projects:not([data-view='wheel']) .project-card__tech { container-type: inline-size; }
  .projects:not([data-view='wheel']) .project-card__tech-list {
    --tech-row: minmax(3.125rem, auto);
    grid-template-rows: repeat(3, var(--tech-row));
  }
  /* Four columns fit at 4 × 4.25rem plus the three gaps. */
  @container (min-width: 18.3125rem) {
    .projects:not([data-view='wheel']) .project-card__tech-list {
      grid-template-rows: repeat(2, var(--tech-row));
    }
  }
}

@media (max-width: 700px) {
  .project-card__content { padding: clamp(1rem, 5vw, 1.5rem); }
  .project-card__links a { font-size: .875rem; }
  .project-card__tech { padding-top: .875rem; }
}

.project-card--interactive:has(.project-card__details[open]) {
  border-color: var(--accent);
}
.project-card__reveal { min-height: 0; overflow: hidden; }
.project-card__notes { padding-top: 12px; }
.project-card__notes > p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

@media (prefers-reduced-motion: no-preference) {
  /* Only the chosen artwork travels. Other controls stay live at their new positions. */
  :root.project-cover-transition { view-transition-name: none; }
  .project-cover-transition .projects[data-view='cards'] [data-selected='true'] .project-card__visual,
  .project-cover-transition .projects[data-view='wheel'] .project-wheel__segment[aria-pressed='true'] {
    view-transition-name: project-cover;
  }
  .project-cover-transition .project-wheel__segment { border-radius: 50%; }
  :root.project-cover-transition::view-transition { pointer-events: none; }
  ::view-transition-group(project-cover) {
    animation-duration: 360ms;
    animation-timing-function: cubic-bezier(.2, .75, .2, 1);
  }
  .project-card--interactive { transition: border-color 240ms ease; }
  .project-card--interactive .project-card__visual img { transition: transform 420ms ease; }
  .project-card--interactive:has(.project-card__details[open]) .project-card__visual img {
    transform: scale(1.025);
  }
  @supports selector(details::details-content) and (transition-behavior: allow-discrete) {
    .project-card--interactive .project-card__details::details-content {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 320ms ease, content-visibility 320ms allow-discrete;
    }
    .project-card--interactive .project-card__details[open]::details-content {
      grid-template-rows: 1fr;
    }
    .project-card__details:has(:focus-visible)::details-content { transition: none; }
  }
}
