.project-gallery#projects {
  --ink: var(--qr-royal);
  --secondary: color-mix(in srgb, var(--ink) 78%, white);
  --gallery-gutter: max(4.8vw, env(safe-area-inset-right), env(safe-area-inset-left));
  color-scheme: light;
  color: var(--ink);
  position: relative;
  z-index: 2;
  overflow-x: clip;
  padding: clamp(44px, 6vw, 90px) var(--gallery-gutter) max(34px, 5vw, env(safe-area-inset-bottom));
  background: linear-gradient(#fff, #f4f6f9 min(60vh, 32rem), #f4f6f9);
}
.project-gallery#projects[inert] { pointer-events: none; visibility: hidden; }
.project-gallery-inner { width: min(100%, 1470px); margin-inline: auto; }
.gallery-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 clamp(36px, 4.5vw, 72px);
}
.gallery-heading h2 {
  margin: 0;
  font-size: clamp(3.25rem, 7.55vw, 7.8rem);
  font-weight: 480;
  letter-spacing: -.065em;
  line-height: 1.03;
}
.gallery-heading h2:focus:not(:focus-visible) { outline: none; }
.gallery-company { flex: 0 0 auto; }
.gallery-company-name {
  margin: 0 0 .72em;
  color: var(--ink);
  font: 400 clamp(.77rem, 1.05vw, 1rem)/1.4 "IBM Plex Mono", monospace;
  letter-spacing: .035em;
}
[data-type-line] {
  display: block; width: max-content; position: relative;
  clip-path: inset(-.25em calc(100% - var(--typed, 100%)) -.25em -.12em);
}
[data-type-line][data-writing]::after {
  content: ""; position: absolute; right: calc(100% - var(--typed));
  top: .12em; height: .9em; width: 1px; background: currentColor;
}
@media (prefers-reduced-motion: reduce), print {
  [data-type-line] { clip-path: none; }
  [data-type-line][data-writing]::after { display: none; }
}
.gallery-stats {
  display: flex;
  gap: clamp(22px, 2.8vw, 46px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.gallery-stats li { display: grid; gap: 4px; }
.gallery-stats strong {
  font-size: clamp(1.65rem, 2.8vw, 2.9rem);
  font-weight: 480;
  letter-spacing: -.05em;
  line-height: 1.04;
}
.gallery-stats .stat-label { color: var(--secondary); font-size: clamp(.77rem,.95vw,.93rem); line-height: 1.35; }

/* A little overscan keeps accents and descenders inside the aperture. */
.word-mask, .word-ink { display: inline-block; max-width: 100%; vertical-align: top; }
.word-mask { clip-path: inset(-.1em -.09em -.08em); }
.installer-word { display: inline-block; }
@media (prefers-reduced-motion:no-preference) {
  .word-ink { transform-origin: left bottom; }
  [data-word-reveal]:not([data-words-in]) .word-ink,
  .project-gallery[inert] .gallery-heading .word-ink {
    transform: translateY(116%) rotate(9deg);
  }
  [data-word-reveal][data-words-in] .word-ink {
    animation: word-rise 810ms cubic-bezier(.24,.67,.2,1) var(--word-delay,0ms) backwards;
  }
  .project-gallery[inert] .gallery-heading .word-ink { animation: none; }
  @keyframes word-rise {
    from { transform: translateY(116%) rotate(9deg); }
    to { transform: none; }
  }
  [data-scroll-words]:not([data-words-in]) .installer-word { opacity: 0; }
  [data-scroll-words][data-words-in] .installer-word {
    transform-origin: left bottom;
    animation: installer-word-in 720ms cubic-bezier(.22,.75,.19,1) calc(var(--word-order) * 64ms) backwards;
  }
  @keyframes installer-word-in {
    from { transform: translate(.76em,.14em) rotate(2deg); opacity: 0; }
    38% { opacity: 1; }
    to { transform: none; opacity: 1; }
  }
}
.sector-link {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  min-height: 44px;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 520;
  line-height: 1.3;
  text-decoration: none;
}
.sector-link span {
  font-size: 1.15em;
  display: inline-block;
  transition: transform 240ms ease;
}
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(42px, 6vw, 92px) clamp(18px, 2vw, 32px);
}
.project-feature {
  --side: -1;
  min-width: 0;
  position: relative;
}
.project-feature:nth-child(even) { --side: 1; --stagger: 92ms; }
.project-link {
  display: block;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
}
.project-story { padding-top: clamp(13px, 1.4vw, 22px); }
.project-name {
  margin: 0 0 .6em;
  color: var(--secondary);
  font-size: clamp(.65rem, .8vw, .77rem);
  font-weight: 560;
  line-height: 1.45;
  letter-spacing: .046em;
  text-transform: uppercase;
}
.project-story h3 {
  display: flex;
  align-items: baseline;
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.65rem, 2.65vw, 2.9rem);
  font-weight: 480;
  letter-spacing: -.047em;
  line-height: 1.09;
}
.project-arrow {
  display: inline-block;
  flex: 0 0 auto;
  width: 0;
  opacity: 0;
  transform: translateX(-.28em);
  font-size: .88em;
  line-height: 1;
  transition: width .34s cubic-bezier(.22,.68,.12,1), opacity .24s ease, transform .34s ease;
}
.project-link:is(:hover,:focus-visible) .project-arrow { width: 1.16em; opacity: 1; transform: none; }
.project-details { margin-top: 11px; max-width: 55ch; }
.project-details p {
  margin: 0;
  color: var(--secondary);
  font-size: clamp(.94rem,1.04vw,1.08rem);
  line-height: 1.57;
  text-wrap: pretty;
}
.project-gallery :is(a,h2):focus-visible { outline: 2px solid #194a7e; outline-offset: 5px; }
@media (hover:hover) {
  .sector-link:hover { text-decoration: underline; }
  .sector-link:hover span { transform: translate(1px,-2px); }
}
@media (max-width:700px) {
  .project-gallery#projects { --gallery-gutter: max(6vw,env(safe-area-inset-left),env(safe-area-inset-right)); }
  .gallery-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px 20px; }
  .gallery-heading h2 { font-size: clamp(2.7rem, 10vw, 4.8rem); }
  .gallery-stats { gap: 25px; }
  .featured-grid { grid-template-columns: minmax(0,1fr); }
  .project-feature:nth-child(even) { --stagger: 0ms; }
  .project-story h3 { font-size: clamp(1.8rem,6.8vw,2.7rem); }
  .project-details { margin-top: 9px; }
}
