/* Scales shared by the product gallery, navigation and homepage chapters. */
html[data-study] {
  --ui-ink: #20221f;
  --ui-muted: #535751;
  --ui-outline: rgb(32 34 31 / 14%);
  --ui-surface: #fff;
  --ui-on-ink: #fbfaf8;
  --ui-chip-height: 2.25rem;
  --ui-chip-size: .8125rem;
  --ui-icon-size: 2.75rem;
  --ui-card-radius: 1.25rem;
  --ui-fast: 200ms;
  --ui-enter: 450ms;
  --ui-ease: cubic-bezier(.2,.8,.2,1);
  --home-chapter-gap: clamp(5rem, 10vw, 9.5rem);
  --chapter-space: clamp(4.5rem, 8.3vw, 8.25rem);
  --chapter-title: clamp(2.375rem, 4.35vw, 4.1875rem);
  --chapter-intro: clamp(.9375rem, 1.15vw, 1.125rem);
  --chapter-head-gap: clamp(1.625rem, 3.1vw, 3rem);
}
html[data-study][data-theme="dark"] {
  --ui-ink: #f4f5ef;
  --ui-muted: #d0d4cb;
  --ui-outline: rgb(239 243 234 / 22%);
  --ui-surface: #272b28;
  --ui-on-ink: #1d211e;
}
@media (max-width: 760px) {
  html[data-study] { --chapter-title: clamp(2.125rem, 8.4vw, 3rem); }
}

/* Adjacent chapters each provide half of the space between their contents. */
html[data-study][data-sequence="selected"] #top #projects.product-gallery {
  padding-block-end: calc(var(--home-chapter-gap) / 2);
}
html[data-study][data-sequence="selected"] #top main > :is(#work,#ai,#contributions,#about,#testimonials):not([hidden]) {
  position: relative;
  padding-block: calc(var(--home-chapter-gap) / 2);
  border-block: 0;
}

html[data-study][data-sequence="selected"] #top main :is(.product-heading,.sh,.aip-header,.about-mast) > h2 {
  font-family: var(--font);
  font-size: var(--chapter-title);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.058em;
  color: var(--ink-a);
  margin-block: 0;
}
html[data-study][data-sequence="selected"] #top main :is(.product-heading,.sh,.aip-header) > p {
  color: var(--mute);
  font-size: var(--chapter-intro);
  line-height: 1.5;
  letter-spacing: -.01em;
}
html[data-study][data-sequence="selected"] #top #aiIn .aip-header p {
  margin-block: var(--section-intro-gap) 0;
}
html[data-study][data-sequence="selected"] #top :is(#work,#contributions) .sh,
html[data-study][data-sequence="selected"] #top #about .about-mast,
html[data-study][data-sequence="selected"] #top #projects .product-head {
  margin-block-end: var(--chapter-head-gap);
}
/* The introduction is a separate grid item from the gallery or contribution list. */
@media (min-width: 940px) {
  html[data-study][data-sequence="selected"] #top :is(#wkIn, #coIn) > .sh {
    min-width: 0;
    margin: 0;
    container-type: inline-size;
  }
  html[data-study][data-sequence="selected"] #top :is(#wkIn, #coIn) > :is(.w2t, .contribution-list) {
    min-width: 0;
  }
  html[data-published-portfolio][data-sequence="selected"] #top #work #wkIn > .sh:has(#edition-picker) {
    display: block;
  }
  html[data-published-portfolio][data-sequence="selected"] #top #work #wkIn > .sh:has(#edition-picker) p {
    max-width: 25ch;
    margin: var(--section-intro-gap) 0 0;
  }
  html[data-study][data-sequence="selected"] #top #wkIn > .sh h2 {
    max-width: 9ch;
  }
  html[data-study][data-sequence="selected"] #top #coIn > .sh h2 {
    font-size: min(var(--chapter-title), 18cqi);
    hyphens: none;
  }
  html[data-study][data-sequence="selected"] #top #coIn > .contribution-list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
    gap: clamp(1.5rem, 3vw, 2.75rem);
  }
}
@media (max-width: 939px) {
  html[data-sequence="selected"][data-sequence-ai="default"] #top #aiIn .aip[data-layout="process"] {
    row-gap: var(--chapter-head-gap);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html[data-sequence="selected"] #top main > .sec [data-r] {
    transition: opacity var(--ui-enter) var(--ui-ease), transform var(--ui-enter) var(--ui-ease);
    transition-delay: calc(var(--d, 0) * 45ms);
  }
  html[data-sequence="selected"] #top main > .sec [data-r]:not(.in) {
    transform: translateY(.5rem);
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-study] #top main [data-r] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
