/* projects.css: styles for the projects section only. Use tokens from base.css; prefix every class with .projects-. See work/DESIGN.md.

   Format: a compact showcase of side projects. Each project's live site is
   shown as a screen in a small browser window: a hunter title bar (three dots
   in the page's own poppy, chartreuse and paper, then the web address) over
   a 16:10 screenshot, keylined in hunter. The window frame pulls three very
   different brand palettes into the page's colours. Name (the link) and one
   or two lines sit beneath.
   phone:  one column, window then text.
   md:     one project per row: window on the left half of main, text beside it.
   lg:     three across the main column, three page columns each. */

.projects-list {
  row-gap: var(--space-xl);
  align-items: start;
}

.projects-item {
  position: relative; /* the name's link stretches over the whole item */
  grid-column: main;
}

/* The window */
.projects-item__screen {
  border: 1px solid var(--color-hunter);
  border-radius: var(--radius-s);
  overflow: hidden;
  background-color: var(--color-hunter);
  transition: border-color var(--duration-fast) ease;
}
.projects-item__bar {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: 0.4rem 0.7rem 0.45rem;
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--color-paper); /* 6.7:1 on hunter */
}
/* Three small dots in the page's palette, drawn by one element and its two pseudo-elements. */
.projects-item__dots {
  position: relative;
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 1.2rem;
  border-radius: 50%;
  background-color: var(--color-poppy);
}
.projects-item__dots::before,
.projects-item__dots::after {
  content: "";
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.projects-item__dots::before { left: 0.65rem; background-color: var(--color-chartreuse); }
.projects-item__dots::after { left: 1.3rem; background-color: var(--color-paper); }

.projects-item__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: 50% 0; /* the top of the page */
  background-color: var(--surface);
}

/* Name and description */
.projects-item__name { margin-top: var(--space-m); }
.projects-item__link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--duration-fast) ease;
}
.projects-item__link svg {
  width: 0.6em;
  height: 0.6em;
  flex: none;
  color: var(--mark);
  transition: transform var(--duration) var(--ease-out);
}
/* The whole item is the link's hit area. */
.projects-item__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.projects-item:hover .projects-item__link { text-decoration-color: var(--link-underline); }
.projects-item:hover .projects-item__link svg { transform: translate(2px, -2px); }
.projects-item:hover .projects-item__screen { border-color: var(--color-hunter-deep); }

/* Focus ring around the whole item where :has() is supported; otherwise the link keeps its own. */
@supports selector(:has(*)) {
  .projects-item__link:focus-visible { outline: none; }
  .projects-item:has(.projects-item__link:focus-visible) {
    outline: 2px solid var(--focus);
    outline-offset: var(--space-2xs);
    border-radius: var(--radius-s);
  }
}

.projects-item__desc {
  margin-top: var(--space-2xs);
  max-width: var(--measure);
  color: var(--text-muted);
}

/* Tablets: one project per row, window and text side by side. */
@media (min-width: 48em) {
  .projects-item {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--grid-gap);
    align-content: start;
  }
  .projects-item__screen { grid-column: 1; grid-row: 1 / span 3; }
  .projects-item__name,
  .projects-item__desc { grid-column: 2; }
  .projects-item__name { margin-top: 0; }
}

/* Desktops: three across the main column. */
@media (min-width: 64em) {
  .projects-item { display: block; }
  .projects-item:nth-child(3n + 1) { grid-column: 4 / 7; }
  .projects-item:nth-child(3n + 2) { grid-column: 7 / 10; }
  .projects-item:nth-child(3n + 3) { grid-column: 10 / 13; }
  .projects-item__name { margin-top: var(--space-m); }
}
