@layer imp-pages, imp-components, imp-base, base, components, pages;

/* Unlayered: keyframes, font faces and rules that interact with Font Awesome's
   runtime-injected CSS (which cannot be layered). */
@media (prefers-reduced-motion: no-preference) {
@view-transition {
    navigation: auto;
  }
@keyframes project-arrive {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to { opacity: 1; transform: none; }
  }
@keyframes project-panel-in { from { opacity: 0; filter: blur(12px); transform: scale(0.985); } }
@keyframes project-content-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
@keyframes project-depart {
    from { opacity: 1; filter: blur(0); transform: none; }
    to { opacity: 0; filter: blur(8px); transform: scale(0.99); }
  }
@keyframes project-return {
    from { opacity: 0; transform: translateY(-8px) scale(1.01); }
    to { opacity: 1; transform: none; }
  }
}

/* base: type selectors and pseudo-elements (lowest specificity) */
@layer base {
@media (prefers-reduced-motion: no-preference) {
::view-transition {
    background: var(--color-white, #fff);
  }
/* Keep the outgoing page underneath until the new page has arrived. */
::view-transition-old(root) {
    animation: none;
    mix-blend-mode: normal;
  }
/* The destination settles into place; the outgoing page stays put underneath. */
::view-transition-new(root) {
    animation-name: project-arrive;
    animation-duration: 300ms;
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
    mix-blend-mode: normal;
  }
}
}

/* components: class, attribute and pseudo-class selectors */
@layer components {
/* Project pages and the home opt in to the same navigation transition. */
html.project-overlay-open { overflow: hidden; scrollbar-gutter: stable; }

@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
html.project-overlay-open { scrollbar-gutter: stable both-edges; }
}

.project-overlay {
  position: fixed;
  inset: 0 auto 0 0;
  width: 100vw;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #faf9f7;
  overflow: hidden;
}

.project-overlay::backdrop { background: transparent; }

.project-overlay iframe { display: block; width: 100%; height: 100%; border: 0; }

.project-overlay iframe[hidden] { display: none; }

@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
.project-overlay { left: calc((100% - 100vw) / 2); }
}

@media (prefers-reduced-motion: no-preference) {
.project-overlay[open] { animation: project-panel-in 320ms cubic-bezier(0.23, 1, 0.32, 1); }
.project-overlay[open].is-closing { animation: project-depart 280ms ease both; }
html.project-entrance .project-gallery > .project-container:first-child > .flex-container-column > *,
html.project-entrance .project-gallery > .project-container:first-child > :not(.flex-container-column) {
    animation: project-content-in 450ms cubic-bezier(0.33, 1, 0.68, 1) backwards;
  }
html.project-entrance .project-gallery > .project-container:first-child > .flex-container-column > :nth-child(2) { animation-delay: 60ms; }
html.project-entrance .project-gallery > .project-container:first-child > .flex-container-column > :nth-child(3) { animation-delay: 105ms; }
html.project-entrance .project-gallery > .project-container:first-child > .flex-container-column > :nth-child(n+4),
html.project-entrance .project-gallery > .project-container:first-child > :not(.flex-container-column) { animation-delay: 135ms; }
html:has(body.home-page)::view-transition-new(root) {
    animation-name: project-return;
  }
}

/* Loading feedback while a project page is fetched in the overlay. */
a.project-link[aria-busy="true"] { cursor: progress; opacity: 0.7; transition: opacity 150ms ease-out; }
}
