@font-face {
  font-family: "Mercure";
  src:
    url("../fonts/Mercure-Regular.woff2") format("woff2"),
    url("../fonts/Mercure-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mercure";
  src:
    url("../fonts/Mercure-Italic.woff2") format("woff2"),
    url("../fonts/Mercure-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Mercure Transcript";
  src:
    url("../fonts/Mercure-Transcript.woff2") format("woff2"),
    url("../fonts/Mercure-Transcript.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111;
  --fg: #fff;
  --row-size: 18px;
  --grid-columns: 12;
  --grid-margin: 24px;
  --grid-gutter: 20px;
  --motion-duration: 1s;
  --motion-rise-distance: 16px;
  --motion-duration-fast: 0.3s;
}

/* Grid: .grid-cols is the raw 12-column track; .grid adds the page margin.
   Nest .grid-cols (not .grid) inside anything already inset by a .grid
   ancestor, otherwise the margin is applied twice and columns drift. */
.grid-cols {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  padding-inline: var(--grid-margin);
}

/* Font-family utilities, shared with the component classes below so the
   font-family string is declared exactly once per family. */
.font-regular,
.col-name,
.col-type,
.col-view {
  font-family: "Mercure", serif;
}

.font-italic {
  font-family: "Mercure", serif;
  font-style: italic;
}

.font-transcript,
.logo,
.info-link,
.col-code,
.wordmark-text {
  font-family: "Mercure Transcript", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "Mercure", serif;
  line-height: 1.1;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: #000;
}

/* Reveal behind all text, shown while hovering the matching project row
   (each row/image pair is wired below by id). Sits in the same stacking
   layer as .bg, just above it in paint order since it comes later in the
   DOM. Default fit is a full-bleed cover; .hover-bg--contain instead
   centers the image at its own aspect ratio, for a portrait asset that
   shouldn't be cropped edge to edge. */
.hover-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.hover-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 3s linear;
}

.hover-bg--contain img {
  width: auto;
  height: 90vh;
  max-width: 100%;
  object-fit: contain;
}

/* Each hero row (#row-X) pairs with its reveal layer (#hover-bg-X); add a
   new project's hover image by extending this list, the dimming rule
   below, and adding the matching HTML ids. Scoped to devices that can
   actually hover — on touch, :hover styling makes the browser eat the
   first tap to "preview" the hover state, forcing a second tap to
   follow the link. */
@media (hover: hover) and (pointer: fine) {
  body:has(#row-guggenheim:hover) #hover-bg-guggenheim,
  body:has(#row-open:hover) #hover-bg-open,
  body:has(#row-apple:hover) #hover-bg-apple,
  body:has(#row-auburn:hover) #hover-bg-auburn,
  body:has(#row-bon-temps:hover) #hover-bg-bon-temps,
  body:has(#row-mr-leight:hover) #hover-bg-mr-leight,
  body:has(#row-never-before-heard-sounds:hover) #hover-bg-never-before-heard-sounds,
  body:has(#row-ways-of-curating:hover) #hover-bg-ways-of-curating {
    opacity: 1;

    & img {
      transform: scale(1.03);
    }
  }
}

/* Auto-carousel reveal, driven by home-carousel.js toggling .is-active —
   unscoped (unlike the :hover rule above) so it also runs on touch. */
body:has(#row-guggenheim.is-active) #hover-bg-guggenheim,
body:has(#row-open.is-active) #hover-bg-open,
body:has(#row-apple.is-active) #hover-bg-apple,
body:has(#row-auburn.is-active) #hover-bg-auburn,
body:has(#row-bon-temps.is-active) #hover-bg-bon-temps,
body:has(#row-mr-leight.is-active) #hover-bg-mr-leight,
body:has(#row-never-before-heard-sounds.is-active) #hover-bg-never-before-heard-sounds,
body:has(#row-ways-of-curating.is-active) #hover-bg-ways-of-curating {
  opacity: 1;

  & img {
    transform: scale(1.03);
  }
}

.site-header {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 24px;
  padding-inline: var(--grid-margin);
  font-size: var(--row-size);
}

.logo {
  margin: 0;
  color: var(--fg);
  white-space: nowrap;
}

.info-link {
  margin: 0;
  color: var(--fg);
  white-space: nowrap;
}

main {
  position: relative;
  flex: 1;
  min-height: 0;
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-top: 24px;
  padding-inline: var(--grid-margin);
  display: flex;
  flex-direction: column;
}

/* .project-row reuses .grid-cols (applied alongside this class in the
   markup) for its 12-column track, then places each field on explicit
   grid lines so it stays aligned to the site's grid. */
.project-row {
  align-items: baseline;
  font-size: var(--row-size);
  line-height: 1.1;
  padding-block: 1px;
}

/* Dim every other row while hovering a row with a hero image behind it,
   so the reveal reads as the focused one. Same hover-capable-only scope
   as the reveal rule above, for the same reason. */
@media (hover: hover) and (pointer: fine) {
  .project-list:has(#row-guggenheim:hover) .project-row:not(#row-guggenheim),
  .project-list:has(#row-open:hover) .project-row:not(#row-open),
  .project-list:has(#row-apple:hover) .project-row:not(#row-apple),
  .project-list:has(#row-auburn:hover) .project-row:not(#row-auburn),
  .project-list:has(#row-bon-temps:hover) .project-row:not(#row-bon-temps),
  .project-list:has(#row-mr-leight:hover) .project-row:not(#row-mr-leight),
  .project-list:has(#row-never-before-heard-sounds:hover) .project-row:not(#row-never-before-heard-sounds),
  .project-list:has(#row-ways-of-curating:hover) .project-row:not(#row-ways-of-curating) {
    opacity: 0.4;
  }
}

/* Auto-carousel dim, mirrors the :hover rule above via .is-active — also
   unscoped so it runs on touch. */
.project-list:has(#row-guggenheim.is-active) .project-row:not(#row-guggenheim),
.project-list:has(#row-open.is-active) .project-row:not(#row-open),
.project-list:has(#row-apple.is-active) .project-row:not(#row-apple),
.project-list:has(#row-auburn.is-active) .project-row:not(#row-auburn),
.project-list:has(#row-bon-temps.is-active) .project-row:not(#row-bon-temps),
.project-list:has(#row-mr-leight.is-active) .project-row:not(#row-mr-leight),
.project-list:has(#row-never-before-heard-sounds.is-active) .project-row:not(#row-never-before-heard-sounds),
.project-list:has(#row-ways-of-curating.is-active) .project-row:not(#row-ways-of-curating) {
  opacity: 0.4;
}

.col-name,
.col-type,
.col-view {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-name {
  grid-column: 1 / 6;
}

.col-type {
  grid-column: 6 / 8;
}

.col-code {
  grid-column: 8 / 11;
  white-space: nowrap;
}

.col-view {
  grid-column: 11 / 13;
  justify-self: end;
}

/* .wordmark-text is the typographic style alone (reusable in flow, e.g. on
   the design-system page); .wordmark adds the homepage's viewport-centered
   positioning on top of it. */
.wordmark-text {
  margin: 0;
  font-size: 64.629px;
  letter-spacing: 0.49em;
  color: var(--fg);
  white-space: nowrap;
}

.wordmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* ----------------------------------------------------------------------
   Homepage entrance animation — header, then each project row, then the
   wordmark, each rising + fading in, staggered in that order. Scoped to
   body.home since .site-header/.project-row are shared markup/classes
   used (unanimated) on every other page.
   ---------------------------------------------------------------------- */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(var(--motion-rise-distance));
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-in-centered {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--motion-rise-distance)));
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* backwards (not both): a running/filled animation owns its animated
   properties over the regular cascade, so `both` would permanently
   override the hover-dim opacity rule below once the entrance finishes.
   `backwards` only holds the opacity:0 start state during the delay,
   handing opacity back to the normal cascade once the animation ends. */
body.home .project-row {
  animation: rise-in var(--motion-duration) ease backwards;
  animation-delay: 0.15s;
}

body.home .wordmark {
  animation: rise-in-centered var(--motion-duration) ease backwards;
  animation-delay: 1.15s;
}

/* ----------------------------------------------------------------------
   Design system page
   ---------------------------------------------------------------------- */

/* Shared by any page taller than one viewport (the homepage is the only
   exception: it stays a fixed, non-scrolling single screen). */
.scroll-page {
  overflow: auto;
}

body.ds {
  padding-bottom: 120px;
}

.ds-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--grid-gutter);
  padding: var(--grid-margin);
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: var(--row-size);
}

.ds-header a {
  color: var(--fg);
}

.ds-header .site-header {
  flex: 1;
  padding: 0;
}

.btn-pill {
  font-family: "Mercure", serif;
  font-size: 14px;
  color: var(--fg);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
}

.grid-toggle-fab {
  position: fixed;
  right: var(--grid-margin);
  bottom: var(--grid-margin);
  z-index: 3;
}

/* Homepage auto-carousel progress bar, driven by home-carousel.js.
   Touch/mobile only — home-carousel.js skips entirely on hover-capable
   desktop, where the existing :hover reveal/dim covers this already. */
.auto-timer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: transparent;
  z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
  .auto-timer-bar {
    display: none;
  }
}

/* Mobile/touch only (matches the condition above and the isDesktop gate in
   home-carousel.js): slower zoom + thinner bar than the desktop defaults. */
@media (hover: none), (pointer: coarse) {
  .hover-bg img {
    transition-duration: 5s;
  }

  .auto-timer-bar {
    height: 5px;
  }
}

.auto-timer-bar-fill {
  height: 100%;
  width: 0%;
  background: #fff;
}

.ds-section {
  padding-block: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.ds-section-label {
  grid-column: 1 / -1;
  margin: 0 0 32px;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* Grid demo: nests .grid-cols (not .grid) because it already sits inside
   the outer .ds-section's margin — see the note on .grid-cols above. */
.ds-grid-demo {
  grid-column: 1 / -1;
  position: relative;
  height: 220px;
}

.ds-grid-demo .grid-cols {
  position: absolute;
  inset: 0;
  height: 100%;
}

.ds-grid-col {
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* Full-page grid overlay: not nested inside a .grid ancestor, so it applies
   its own margin via the .grid class directly. */
#grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  height: 100vh;
}

#grid-overlay[hidden] {
  display: none;
}

#grid-overlay .ds-grid-col {
  height: 100%;
  background: rgba(255, 0, 0, 0.08);
  border-left: 1px solid rgba(255, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 0, 0, 0.3);
  align-items: flex-start;
  padding: 4px 0 0;
  color: rgba(255, 0, 0, 0.6);
}

/* Marks the available height below the header — toggled together with
   #grid-overlay by grid-toggle.js, which sets `top` from the header's
   own rendered height rather than a hardcoded number. */
#max-height-line {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 50;
  pointer-events: none;
  border-top: 1px dashed red;
}

#max-height-line[hidden] {
  display: none;
}

#max-height-line::after {
  content: "max height";
  position: absolute;
  top: 4px;
  right: var(--grid-margin);
  font-size: 12px;
  font-family: "Mercure", serif;
  color: red;
}

.ds-swatches {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--grid-gutter);
  flex-wrap: wrap;
}

.ds-swatch {
  width: 220px;
}

.ds-swatch-fill {
  height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-bottom: 12px;
}

.ds-swatch-name {
  font-size: 16px;
  margin: 0;
}

.ds-swatch-meta {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin: 2px 0 0;
}

.ds-type-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 220px 1fr;
  column-gap: var(--grid-gutter);
  align-items: baseline;
  padding-block: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ds-type-row:first-of-type {
  border-top: none;
}

.ds-type-meta {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.ds-type-sample {
  margin: 0;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-row-size {
  font-size: var(--row-size);
}

.ds-spacing-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 16px;
}

.ds-spacing-bar {
  height: 14px;
  background: var(--fg);
}

.ds-spacing-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.ds-component-demo {
  grid-column: 1 / -1;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 32px var(--grid-margin);
  margin-bottom: var(--grid-gutter);
  overflow: hidden;
}

.ds-component-demo--wordmark {
  height: 160px;
}

/* ----------------------------------------------------------------------
   Information page
   ---------------------------------------------------------------------- */

.info-copy {
  padding-top: 24px;
  padding-bottom: var(--grid-margin);
}

.info-copy-text,
.project-credits-text {
  line-height: 1.1;
  color: var(--fg);
}

.info-copy-text p,
.project-credits-text p {
  margin: 0 0 1.1em;
}

.info-copy-text p:last-child,
.project-credits-text p:last-child {
  margin-bottom: 0;
}

.info-copy-text {
  grid-column: 1 / -1;
  font-size: 52px;
}

/* Scroll-in reveal, paused until each paragraph gains .in-view (set by an
   IntersectionObserver in information.html). `backwards` (see the note on
   the homepage entrance animation above) hands opacity back to the normal
   cascade once each paragraph's animation finishes. */
.info-copy-text p {
  animation: rise-in var(--motion-duration) ease backwards;
  animation-play-state: paused;
}

.info-copy-text p.in-view {
  animation-play-state: running;
}

.project-credits-text {
  width: 100%;
  font-size: 22px;
}

/* ----------------------------------------------------------------------
   Project view (project.html) — shared template for every project row,
   swapping only PROJECTS data in project.js.
   ---------------------------------------------------------------------- */

/* Frame spans columns 2–11 of the 12-column grid (1 column inset on
   each side) instead of a fixed pixel width, so it scales with the
   page like everything else on the site. */
.project-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  padding-inline: var(--grid-margin);
  justify-items: center;
  align-content: center;
  row-gap: 24px;
}

.project-frame {
  grid-column: 2 / 12;
  width: 100%;
  aspect-ratio: 900 / 510;
}

.project-nav {
  grid-column: 1 / -1;
}

/* Full-bleed variant (project-guggenheim-full.html): frame fills the
   viewport width up to the page margins instead of a fixed 900px,
   scaling its height to match via the same aspect ratio. Since that can
   make the frame taller than the viewport, the page scrolls instead of
   the usual fixed single-screen layout, and the frame sits in normal
   flow below the header (not vertically centered) so it can never
   render under the nav regardless of height. */
body.project-full-bleed {
  overflow: auto;
}

.project-full-bleed .project-main {
  flex: none;
  align-content: start;
  padding-top: 24px;
  padding-bottom: var(--grid-margin);
}

.project-full-bleed .project-frame {
  grid-column: 1 / -1;
  width: 100%;
  aspect-ratio: 900 / 510;
}

.project-frame img,
.project-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Credits panel — the last "slide" in every project's gallery, same box
   as the image/video it replaces. Needs its own [hidden] override since
   .project-credits already sets its own `display`, the same issue noted
   on #grid-overlay/#max-height-line above. */
.project-credits {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--grid-margin);
}

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

.project-nav {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--row-size);
  color: var(--fg);
}

body.project-view .site-header {
  cursor: default;
}

body.project-view .site-header a {
  cursor: pointer;
}

/* ----------------------------------------------------------------------
   Mobile
   ---------------------------------------------------------------------- */

/* Header text swap: short variant hidden by default, swapped in under the
   breakpoint below. */
.header-text-short {
  display: none;
}

@media (max-width: 767px) {
  .header-text-full {
    display: none;
  }

  .header-text-short {
    display: inline;
  }

  /* Mobile swaps the short "P. (O)" wordmark for the full "PATTERN
     (OFFICE)" wordmark — sized/tracked independently of the desktop
     .wordmark-text base since it's a different piece of copy, not just
     a smaller version of the same one. */
  .wordmark-text .header-text-short {
    font-size: 32px;
    letter-spacing: normal;
  }

  .info-copy-text {
    grid-column: 1 / -1;
    font-size: 22px;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.8);
  }

  .project-frame {
    grid-column: 1 / -1;
  }

  .project-nav {
    position: fixed;
    left: 50%;
    bottom: var(--grid-margin);
    transform: translateX(-50%);
  }
}

@media (max-width: 646px) {
  .col-type,
  .col-code {
    display: none;
  }

  /* Name no longer shares the 12-column track with the hidden Type/Code
     columns — let it fill all space up to View instead of truncating at
     the old fixed grid-column:1/6 span. */
  .project-row {
    display: flex;
    justify-content: space-between;
    gap: var(--grid-gutter);
  }

  .col-name {
    flex: 1;
    min-width: 0;
  }

  .col-view {
    flex: none;
  }
}
