:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #182b31;
  --blue: #3449d8;
  --muted: #526166;
  --line: #d9ded8;
  --sans: "DM Sans", Arial, sans-serif;
  --display: Manrope, var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--sans); }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
.wrap { width: min(100% - 64px, 1120px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.collection { padding-block: 48px 58px; }
.collection-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 16px; }
.collection-header h1 { font: 800 clamp(2rem, 4.2vw, 3.35rem)/1.1 var(--display); letter-spacing: -.055em; }
#project-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.contact-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .875rem; }
.website-link { padding: 7px 12px; border: 1px solid var(--blue); border-radius: 5px; color: var(--blue); font-weight: 700; }
.website-link:hover { background: var(--blue); color: #fff; }
.email-link { color: var(--muted); }
.email-link:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.filters { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-block: 15px 23px; border-bottom: 1px solid var(--line); }
.filters button { padding: 10px 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: .9rem; }
.filters button:hover, .filters button[aria-pressed="true"] { color: var(--blue); }
.filters button[aria-pressed="true"] { border-bottom-color: var(--blue); }
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 22px 0 0; padding: 0; gap: 27px 18px; }
.project-link { display: block; }
.thumbnail {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1.7;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e7eee6;
}
.preview-label { display: none; }
.thumbnail img { display: block; width: 101.3%; height: 100%; object-fit: cover; object-position: top center; }
.project-info { padding-top: 7px; }
.project-info h2 { font: 700 .95rem/1.35 var(--sans); }
.project-link:hover h2 { color: var(--blue); }
.footer { display: flex; justify-content: flex-end; padding-block: 16px 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.footer a:hover { color: var(--blue); }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 36px); }
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 510px) {
  .collection { padding-block: 29px 40px; }
  .filters { column-gap: 13px; }
  .projects { gap: 19px 11px; }
  .project-info h2 { font-size: .84rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .projects:not(.has-filtered) .project {
    animation: project-enter 510ms cubic-bezier(.2, .72, .22, 1) backwards;
    animation-delay: var(--entrance-delay, 0ms);
  }
  .project:nth-child(3n + 2) { --entrance-delay: 60ms; }
  .project:nth-child(3n + 3) { --entrance-delay: 120ms; }
  .thumbnail img { transition: transform 650ms cubic-bezier(.17, .78, .22, 1); }
  .filters button { transition: color 170ms ease, border-color 170ms ease; }
  .preview-label { transition: clip-path 350ms cubic-bezier(.2, .72, .22, 1); }
  .project-info h2 { transition: color 180ms ease; }

  @keyframes project-enter {
    from { opacity: 0; transform: translateY(19px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@supports (view-transition-name: match-element) {
  @media (prefers-reduced-motion: no-preference) {
    :root { view-transition-name: none; }
    .project { view-transition-name: match-element; }
    ::view-transition { pointer-events: none; }
    ::view-transition-group(*) {
      animation-duration: 260ms;
      animation-timing-function: cubic-bezier(.22, .8, .25, 1);
    }
    ::view-transition-old(*):only-child { animation-duration: 150ms; }
  }
}

/* Keep the action visible for keyboard users and reveal it on pointer hover. */
.project-link:focus-visible .preview-label {
  display: block;
  clip-path: inset(0);
}
.preview-label {
  position: absolute;
  inset: auto 0 0;
  padding: 12px 14px;
  background: var(--blue);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  .preview-label {
    display: block;
    clip-path: inset(100% 0 0);
  }
  .project-link:is(:hover, :focus-visible) .preview-label { clip-path: inset(0); }
  .project-link:is(:hover, :focus-visible) h2 { color: var(--blue); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .project-link:is(:hover, :focus-visible) img { transform: scale(1.13); }
}
